taggedjs 2.4.2 → 2.4.12
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 +3612 -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 +25 -17
- package/js/Tag.class.js +208 -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 +36 -0
- package/js/TemplaterResult.class.js +73 -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 +45 -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 +18 -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 +16 -15
- package/js/getCallback.js.map +1 -1
- package/js/hasTagSupportChanged.function.d.ts +6 -6
- package/js/hasTagSupportChanged.function.js +30 -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 +6 -4
- 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 +17 -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 +30 -0
- package/js/renderExistingTag.function.js.map +1 -0
- package/js/renderTagSupport.function.d.ts +4 -0
- package/js/renderTagSupport.function.js +42 -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 +78 -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 +105 -39
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +8 -10
- package/js/updateExistingValue.function.js +62 -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 -2
- 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
|
@@ -1,33 +1,42 @@
|
|
|
1
|
-
import { deepEqual } from "./deepFunctions
|
|
2
|
-
export function hasTagSupportChanged(oldTagSupport, newTagSupport) {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { deepEqual } from "./deepFunctions";
|
|
2
|
+
export function hasTagSupportChanged(oldTagSupport, newTagSupport, newTemplater) {
|
|
3
|
+
const sameSupport = oldTagSupport === newTagSupport;
|
|
4
|
+
const samePropConfig = oldTagSupport.propsConfig === newTagSupport.propsConfig;
|
|
5
|
+
// const sameProps = oldTagSupport.propsConfig.latest === newTagSupport.propsConfig.latest
|
|
6
|
+
if (sameSupport) {
|
|
7
|
+
throw new Error('sameSupport - 22');
|
|
5
8
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
if (samePropConfig) {
|
|
10
|
+
throw new Error('samePropConfig - 22');
|
|
11
|
+
}
|
|
12
|
+
if (newTagSupport.templater.isTag || oldTagSupport.templater.isTag || newTemplater.isTag) {
|
|
13
|
+
throw new Error('trying to compare a basic tag');
|
|
14
|
+
}
|
|
15
|
+
const latestProps = newTemplater.props; // newTagSupport.propsConfig.latest
|
|
16
|
+
const pastCloneProps = oldTagSupport.propsConfig.latestCloned;
|
|
17
|
+
const propsChanged = hasPropChanges(latestProps, pastCloneProps);
|
|
10
18
|
// if no changes detected, no need to continue to rendering further tags
|
|
11
19
|
if (propsChanged) {
|
|
12
|
-
return
|
|
20
|
+
return propsChanged;
|
|
13
21
|
}
|
|
14
22
|
const kidsChanged = hasKidsChanged(oldTagSupport, newTagSupport);
|
|
15
23
|
// we already know props didn't change and if kids didn't either, than don't render
|
|
16
24
|
return kidsChanged;
|
|
17
25
|
}
|
|
18
26
|
export function hasPropChanges(props, // natural props
|
|
19
|
-
pastCloneProps
|
|
20
|
-
|
|
21
|
-
const isCommonEqual = props === undefined && props === compareToProps
|
|
22
|
-
if
|
|
23
|
-
|
|
27
|
+
pastCloneProps) {
|
|
28
|
+
/*
|
|
29
|
+
const isCommonEqual = props === undefined && props === compareToProps
|
|
30
|
+
if(isCommonEqual) {
|
|
31
|
+
return false
|
|
24
32
|
}
|
|
33
|
+
*/
|
|
25
34
|
let castedProps = props;
|
|
26
35
|
let castedPastProps = pastCloneProps;
|
|
27
36
|
// check all prop functions match
|
|
28
37
|
if (typeof (props) === 'object') {
|
|
29
38
|
if (!pastCloneProps) {
|
|
30
|
-
return
|
|
39
|
+
return 3;
|
|
31
40
|
}
|
|
32
41
|
castedProps = { ...props };
|
|
33
42
|
castedPastProps = { ...(pastCloneProps || {}) };
|
|
@@ -37,7 +46,7 @@ compareToProps) {
|
|
|
37
46
|
}*/
|
|
38
47
|
let compare = castedPastProps[key];
|
|
39
48
|
if (!(value instanceof Function)) {
|
|
40
|
-
return
|
|
49
|
+
return 4; // this will be checked in deepEqual
|
|
41
50
|
}
|
|
42
51
|
if (!(compare instanceof Function)) {
|
|
43
52
|
return false; // its a function now but was not before
|
|
@@ -55,14 +64,14 @@ compareToProps) {
|
|
|
55
64
|
}
|
|
56
65
|
delete castedProps[key]; // its a function and not needed to be compared
|
|
57
66
|
delete castedPastProps[key]; // its a function and not needed to be compared
|
|
58
|
-
return
|
|
67
|
+
return 5;
|
|
59
68
|
});
|
|
60
69
|
if (!allFunctionsMatch) {
|
|
61
|
-
return
|
|
70
|
+
return 6; // a change has been detected by function comparisons
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
|
-
const isEqual = deepEqual(
|
|
65
|
-
return
|
|
73
|
+
const isEqual = deepEqual(castedPastProps, castedProps);
|
|
74
|
+
return isEqual ? false : 7; // if equal then no changes
|
|
66
75
|
}
|
|
67
76
|
export function hasKidsChanged(oldTagSupport, newTagSupport) {
|
|
68
77
|
const oldCloneKidValues = oldTagSupport.propsConfig.lastClonedKidValues;
|
|
@@ -71,6 +80,6 @@ export function hasKidsChanged(oldTagSupport, newTagSupport) {
|
|
|
71
80
|
const x = newClonedKidValues[index];
|
|
72
81
|
return set.every((item, index) => item === x[index]);
|
|
73
82
|
});
|
|
74
|
-
return
|
|
83
|
+
return everySame ? false : 9;
|
|
75
84
|
}
|
|
76
85
|
//# sourceMappingURL=hasTagSupportChanged.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasTagSupportChanged.function.js","sourceRoot":"","sources":["../ts/hasTagSupportChanged.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hasTagSupportChanged.function.js","sourceRoot":"","sources":["../ts/hasTagSupportChanged.function.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,UAAU,oBAAoB,CAClC,aAA6B,EAC7B,aAA6B,EAC7B,YAA6B;IAE7B,MAAM,WAAW,GAAG,aAAa,KAAK,aAAa,CAAA;IACnD,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,KAAK,aAAa,CAAC,WAAW,CAAA;IAC9E,0FAA0F;IAC1F,IAAG,WAAW,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACrC,CAAC;IACD,IAAG,cAAc,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,IAAG,aAAa,CAAC,SAAS,CAAC,KAAK,IAAI,aAAa,CAAC,SAAS,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QACxF,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAA,CAAC,mCAAmC;IAC1E,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,YAAY,CAAA;IAC7D,MAAM,YAAY,GAAG,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAEhE,wEAAwE;IACxE,IAAG,YAAY,EAAE,CAAC;QAChB,OAAO,YAAY,CAAA;IACrB,CAAC;IA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function html(strings: string[] | TemplateStringsArray, ...values: unknown[]): Tag;
|
package/js/html.js
CHANGED
package/js/html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../ts/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../ts/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,MAAM,UAAU,IAAI,CAClB,OAAwC,EACxC,GAAG,MAAiB;IAEpB,OAAO,IAAI,GAAG,CAAC,OAAmB,EAAE,MAAM,CAAC,CAAA;AAC7C,CAAC"}
|
package/js/index.d.ts
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export { setProp } from "./setProp.function.js";
|
|
24
|
-
export * from "./onInit.js";
|
|
25
|
-
export * from "./onDestroy.js";
|
|
26
|
-
export * from "./getCallback.js";
|
|
1
|
+
import { tagElement } from "./tagElement";
|
|
2
|
+
export * from "./ElementTargetEvent.interface";
|
|
3
|
+
export * from "./tag";
|
|
4
|
+
export * from "./html";
|
|
5
|
+
export * from "./errors";
|
|
6
|
+
export * from "./Subject";
|
|
7
|
+
export * from "./isInstance";
|
|
8
|
+
export * from "./ValueSubject";
|
|
9
|
+
export * from "./watch.function";
|
|
10
|
+
export * from "./TagSupport.class";
|
|
11
|
+
export * from "./interpolateElement";
|
|
12
|
+
export { tagElement } from "./tagElement";
|
|
13
|
+
export { Tag } from "./Tag.class";
|
|
14
|
+
export { runBeforeRender } from "./tagRunner";
|
|
15
|
+
export { setUse } from "./setUse.function";
|
|
16
|
+
export { providers } from "./providers";
|
|
17
|
+
export { set } from "./set.function";
|
|
18
|
+
export { setLet } from "./setLet.function";
|
|
19
|
+
export { setProp } from "./setProp.function";
|
|
20
|
+
export * from "./onInit";
|
|
21
|
+
export * from "./onDestroy";
|
|
22
|
+
export * from "./getCallback";
|
|
27
23
|
export declare const hmr: {
|
|
28
24
|
tagElement: typeof tagElement;
|
|
29
|
-
redrawTag: typeof redrawTag;
|
|
30
25
|
};
|
package/js/index.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./redrawTag.function.js";
|
|
15
|
-
export * from "./interpolateElement.js";
|
|
1
|
+
// import { redrawTag } from "./redrawTag.function"
|
|
2
|
+
import { tagElement } from "./tagElement";
|
|
3
|
+
export * from "./ElementTargetEvent.interface";
|
|
4
|
+
export * from "./tag";
|
|
5
|
+
export * from "./html";
|
|
6
|
+
export * from "./errors";
|
|
7
|
+
export * from "./Subject";
|
|
8
|
+
export * from "./isInstance";
|
|
9
|
+
export * from "./ValueSubject";
|
|
10
|
+
export * from "./watch.function";
|
|
11
|
+
export * from "./TagSupport.class";
|
|
12
|
+
// export * from "./redrawTag.function"
|
|
13
|
+
export * from "./interpolateElement";
|
|
16
14
|
// TODO: export *
|
|
17
|
-
export { tagElement } from "./tagElement
|
|
18
|
-
export { Tag } from "./Tag.class
|
|
19
|
-
export { runBeforeRender } from "./tagRunner
|
|
20
|
-
export { setUse } from "./setUse.function
|
|
15
|
+
export { tagElement } from "./tagElement";
|
|
16
|
+
export { Tag } from "./Tag.class";
|
|
17
|
+
export { runBeforeRender } from "./tagRunner";
|
|
18
|
+
export { setUse } from "./setUse.function";
|
|
21
19
|
/* hooks */
|
|
22
20
|
// TODO: export *
|
|
23
|
-
export { providers } from "./providers
|
|
24
|
-
export { set } from "./set.function
|
|
25
|
-
export { setLet } from "./setLet.function
|
|
26
|
-
export { setProp } from "./setProp.function
|
|
27
|
-
export * from "./onInit
|
|
28
|
-
export * from "./onDestroy
|
|
29
|
-
export * from "./getCallback
|
|
21
|
+
export { providers } from "./providers";
|
|
22
|
+
export { set } from "./set.function";
|
|
23
|
+
export { setLet } from "./setLet.function";
|
|
24
|
+
export { setProp } from "./setProp.function";
|
|
25
|
+
export * from "./onInit";
|
|
26
|
+
export * from "./onDestroy";
|
|
27
|
+
export * from "./getCallback";
|
|
30
28
|
/* end: hooks */
|
|
31
29
|
export const hmr = {
|
|
32
|
-
tagElement,
|
|
30
|
+
tagElement,
|
|
31
|
+
// redrawTag
|
|
33
32
|
};
|
|
34
33
|
//# sourceMappingURL=index.js.map
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,cAAc,gCAAgC,CAAA;AAE9C,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,uCAAuC;AACvC,cAAc,sBAAsB,CAAA;AAEpC,iBAAiB;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,WAAW;AACT,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC/B,gBAAgB;AAEhB,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,UAAU;IACV,YAAY;CACb,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Context, Tag } from "./Tag.class
|
|
1
|
+
import { Context, Tag } from "./Tag.class";
|
|
2
|
+
export type HowToSet = (element: Element, name: string, value: string) => any;
|
|
2
3
|
export declare function interpolateAttributes(child: Element, scope: Context, ownerTag: Tag): void;
|
|
3
|
-
/** Looking for (class | style) followed by a period */
|
|
4
|
-
export declare function isSpecialAttr(attrName: string | String): boolean;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isSubjectInstance } from "./isInstance.js";
|
|
1
|
+
import { processAttribute } from "./processAttribute.function";
|
|
3
2
|
function howToSetAttribute(element, name, value) {
|
|
4
|
-
/*
|
|
5
|
-
if(name === 'class'){
|
|
6
|
-
value.split(' ').forEach(className => child.classList.add(className))
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
*/
|
|
10
3
|
element.setAttribute(name, value);
|
|
11
4
|
}
|
|
12
5
|
function howToSetInputValue(element, name, value) {
|
|
@@ -14,11 +7,6 @@ function howToSetInputValue(element, name, value) {
|
|
|
14
7
|
}
|
|
15
8
|
export function interpolateAttributes(child, scope, ownerTag) {
|
|
16
9
|
const attrNames = child.getAttributeNames();
|
|
17
|
-
const isTextArea = child.nodeName === 'TEXTAREA';
|
|
18
|
-
if (isTextArea && !attrNames.includes('value')) {
|
|
19
|
-
const value = child.getAttribute('textVarValue'); // (child as any).value
|
|
20
|
-
processAttribute('textVarValue', value, child, scope, ownerTag, (_name, value) => child.value = value);
|
|
21
|
-
}
|
|
22
10
|
let howToSet = howToSetAttribute;
|
|
23
11
|
attrNames.forEach(attrName => {
|
|
24
12
|
if (child.nodeName === 'INPUT' && attrName === 'value') {
|
|
@@ -29,118 +17,4 @@ export function interpolateAttributes(child, scope, ownerTag) {
|
|
|
29
17
|
howToSet = howToSetAttribute; // put back
|
|
30
18
|
});
|
|
31
19
|
}
|
|
32
|
-
/** Looking for (class | style) followed by a period */
|
|
33
|
-
export function isSpecialAttr(attrName) {
|
|
34
|
-
return attrName.search(/^(class|style)(\.)/) >= 0;
|
|
35
|
-
}
|
|
36
|
-
function processAttribute(attrName, value, child, scope, ownerTag, howToSet) {
|
|
37
|
-
if (isTagVar(value)) {
|
|
38
|
-
return processScopedNameValueAttr(attrName, value, child, scope, ownerTag, howToSet);
|
|
39
|
-
}
|
|
40
|
-
if (isTagVar(attrName)) {
|
|
41
|
-
const contextValueSubject = getContextValueByVarString(scope, attrName);
|
|
42
|
-
let lastValue;
|
|
43
|
-
// the above callback gets called immediately since its a ValueSubject()
|
|
44
|
-
const sub = contextValueSubject.subscribe((value) => {
|
|
45
|
-
processNameOnlyAttr(value, lastValue, child, ownerTag, howToSet);
|
|
46
|
-
lastValue = value;
|
|
47
|
-
});
|
|
48
|
-
ownerTag.cloneSubs.push(sub); // this is where unsubscribe is picked up
|
|
49
|
-
child.removeAttribute(attrName);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// Non dynamic
|
|
53
|
-
const isSpecial = isSpecialAttr(attrName);
|
|
54
|
-
if (isSpecial) {
|
|
55
|
-
return inputAttribute(attrName, value, child);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const startRegX = /^\s*{__tagvar/;
|
|
59
|
-
const endRegX = /}\s*$/;
|
|
60
|
-
function isTagVar(value) {
|
|
61
|
-
return value && value.search(startRegX) >= 0 && value.search(endRegX) >= 0;
|
|
62
|
-
}
|
|
63
|
-
function processNameOnlyAttr(attrValue, lastValue, child, ownerTag, howToSet) {
|
|
64
|
-
if (lastValue && lastValue != attrValue) {
|
|
65
|
-
if (typeof (lastValue) === 'string') {
|
|
66
|
-
child.removeAttribute(lastValue);
|
|
67
|
-
}
|
|
68
|
-
else if (lastValue instanceof Object) {
|
|
69
|
-
Object.entries(lastValue).forEach(([name]) => child.removeAttribute(name));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (typeof (attrValue) === 'string') {
|
|
73
|
-
if (!attrValue.length) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
processNameValueAttr(attrValue, '', child, ownerTag, howToSet);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (attrValue instanceof Object) {
|
|
80
|
-
Object.entries(attrValue).forEach(([name, value]) => processNameValueAttr(name, value, child, ownerTag, howToSet));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function getContextValueByVarString(scope, value) {
|
|
85
|
-
const code = value.replace('{', '').split('').reverse().join('').replace('}', '').split('').reverse().join('');
|
|
86
|
-
return scope[code];
|
|
87
|
-
}
|
|
88
|
-
function processNameValueAttr(attrName, result, child, ownerTag, howToSet) {
|
|
89
|
-
const isSpecial = isSpecialAttr(attrName);
|
|
90
|
-
// attach as callback?
|
|
91
|
-
if (result instanceof Function) {
|
|
92
|
-
const action = function (...args) {
|
|
93
|
-
return result(child, args);
|
|
94
|
-
};
|
|
95
|
-
child[attrName].action = action;
|
|
96
|
-
// child.addEventListener(attrName, action)
|
|
97
|
-
}
|
|
98
|
-
// Most every variable comes in here since everything is made a ValueSubject
|
|
99
|
-
if (isSubjectInstance(result)) {
|
|
100
|
-
child.removeAttribute(attrName);
|
|
101
|
-
const callback = (newAttrValue) => {
|
|
102
|
-
return processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet);
|
|
103
|
-
};
|
|
104
|
-
// 🗞️ Subscribe. Above callback called immediately since its a ValueSubject()
|
|
105
|
-
const sub = result.subscribe(callback);
|
|
106
|
-
// Record subscription for later unsubscribe when element destroyed
|
|
107
|
-
ownerTag.cloneSubs.push(sub);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
howToSet(child, attrName, result);
|
|
111
|
-
// child.setAttribute(attrName, result.value)
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
function processAttributeSubjectValue(newAttrValue, child, attrName, isSpecial, howToSet) {
|
|
115
|
-
if (newAttrValue instanceof Function) {
|
|
116
|
-
;
|
|
117
|
-
child[attrName] = function (...args) {
|
|
118
|
-
const result = newAttrValue(child, args);
|
|
119
|
-
return result;
|
|
120
|
-
};
|
|
121
|
-
child[attrName].tagFunction = newAttrValue;
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (isSpecial) {
|
|
125
|
-
inputAttribute(attrName, newAttrValue, child);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (newAttrValue) {
|
|
129
|
-
howToSet(child, attrName, newAttrValue);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const isDeadValue = newAttrValue === undefined || newAttrValue === false || newAttrValue === null;
|
|
133
|
-
if (isDeadValue) {
|
|
134
|
-
child.removeAttribute(attrName);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// value is 0
|
|
138
|
-
howToSet(child, attrName, newAttrValue);
|
|
139
|
-
}
|
|
140
|
-
function processScopedNameValueAttr(attrName, value, // {__tagVarN}
|
|
141
|
-
child, scope, ownerTag, howToSet) {
|
|
142
|
-
// get the code inside the brackets like "variable0" or "{variable0}"
|
|
143
|
-
const result = getContextValueByVarString(scope, value);
|
|
144
|
-
return processNameValueAttr(attrName, result, child, ownerTag, howToSet);
|
|
145
|
-
}
|
|
146
20
|
//# sourceMappingURL=interpolateAttributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolateAttributes.js","sourceRoot":"","sources":["../ts/interpolateAttributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"interpolateAttributes.js","sourceRoot":"","sources":["../ts/interpolateAttributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAI9D,SAAS,iBAAiB,CACxB,OAAgB,EAChB,IAAY,EACZ,KAAa;IAEb,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACnC,CAAC;AAED,SAAS,kBAAkB,CACzB,OAAgB,EAChB,IAAY,EACZ,KAAa;IAEZ,OAAe,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,KAAc,EACd,QAAa;IAEb,MAAM,SAAS,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAA;IAE3C,IAAI,QAAQ,GAAG,iBAAiB,CAAA;IAEhC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,IAAG,KAAK,CAAC,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACtD,QAAQ,GAAG,kBAAkB,CAAA;QAC/B,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAC1C,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAEnE,QAAQ,GAAG,iBAAiB,CAAA,CAAC,WAAW;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Clones } from "./Clones.type
|
|
2
|
-
import { Tag } from "./Tag.class
|
|
3
|
-
import { InterpolateOptions } from "./interpolateElement
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
1
|
+
import { Clones } from "./Clones.type";
|
|
2
|
+
import { Tag } from "./Tag.class";
|
|
3
|
+
import { InterpolateOptions } from "./interpolateElement";
|
|
4
|
+
import { InterpolateComponentResult } from "./interpolateTemplate";
|
|
5
|
+
export type InterpolatedContentTemplates = {
|
|
6
|
+
clones: Clones;
|
|
7
|
+
tagComponents: InterpolateComponentResult[];
|
|
8
|
+
};
|
|
9
|
+
export declare function interpolateContentTemplates(element: Element, context: any, tag: Tag, options: InterpolateOptions, children: HTMLCollection): InterpolatedContentTemplates;
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { interpolateTemplate } from "./interpolateTemplate
|
|
2
|
-
|
|
3
|
-
/** Returns subscriptions[] that will need to be unsubscribed from when element is destroyed */
|
|
4
|
-
export function interpolateContentTemplates(element, // <div><div></div><template tag-wrap="22">...</template></div>
|
|
5
|
-
context, tag, options, children) {
|
|
1
|
+
import { interpolateTemplate } from "./interpolateTemplate";
|
|
2
|
+
export function interpolateContentTemplates(element, context, tag, options, children) {
|
|
6
3
|
if (!children || element.tagName === 'TEMPLATE') {
|
|
7
|
-
return []; // done
|
|
4
|
+
return { clones: [], tagComponents: [] }; // done
|
|
8
5
|
}
|
|
9
6
|
// counting for animation stagger computing
|
|
10
7
|
const counts = options.counts;
|
|
11
8
|
const clones = [];
|
|
9
|
+
const tagComponents = [];
|
|
12
10
|
const childArray = new Array(...children);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
childArray.forEach((child, childIndex) => {
|
|
17
|
-
const nextClones = interpolateTemplate(child, context, tag, counts, options);
|
|
18
|
-
if (child.tagName === 'TEXTAREA') {
|
|
19
|
-
scanTextAreaValue(child);
|
|
20
|
-
}
|
|
11
|
+
childArray.forEach(child => {
|
|
12
|
+
const { clones: nextClones, tagComponent } = interpolateTemplate(child, context, tag, counts, options);
|
|
21
13
|
clones.push(...nextClones);
|
|
14
|
+
if (tagComponent) {
|
|
15
|
+
tagComponents.push(tagComponent);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
22
18
|
if (child.children) {
|
|
23
19
|
const nextKids = new Array(...child.children);
|
|
24
20
|
nextKids.forEach((subChild, index) => {
|
|
21
|
+
// IF <template end /> its a variable to be processed
|
|
25
22
|
if (isRenderEndTemplate(subChild)) {
|
|
26
|
-
interpolateTemplate(subChild, context, tag, counts, options);
|
|
23
|
+
const { tagComponent } = interpolateTemplate(subChild, context, tag, counts, options);
|
|
24
|
+
if (tagComponent) {
|
|
25
|
+
tagComponents.push(tagComponent);
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
|
-
const nextClones = interpolateContentTemplates(subChild, context, tag, options, subChild.children);
|
|
28
|
+
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tag, options, subChild.children);
|
|
29
29
|
clones.push(...nextClones);
|
|
30
|
+
tagComponents.push(...nextTagComponent);
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
return clones;
|
|
34
|
+
return { clones, tagComponents };
|
|
34
35
|
}
|
|
35
36
|
function isRenderEndTemplate(child) {
|
|
36
37
|
const isTemplate = child.tagName === 'TEMPLATE';
|
|
@@ -38,15 +39,4 @@ function isRenderEndTemplate(child) {
|
|
|
38
39
|
child.getAttribute('interpolate') !== undefined &&
|
|
39
40
|
child.getAttribute('end') !== undefined;
|
|
40
41
|
}
|
|
41
|
-
function scanTextAreaValue(textarea) {
|
|
42
|
-
const value = textarea.value;
|
|
43
|
-
if (value.search(templateSearch) >= 0) {
|
|
44
|
-
const match = value.match(/__tagvar(\d{1,4})/);
|
|
45
|
-
const result = match ? match[0] : '';
|
|
46
|
-
const token = '{' + result + '}';
|
|
47
|
-
// textarea.value = token
|
|
48
|
-
textarea.value = '';
|
|
49
|
-
textarea.setAttribute('textVarValue', token);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
42
|
//# sourceMappingURL=interpolateContentTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolateContentTemplates.js","sourceRoot":"","sources":["../ts/interpolateContentTemplates.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"interpolateContentTemplates.js","sourceRoot":"","sources":["../ts/interpolateContentTemplates.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwC,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAOjG,MAAM,UAAU,2BAA2B,CACzC,OAAgB,EAChB,OAAY,EACZ,GAAQ,EACR,OAA2B,EAC3B,QAAwB;IAExB,IAAK,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,UAAU,EAAG,CAAC;QAClD,OAAO,EAAC,MAAM,EAAC,EAAE,EAAE,aAAa,EAAE,EAAE,EAAC,CAAA,CAAC,OAAO;IAC/C,CAAC;IAED,2CAA2C;IAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC7B,MAAM,MAAM,GAAW,EAAE,CAAA;IACzB,MAAM,aAAa,GAAiC,EAAE,CAAA;IACtD,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAA;IAEzC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAC,GAAG,mBAAmB,CAC5D,KAAiB,EACjB,OAAO,EACP,GAAG,EACH,MAAM,EACN,OAAO,CACR,CAAA;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAA;QAE1B,IAAG,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@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Counts } from "./interpolateTemplate
|
|
1
|
+
import { InterpolatedContentTemplates } from "./interpolateContentTemplates";
|
|
2
|
+
import { Context, Tag, TagTemplate } from "./Tag.class";
|
|
3
|
+
import { Counts } from "./interpolateTemplate";
|
|
4
4
|
export type InterpolateOptions = {
|
|
5
5
|
/** make the element go on document */
|
|
6
6
|
forceElement?: boolean;
|
|
7
7
|
counts: Counts;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/** Review elements within an element */
|
|
10
|
+
export declare function interpolateElement(container: Element, context: Context, // variables used to evaluate
|
|
11
|
+
interpolatedTemplates: TagTemplate, tagOwner: Tag, options: InterpolateOptions, test?: boolean): InterpolatedContentTemplates;
|
|
12
|
+
export declare function interpolateString(string: string): import("./interpolations").InterpolatedTemplates;
|
package/js/interpolateElement.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { interpolateAttributes } from "./interpolateAttributes
|
|
2
|
-
import { interpolateToTemplates } from "./interpolations
|
|
3
|
-
import { interpolateContentTemplates } from "./interpolateContentTemplates
|
|
4
|
-
import { escapeSearch, variablePrefix } from "./Tag.class
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { interpolateAttributes } from "./interpolateAttributes";
|
|
2
|
+
import { interpolateToTemplates } from "./interpolations";
|
|
3
|
+
import { interpolateContentTemplates } from "./interpolateContentTemplates";
|
|
4
|
+
import { escapeSearch, variablePrefix } from "./Tag.class";
|
|
5
|
+
/** Review elements within an element */
|
|
6
|
+
export function interpolateElement(container, context, // variables used to evaluate
|
|
7
|
+
interpolatedTemplates, tagOwner, options, test = false) {
|
|
7
8
|
const clones = [];
|
|
9
|
+
const tagComponents = [];
|
|
8
10
|
const result = interpolatedTemplates.interpolation;
|
|
9
|
-
const template =
|
|
11
|
+
const template = container.children[0];
|
|
10
12
|
const children = template.content.children;
|
|
11
13
|
if (result.keys.length) {
|
|
12
|
-
const nextClones = interpolateContentTemplates(
|
|
14
|
+
const { clones: nextClones, tagComponents: nextTagComponents } = interpolateContentTemplates(container, context, tagOwner, options, children);
|
|
13
15
|
clones.push(...nextClones);
|
|
16
|
+
tagComponents.push(...nextTagComponents);
|
|
14
17
|
}
|
|
15
|
-
interpolateAttributes(
|
|
18
|
+
interpolateAttributes(container, context, tagOwner);
|
|
16
19
|
processChildrenAttributes(children, context, tagOwner);
|
|
17
|
-
return clones;
|
|
20
|
+
return { clones, tagComponents };
|
|
18
21
|
}
|
|
19
22
|
function processChildrenAttributes(children, context, ownerTag) {
|
|
20
23
|
new Array(...children).forEach(child => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolateElement.js","sourceRoot":"","sources":["../ts/interpolateElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"interpolateElement.js","sourceRoot":"","sources":["../ts/interpolateElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAgC,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AACzG,OAAO,EAA6B,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAUrF,wCAAwC;AACxC,MAAM,UAAU,kBAAkB,CAChC,SAAkB,EAClB,OAAgB,EAAE,6BAA6B;AAC/C,qBAAkC,EAClC,QAAa,EACb,OAA2B,EAC3B,IAAI,GAAG,KAAK;IAEZ,MAAM,MAAM,GAAW,EAAE,CAAA;IACzB,MAAM,aAAa,GAAiC,EAAE,CAAA;IACtD,MAAM,MAAM,GAAG,qBAAqB,CAAC,aAAa,CAAA;IAClD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAwB,CAAA;IAC7D,MAAM,QAAQ,GAAG,QAAQ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