taggedjs 2.4.2 → 2.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +3675 -0
- package/bundle.js.map +1 -0
- package/index.js +1 -1
- package/js/Subject.d.ts +3 -4
- package/js/Subject.js +4 -4
- package/js/Subject.js.map +1 -1
- package/js/Tag.class.d.ts +24 -17
- package/js/Tag.class.js +205 -78
- package/js/Tag.class.js.map +1 -1
- package/js/Tag.utils.d.ts +13 -13
- package/js/Tag.utils.js +2 -18
- package/js/Tag.utils.js.map +1 -1
- package/js/TagSupport.class.d.ts +15 -14
- package/js/TagSupport.class.js +24 -46
- package/js/TagSupport.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +34 -0
- package/js/TemplaterResult.class.js +79 -0
- package/js/TemplaterResult.class.js.map +1 -0
- package/js/ValueSubject.d.ts +4 -2
- package/js/ValueSubject.js +1 -1
- package/js/ValueSubject.js.map +1 -1
- package/js/alterProps.function.d.ts +4 -0
- package/js/alterProps.function.js +46 -0
- package/js/alterProps.function.js.map +1 -0
- package/js/bindSubjectCallback.function 9.27.33/342/200/257AM.js" +32 -0
- package/js/bindSubjectCallback.function.d 9.27.33/342/200/257AM.ts" +8 -0
- package/js/bindSubjectCallback.function.d.ts +3 -4
- package/js/bindSubjectCallback.function.js +20 -8
- package/js/bindSubjectCallback.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +6 -0
- package/js/checkDestroyPrevious.function.js +62 -0
- package/js/checkDestroyPrevious.function.js.map +1 -0
- package/js/destroyTag.function.d.ts +5 -0
- package/js/destroyTag.function.js +19 -0
- package/js/destroyTag.function.js.map +1 -0
- package/js/elementInitCheck.d.ts +1 -1
- package/js/getCallback.d.ts +1 -1
- package/js/getCallback.js +15 -13
- package/js/getCallback.js.map +1 -1
- package/js/hasTagSupportChanged.function.d.ts +6 -6
- package/js/hasTagSupportChanged.function.js +31 -21
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/html.d.ts +1 -1
- package/js/html.js +1 -1
- package/js/html.js.map +1 -1
- package/js/index.d.ts +22 -27
- package/js/index.js +26 -27
- package/js/index.js.map +1 -1
- package/js/interpolateAttributes.d.ts +2 -3
- package/js/interpolateAttributes.js +1 -127
- package/js/interpolateAttributes.js.map +1 -1
- package/js/interpolateContentTemplates.d.ts +9 -6
- package/js/interpolateContentTemplates.js +18 -28
- package/js/interpolateContentTemplates.js.map +1 -1
- package/js/interpolateElement.d.ts +7 -6
- package/js/interpolateElement.js +13 -10
- package/js/interpolateElement.js.map +1 -1
- package/js/interpolateTemplate.d.ts +22 -7
- package/js/interpolateTemplate.js +65 -27
- package/js/interpolateTemplate.js.map +1 -1
- package/js/isInstance.d.ts +3 -4
- package/js/isInstance.js.map +1 -1
- package/js/isLikeTags.function.d.ts +2 -0
- package/js/isLikeTags.function.js +30 -0
- package/js/isLikeTags.function.js.map +1 -0
- package/js/onDestroy.js +3 -3
- package/js/onDestroy.js.map +1 -1
- package/js/onInit.js +1 -1
- package/js/onInit.js.map +1 -1
- package/js/processAttribute.function.d.ts +3 -0
- package/js/processAttribute.function.js +122 -0
- package/js/processAttribute.function.js.map +1 -0
- package/js/processNewValue.function.d.ts +2 -2
- package/js/processNewValue.function.js +13 -15
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +5 -7
- package/js/processRegularValue.function.js +10 -17
- package/js/processRegularValue.function.js.map +1 -1
- package/js/processSubjectComponent.function.d.ts +6 -6
- package/js/processSubjectComponent.function.js +30 -22
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +16 -14
- package/js/processSubjectValue.function.js +55 -79
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTagArray.d.ts +9 -8
- package/js/processTagArray.js +36 -37
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +7 -8
- package/js/processTagResult.function.js +40 -17
- package/js/processTagResult.function.js.map +1 -1
- package/js/provider.utils.d.ts +1 -1
- package/js/provider.utils.js +19 -8
- package/js/provider.utils.js.map +1 -1
- package/js/providers.js +6 -6
- package/js/providers.js.map +1 -1
- package/js/redrawTag.function.d.ts +5 -8
- package/js/redrawTag.function.js +16 -4
- package/js/redrawTag.function.js.map +1 -1
- package/js/render.d.ts +1 -1
- package/js/render.js.map +1 -1
- package/js/renderExistingTag.function.d.ts +7 -0
- package/js/renderExistingTag.function.js +40 -0
- package/js/renderExistingTag.function.js.map +1 -0
- package/js/renderTagSupport.function.d.ts +4 -0
- package/js/renderTagSupport.function.js +50 -0
- package/js/renderTagSupport.function.js.map +1 -0
- package/js/scanTextAreaValue.function.d.ts +2 -0
- package/js/scanTextAreaValue.function.js +16 -0
- package/js/scanTextAreaValue.function.js.map +1 -0
- package/js/set.function.d.ts +4 -3
- package/js/set.function.js +25 -34
- package/js/set.function.js.map +1 -1
- package/js/setLet.function.d.ts +1 -1
- package/js/setLet.function.js +14 -3
- package/js/setLet.function.js.map +1 -1
- package/js/setProp.function.d.ts +1 -1
- package/js/setProp.function.js +6 -3
- package/js/setProp.function.js.map +1 -1
- package/js/setUse.function.d.ts +11 -11
- package/js/tag.d.ts +6 -4
- package/js/tag.js +80 -71
- package/js/tag.js.map +1 -1
- package/js/tagElement.d.ts +5 -7
- package/js/tagElement.js +20 -31
- package/js/tagElement.js.map +1 -1
- package/js/tagRunner.d.ts +6 -6
- package/js/tagRunner.js +1 -1
- package/js/tagRunner.js.map +1 -1
- package/js/templater.utils.d.ts +23 -12
- package/js/templater.utils.js +55 -40
- package/js/templater.utils.js.map +1 -1
- package/js/updateExistingTag.function.d.ts +4 -4
- package/js/updateExistingTag.function.js +16 -7
- package/js/updateExistingTag.function.js.map +1 -1
- package/js/updateExistingTagComponent.function.d.ts +4 -4
- package/js/updateExistingTagComponent.function.js +114 -38
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +8 -10
- package/js/updateExistingValue.function.js +58 -89
- package/js/updateExistingValue.function.js.map +1 -1
- package/js/watch.function.js +4 -3
- package/js/watch.function.js.map +1 -1
- package/package.json +1 -1
- package/js/CustomError.d.ts +0 -7
- package/js/CustomError.js +0 -9
- package/js/CustomError.js.map +0 -1
- package/js/ElementTarget.interface.d.ts +0 -7
- package/js/ElementTarget.interface.js +0 -2
- package/js/ElementTarget.interface.js.map +0 -1
- package/js/Errors2.d.ts +0 -14
- package/js/Errors2.js +0 -21
- package/js/Errors2.js.map +0 -1
- package/js/gateway/gateway.web.component.d.ts +0 -11
- package/js/gateway/gateway.web.component.js +0 -20
- package/js/gateway/gateway.web.component.js.map +0 -1
- package/js/gateway/index.d.ts +0 -3
- package/js/gateway/index.js +0 -4
- package/js/gateway/index.js.map +0 -1
- package/js/gateway/loadTagGateway.function.d.ts +0 -2
- package/js/gateway/loadTagGateway.function.js +0 -18
- package/js/gateway/loadTagGateway.function.js.map +0 -1
- package/js/gateway/tagGateway.function.d.ts +0 -5
- package/js/gateway/tagGateway.function.js +0 -49
- package/js/gateway/tagGateway.function.js.map +0 -1
- package/js/gateway/tagGateway.utils.d.ts +0 -22
- package/js/gateway/tagGateway.utils.js +0 -137
- package/js/gateway/tagGateway.utils.js.map +0 -1
- package/js/getTagSupport.d.ts +0 -20
- package/js/getTagSupport.js +0 -114
- package/js/getTagSupport.js.map +0 -1
- package/js/renderAppToElement.d.ts +0 -14
- package/js/renderAppToElement.js +0 -57
- package/js/renderAppToElement.js.map +0 -1
- package/js/state.d.ts +0 -22
- package/js/state.js +0 -128
- package/js/state.js.map +0 -1
- package/js/tagGateway.function.d.ts +0 -14
- package/js/tagGateway.function.js +0 -138
- package/js/tagGateway.function.js.map +0 -1
- package/js/updateTag.utils.d.ts +0 -8
- package/js/updateTag.utils.js +0 -83
- package/js/updateTag.utils.js.map +0 -1
- package/taggedjs.js +0 -1
- /package/js/{Errors.d.ts → errors.d.ts} +0 -0
- /package/js/{Errors.js → errors.js} +0 -0
- /package/js/{Errors.js.map → errors.js.map} +0 -0
package/js/tag.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { isSubjectInstance, isTagArray, isTagInstance } from
|
|
2
|
-
import { setUse } from
|
|
3
|
-
import { TemplaterResult
|
|
4
|
-
import { ValueSubject } from
|
|
5
|
-
import { runTagCallback } from
|
|
6
|
-
import { deepClone } from
|
|
7
|
-
import { TagSupport } from
|
|
1
|
+
import { isSubjectInstance, isTagArray, isTagInstance } from './isInstance';
|
|
2
|
+
import { setUse } from './setUse.function';
|
|
3
|
+
import { TemplaterResult } from './TemplaterResult.class';
|
|
4
|
+
import { ValueSubject } from './ValueSubject';
|
|
5
|
+
import { runTagCallback } from './bindSubjectCallback.function';
|
|
6
|
+
import { deepClone } from './deepFunctions';
|
|
7
|
+
import { TagSupport } from './TagSupport.class';
|
|
8
|
+
import { alterProps } from './alterProps.function';
|
|
8
9
|
export const tags = [];
|
|
9
10
|
let tagCount = 0;
|
|
10
|
-
/** Wraps a tag component in a state manager and always push children to last argument as
|
|
11
|
+
/** Wraps a tag component in a state manager and always push children to last argument as an array */
|
|
11
12
|
// export function tag<T>(a: T): T;
|
|
12
13
|
export function tag(tagComponent) {
|
|
13
14
|
const result = (function tagWrapper(props, children) {
|
|
@@ -19,65 +20,7 @@ export function tag(tagComponent) {
|
|
|
19
20
|
const { childSubject, madeSubject } = kidsToTagArraySubject(children);
|
|
20
21
|
childSubject.isChildSubject = true;
|
|
21
22
|
const templater = new TemplaterResult(props, childSubject);
|
|
22
|
-
|
|
23
|
-
const originalFunction = innerTagWrap.original;
|
|
24
|
-
const oldTagSetup = templater.tagSupport;
|
|
25
|
-
const oldest = templater.oldest;
|
|
26
|
-
let props = oldTagSetup.propsConfig.latest;
|
|
27
|
-
let castedProps = alterProps(props, templater);
|
|
28
|
-
// CALL ORIGINAL COMPONENT FUNCTION
|
|
29
|
-
const tag = originalFunction(castedProps, childSubject);
|
|
30
|
-
if (oldTagSetup.mutatingRender === TagSupport.prototype.mutatingRender) {
|
|
31
|
-
oldTagSetup.oldest = tag;
|
|
32
|
-
// tag.tagSupport = oldTagSetup
|
|
33
|
-
oldTagSetup.mutatingRender = () => {
|
|
34
|
-
const exit = oldTagSetup.renderExistingTag(tag, templater);
|
|
35
|
-
if (exit) {
|
|
36
|
-
return tag;
|
|
37
|
-
}
|
|
38
|
-
if (tag.ownerTag) {
|
|
39
|
-
const newest = tag.ownerTag.tagSupport.render();
|
|
40
|
-
tag.ownerTag.tagSupport.newest = newest;
|
|
41
|
-
return tag;
|
|
42
|
-
}
|
|
43
|
-
return tag;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
tag.tagSupport = new TagSupport(templater, oldTagSetup.children);
|
|
47
|
-
const clonedProps = deepClone(castedProps); // castedProps
|
|
48
|
-
tag.tagSupport.propsConfig = {
|
|
49
|
-
latest: props, // castedProps
|
|
50
|
-
latestCloned: clonedProps,
|
|
51
|
-
clonedProps: clonedProps,
|
|
52
|
-
lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,
|
|
53
|
-
};
|
|
54
|
-
tag.tagSupport.memory = oldTagSetup.memory;
|
|
55
|
-
tag.tagSupport.mutatingRender = oldTagSetup.mutatingRender;
|
|
56
|
-
oldTagSetup.newest = tag;
|
|
57
|
-
oldTagSetup.propsConfig = { ...tag.tagSupport.propsConfig };
|
|
58
|
-
if (oldest) {
|
|
59
|
-
oldest.tagSupport.propsConfig = { ...tag.tagSupport.propsConfig };
|
|
60
|
-
}
|
|
61
|
-
if (madeSubject) {
|
|
62
|
-
childSubject.value.forEach(kid => {
|
|
63
|
-
kid.values.forEach((value, index) => {
|
|
64
|
-
if (!(value instanceof Function)) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (kid.values[index].isChildOverride) {
|
|
68
|
-
return; // already overwritten
|
|
69
|
-
}
|
|
70
|
-
// all functions need to report to me
|
|
71
|
-
kid.values[index] = function (...args) {
|
|
72
|
-
runTagCallback(value, tag.ownerTag, this, args);
|
|
73
|
-
// runTagCallback(value, tag, this, args)
|
|
74
|
-
};
|
|
75
|
-
kid.values[index].isChildOverride = true;
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return tag;
|
|
80
|
-
}
|
|
23
|
+
const innerTagWrap = getTagWrap(templater, madeSubject);
|
|
81
24
|
innerTagWrap.original = tagComponent;
|
|
82
25
|
templater.tagged = true;
|
|
83
26
|
templater.wrapper = innerTagWrap;
|
|
@@ -102,7 +45,10 @@ function kidsToTagArraySubject(children) {
|
|
|
102
45
|
kid.arrayValue = 0;
|
|
103
46
|
return { childSubject: new ValueSubject([kid]), madeSubject: true };
|
|
104
47
|
}
|
|
105
|
-
return {
|
|
48
|
+
return {
|
|
49
|
+
childSubject: new ValueSubject([]),
|
|
50
|
+
madeSubject: true
|
|
51
|
+
};
|
|
106
52
|
}
|
|
107
53
|
function updateResult(result, tagComponent) {
|
|
108
54
|
result.isTag = true;
|
|
@@ -111,9 +57,72 @@ function updateResult(result, tagComponent) {
|
|
|
111
57
|
function updateComponent(tagComponent) {
|
|
112
58
|
tagComponent.tags = tags;
|
|
113
59
|
tagComponent.setUse = setUse;
|
|
114
|
-
tagComponent.tagIndex =
|
|
60
|
+
tagComponent.tagIndex = tagCount++; // needed for things like HMR
|
|
115
61
|
}
|
|
116
|
-
|
|
62
|
+
/** creates/returns a function that when called then calls the original component function */
|
|
63
|
+
function getTagWrap(templater, madeSubject) {
|
|
64
|
+
const innerTagWrap = function (oldTagSetup, subject) {
|
|
65
|
+
const global = oldTagSetup.templater.global;
|
|
66
|
+
global.newestTemplater = templater;
|
|
67
|
+
++global.renderCount;
|
|
68
|
+
templater.global = global;
|
|
69
|
+
const childSubject = templater.children;
|
|
70
|
+
const lastArray = global.oldest?.tagSupport.templater.children.lastArray;
|
|
71
|
+
if (lastArray) {
|
|
72
|
+
childSubject.lastArray = lastArray;
|
|
73
|
+
}
|
|
74
|
+
const originalFunction = innerTagWrap.original;
|
|
75
|
+
// const oldTagSetup = templater.tagSupport
|
|
76
|
+
const oldest = templater.global.oldest;
|
|
77
|
+
if (oldest && !oldest.hasLiveElements) {
|
|
78
|
+
throw new Error('issue already 22');
|
|
79
|
+
}
|
|
80
|
+
// ???
|
|
81
|
+
let props = templater.props;
|
|
82
|
+
// let props = oldTagSetup.propsConfig.latest
|
|
83
|
+
const ownerTagSupport = oldTagSetup.ownerTagSupport;
|
|
84
|
+
const oldTemplater = ownerTagSupport?.templater;
|
|
85
|
+
const oldLatest = oldTemplater?.global.newest;
|
|
86
|
+
const newestOwnerTemplater = oldLatest?.tagSupport.templater;
|
|
87
|
+
if (oldLatest && !newestOwnerTemplater) {
|
|
88
|
+
throw new Error('what to do here?');
|
|
89
|
+
}
|
|
90
|
+
// ???
|
|
91
|
+
let castedProps = alterProps(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);
|
|
92
|
+
const clonedProps = deepClone(props); // castedProps
|
|
93
|
+
// CALL ORIGINAL COMPONENT FUNCTION
|
|
94
|
+
const tag = originalFunction(castedProps, childSubject);
|
|
95
|
+
tag.tagSupport = new TagSupport(oldTagSetup.ownerTagSupport, templater, subject);
|
|
96
|
+
tag.tagSupport.propsConfig = {
|
|
97
|
+
latest: props, // castedProps
|
|
98
|
+
latestCloned: clonedProps,
|
|
99
|
+
clonedProps: clonedProps,
|
|
100
|
+
lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,
|
|
101
|
+
};
|
|
102
|
+
tag.tagSupport.memory = oldTagSetup.memory; // state handover
|
|
103
|
+
if (madeSubject) {
|
|
104
|
+
childSubject.value.forEach(kid => {
|
|
105
|
+
kid.values.forEach((value, index) => {
|
|
106
|
+
if (!(value instanceof Function)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const valuesValue = kid.values[index];
|
|
110
|
+
if (valuesValue.isChildOverride) {
|
|
111
|
+
return; // already overwritten
|
|
112
|
+
}
|
|
113
|
+
// all functions need to report to me
|
|
114
|
+
kid.values[index] = function (...args) {
|
|
115
|
+
const ownerTag = tag.ownerTag;
|
|
116
|
+
runTagCallback(value, // callback
|
|
117
|
+
ownerTag, this, // bindTo
|
|
118
|
+
args);
|
|
119
|
+
};
|
|
120
|
+
valuesValue.isChildOverride = true;
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return tag;
|
|
125
|
+
};
|
|
126
|
+
return innerTagWrap;
|
|
117
127
|
}
|
|
118
|
-
const noPropsGiven = new NoPropsGiven();
|
|
119
128
|
//# sourceMappingURL=tag.js.map
|
package/js/tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../ts/tag.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../ts/tag.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAW,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAclD,MAAM,CAAC,MAAM,IAAI,GAA4B,EAAE,CAAA;AAG/C,IAAI,QAAQ,GAAG,CAAC,CAAA;AAEhB,qGAAqG;AACrG,mCAAmC;AACnC,MAAM,UAAU,GAAG,CACjB,YAAgC;IAEhC,MAAM,MAAM,GAAG,CAAC,SAAS,UAAU,CACjC,KAAuB,EACvB,QAA2B;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,iBAAiB;QAE5D,IAAG,WAAW,EAAE,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBAC/B,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;oBAClC,IAAG,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC,EAAE,CAAC;wBAChC,OAAM;oBACR,CAAC;oBAED,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;oBAErC,IAAG,WAAW,CAAC,eAAe,EAAE,CAAC;wBAC/B,OAAM,CAAC,sBAAsB;oBAC/B,CAAC;oBAED,qCAAqC;oBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,UAAS,GAAG,IAAe;wBAC7C,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAe,CAAA;wBACpC,cAAc,CACZ,KAAK,EAAE,WAAW;wBAClB,QAAQ,EACR,IAAI,EAAE,SAAS;wBACf,IAAI,CACL,CAAA;oBACH,CAAC,CAAA;oBAED,WAAW,CAAC,eAAe,GAAG,IAAI,CAAA;gBACpC,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;IAED,OAAO,YAAuB,CAAA;AAChC,CAAC"}
|
package/js/tagElement.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TemplaterResult } from
|
|
3
|
-
import { Tag } from
|
|
4
|
-
import { TagComponent } from
|
|
1
|
+
import { BaseTagSupport } from './TagSupport.class';
|
|
2
|
+
import { TemplaterResult } from './TemplaterResult.class';
|
|
3
|
+
import { Tag } from './Tag.class';
|
|
4
|
+
import { TagComponent } from './tag';
|
|
5
5
|
export declare function tagElement(app: TagComponent, // (...args: unknown[]) => TemplaterResult,
|
|
6
6
|
element: HTMLElement | Element, props: unknown): {
|
|
7
7
|
tag: Tag;
|
|
@@ -9,7 +9,5 @@ element: HTMLElement | Element, props: unknown): {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function applyTagUpdater(wrapper: TemplaterResult): {
|
|
11
11
|
tag: Tag;
|
|
12
|
-
tagSupport:
|
|
12
|
+
tagSupport: BaseTagSupport;
|
|
13
13
|
};
|
|
14
|
-
/** Overwrites arguments.tagSupport.mutatingRender */
|
|
15
|
-
export declare function addAppTagRender(tagSupport: TagSupport, tag: Tag): void;
|
package/js/tagElement.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BaseTagSupport } from './TagSupport.class';
|
|
2
|
+
import { runAfterRender, runBeforeRender } from './tagRunner';
|
|
3
|
+
import { ValueSubject } from './ValueSubject';
|
|
3
4
|
const appElements = [];
|
|
4
5
|
export function tagElement(app, // (...args: unknown[]) => TemplaterResult,
|
|
5
6
|
element, props) {
|
|
@@ -14,47 +15,35 @@ element, props) {
|
|
|
14
15
|
const wrapper = app(props);
|
|
15
16
|
// have a function setup and call the tagWrapper with (props, {update, async, on})
|
|
16
17
|
const result = applyTagUpdater(wrapper);
|
|
17
|
-
const { tag
|
|
18
|
-
//
|
|
18
|
+
const { tag } = result;
|
|
19
|
+
// TODO: is the below needed?
|
|
19
20
|
tag.appElement = element;
|
|
20
|
-
tag.tagSupport.
|
|
21
|
-
addAppTagRender(tag.tagSupport, tag);
|
|
21
|
+
tag.tagSupport.templater.global.isApp = true;
|
|
22
22
|
const templateElm = document.createElement('template');
|
|
23
|
-
templateElm.setAttribute('
|
|
23
|
+
templateElm.setAttribute('id', 'app-tag-' + appElements.length);
|
|
24
|
+
templateElm.setAttribute('app-tag-detail', appElements.length.toString());
|
|
24
25
|
element.appendChild(templateElm);
|
|
25
26
|
tag.buildBeforeElement(templateElm);
|
|
27
|
+
wrapper.global.oldest = tag;
|
|
28
|
+
wrapper.global.newest = tag;
|
|
29
|
+
if (!tag.hasLiveElements) {
|
|
30
|
+
throw new Error('x');
|
|
31
|
+
}
|
|
32
|
+
;
|
|
26
33
|
element.setUse = app.original.setUse;
|
|
27
34
|
appElements.push({ element, tag });
|
|
28
35
|
return { tag, tags: app.original.tags };
|
|
29
36
|
}
|
|
30
37
|
export function applyTagUpdater(wrapper) {
|
|
31
|
-
const
|
|
38
|
+
const subject = new ValueSubject({});
|
|
39
|
+
const tagSupport = new BaseTagSupport(wrapper, subject);
|
|
40
|
+
wrapper.tagSupport = tagSupport;
|
|
32
41
|
runBeforeRender(tagSupport, undefined);
|
|
33
42
|
// Call the apps function for our tag templater
|
|
34
|
-
const tag = wrapper.wrapper();
|
|
43
|
+
const tag = wrapper.wrapper(tagSupport, subject);
|
|
44
|
+
// wrapper.global.oldest = tag
|
|
45
|
+
// wrapper.global.newest = tag
|
|
35
46
|
runAfterRender(tagSupport, tag);
|
|
36
47
|
return { tag, tagSupport };
|
|
37
48
|
}
|
|
38
|
-
/** Overwrites arguments.tagSupport.mutatingRender */
|
|
39
|
-
export function addAppTagRender(tagSupport, tag) {
|
|
40
|
-
let lastTag = tag;
|
|
41
|
-
tagSupport.mutatingRender = () => {
|
|
42
|
-
const preRenderCount = tagSupport.memory.renderCount;
|
|
43
|
-
providersChangeCheck(tag);
|
|
44
|
-
// When the providers were checked, a render to myself occurred and I do not need to re-render again
|
|
45
|
-
if (preRenderCount !== tagSupport.memory.renderCount) {
|
|
46
|
-
return lastTag;
|
|
47
|
-
}
|
|
48
|
-
runBeforeRedraw(tag.tagSupport, tag);
|
|
49
|
-
const templater = tagSupport.templater; // wrapper
|
|
50
|
-
const fromTag = lastTag = templater.wrapper();
|
|
51
|
-
fromTag.tagSupport.memory = tagSupport.memory;
|
|
52
|
-
tagSupport.propsConfig = { ...fromTag.tagSupport.propsConfig };
|
|
53
|
-
tag.tagSupport.newest = fromTag;
|
|
54
|
-
runAfterRender(tag.tagSupport, tag);
|
|
55
|
-
tagSupport.oldest.updateByTag(fromTag);
|
|
56
|
-
tagSupport.newest = fromTag;
|
|
57
|
-
return lastTag;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
49
|
//# sourceMappingURL=tagElement.js.map
|
package/js/tagElement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagElement.js","sourceRoot":"","sources":["../ts/tagElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tagElement.js","sourceRoot":"","sources":["../ts/tagElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,MAAM,WAAW,GAAmC,EAAE,CAAA;AAEtD,MAAM,UAAU,UAAU,CACxB,GAAiB,EAAE,2CAA2C;AAC9D,OAA8B,EAC9B,KAAc;IAEd,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;IAC/E,IAAG,WAAW,IAAI,CAAC,EAAE,CAAC;QACpB,WAAW,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;QACtC,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;QAClC,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,6DAA6D,EAAE,EAAC,OAAO,EAAC,CAAC,CAAA;IACxF,CAAC;IAED,2DAA2D;IAC3D,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAA+B,CAAA;IAExD,kFAAkF;IAClF,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IACvC,MAAM,EAAC,GAAG,EAAC,GAAG,MAAM,CAAA;IAEpB,6BAA6B;IAC7B,GAAG,CAAC,UAAU,GAAG,OAAO,CAAA;IACxB,GAAG,CAAC,UA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IACD,8BAA8B;IAC9B,8BAA8B;IAC9B,cAAc,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;IAE/B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAA;AAC5B,CAAC"}
|
package/js/tagRunner.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Tag } from
|
|
2
|
-
import {
|
|
3
|
-
export declare function runBeforeRender(tagSupport:
|
|
4
|
-
export declare function runAfterRender(tagSupport:
|
|
5
|
-
export declare function runBeforeRedraw(tagSupport:
|
|
6
|
-
export declare function runBeforeDestroy(tagSupport:
|
|
1
|
+
import { Tag } from './Tag.class';
|
|
2
|
+
import { BaseTagSupport } from './TagSupport.class';
|
|
3
|
+
export declare function runBeforeRender(tagSupport: BaseTagSupport, tagOwner: Tag): void;
|
|
4
|
+
export declare function runAfterRender(tagSupport: BaseTagSupport, tag: Tag): void;
|
|
5
|
+
export declare function runBeforeRedraw(tagSupport: BaseTagSupport, tag: Tag): void;
|
|
6
|
+
export declare function runBeforeDestroy(tagSupport: BaseTagSupport, tag: Tag): void;
|
package/js/tagRunner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// TODO: This should be more like `new TaggedJs().use({})`
|
|
2
|
-
import { setUse } from
|
|
2
|
+
import { setUse } from './setUse.function';
|
|
3
3
|
// Life cycle 1
|
|
4
4
|
export function runBeforeRender(tagSupport, tagOwner) {
|
|
5
5
|
setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, tagOwner));
|
package/js/tagRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagRunner.js","sourceRoot":"","sources":["../ts/tagRunner.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAI1D,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tagRunner.js","sourceRoot":"","sources":["../ts/tagRunner.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAI1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,eAAe;AACf,MAAM,UAAU,eAAe,CAC7B,UAA0B,EAC1B,QAAa;IAEb,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC5E,CAAC;AAED,eAAe;AACf,MAAM,UAAU,cAAc,CAC5B,UAA0B,EAC1B,GAAQ;IAER,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;AACtE,CAAC;AAED,eAAe;AACf,MAAM,UAAU,eAAe,CAC7B,UAA0B,EAC1B,GAAQ;IAER,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;AACvE,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,gBAAgB,CAC9B,UAA0B,EAC1B,GAAQ;IAER,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;AACxE,CAAC"}
|
package/js/templater.utils.d.ts
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
import { Tag } from
|
|
2
|
-
import {
|
|
3
|
-
import { Props } from
|
|
4
|
-
import { TagChildren } from
|
|
5
|
-
|
|
1
|
+
import { Context, Tag } from './Tag.class';
|
|
2
|
+
import { BaseTagSupport } from './TagSupport.class';
|
|
3
|
+
import { Props } from './Props';
|
|
4
|
+
import { TagChildren } from './tag';
|
|
5
|
+
import { Provider } from './providers';
|
|
6
|
+
import { OnDestroyCallback } from './onDestroy';
|
|
7
|
+
export type Wrapper = ((tagSupport: BaseTagSupport) => Tag) & {
|
|
6
8
|
original: () => Tag;
|
|
7
9
|
};
|
|
8
10
|
export declare class TemplaterResult {
|
|
11
|
+
props: Props;
|
|
12
|
+
children: TagChildren;
|
|
9
13
|
tagged: boolean;
|
|
10
14
|
wrapper: Wrapper;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
global: {
|
|
16
|
+
oldest?: Tag;
|
|
17
|
+
newest?: Tag;
|
|
18
|
+
context: Context;
|
|
19
|
+
providers: Provider[];
|
|
20
|
+
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
21
|
+
renderCount: number;
|
|
22
|
+
destroyCallback?: OnDestroyCallback;
|
|
23
|
+
insertBefore?: Element | Text;
|
|
24
|
+
};
|
|
25
|
+
tagSupport: BaseTagSupport;
|
|
14
26
|
constructor(props: Props, children: TagChildren);
|
|
15
|
-
redraw?: (force?: boolean) => Tag
|
|
27
|
+
redraw?: (force?: boolean) => Tag;
|
|
16
28
|
isTemplater: boolean;
|
|
17
|
-
|
|
18
|
-
renderWithSupport(tagSupport: TagSupport, existingTag: Tag | undefined, ownerTag?: Tag): {
|
|
29
|
+
renderWithSupport(tagSupport: BaseTagSupport, existingTag: Tag | undefined, ownerTag?: Tag): {
|
|
19
30
|
remit: boolean;
|
|
20
31
|
retag: Tag;
|
|
21
32
|
};
|
|
22
33
|
}
|
|
23
34
|
export interface TemplateRedraw extends TemplaterResult {
|
|
24
|
-
redraw: () => Tag
|
|
35
|
+
redraw: () => Tag;
|
|
25
36
|
}
|
|
26
37
|
export declare function alterProps(props: Props, templater: TemplaterResult): any;
|
package/js/templater.utils.js
CHANGED
|
@@ -1,72 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { setUse } from "./setUse.function.js";
|
|
1
|
+
import { isTagInstance } from './isInstance';
|
|
2
|
+
import { runAfterRender, runBeforeRedraw, runBeforeRender } from './tagRunner';
|
|
3
|
+
import { setUse } from './setUse.function';
|
|
5
4
|
export class TemplaterResult {
|
|
5
|
+
props;
|
|
6
|
+
children;
|
|
6
7
|
tagged;
|
|
7
8
|
wrapper;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
global = {
|
|
10
|
+
context: {}, // populated after reading interpolated.values array converted to an object {variable0, variable:1}
|
|
11
|
+
providers: [],
|
|
12
|
+
/** Indicator of re-rending. Saves from double rending something already rendered */
|
|
13
|
+
renderCount: 0,
|
|
14
|
+
};
|
|
10
15
|
tagSupport;
|
|
11
16
|
constructor(props, children) {
|
|
12
|
-
this.
|
|
17
|
+
this.props = props;
|
|
18
|
+
this.children = children;
|
|
13
19
|
}
|
|
14
20
|
redraw;
|
|
15
21
|
isTemplater = true;
|
|
16
|
-
forceRenderTemplate(tagSupport, ownerTag) {
|
|
17
|
-
const tag = this.wrapper();
|
|
18
|
-
runAfterRender(tagSupport, tag);
|
|
19
|
-
this.oldest = tag;
|
|
20
|
-
tagSupport.oldest = tag;
|
|
21
|
-
this.oldest = tag;
|
|
22
|
-
this.newest = tag;
|
|
23
|
-
tag.ownerTag = ownerTag;
|
|
24
|
-
return tag;
|
|
25
|
-
}
|
|
26
22
|
renderWithSupport(tagSupport, existingTag, ownerTag) {
|
|
23
|
+
const wrapTagSupport = tagSupport; // this.tagSupport
|
|
24
|
+
// this.tagSupport = wrapTagSupport
|
|
27
25
|
/* BEFORE RENDER */
|
|
28
26
|
// signify to other operations that a rendering has occurred so they do not need to render again
|
|
29
|
-
++
|
|
27
|
+
// ++wrapTagSupport.memory.renderCount
|
|
30
28
|
const runtimeOwnerTag = existingTag?.ownerTag || ownerTag;
|
|
31
29
|
if (existingTag) {
|
|
32
|
-
|
|
33
|
-
runBeforeRedraw(tagSupport, existingTag);
|
|
30
|
+
runBeforeRedraw(wrapTagSupport, existingTag);
|
|
34
31
|
}
|
|
35
32
|
else {
|
|
33
|
+
if (!wrapTagSupport) {
|
|
34
|
+
throw new Error('63521');
|
|
35
|
+
}
|
|
36
36
|
// first time render
|
|
37
|
-
runBeforeRender(
|
|
37
|
+
runBeforeRender(wrapTagSupport, runtimeOwnerTag);
|
|
38
38
|
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
39
39
|
const providers = setUse.memory.providerConfig;
|
|
40
40
|
providers.ownerTag = runtimeOwnerTag;
|
|
41
41
|
}
|
|
42
42
|
/* END: BEFORE RENDER */
|
|
43
|
-
const
|
|
44
|
-
const retag = templater.wrapper();
|
|
43
|
+
const retag = this.wrapper(wrapTagSupport);
|
|
45
44
|
/* AFTER */
|
|
46
|
-
runAfterRender(
|
|
47
|
-
templater.newest = retag;
|
|
45
|
+
runAfterRender(wrapTagSupport, retag);
|
|
48
46
|
retag.ownerTag = runtimeOwnerTag;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
oldest.tagSupport.memory = retag.tagSupport.memory;
|
|
53
|
-
const isSameTag = existingTag && existingTag.isLikeTag(retag);
|
|
54
|
-
// If previously was a tag and seems to be same tag, then just update current tag with new values
|
|
55
|
-
if (isSameTag) {
|
|
56
|
-
existingTag.updateByTag(retag);
|
|
57
|
-
return { remit: false, retag };
|
|
47
|
+
wrapTagSupport.templater.global.newest = retag;
|
|
48
|
+
if (this.global.oldest && !this.global.oldest.hasLiveElements) {
|
|
49
|
+
throw new Error('56513540');
|
|
58
50
|
}
|
|
51
|
+
if (wrapTagSupport.templater.global.oldest && !wrapTagSupport.templater.global.oldest.hasLiveElements) {
|
|
52
|
+
throw new Error('5555 - 10');
|
|
53
|
+
}
|
|
54
|
+
// new maybe not needed
|
|
55
|
+
// this.oldest = this.oldest || retag
|
|
56
|
+
// wrapTagSupport.oldest = wrapTagSupport.oldest || retag
|
|
59
57
|
return { remit: true, retag };
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
/* Used to rewrite props that are functions. When they are called it should cause parent rendering */
|
|
63
61
|
export function alterProps(props, templater) {
|
|
64
62
|
function callback(toCall, callWith) {
|
|
63
|
+
const renderCount = templater.global.renderCount;
|
|
65
64
|
const callbackResult = toCall(...callWith);
|
|
66
|
-
const
|
|
65
|
+
const tag = templater.global.newest;
|
|
66
|
+
let tagSupport = tag?.tagSupport.ownerTagSupport;
|
|
67
67
|
if (tagSupport) {
|
|
68
|
-
tagSupport.
|
|
68
|
+
tagSupport = templater.global.newest?.tagSupport || templater.global.oldest?.tagSupport || tagSupport;
|
|
69
|
+
}
|
|
70
|
+
if (templater.global.renderCount > renderCount) {
|
|
71
|
+
throw new Error('already rendered');
|
|
72
|
+
}
|
|
73
|
+
const ownerTag = tag?.ownerTag;
|
|
74
|
+
if (ownerTag) {
|
|
75
|
+
const newestOwner = ownerTag.tagSupport.templater.global.newest;
|
|
76
|
+
newestOwner.tagSupport.render();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
console.log('alter prop reder', {
|
|
80
|
+
original: tagSupport.templater.wrapper.original,
|
|
81
|
+
ownerTag: tag?.ownerTag,
|
|
82
|
+
});
|
|
83
|
+
const newTag = tagSupport.render(); // call owner to render
|
|
84
|
+
if (!templater.global.oldest) {
|
|
85
|
+
throw new Error('lklk');
|
|
69
86
|
}
|
|
87
|
+
templater.global.newest = newTag;
|
|
88
|
+
// templater.global.oldest = templater.global.oldest || newTag
|
|
70
89
|
return callbackResult;
|
|
71
90
|
}
|
|
72
91
|
const isPropTag = isTagInstance(props);
|
|
@@ -85,10 +104,6 @@ function resetFunctionProps(props, callback) {
|
|
|
85
104
|
if (value instanceof Function) {
|
|
86
105
|
const original = newProps[name].original;
|
|
87
106
|
if (original) {
|
|
88
|
-
newProps[name] = (...args) => {
|
|
89
|
-
return callback(value, args);
|
|
90
|
-
};
|
|
91
|
-
newProps[name].original = original;
|
|
92
107
|
return; // already previously converted
|
|
93
108
|
}
|
|
94
109
|
newProps[name] = (...args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templater.utils.js","sourceRoot":"","sources":["../ts/templater.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templater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,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,KAAK,EAAE,IAAI,CAAC,CAAA;YAC9B,CAAC,CAAA;YAED,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAA;YAE/B,OAAM;QACR,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tag } from
|
|
2
|
-
import { TagSubject } from
|
|
3
|
-
import { TemplaterResult } from
|
|
4
|
-
export declare function updateExistingTag(templater: TemplaterResult, ogTag: Tag, existingSubject: TagSubject): never[];
|
|
1
|
+
import { Tag } from './Tag.class';
|
|
2
|
+
import { TagSubject } from './Tag.utils';
|
|
3
|
+
import { TemplaterResult } from './templater.utils';
|
|
4
|
+
export declare function updateExistingTag(templater: TemplaterResult, ogTag: Tag, existingSubject: TagSubject): never[] | undefined;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { runAfterRender, runBeforeRedraw } from
|
|
1
|
+
import { runAfterRender, runBeforeRedraw } from './tagRunner';
|
|
2
2
|
export function updateExistingTag(templater, ogTag, existingSubject) {
|
|
3
|
+
if (!templater.tagSupport) {
|
|
4
|
+
throw new Error('start clone tag support here');
|
|
5
|
+
}
|
|
6
|
+
console.log('redraw templater!!!!', { wrapp: templater.wrapper?.original });
|
|
7
|
+
templater.render();
|
|
8
|
+
return;
|
|
3
9
|
const tagSupport = ogTag.tagSupport;
|
|
4
|
-
const oldest =
|
|
5
|
-
const newest =
|
|
6
|
-
runBeforeRedraw(oldest.tagSupport, newest || oldest)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const oldest = templater.global.oldest;
|
|
11
|
+
const newest = templater.global.newest;
|
|
12
|
+
// runBeforeRedraw(oldest.tagSupport, newest || oldest)
|
|
13
|
+
runBeforeRedraw(oldest.tagSupport, oldest);
|
|
14
|
+
const wrapTagSupport = tagSupport; // newest.tagSupport || tagSupport
|
|
15
|
+
// const retag = templater.wrapper(wrapTagSupport)
|
|
16
|
+
const retag = templater.wrapper(wrapTagSupport);
|
|
17
|
+
templater.global.newest = retag;
|
|
10
18
|
runAfterRender(oldest.tagSupport, oldest);
|
|
11
19
|
ogTag.updateByTag(retag);
|
|
20
|
+
// oldest.updateByTag(retag)
|
|
12
21
|
existingSubject.set(templater);
|
|
13
22
|
return [];
|
|
14
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateExistingTag.function.js","sourceRoot":"","sources":["../ts/updateExistingTag.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateExistingTag.function.js","sourceRoot":"","sources":["../ts/updateExistingTag.function.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG7D,MAAM,UAAU,iBAAiB,CAC/B,SAA0B,EAC1B,KAAU,EACV,eAA2B;IAE3B,IAAG,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACjD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAC,KAAK,EAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAC,CAAC,CAEvE;IAAC,SAAiB,CAAC,MAAM,EAAE,CAAA;IAC5B,OAAM;IAEN,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;IACnC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,MAAa,CAAA;IAC7C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,MAAa,CAAA;IAE7C,uDAAuD;IACvD,eAAe,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAE1C,MAAM,cAAc,GAAG,UAAU,CAAA,CAAC,kCAAkC;IAEpE,kDAAkD;IAClD,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAE/C,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IAE/B,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACzC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IACxB,4BAA4B;IAE5B,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAE9B,OAAO,EAAE,CAAA;AACX,CAAC"}
|