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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TemplaterResult } from './TemplaterResult.class';
|
|
2
|
-
import { Counts } from './interpolateTemplate';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Counts } from './interpolations/interpolateTemplate';
|
|
3
|
+
import { TagSubject } from './subject.types';
|
|
4
|
+
import { TagSupport } from './TagSupport.class';
|
|
5
5
|
import { InsertBefore } from './Clones.type';
|
|
6
|
-
export declare function processSubjectComponent(templater: TemplaterResult, subject: TagSubject, insertBefore: InsertBefore,
|
|
6
|
+
export declare function processSubjectComponent(templater: TemplaterResult, subject: TagSubject, insertBefore: InsertBefore, ownerSupport: TagSupport, options: {
|
|
7
7
|
counts: Counts;
|
|
8
8
|
forceElement?: boolean;
|
|
9
|
-
}):
|
|
9
|
+
}): TagSupport;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { renderWithSupport } from './TemplaterResult.class';
|
|
2
|
-
import { setUse } from './
|
|
2
|
+
import { setUse } from './state';
|
|
3
3
|
import { processTagResult } from './processTagResult.function';
|
|
4
4
|
import { TagSupport } from './TagSupport.class';
|
|
5
|
-
export function processSubjectComponent(templater, subject, insertBefore,
|
|
5
|
+
export function processSubjectComponent(templater, subject, insertBefore, ownerSupport, options) {
|
|
6
6
|
// Check if function component is wrapped in a tag() call
|
|
7
7
|
// TODO: This below check not needed in production mode
|
|
8
8
|
if (templater.tagged !== true) {
|
|
9
|
-
const
|
|
9
|
+
const wrapper = templater.wrapper;
|
|
10
|
+
const original = wrapper.original;
|
|
10
11
|
let name = original.name || original.constructor?.name;
|
|
11
12
|
if (name === 'Function') {
|
|
12
13
|
name = undefined;
|
|
@@ -15,43 +16,34 @@ export function processSubjectComponent(templater, subject, insertBefore, ownerT
|
|
|
15
16
|
const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\`\`) on component:\n\n${label}\n\n`);
|
|
16
17
|
throw error;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
templater.global.insertBefore = insertBefore;
|
|
24
|
-
let retag = subject.tag;
|
|
19
|
+
const tagSupport = new TagSupport(templater, ownerSupport, subject);
|
|
20
|
+
let reSupport = subject.tagSupport;
|
|
21
|
+
const global = tagSupport.global = reSupport?.global || tagSupport.global;
|
|
22
|
+
global.insertBefore = insertBefore;
|
|
25
23
|
const providers = setUse.memory.providerConfig;
|
|
26
|
-
providers.
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
24
|
+
providers.ownerSupport = ownerSupport;
|
|
25
|
+
const isRender = !reSupport || options.forceElement;
|
|
26
|
+
if (isRender) {
|
|
27
|
+
const support = reSupport || tagSupport;
|
|
28
|
+
reSupport = renderSubjectComponent(subject, support, ownerSupport);
|
|
30
29
|
}
|
|
31
|
-
processTagResult(
|
|
30
|
+
processTagResult(reSupport, subject, // The element set here will be removed from document. Also result.tag will be added in here
|
|
32
31
|
insertBefore, // <template end interpolate /> (will be removed)
|
|
33
32
|
options);
|
|
34
|
-
return
|
|
33
|
+
return reSupport;
|
|
35
34
|
}
|
|
36
|
-
function
|
|
37
|
-
const preClones =
|
|
38
|
-
|
|
39
|
-
subject,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
retag.clones.push(...myClones);
|
|
47
|
-
if (myClones.find(x => x === insertBefore)) {
|
|
48
|
-
throw new Error('way back here we add marker');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (ownerTag.childTags.find(x => x === retag)) {
|
|
52
|
-
throw new Error('about to reattach tag already present');
|
|
35
|
+
function renderSubjectComponent(subject, reSupport, ownerSupport) {
|
|
36
|
+
const preClones = ownerSupport.clones.map(clone => clone);
|
|
37
|
+
reSupport = renderWithSupport(reSupport, subject.tagSupport, // existing tag
|
|
38
|
+
subject, ownerSupport);
|
|
39
|
+
reSupport.global.newest = reSupport;
|
|
40
|
+
// ??? - mirroring add 0
|
|
41
|
+
// reSupport.ownerTagSupport = ownerSupport
|
|
42
|
+
if (ownerSupport.clones.length > preClones.length) {
|
|
43
|
+
const myClones = ownerSupport.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
44
|
+
reSupport.clones.push(...myClones);
|
|
53
45
|
}
|
|
54
|
-
|
|
55
|
-
return
|
|
46
|
+
ownerSupport.childTags.push(reSupport);
|
|
47
|
+
return reSupport;
|
|
56
48
|
}
|
|
57
49
|
//# sourceMappingURL=processSubjectComponent.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processSubjectComponent.function.js","sourceRoot":"","sources":["../ts/processSubjectComponent.function.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"processSubjectComponent.function.js","sourceRoot":"","sources":["../ts/processSubjectComponent.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,MAAM,UAAU,uBAAuB,CACrC,SAA0B,EAC1B,OAAmB,EACnB,YAA0B,EAC1B,YAAwB,EACxB,OAAiD;IAEjD,yDAAyD;IACzD,uDAAuD;IACvD,IAAG,SAAS,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,SAAS,CAAC,OAAkB,CAAA;QAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QACjC,IAAI,IAAI,GAAuB,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,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D,SAAS,GAAG,iBAAiB,CAC3B,SAAS,EACT,OAAO,CAAC,UAAU,EAAE,eAAe;IACnC,OAAO,EACP,YAAY,CACb,CAAA;IAED,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAA;IACnC,wBAAwB;IACxB,2CAA2C;IAE3C,IAAG,YAAY,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;QACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAA;QACjG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;IACpC,CAAC;IAED,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAEtC,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { TagArraySubject } from './processTagArray';
|
|
2
2
|
import { TemplaterResult } from './TemplaterResult.class';
|
|
3
3
|
import { Clones, InsertBefore } from './Clones.type';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { DisplaySubject, TagSubject } from './Tag.utils';
|
|
4
|
+
import { Counts } from './interpolations/interpolateTemplate';
|
|
5
|
+
import { DisplaySubject, TagSubject } from './subject.types';
|
|
7
6
|
import { ValueSubject } from './subject/ValueSubject';
|
|
8
|
-
import {
|
|
7
|
+
import { RegularValue } from './processRegularValue.function';
|
|
8
|
+
import { Callback } from './interpolations/bindSubjectCallback.function';
|
|
9
|
+
import { TagSupport } from './TagSupport.class';
|
|
10
|
+
import { Tag } from './Tag.class';
|
|
11
|
+
import { Subject } from './subject';
|
|
9
12
|
type processOptions = {
|
|
10
13
|
forceElement?: boolean;
|
|
11
14
|
counts: Counts;
|
|
@@ -13,9 +16,10 @@ type processOptions = {
|
|
|
13
16
|
export type ClonesAndPromise = {
|
|
14
17
|
clones: Clones;
|
|
15
18
|
};
|
|
16
|
-
export type InterpolateSubject = TagArraySubject | TagSubject | DisplaySubject | ValueSubject<Callback>;
|
|
17
|
-
export
|
|
19
|
+
export type InterpolateSubject = ValueSubject<undefined> | TagArraySubject | TagSubject | DisplaySubject | ValueSubject<Callback>;
|
|
20
|
+
export type TemplateValue = Tag | TemplaterResult | (Tag | TemplaterResult)[] | RegularValue | Subject<any> | Callback;
|
|
21
|
+
export declare function processSubjectValue(value: TemplateValue, subject: InterpolateSubject, // could be tag via result.tag
|
|
18
22
|
insertBefore: InsertBefore, // <template end interpolate /> (will be removed)
|
|
19
|
-
|
|
23
|
+
ownerSupport: TagSupport, // owner
|
|
20
24
|
options: processOptions): Clones | undefined;
|
|
21
25
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { processSubjectComponent } from './processSubjectComponent.function';
|
|
2
|
-
import { isTagArray, isTagComponent,
|
|
2
|
+
import { isTagArray, isTagClass, isTagComponent, isTagTemplater } from './isInstance';
|
|
3
3
|
import { processTagArray } from './processTagArray';
|
|
4
4
|
import { processRegularValue } from './processRegularValue.function';
|
|
5
|
-
import { processTag } from './processTag.function';
|
|
5
|
+
import { processTag, tagFakeTemplater } from './processTag.function';
|
|
6
6
|
var ValueTypes;
|
|
7
7
|
(function (ValueTypes) {
|
|
8
8
|
ValueTypes["tag"] = "tag";
|
|
9
|
+
ValueTypes["templater"] = "templater";
|
|
9
10
|
ValueTypes["tagArray"] = "tag-array";
|
|
10
11
|
ValueTypes["tagComponent"] = "tag-component";
|
|
11
12
|
ValueTypes["value"] = "value";
|
|
@@ -14,7 +15,10 @@ function getValueType(value) {
|
|
|
14
15
|
if (isTagComponent(value)) {
|
|
15
16
|
return ValueTypes.tagComponent;
|
|
16
17
|
}
|
|
17
|
-
if (
|
|
18
|
+
if (isTagTemplater(value)) {
|
|
19
|
+
return ValueTypes.templater;
|
|
20
|
+
}
|
|
21
|
+
if (isTagClass(value)) {
|
|
18
22
|
return ValueTypes.tag;
|
|
19
23
|
}
|
|
20
24
|
if (isTagArray(value)) {
|
|
@@ -22,19 +26,28 @@ function getValueType(value) {
|
|
|
22
26
|
}
|
|
23
27
|
return ValueTypes.value;
|
|
24
28
|
}
|
|
29
|
+
// export type ExistingValue = TemplaterResult | Tag[] | TagSupport | Function | Subject<unknown> | RegularValue | Tag
|
|
25
30
|
export function processSubjectValue(value, subject, // could be tag via result.tag
|
|
26
31
|
insertBefore, // <template end interpolate /> (will be removed)
|
|
27
|
-
|
|
32
|
+
ownerSupport, // owner
|
|
28
33
|
options) {
|
|
29
34
|
const valueType = getValueType(value);
|
|
30
35
|
switch (valueType) {
|
|
36
|
+
case ValueTypes.templater:
|
|
37
|
+
processTag(value, insertBefore, ownerSupport, subject);
|
|
38
|
+
return;
|
|
31
39
|
case ValueTypes.tag:
|
|
32
|
-
|
|
40
|
+
const tag = value;
|
|
41
|
+
let templater = tag.templater;
|
|
42
|
+
if (!templater) {
|
|
43
|
+
templater = tagFakeTemplater(tag);
|
|
44
|
+
}
|
|
45
|
+
processTag(templater, insertBefore, ownerSupport, subject);
|
|
33
46
|
return;
|
|
34
47
|
case ValueTypes.tagArray:
|
|
35
|
-
return processTagArray(subject, value, insertBefore,
|
|
48
|
+
return processTagArray(subject, value, insertBefore, ownerSupport, options);
|
|
36
49
|
case ValueTypes.tagComponent:
|
|
37
|
-
processSubjectComponent(value, subject, insertBefore,
|
|
50
|
+
processSubjectComponent(value, subject, insertBefore, ownerSupport, options);
|
|
38
51
|
return;
|
|
39
52
|
}
|
|
40
53
|
processRegularValue(value, subject, insertBefore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processSubjectValue.function.js","sourceRoot":"","sources":["../ts/processSubjectValue.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,UAAU,E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GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAErC,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,UAAU,CAAC,SAAS;YACvB,UAAU,CACR,KAAwB,EACxB,YAAY,EACZ,YAAY,EACZ,OAAqB,CACtB,CAAA;YACD,OAAM;QAER,KAAK,UAAU,CAAC,GAAG;YACjB,MAAM,GAAG,GAAG,KAAY,CAAA;YACxB,IAAI,SAAS,GAAG,GAAG,CAAC,SAAS,CAAA;YAE7B,IAAG,CAAC,SAAS,EAAE,CAAC;gBACd,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC;YAED,UAAU,CACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,OAAqB,CACtB,CAAA;YACD,OAAM;QAER,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,eAAe,CACpB,OAA0B,EAC1B,KAAkC,EAClC,YAAY,EACZ,YAAY,EACZ,OAAO,CACR,CAAA;QAEH,KAAK,UAAU,CAAC,YAAY;YAC1B,uBAAuB,CACrB,KAAwB,EACxB,OAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,OAAO,CACR,CAAA;YACD,OAAM;IACV,CAAC;IAED,mBAAmB,CACjB,KAAqB,EACrB,OAAyB,EACzB,YAAY,CACb,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { InsertBefore } from './Clones.type';
|
|
2
2
|
import { Tag } from './Tag.class';
|
|
3
|
-
import { TagSubject } from './
|
|
3
|
+
import { TagSubject } from './subject.types';
|
|
4
|
+
import { TagSupport } from './TagSupport.class';
|
|
5
|
+
import { TemplaterResult } from './TemplaterResult.class';
|
|
4
6
|
/** Could be a regular tag or a component. Both are Tag.class */
|
|
5
|
-
export declare function processTag(
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function processTag(templater: TemplaterResult, insertBefore: InsertBefore, ownerSupport: TagSupport, // owner
|
|
8
|
+
subject: TagSubject): void;
|
|
9
|
+
export declare function setupNewTemplater(tagSupport: TagSupport, ownerSupport: TagSupport, subject: TagSubject): void;
|
|
10
|
+
export declare function tagFakeTemplater(tag: Tag): TemplaterResult;
|
|
11
|
+
export declare function getFakeTemplater(): TemplaterResult;
|
|
@@ -1,59 +1,43 @@
|
|
|
1
|
-
import { isTagInstance } from './isInstance';
|
|
2
1
|
import { TagSupport } from './TagSupport.class';
|
|
3
2
|
import { ValueSubject } from './subject';
|
|
4
3
|
/** Could be a regular tag or a component. Both are Tag.class */
|
|
5
|
-
export function processTag(
|
|
6
|
-
|
|
4
|
+
export function processTag(templater, insertBefore, ownerSupport, // owner
|
|
5
|
+
subject) {
|
|
6
|
+
let tagSupport = subject.tagSupport;
|
|
7
7
|
// first time seeing this tag?
|
|
8
|
-
if (!
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
applyFakeTemplater(tag, ownerTag, subject);
|
|
13
|
-
if (ownerTag.childTags.find(x => x === tag)) {
|
|
14
|
-
throw new Error('about to reattach tag already present - 5');
|
|
15
|
-
}
|
|
16
|
-
ownerTag.childTags.push(tag);
|
|
8
|
+
if (!tagSupport) {
|
|
9
|
+
tagSupport = new TagSupport(templater, ownerSupport, subject);
|
|
10
|
+
setupNewTemplater(tagSupport, ownerSupport, subject);
|
|
11
|
+
ownerSupport.childTags.push(tagSupport);
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
tag.buildBeforeElement(insertBefore, {
|
|
13
|
+
subject.tagSupport = tagSupport;
|
|
14
|
+
tagSupport.ownerTagSupport = ownerSupport;
|
|
15
|
+
tagSupport.buildBeforeElement(insertBefore, {
|
|
23
16
|
counts: { added: 0, removed: 0 },
|
|
24
17
|
forceElement: true,
|
|
25
18
|
});
|
|
26
19
|
}
|
|
27
|
-
export function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
const fakeTemplater = getFakeTemplater();
|
|
32
|
-
tag.tagSupport = new TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call
|
|
33
|
-
subject);
|
|
34
|
-
fakeTemplater.global.oldest = tag;
|
|
35
|
-
fakeTemplater.global.newest = tag;
|
|
36
|
-
fakeTemplater.tagSupport = tag.tagSupport;
|
|
20
|
+
export function setupNewTemplater(tagSupport, ownerSupport, subject) {
|
|
21
|
+
tagSupport.global.oldest = tagSupport;
|
|
22
|
+
tagSupport.global.newest = tagSupport;
|
|
37
23
|
// asking me to render will cause my parent to render
|
|
38
|
-
|
|
24
|
+
tagSupport.ownerTagSupport = ownerSupport;
|
|
25
|
+
subject.tagSupport = tagSupport;
|
|
26
|
+
}
|
|
27
|
+
export function tagFakeTemplater(tag) {
|
|
28
|
+
const templater = getFakeTemplater();
|
|
29
|
+
templater.tag = tag;
|
|
30
|
+
tag.templater = templater;
|
|
31
|
+
return templater;
|
|
39
32
|
}
|
|
40
|
-
function getFakeTemplater() {
|
|
33
|
+
export function getFakeTemplater() {
|
|
41
34
|
return {
|
|
42
|
-
global: {
|
|
43
|
-
renderCount: 0,
|
|
44
|
-
providers: [],
|
|
45
|
-
context: {},
|
|
46
|
-
subscriptions: [],
|
|
47
|
-
deleted: false,
|
|
48
|
-
newestTemplater: {},
|
|
49
|
-
},
|
|
50
35
|
children: new ValueSubject([]), // no children
|
|
51
36
|
props: {},
|
|
52
37
|
isTag: true,
|
|
53
38
|
isTemplater: false,
|
|
54
39
|
tagged: false,
|
|
55
|
-
wrapper: (() => undefined),
|
|
56
|
-
tagSupport: {},
|
|
40
|
+
// wrapper: (() => undefined) as unknown as Wrapper,
|
|
57
41
|
};
|
|
58
42
|
}
|
|
59
43
|
//# sourceMappingURL=processTag.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processTag.function.js","sourceRoot":"","sources":["../ts/processTag.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processTag.function.js","sourceRoot":"","sources":["../ts/processTag.function.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G,SAAS,CAAA;IAEzB,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAQ;QACN,QAAQ,EAAE,IAAI,YAAY,CAAQ,EAAE,CAAC,EAAE,cAAc;QACrD,KAAK,EAAE,EAAW;QAElB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,KAAK;QACb,oDAAoD;KAClC,CAAA;AACtB,CAAC"}
|
package/js/processTagArray.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Clones, InsertBefore } from './Clones.type';
|
|
2
2
|
import { Tag } from './Tag.class';
|
|
3
3
|
import { ValueSubject } from './subject/ValueSubject';
|
|
4
|
-
import { Counts } from './interpolateTemplate';
|
|
4
|
+
import { Counts } from './interpolations/interpolateTemplate';
|
|
5
|
+
import { TagSupport } from './TagSupport.class';
|
|
6
|
+
import { TemplaterResult } from './TemplaterResult.class';
|
|
5
7
|
export type LastArrayItem = {
|
|
6
|
-
|
|
8
|
+
tagSupport: TagSupport;
|
|
7
9
|
index: number;
|
|
8
10
|
deleted?: boolean;
|
|
9
11
|
};
|
|
@@ -13,9 +15,9 @@ export type TagArraySubject = ValueSubject<Tag[]> & {
|
|
|
13
15
|
lastArray?: LastArrayItem[];
|
|
14
16
|
isChildSubject?: boolean;
|
|
15
17
|
};
|
|
16
|
-
export declare function processTagArray(subject: TagArraySubject, value: Tag[], // arry of Tag classes
|
|
18
|
+
export declare function processTagArray(subject: TagArraySubject, value: (TemplaterResult | Tag)[], // arry of Tag classes
|
|
17
19
|
insertBefore: InsertBefore, // <template end interpolate />
|
|
18
|
-
|
|
20
|
+
ownerSupport: TagSupport, options: {
|
|
19
21
|
counts: Counts;
|
|
20
22
|
forceElement?: boolean;
|
|
21
23
|
}): Clones;
|
package/js/processTagArray.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ValueSubject } from './subject/ValueSubject';
|
|
2
2
|
import { ArrayNoKeyError } from './errors';
|
|
3
3
|
import { destroyArrayTag } from './checkDestroyPrevious.function';
|
|
4
|
-
import {
|
|
4
|
+
import { setupNewTemplater, tagFakeTemplater } from './processTag.function';
|
|
5
|
+
import { TagSupport } from './TagSupport.class';
|
|
6
|
+
import { isTagClass } from './isInstance';
|
|
5
7
|
export function processTagArray(subject, value, // arry of Tag classes
|
|
6
8
|
insertBefore, // <template end interpolate />
|
|
7
|
-
|
|
8
|
-
const clones =
|
|
9
|
+
ownerSupport, options) {
|
|
10
|
+
const clones = ownerSupport.clones; // []
|
|
9
11
|
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
10
12
|
if (!subject.placeholder) {
|
|
11
13
|
setPlaceholderElm(insertBefore, subject);
|
|
@@ -17,14 +19,17 @@ ownerTag, options) {
|
|
|
17
19
|
const newLength = value.length - 1;
|
|
18
20
|
const at = index - removed;
|
|
19
21
|
const lessLength = newLength < at;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const tag =
|
|
23
|
-
const
|
|
22
|
+
const subValue = value[index - removed];
|
|
23
|
+
const subTag = subValue;
|
|
24
|
+
// const tag = subTag?.templater.tag as Tag
|
|
25
|
+
const lastTag = item.tagSupport.templater.tag;
|
|
26
|
+
const newArrayValue = subTag?.memory.arrayValue;
|
|
27
|
+
const lastArrayValue = lastTag.memory.arrayValue;
|
|
28
|
+
const destroyItem = lessLength || !areLikeValues(newArrayValue, lastArrayValue);
|
|
24
29
|
if (destroyItem) {
|
|
25
30
|
const last = lastArray[index];
|
|
26
|
-
const
|
|
27
|
-
destroyArrayTag(
|
|
31
|
+
const tagSupport = last.tagSupport;
|
|
32
|
+
destroyArrayTag(tagSupport, options.counts);
|
|
28
33
|
last.deleted = true;
|
|
29
34
|
++removed;
|
|
30
35
|
++options.counts.removed;
|
|
@@ -32,22 +37,28 @@ ownerTag, options) {
|
|
|
32
37
|
}
|
|
33
38
|
return true;
|
|
34
39
|
});
|
|
35
|
-
value.forEach((
|
|
40
|
+
value.forEach((item, index) => {
|
|
36
41
|
const previous = lastArray[index];
|
|
37
|
-
const previousSupport = previous?.
|
|
38
|
-
const
|
|
39
|
-
|
|
42
|
+
const previousSupport = previous?.tagSupport;
|
|
43
|
+
const subTag = item;
|
|
44
|
+
if (isTagClass(subTag) && !subTag.templater) {
|
|
45
|
+
tagFakeTemplater(subTag);
|
|
46
|
+
}
|
|
47
|
+
const tagSupport = new TagSupport(subTag.templater, ownerSupport, new ValueSubject(undefined));
|
|
48
|
+
// tagSupport.templater = subTag.templater
|
|
40
49
|
if (previousSupport) {
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
setupNewTemplater(tagSupport, ownerSupport, previousSupport.subject);
|
|
51
|
+
const global = previousSupport.global;
|
|
52
|
+
tagSupport.global = global;
|
|
53
|
+
global.newest = tagSupport;
|
|
43
54
|
}
|
|
44
55
|
// check for html``.key()
|
|
45
56
|
const keySet = 'arrayValue' in subTag.memory;
|
|
46
57
|
if (!keySet) {
|
|
47
58
|
const details = {
|
|
48
|
-
template:
|
|
59
|
+
template: tagSupport.getTemplate().string,
|
|
49
60
|
array: value,
|
|
50
|
-
ownerTagContent:
|
|
61
|
+
ownerTagContent: ownerSupport.lastTemplateString,
|
|
51
62
|
};
|
|
52
63
|
const message = 'Use html`...`.key(item) instead of html`...` to template an Array';
|
|
53
64
|
console.error(message, details);
|
|
@@ -56,22 +67,15 @@ ownerTag, options) {
|
|
|
56
67
|
}
|
|
57
68
|
const couldBeSame = lastArray.length > index;
|
|
58
69
|
if (couldBeSame) {
|
|
59
|
-
const prevSupport = previous.
|
|
60
|
-
const prevGlobal = prevSupport.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
oldest.updateByTag(subTag);
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
// TODO: should not get here?
|
|
69
|
-
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
70
|
-
throw new Error('item should be back');
|
|
71
|
-
// return [] // removed: item should have been previously deleted and will be added back
|
|
70
|
+
const prevSupport = previous.tagSupport;
|
|
71
|
+
const prevGlobal = prevSupport.global;
|
|
72
|
+
// subTag.tagSupport = subTag.tagSupport || prevSupport
|
|
73
|
+
const oldest = prevGlobal.oldest;
|
|
74
|
+
oldest.updateBy(tagSupport);
|
|
75
|
+
return [];
|
|
72
76
|
}
|
|
73
|
-
processAddTagArrayItem(runtimeInsertBefore,
|
|
74
|
-
|
|
77
|
+
processAddTagArrayItem(runtimeInsertBefore, tagSupport, index, options, lastArray);
|
|
78
|
+
ownerSupport.childTags.push(tagSupport);
|
|
75
79
|
});
|
|
76
80
|
return clones;
|
|
77
81
|
}
|
|
@@ -85,9 +89,9 @@ function setPlaceholderElm(insertBefore, subject) {
|
|
|
85
89
|
parentNode.insertBefore(placeholder, insertBefore);
|
|
86
90
|
parentNode.removeChild(insertBefore);
|
|
87
91
|
}
|
|
88
|
-
function processAddTagArrayItem(before,
|
|
92
|
+
function processAddTagArrayItem(before, tagSupport, index, options, lastArray) {
|
|
89
93
|
const lastValue = {
|
|
90
|
-
|
|
94
|
+
tagSupport, index
|
|
91
95
|
};
|
|
92
96
|
// Added to previous array
|
|
93
97
|
lastArray.push(lastValue);
|
|
@@ -95,12 +99,10 @@ function processAddTagArrayItem(before, subTag, index, options, lastArray) {
|
|
|
95
99
|
added: options.counts.added + index,
|
|
96
100
|
removed: options.counts.removed,
|
|
97
101
|
};
|
|
98
|
-
if (!before.parentNode) {
|
|
99
|
-
throw new Error('issue adding array item');
|
|
100
|
-
}
|
|
101
102
|
const newTempElm = document.createElement('template');
|
|
102
|
-
before.parentNode
|
|
103
|
-
|
|
103
|
+
const parent = before.parentNode;
|
|
104
|
+
parent.insertBefore(newTempElm, before);
|
|
105
|
+
tagSupport.buildBeforeElement(newTempElm, // before,
|
|
104
106
|
{ counts, forceElement: options.forceElement });
|
|
105
107
|
}
|
|
106
108
|
/** compare two values. If both values are arrays then the items will be compared */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processTagArray.js","sourceRoot":"","sources":["../ts/processTagArray.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"processTagArray.js","sourceRoot":"","sources":["../ts/processTagArray.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAgBzC,MAAM,UAAU,eAAe,CAC7B,OAAwB,EACxB,KAAgC,EAAE,sBAAsB;AACxD,YAA0B,EAAE,+BAA+B;AAC3D,YAAwB,EACxB,OAGC;IAED,MAAM,MAAM,GAAW,YAAY,CAAC,MAAM,CAAA,CAAC,KAAK;IAChD,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAA;IAE3D,IAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,iBAAiB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,MAAM,mBAAmB,GAAG,OAAO,CAAC,WAAmB,CAAA,CAAC,kBAAkB;IAE1E,IAAI,OAAO,GAAG,CAAC,CAAA;IAEf,sCAAsC;IACtC,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CACvD,IAAmB,EACnB,KA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AAU,EAAE,UAAU;IACtB,EAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAC,CAC7C,CAAA;AACH,CAAC;AAED,oFAAoF;AACpF,SAAS,aAAa,CAAC,MAAe,EAAE,MAAe;IACrD,IAAG,MAAM,KAAK,MAAM,EAAE,CAAC;QACrB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,YAAY,KAAK,IAAI,MAAM,YAAY,KAAK,CAAA;IACrE,MAAM,YAAY,GAAG,UAAU,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAA;IACjE,IAAG,YAAY,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7D,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Counts } from './interpolateTemplate';
|
|
1
|
+
import { Counts } from './interpolations/interpolateTemplate';
|
|
3
2
|
import { TagArraySubject } from './processTagArray';
|
|
4
|
-
import { TagSubject } from './
|
|
3
|
+
import { TagSubject } from './subject.types';
|
|
5
4
|
import { InsertBefore } from './Clones.type';
|
|
6
|
-
|
|
5
|
+
import { TagSupport } from './TagSupport.class';
|
|
6
|
+
export declare function processTagResult(tagSupport: TagSupport, subject: TagArraySubject | TagSubject | Function, // used for recording past and current value
|
|
7
7
|
insertBefore: InsertBefore, // <template end interpolate />
|
|
8
8
|
{ counts, forceElement, }: {
|
|
9
9
|
counts: Counts;
|
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
export function processTagResult(
|
|
1
|
+
export function processTagResult(tagSupport, subject, // used for recording past and current value
|
|
2
2
|
insertBefore, // <template end interpolate />
|
|
3
3
|
{ counts, forceElement, }) {
|
|
4
|
-
if (!insertBefore.parentNode) {
|
|
5
|
-
throw new Error(`before here processTagResult ${insertBefore.nodeName}`);
|
|
6
|
-
}
|
|
7
4
|
// *if appears we already have seen
|
|
8
5
|
const subjectTag = subject;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const justUpdate =
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
const areLike = previousTag.isLikeTag(tag)
|
|
15
|
-
|
|
16
|
-
// are we just updating an if we already had?
|
|
17
|
-
if(areLike) {
|
|
18
|
-
return processTagResultUpdate(tag, subjectTag, previousTag)
|
|
19
|
-
}
|
|
20
|
-
*/
|
|
21
|
-
return processTagResultUpdate(tag, subjectTag, previousTag);
|
|
22
|
-
}
|
|
23
|
-
/*
|
|
24
|
-
if(insertBefore.nodeName !== 'TEMPLATE') {
|
|
25
|
-
throw new Error(`processTagResult.function.ts insertBefore is not template ${insertBefore.nodeName}`)
|
|
6
|
+
const lastSupport = subjectTag.tagSupport;
|
|
7
|
+
const prevSupport = lastSupport?.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
|
|
8
|
+
const justUpdate = prevSupport; // && !forceElement
|
|
9
|
+
if (prevSupport && justUpdate) {
|
|
10
|
+
return processTagResultUpdate(tagSupport, subjectTag, prevSupport);
|
|
26
11
|
}
|
|
27
|
-
|
|
28
|
-
tag.buildBeforeElement(insertBefore, {
|
|
12
|
+
tagSupport.buildBeforeElement(insertBefore, {
|
|
29
13
|
counts,
|
|
30
14
|
forceElement,
|
|
31
15
|
});
|
|
32
16
|
}
|
|
33
|
-
function processTagResultUpdate(
|
|
34
|
-
|
|
17
|
+
function processTagResultUpdate(tagSupport, subject, // used for recording past and current value
|
|
18
|
+
prevSupport) {
|
|
35
19
|
// components
|
|
36
20
|
if (subject instanceof Function) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
subject.
|
|
21
|
+
const newSupport = subject(prevSupport);
|
|
22
|
+
prevSupport.updateBy(newSupport);
|
|
23
|
+
subject.tagSupport = newSupport;
|
|
40
24
|
return;
|
|
41
25
|
}
|
|
42
|
-
|
|
43
|
-
subject.
|
|
26
|
+
prevSupport.updateBy(tagSupport);
|
|
27
|
+
subject.tagSupport = tagSupport;
|
|
44
28
|
return;
|
|
45
29
|
}
|
|
46
30
|
//# sourceMappingURL=processTagResult.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processTagResult.function.js","sourceRoot":"","sources":["../ts/processTagResult.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processTagResult.function.js","sourceRoot":"","sources":["../ts/processTagResult.function.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,gBAAgB,CAC9B,UAAsB,EACtB,OAAgD,EAAE,4CAA4C;AAC9F,YAA0B,EAAE,+BAA+B;AAC3D,EACE,MAAM,EAAE,YAAY,GAIrB;IAED,mCAAmC;IACnC,MAAM,UAAU,GAAG,OAAqB,CAAA;IACxC,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAA;IACzC,MAAM,WAAW,GAAG,WAAW,EAAE,MAAM,CAAC,MAAM,IAAI,SAAS,CAAA,CAAC,6CAA6C;IACzG,MAAM,UAAU,GAAG,WAAW,CAAA,CAAC,mBAAmB;IAElD,IAAG,WAAW,IAAI,UAAU,EAAE,CAAC;QAC7B,OAAO,sBAAsB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAA;IACpE,CAAC;IAED,UAAU,CAAC,kBAAkB,CAAC,YAAY,EAAE;QAC1C,MAAM;QACN,YAAY;KACb,CAAC,CAAA;AACJ,CAAC;AAGD,SAAS,sBAAsB,CAC7B,UAAsB,EACtB,OAAqD,EAAE,4CAA4C;AACnG,WAAuB;IAEvB,aAAa;IACb,IAAG,OAAO,YAAY,QAAQ,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;QACvC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAE/B;QAAC,OAAiC,CAAC,UAAU,GAAG,UAAU,CAAA;QAC3D,OAAM;IACR,CAAC;IAED,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAChC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAA;IAE/B,OAAM;AACR,CAAC"}
|