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/tag.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isSubjectInstance, isTagArray,
|
|
2
|
-
import { setUse } from './
|
|
1
|
+
import { isSubjectInstance, isTagArray, isTagClass, isTagTemplater } from './isInstance';
|
|
2
|
+
import { setUse } from './state';
|
|
3
3
|
import { TemplaterResult } from './TemplaterResult.class';
|
|
4
|
-
import { runTagCallback } from './bindSubjectCallback.function';
|
|
4
|
+
import { runTagCallback } from './interpolations/bindSubjectCallback.function';
|
|
5
5
|
import { deepClone } from './deepFunctions';
|
|
6
6
|
import { TagSupport } from './TagSupport.class';
|
|
7
7
|
import { alterProps } from './alterProps.function';
|
|
@@ -11,8 +11,10 @@ let tagCount = 0;
|
|
|
11
11
|
/** Wraps a tag component in a state manager and always push children to last argument as an array */
|
|
12
12
|
// export function tag<T>(a: T): T;
|
|
13
13
|
export function tag(tagComponent) {
|
|
14
|
+
/** function developer triggers */
|
|
14
15
|
const result = (function tagWrapper(props, children) {
|
|
15
|
-
|
|
16
|
+
// is the props argument actually children?
|
|
17
|
+
const isPropTag = isTagClass(props) || isTagTemplater(props) || isTagArray(props);
|
|
16
18
|
if (isPropTag) {
|
|
17
19
|
children = props;
|
|
18
20
|
props = undefined;
|
|
@@ -20,6 +22,7 @@ export function tag(tagComponent) {
|
|
|
20
22
|
const { childSubject, madeSubject } = kidsToTagArraySubject(children);
|
|
21
23
|
childSubject.isChildSubject = true;
|
|
22
24
|
const templater = new TemplaterResult(props, childSubject);
|
|
25
|
+
// attach memory back to original function that contains developer display logic
|
|
23
26
|
const innerTagWrap = getTagWrap(templater, madeSubject);
|
|
24
27
|
innerTagWrap.original = tagComponent;
|
|
25
28
|
templater.tagged = true;
|
|
@@ -30,6 +33,7 @@ export function tag(tagComponent) {
|
|
|
30
33
|
// group tags together and have hmr pickup
|
|
31
34
|
updateComponent(tagComponent);
|
|
32
35
|
tags.push(tagComponent);
|
|
36
|
+
// fake the return as being (props?, children?) => TemplaterResult
|
|
33
37
|
return result;
|
|
34
38
|
}
|
|
35
39
|
function kidsToTagArraySubject(children) {
|
|
@@ -59,45 +63,35 @@ function updateComponent(tagComponent) {
|
|
|
59
63
|
tagComponent.setUse = setUse;
|
|
60
64
|
tagComponent.tagIndex = tagCount++; // needed for things like HMR
|
|
61
65
|
}
|
|
62
|
-
/** creates/returns a function that when called then calls the original component function
|
|
66
|
+
/** creates/returns a function that when called then calls the original component function
|
|
67
|
+
* Gets used as templater.wrapper()
|
|
68
|
+
*/
|
|
63
69
|
function getTagWrap(templater, madeSubject) {
|
|
70
|
+
// this function gets called by taggedjs
|
|
64
71
|
const innerTagWrap = function (oldTagSetup, subject) {
|
|
65
|
-
const global = oldTagSetup.
|
|
66
|
-
global.newestTemplater = templater;
|
|
72
|
+
const global = oldTagSetup.global;
|
|
67
73
|
++global.renderCount;
|
|
68
|
-
templater.global = global;
|
|
69
74
|
const childSubject = templater.children;
|
|
70
|
-
const lastArray = global.oldest?.
|
|
75
|
+
const lastArray = global.oldest?.templater.children.lastArray;
|
|
71
76
|
if (lastArray) {
|
|
72
77
|
childSubject.lastArray = lastArray;
|
|
73
78
|
}
|
|
74
79
|
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
80
|
let props = templater.props;
|
|
81
|
-
|
|
82
|
-
const oldTemplater = ownerTagSupport?.templater;
|
|
83
|
-
const oldLatest = oldTemplater?.global.newest;
|
|
84
|
-
const newestOwnerTemplater = oldLatest?.tagSupport.templater;
|
|
85
|
-
if (oldLatest && !newestOwnerTemplater) {
|
|
86
|
-
throw new Error('what to do here?');
|
|
87
|
-
}
|
|
88
|
-
let castedProps = alterProps(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);
|
|
81
|
+
let castedProps = alterProps(props, oldTagSetup.ownerTagSupport);
|
|
89
82
|
const clonedProps = deepClone(props); // castedProps
|
|
90
83
|
// CALL ORIGINAL COMPONENT FUNCTION
|
|
91
84
|
const tag = originalFunction(castedProps, childSubject);
|
|
92
|
-
tag.
|
|
93
|
-
tag
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
tag.templater = templater;
|
|
86
|
+
templater.tag = tag;
|
|
87
|
+
const tagSupport = new TagSupport(templater, oldTagSetup.ownerTagSupport, subject, global.renderCount);
|
|
88
|
+
tagSupport.global = global;
|
|
89
|
+
tagSupport.propsConfig = {
|
|
90
|
+
latest: props,
|
|
96
91
|
latestCloned: clonedProps,
|
|
97
|
-
|
|
98
|
-
lastClonedKidValues: tag.tagSupport.propsConfig.lastClonedKidValues,
|
|
92
|
+
lastClonedKidValues: tagSupport.propsConfig.lastClonedKidValues,
|
|
99
93
|
};
|
|
100
|
-
|
|
94
|
+
tagSupport.memory = oldTagSetup.memory; // state handover
|
|
101
95
|
if (madeSubject) {
|
|
102
96
|
childSubject.value.forEach(kid => {
|
|
103
97
|
kid.values.forEach((value, index) => {
|
|
@@ -110,16 +104,16 @@ function getTagWrap(templater, madeSubject) {
|
|
|
110
104
|
}
|
|
111
105
|
// all functions need to report to me
|
|
112
106
|
kid.values[index] = function (...args) {
|
|
113
|
-
const
|
|
107
|
+
const ownerSupport = tagSupport.ownerTagSupport;
|
|
114
108
|
runTagCallback(value, // callback
|
|
115
|
-
|
|
109
|
+
ownerSupport, this, // bindTo
|
|
116
110
|
args);
|
|
117
111
|
};
|
|
118
112
|
valuesValue.isChildOverride = true;
|
|
119
113
|
});
|
|
120
114
|
});
|
|
121
115
|
}
|
|
122
|
-
return
|
|
116
|
+
return tagSupport;
|
|
123
117
|
};
|
|
124
118
|
return innerTagWrap;
|
|
125
119
|
}
|
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,
|
|
1
|
+
{"version":3,"file":"tag.js","sourceRoot":"","sources":["../ts/tag.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,eAAe,EAAW,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAA;AAC9E,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,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAcrD,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,kCAAkC;IAClC,MAAM,MAAM,GAAG,CAAC,SAAS,UAAU,CACjC,KAAuB,EACvB,QAA2B;QAE3B,2CAA2C;QAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;QAEjF,IAAG,SAAS,EAAE,CAAC;YACb,QAAQ,GAAG,KAAkC,CAAA;YAC7C,KAAK,GAAG,SAAS,CAAA;QACnB,CAAC;QAED,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CACpE;QAAC,YAAoB,CAAC,cAAc,G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ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TagSupport } from './TagSupport.class';
|
|
2
2
|
import { TemplaterResult } from './TemplaterResult.class';
|
|
3
|
-
import { Tag } from './Tag.class';
|
|
4
3
|
import { TagComponent } from './tag';
|
|
5
4
|
export declare function tagElement(app: TagComponent, // (...args: unknown[]) => TemplaterResult,
|
|
6
5
|
element: HTMLElement | Element, props: unknown): {
|
|
7
|
-
|
|
6
|
+
tagSupport: TagSupport;
|
|
8
7
|
tags: TagComponent[];
|
|
9
8
|
};
|
|
10
|
-
export declare function
|
|
11
|
-
tag: Tag;
|
|
12
|
-
tagSupport: BaseTagSupport;
|
|
13
|
-
};
|
|
9
|
+
export declare function runWrapper(templater: TemplaterResult): TagSupport;
|
package/js/tagElement.js
CHANGED
|
@@ -6,7 +6,7 @@ export function tagElement(app, // (...args: unknown[]) => TemplaterResult,
|
|
|
6
6
|
element, props) {
|
|
7
7
|
const appElmIndex = appElements.findIndex(appElm => appElm.element === element);
|
|
8
8
|
if (appElmIndex >= 0) {
|
|
9
|
-
appElements[appElmIndex].
|
|
9
|
+
appElements[appElmIndex].tagSupport.destroy();
|
|
10
10
|
appElements.splice(appElmIndex, 1);
|
|
11
11
|
// an element already had an app on it
|
|
12
12
|
console.warn('Found and destroyed app element already rendered to element', { element });
|
|
@@ -14,36 +14,36 @@ element, props) {
|
|
|
14
14
|
// Create the app which returns [props, runOneTimeFunction]
|
|
15
15
|
const wrapper = app(props);
|
|
16
16
|
// have a function setup and call the tagWrapper with (props, {update, async, on})
|
|
17
|
-
const
|
|
18
|
-
const { tag } = result;
|
|
17
|
+
const tagSupport = runWrapper(wrapper);
|
|
19
18
|
// TODO: is the below needed?
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
tagSupport.appElement = element;
|
|
20
|
+
tagSupport.isApp = true;
|
|
21
|
+
tagSupport.global.isApp = true;
|
|
22
22
|
const templateElm = document.createElement('template');
|
|
23
23
|
templateElm.setAttribute('id', 'app-tag-' + appElements.length);
|
|
24
24
|
templateElm.setAttribute('app-tag-detail', appElements.length.toString());
|
|
25
25
|
element.appendChild(templateElm);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!tag.hasLiveElements) {
|
|
30
|
-
throw new Error('x');
|
|
31
|
-
}
|
|
32
|
-
;
|
|
26
|
+
tagSupport.buildBeforeElement(templateElm);
|
|
27
|
+
tagSupport.global.oldest = tagSupport;
|
|
28
|
+
tagSupport.global.newest = tagSupport;
|
|
33
29
|
element.setUse = app.original.setUse;
|
|
34
|
-
appElements.push({ element,
|
|
35
|
-
return {
|
|
30
|
+
appElements.push({ element, tagSupport });
|
|
31
|
+
return {
|
|
32
|
+
tagSupport,
|
|
33
|
+
tags: app.original.tags,
|
|
34
|
+
};
|
|
36
35
|
}
|
|
37
|
-
export function
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
export function runWrapper(templater) {
|
|
37
|
+
let newSupport = {};
|
|
38
|
+
const subject = new ValueSubject(newSupport);
|
|
39
|
+
newSupport = new BaseTagSupport(templater, subject);
|
|
40
|
+
subject.set(templater);
|
|
41
|
+
subject.tagSupport = newSupport;
|
|
42
|
+
runBeforeRender(newSupport, undefined);
|
|
42
43
|
// Call the apps function for our tag templater
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return { tag, tagSupport };
|
|
44
|
+
const wrapper = templater.wrapper;
|
|
45
|
+
const tagSupport = wrapper(newSupport, subject);
|
|
46
|
+
runAfterRender(newSupport, tagSupport);
|
|
47
|
+
return tagSupport;
|
|
48
48
|
}
|
|
49
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":"AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+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AAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzE,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;IAEhC,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAE1C,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU,CAAA;IACrC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU,CAEpC;IAAC,OAAe,CAAC,MAAM,GAAI,GAAW,CAAC,QAAQ,CAAC,MAAM,CAAA;IAEvD,WAAW,CAAC,IAAI,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,CAAC,CAAA;IAEvC,OAAO;QACL,UAAU;QACV,IAAI,EAAG,GAAW,CAAC,QAAQ,CAAC,IAAI;KACjC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,SAA0B;IAE1B,IAAI,UAAU,GAAG,EAAgB,CAAA;IACjC,MAAM,OAAO,GAAG,IAAI,YAAY,CAAa,UAAU,CAA0B,CAAA;IAEjF,UAAU,GAAG,IAAI,cAAc,CAC7B,SAAS,EACT,OAAO,CACM,CAAA;IAEf,OAAO,CAAC,GAAG,CAAE,SAAS,CAAE,CAAA;IAExB,OAAO,CAAC,UAAU,GAAG,UAAU,CAAA;IAE/B,eAAe,CAAC,UAAU,EAAE,SAAkC,CAAC,CAAA;IAE/D,+CAA+C;IAC/C,MAAM,OAAO,GAAG,SAAS,CAAC,OAAkB,CAAA;IAC5C,MAAM,UAAU,GAAG,OAAO,CACxB,UAAU,EACV,OAAO,CACR,CAAA;IAED,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAEtC,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
package/js/tagRunner.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
1
|
+
import { BaseTagSupport, TagSupport } from './TagSupport.class';
|
|
2
|
+
import { Subject } from './subject';
|
|
3
|
+
export declare const tagClosed$: Subject<TagSupport>;
|
|
4
|
+
export declare function runBeforeRender(tagSupport: BaseTagSupport, ownerSupport?: TagSupport): void;
|
|
5
|
+
export declare function runAfterRender(tagSupport: BaseTagSupport, ownerTagSupport: TagSupport): void;
|
|
6
|
+
export declare function runBeforeRedraw(tagSupport: BaseTagSupport, ownerTagSupport: TagSupport): void;
|
|
7
|
+
export declare function runBeforeDestroy(tagSupport: BaseTagSupport, ownerTagSupport: TagSupport): void;
|
package/js/tagRunner.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
// TODO: This should be more like `new TaggedJs().use({})`
|
|
2
|
-
import { setUse } from './
|
|
2
|
+
import { setUse } from './state';
|
|
3
|
+
import { Subject } from './subject';
|
|
4
|
+
// Emits event at the end of a tag being rendered. Use tagClosed$.toPromise() to render a tag after a current tag is done rendering
|
|
5
|
+
export const tagClosed$ = new Subject(undefined, subscription => {
|
|
6
|
+
if (!setUse.memory.stateConfig.rearray) {
|
|
7
|
+
subscription.next(); // we are not currently processing so process now
|
|
8
|
+
}
|
|
9
|
+
});
|
|
3
10
|
// Life cycle 1
|
|
4
|
-
export function runBeforeRender(tagSupport,
|
|
5
|
-
setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport,
|
|
11
|
+
export function runBeforeRender(tagSupport, ownerSupport) {
|
|
12
|
+
setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, ownerSupport));
|
|
6
13
|
}
|
|
7
14
|
// Life cycle 2
|
|
8
|
-
export function runAfterRender(tagSupport,
|
|
9
|
-
setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport,
|
|
15
|
+
export function runAfterRender(tagSupport, ownerTagSupport) {
|
|
16
|
+
setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, ownerTagSupport));
|
|
17
|
+
tagClosed$.next(ownerTagSupport);
|
|
10
18
|
}
|
|
11
19
|
// Life cycle 3
|
|
12
|
-
export function runBeforeRedraw(tagSupport,
|
|
13
|
-
setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport,
|
|
20
|
+
export function runBeforeRedraw(tagSupport, ownerTagSupport) {
|
|
21
|
+
setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, ownerTagSupport));
|
|
14
22
|
}
|
|
15
23
|
// Life cycle 4 - end of life
|
|
16
|
-
export function runBeforeDestroy(tagSupport,
|
|
17
|
-
setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport,
|
|
24
|
+
export function runBeforeDestroy(tagSupport, ownerTagSupport) {
|
|
25
|
+
setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, ownerTagSupport));
|
|
18
26
|
}
|
|
19
27
|
//# sourceMappingURL=tagRunner.js.map
|
package/js/tagRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagRunner.js","sourceRoot":"","sources":["../ts/tagRunner.ts"],"names":[],"mappings":"AAAA,0DAA0D;
|
|
1
|
+
{"version":3,"file":"tagRunner.js","sourceRoot":"","sources":["../ts/tagRunner.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,mIAAmI;AACnI,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAa,SAAS,EAAE,YAAY,CAAC,EAAE;IAC1E,IAAG,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACtC,YAAY,CAAC,IAAI,EAAE,CAAA,CAAC,iDAAiD;IACvE,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,eAAe;AACf,MAAM,UAAU,eAAe,CAC7B,UAA0B,EAC1B,YAAyB;IAEzB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;AAChF,CAAC;AAED,eAAe;AACf,MAAM,UAAU,cAAc,CAC5B,UAA0B,EAC1B,eAA2B;IAE3B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAA;IAChF,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;AAClC,CAAC;AAED,eAAe;AACf,MAAM,UAAU,eAAe,CAC7B,UAA0B,EAC1B,eAA2B;IAE3B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAA;AACnF,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,gBAAgB,CAC9B,UAA0B,EAC1B,eAA2B;IAE3B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAA;AACpF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { InsertBefore } from "./Clones.type";
|
|
2
|
-
import { NoDisplayValue } from "./processAttribute.function";
|
|
2
|
+
import { NoDisplayValue } from "./interpolations/processAttribute.function";
|
|
3
3
|
export declare function updateBeforeTemplate(value: string | boolean | number | NoDisplayValue, lastFirstChild: InsertBefore): Text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateBeforeTemplate.function.js","sourceRoot":"","sources":["../ts/updateBeforeTemplate.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateBeforeTemplate.function.js","sourceRoot":"","sources":["../ts/updateBeforeTemplate.function.ts"],"names":[],"mappings":"AAIA,oCAAoC;AACpC,MAAM,UAAU,oBAAoB,CAClC,KAAiD,EACjD,cAA4B;IAE5B,MAAM,MAAM,GAAG,cAAc,CAAC,UAAwB,CAAA;IACtD,IAAI,WAAW,GAAG,KAAe,CAAA;IAEjC,uEAAuE;IACvE,IAAG,CAAC,SAAS,EAAC,KAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAuB,CAAC,EAAE,CAAC,CAAC,oBAAoB;QACjF,WAAW,GAAG,EAAE,CAAA;IAClB,CAAC;IAED,kDAAkD;IAClD,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA,CAAC,kBAAkB;IACxE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAE7C,2BAA2B;IAC3B,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAA;IAElC,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isSubjectInstance, isTagComponent } from './isInstance';
|
|
2
|
+
import { TagSupport } from './TagSupport.class';
|
|
3
|
+
export function updateContextItem(context, variableName, value) {
|
|
4
|
+
const subject = context[variableName];
|
|
5
|
+
const tagSubject = subject;
|
|
6
|
+
const tagSupport = tagSubject.tagSupport;
|
|
7
|
+
if (tagSupport) {
|
|
8
|
+
if (value) {
|
|
9
|
+
if (isTagComponent(value)) {
|
|
10
|
+
const templater = value;
|
|
11
|
+
let newSupport = new TagSupport(templater, tagSupport.ownerTagSupport, subject);
|
|
12
|
+
if (isTagComponent(tagSupport)) {
|
|
13
|
+
shareTemplaterGlobal(tagSupport, newSupport);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (isSubjectInstance(value)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// listeners will evaluate updated values to possibly update display(s)
|
|
22
|
+
subject.set(value);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
function shareTemplaterGlobal(oldTagSupport, tagSupport) {
|
|
26
|
+
const oldTemp = oldTagSupport.templater;
|
|
27
|
+
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
28
|
+
const oldValueFn = oldWrap.original;
|
|
29
|
+
const templater = tagSupport.templater;
|
|
30
|
+
const newWrapper = templater.wrapper;
|
|
31
|
+
const newValueFn = newWrapper?.original;
|
|
32
|
+
const fnMatched = oldValueFn === newValueFn;
|
|
33
|
+
if (fnMatched) {
|
|
34
|
+
tagSupport.global = oldTagSupport.global;
|
|
35
|
+
// ??? new mirroring transfer state
|
|
36
|
+
const newest = oldTagSupport.global.newest;
|
|
37
|
+
if (newest) {
|
|
38
|
+
const prevState = newest.memory.state;
|
|
39
|
+
tagSupport.memory.state = [...prevState];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=updateContextItem.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateContextItem.function.js","sourceRoot":"","sources":["../ts/updateContextItem.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAKhE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,MAAM,UAAU,iBAAiB,CAC/B,OAAgB,EAChB,YAAoB,EACpB,KAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IACrC,MAAM,UAAU,GAAG,OAAqB,CAAA;IACxC,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAA;IAExC,IAAG,UAAU,EAAE,CAAC;QACd,IAAG,KAAK,EAAE,CAAC;YACT,IAAI,cAAc,CAAC,KAAK,CAAC,EAAG,CAAC;gBAC3B,MAAM,SAAS,GAAG,KAAwB,CAAA;gBAC1C,IAAI,UAAU,GAAG,IAAI,UAAU,CAC7B,SAAS,EACT,UAAU,CAAC,eAAe,EAC1B,OAAqB,CACtB,CAAA;gBAED,IAAG,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC9B,oBAAoB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAG,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAM;IACR,CAAC;IAED,uEAAuE;IACvE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAElB,OAAM;AACR,CAAC;AAED,SAAS,oBAAoB,CAC3B,aAAyB,EACzB,UAAsB;IAEtB,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CAAA;IACvC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAkB,CAAA,CAAC,uBAAuB;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAA;IAEnC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;IACtC,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAA;IACpC,MAAM,UAAU,GAAG,UAAU,EAAE,QAAQ,CAAA;IACvC,MAAM,SAAS,GAAG,UAAU,KAAK,UAAU,CAAA;IAE3C,IAAG,SAAS,EAAE,CAAC;QACb,UAAU,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAA;QACxC,mCAAmC;QACnC,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,MAAoB,CAAA;QACxD,IAAG,MAAM,EAAE,CAAC;YACV,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAA;YACrC,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TagSubject } from './
|
|
2
|
-
import {
|
|
3
|
-
import { Tag } from './Tag.class';
|
|
1
|
+
import { TagSubject } from './subject.types';
|
|
2
|
+
import { TagSupport } from './TagSupport.class';
|
|
4
3
|
import { InsertBefore } from './Clones.type';
|
|
5
|
-
export declare function updateExistingTagComponent(
|
|
4
|
+
export declare function updateExistingTagComponent(ownerSupport: TagSupport, tagSupport: TagSupport, // lastest
|
|
5
|
+
subject: TagSubject, insertBefore: InsertBefore): TagSupport;
|
|
@@ -3,135 +3,96 @@ import { processSubjectComponent } from './processSubjectComponent.function';
|
|
|
3
3
|
import { destroyTagMemory } from './destroyTag.function';
|
|
4
4
|
import { renderTagSupport } from './renderTagSupport.function';
|
|
5
5
|
import { callbackPropOwner } from './alterProps.function';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { isLikeTags } from './isLikeTags.function';
|
|
7
|
+
export function updateExistingTagComponent(ownerSupport, tagSupport, // lastest
|
|
8
|
+
subject, insertBefore) {
|
|
9
|
+
// ??? changed during mirroring
|
|
10
|
+
// let lastSupport = subject.tagSupport
|
|
11
|
+
let lastSupport = subject.tagSupport?.global.newest; // || subject.tagSupport
|
|
12
|
+
let oldestTag = lastSupport.global.oldest;
|
|
13
|
+
const oldWrapper = lastSupport.templater.wrapper;
|
|
14
|
+
const newWrapper = tagSupport.templater.wrapper;
|
|
10
15
|
let isSameTag = false;
|
|
11
16
|
if (oldWrapper && newWrapper) {
|
|
12
17
|
const oldFunction = oldWrapper.original;
|
|
13
18
|
const newFunction = newWrapper.original;
|
|
14
19
|
isSameTag = oldFunction === newFunction;
|
|
15
20
|
}
|
|
16
|
-
const
|
|
17
|
-
const oldGlobal = oldTagSupport.templater.global;
|
|
18
|
-
const globalInsert = oldGlobal.insertBefore;
|
|
19
|
-
// const placeholderElm = ownerTag.tagSupport.templater.global.placeholderElm
|
|
20
|
-
const placeholderElm = oldGlobal.placeholder;
|
|
21
|
-
if (placeholderElm) {
|
|
22
|
-
if (!placeholderElm.parentNode) {
|
|
23
|
-
throw new Error('stop here no subject parent node update existing tag');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
21
|
+
const templater = tagSupport.templater;
|
|
26
22
|
if (!isSameTag) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
insertBefore, // oldInsertBefore,
|
|
31
|
-
ownerTag, {
|
|
23
|
+
const oldestSupport = lastSupport.global.oldest;
|
|
24
|
+
destroyTagMemory(oldestSupport, subject);
|
|
25
|
+
return processSubjectComponent(templater, subject, insertBefore, ownerSupport, {
|
|
32
26
|
forceElement: false,
|
|
33
27
|
counts: { added: 0, removed: 0 },
|
|
34
28
|
});
|
|
35
29
|
}
|
|
36
30
|
else {
|
|
37
|
-
const
|
|
38
|
-
const hasChanged = hasTagSupportChanged(oldTagSupport, newTagSupport, templater);
|
|
31
|
+
const hasChanged = hasTagSupportChanged(lastSupport, tagSupport, templater);
|
|
39
32
|
if (!hasChanged) {
|
|
40
33
|
// if the new props are an object then implicitly since no change, the old props are an object
|
|
41
34
|
const newProps = templater.props;
|
|
42
35
|
if (newProps && typeof (newProps) === 'object') {
|
|
43
|
-
|
|
44
|
-
// const oldProps = existingTag.tagSupport.propsConfig.latestCloned as Record<string,any> // newestTag.props as Record<string, any>
|
|
45
|
-
syncFunctionProps(templater, existingTag, ownerTag, newProps);
|
|
36
|
+
syncFunctionProps(lastSupport, ownerSupport, newProps);
|
|
46
37
|
}
|
|
47
|
-
return
|
|
38
|
+
return lastSupport; // its the same tag component
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
const newTag = renderTagSupport(templater.tagSupport, false);
|
|
56
|
-
existingTag = subject.tag;
|
|
57
|
-
const newOldest = newTag.tagSupport.templater.global.oldest;
|
|
41
|
+
const previous = lastSupport.global.newest;
|
|
42
|
+
const newSupport = renderTagSupport(tagSupport, false);
|
|
43
|
+
lastSupport = subject.tagSupport;
|
|
44
|
+
const newOldest = newSupport.global.oldest;
|
|
58
45
|
const hasOldest = newOldest ? true : false;
|
|
59
46
|
if (!hasOldest) {
|
|
60
|
-
return buildNewTag(
|
|
61
|
-
// ??? newly changed
|
|
62
|
-
insertBefore, // oldInsertBefore,
|
|
63
|
-
oldTagSupport, subject);
|
|
47
|
+
return buildNewTag(newSupport, insertBefore, lastSupport, subject);
|
|
64
48
|
}
|
|
65
49
|
if (newOldest && templater.children.value.length) {
|
|
66
|
-
const oldKidsSub = newOldest.
|
|
50
|
+
const oldKidsSub = newOldest.templater.children;
|
|
67
51
|
oldKidsSub.set(templater.children.value);
|
|
68
52
|
}
|
|
69
|
-
// const newTag = tempResult.newest as Tag
|
|
70
|
-
if (previous && !oldestTag) {
|
|
71
|
-
throw new Error('bad elders');
|
|
72
|
-
}
|
|
73
53
|
// detect if both the function is the same and the return is the same
|
|
74
|
-
const isLikeTag = isSameTag && previous
|
|
75
|
-
if (previous && !oldestTag) {
|
|
76
|
-
throw new Error('bad elders');
|
|
77
|
-
}
|
|
78
|
-
let oldest = oldTagSupport.templater.global.oldest;
|
|
54
|
+
const isLikeTag = isSameTag && isLikeTags(previous, newSupport);
|
|
79
55
|
if (isLikeTag) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
subject.tag = newTag;
|
|
84
|
-
oldestTag.updateByTag(newTag); // the oldest tag has element references
|
|
85
|
-
return newTag;
|
|
56
|
+
subject.tagSupport = newSupport;
|
|
57
|
+
oldestTag.updateBy(newSupport); // the oldest tag has element references
|
|
58
|
+
return newSupport;
|
|
86
59
|
}
|
|
87
60
|
else {
|
|
88
61
|
// Although function looked the same it returned a different html result
|
|
89
|
-
if (isSameTag &&
|
|
90
|
-
destroyTagMemory(
|
|
91
|
-
|
|
62
|
+
if (isSameTag && lastSupport) {
|
|
63
|
+
destroyTagMemory(lastSupport, subject);
|
|
64
|
+
newSupport.global.context = {}; // do not share previous outputs
|
|
92
65
|
}
|
|
93
|
-
|
|
66
|
+
oldestTag = undefined;
|
|
94
67
|
}
|
|
95
|
-
if (!
|
|
96
|
-
|
|
68
|
+
if (!oldestTag) {
|
|
69
|
+
lastSupport = newSupport;
|
|
70
|
+
buildNewTag(newSupport, lastSupport.global.insertBefore, lastSupport, subject);
|
|
97
71
|
}
|
|
98
|
-
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
function checkStateChanged(state) {
|
|
102
|
-
return !state.newest.every(state => {
|
|
103
|
-
const lastValue = state.lastValue;
|
|
104
|
-
const nowValue = state.get();
|
|
105
|
-
const matched = lastValue === nowValue;
|
|
106
|
-
if (matched) {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
return false;
|
|
110
|
-
});
|
|
72
|
+
lastSupport.global.newest = newSupport;
|
|
73
|
+
return newSupport;
|
|
111
74
|
}
|
|
112
|
-
function buildNewTag(
|
|
113
|
-
|
|
75
|
+
function buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {
|
|
76
|
+
newSupport.buildBeforeElement(oldInsertBefore, {
|
|
114
77
|
forceElement: true,
|
|
115
78
|
counts: { added: 0, removed: 0 },
|
|
116
79
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
oldTagSupport.
|
|
120
|
-
oldTagSupport.
|
|
121
|
-
subject.
|
|
122
|
-
return
|
|
80
|
+
newSupport.global.oldest = newSupport;
|
|
81
|
+
newSupport.global.newest = newSupport;
|
|
82
|
+
oldTagSupport.global.oldest = newSupport;
|
|
83
|
+
oldTagSupport.global.newest = newSupport;
|
|
84
|
+
subject.tagSupport = newSupport;
|
|
85
|
+
return newSupport;
|
|
123
86
|
}
|
|
124
|
-
function syncFunctionProps(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const priorProps =
|
|
128
|
-
const
|
|
129
|
-
const ownerSupport = oldLatest.tagSupport;
|
|
87
|
+
function syncFunctionProps(lastSupport, ownerSupport, newProps) {
|
|
88
|
+
lastSupport = lastSupport.global.newest || lastSupport;
|
|
89
|
+
const priorPropConfig = lastSupport.propsConfig;
|
|
90
|
+
const priorProps = priorPropConfig.latestCloned;
|
|
91
|
+
const prevSupport = ownerSupport.global.newest;
|
|
130
92
|
Object.entries(priorProps).forEach(([name, value]) => {
|
|
131
93
|
if (!(value instanceof Function)) {
|
|
132
94
|
return;
|
|
133
95
|
}
|
|
134
|
-
const newOriginal = value.original;
|
|
135
96
|
// TODO: The code below maybe irrelevant
|
|
136
97
|
const newCallback = newProps[name];
|
|
137
98
|
const original = newCallback.original;
|
|
@@ -141,7 +102,7 @@ function syncFunctionProps(templater, existingTag, ownerTag, newProps) {
|
|
|
141
102
|
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
142
103
|
priorProps[name].toCall = (...args) => {
|
|
143
104
|
return callbackPropOwner(newCallback, // value, // newOriginal,
|
|
144
|
-
args,
|
|
105
|
+
args, prevSupport);
|
|
145
106
|
};
|
|
146
107
|
return;
|
|
147
108
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateExistingTagComponent.function.js","sourceRoot":"","sources":["../ts/updateExistingTagComponent.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateExistingTagComponent.function.js","sourceRoot":"","sources":["../ts/updateExistingTagComponent.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,UAAU,0BAA0B,CACxC,YAAwB,EACxB,UAAsB,EAAE,UAAU;AAClC,OAAmB,EACnB,YAA0B;IAE1B,+BAA+B;IAC/B,uCAAuC;IACvC,IAAI,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,MAAoB,CAAA,CAAC,w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AAG,QAAQ,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;QACrC,IAAG,QAAQ,EAAE,CAAC;YACZ,OAAM,CAAC,+BAA+B;QACxC,CAAC;QAED,kGAAkG;QAClG,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;YAC3C,OAAO,iBAAiB,CACtB,WAAW,EAAE,yBAAyB;YACtC,IAAI,EACJ,WAAW,CACZ,CAAA;QACH,CAAC,CAAA;QAED,OAAM;IACR,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { TagSupport } from './TagSupport.class';
|
|
2
|
-
import {
|
|
3
|
-
import { TemplaterResult } from './TemplaterResult.class';
|
|
4
|
-
import { Tag } from './Tag.class';
|
|
5
|
-
import { InterpolateSubject } from './processSubjectValue.function';
|
|
6
|
-
import { RegularValue } from './processRegularValue.function';
|
|
2
|
+
import { InterpolateSubject, TemplateValue } from './processSubjectValue.function';
|
|
7
3
|
import { InsertBefore } from './Clones.type';
|
|
8
|
-
export
|
|
9
|
-
export declare function updateExistingValue(subject: InterpolateSubject, value: ExistingValue, ownerTag: Tag, insertBefore: InsertBefore): InterpolateSubject;
|
|
4
|
+
export declare function updateExistingValue(subject: InterpolateSubject, value: TemplateValue, ownerSupport: TagSupport, insertBefore: InsertBefore): InterpolateSubject;
|