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,38 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { setUse } from
|
|
3
|
-
import { processTagResult } from
|
|
4
|
-
|
|
1
|
+
import { renderWithSupport } from './TemplaterResult.class';
|
|
2
|
+
import { setUse } from './setUse.function';
|
|
3
|
+
import { processTagResult } from './processTagResult.function';
|
|
4
|
+
import { TagSupport } from './TagSupport.class';
|
|
5
|
+
export function processSubjectComponent(templater, subject, template, ownerTag, options) {
|
|
6
|
+
// Check if function component is wrapped in a tag() call
|
|
5
7
|
// TODO: This below check not needed in production mode
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
+
if (templater.tagged !== true) {
|
|
9
|
+
const original = templater.wrapper.original;
|
|
10
|
+
let name = original.name || original.constructor?.name;
|
|
8
11
|
if (name === 'Function') {
|
|
9
12
|
name = undefined;
|
|
10
13
|
}
|
|
11
|
-
const label = name ||
|
|
14
|
+
const label = name || original.toString().substring(0, 120);
|
|
12
15
|
const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\`\`) on component:\n\n${label}\n\n`);
|
|
13
16
|
throw error;
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
templater.tagSupport = new TagSupport(ownerTag.tagSupport, templater, subject);
|
|
19
|
+
// templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest
|
|
20
|
+
templater.global.insertBefore = template;
|
|
21
|
+
let retag = subject.tag;
|
|
18
22
|
const providers = setUse.memory.providerConfig;
|
|
19
23
|
providers.ownerTag = ownerTag;
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const isRedraw = !retag || options.forceElement;
|
|
25
|
+
if (isRedraw) {
|
|
26
|
+
const preClones = ownerTag.clones.map(clone => clone);
|
|
27
|
+
retag = renderWithSupport(templater.tagSupport, subject.tag, // existing tag
|
|
28
|
+
subject, ownerTag);
|
|
29
|
+
if (retag.tagSupport.templater.global.newest != retag) {
|
|
30
|
+
throw new Error('mismatch result newest');
|
|
24
31
|
}
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
templater.global.newest = retag;
|
|
33
|
+
if (ownerTag.clones.length > preClones.length) {
|
|
34
|
+
const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
35
|
+
retag.clones.push(...myClones);
|
|
27
36
|
}
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
if (ownerTag.childTags.find(x => x === retag)) {
|
|
38
|
+
throw new Error('about to reattach tag already present');
|
|
39
|
+
}
|
|
40
|
+
ownerTag.childTags.push(retag);
|
|
30
41
|
}
|
|
31
|
-
|
|
32
|
-
tagSupport.templater = retag.tagSupport.templater;
|
|
33
|
-
const clones = processTagResult(retag, result, // The element set here will be removed from document. Also result.tag will be added in here
|
|
42
|
+
processTagResult(retag, subject, // The element set here will be removed from document. Also result.tag will be added in here
|
|
34
43
|
template, // <template end interpolate /> (will be removed)
|
|
35
44
|
options);
|
|
36
|
-
return clones;
|
|
37
45
|
}
|
|
38
46
|
//# sourceMappingURL=processSubjectComponent.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processSubjectComponent.function.js","sourceRoot":"","sources":["../ts/processSubjectComponent.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processSubjectComponent.function.js","sourceRoot":"","sources":["../ts/processSubjectComponent.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,MAAM,UAAU,uBAAuB,CACrC,SAA0B,EAC1B,OAAmB,EACnB,QAAmC,EACnC,QAAa,EACb,OAAiD;IAEjD,yDAAyD;IACzD,uDAAuD;IACvD,IAAG,SAAS,C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C;YACrD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC3C,CAAC;QAED,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;QAE/B,IAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;YAC7C,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAA;YAC7F,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;QAChC,CAAC;QAED,IAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;QAC1D,CAAC;QAED,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;IAED,gBAAgB,CACd,KAAK,EACL,OAAO,EAAE,4FAA4F;IACrG,QAAQ,EAAE,iDAAiD;IAC3D,OAAO,CACR,CAAA;AACH,CAAC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { TagArraySubject } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { TagArraySubject } from './processTagArray';
|
|
2
|
+
import { TemplaterResult } from './TemplaterResult.class';
|
|
3
|
+
import { Clones } from './Clones.type';
|
|
4
|
+
import { Tag } from './Tag.class';
|
|
5
|
+
import { Counts, Template } from './interpolateTemplate';
|
|
6
|
+
import { DisplaySubject, TagSubject } from './Tag.utils';
|
|
7
|
+
import { ValueSubject } from './ValueSubject';
|
|
8
|
+
import { Callback } from './bindSubjectCallback.function';
|
|
6
9
|
type processOptions = {
|
|
7
10
|
forceElement?: boolean;
|
|
8
11
|
counts: Counts;
|
|
9
12
|
};
|
|
10
13
|
export type ClonesAndPromise = {
|
|
11
14
|
clones: Clones;
|
|
12
|
-
promise?: Promise<any>;
|
|
13
15
|
};
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
+
export type InterpolateSubject = TagArraySubject | TagSubject | DisplaySubject | ValueSubject<Callback>;
|
|
17
|
+
export declare function processSubjectValue(value: any | TemplaterResult, subject: InterpolateSubject, // could be tag via result.tag
|
|
18
|
+
template: Element | Text | Template, // <template end interpolate /> (will be removed)
|
|
16
19
|
ownerTag: Tag, // owner
|
|
17
|
-
options: processOptions):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare function
|
|
20
|
+
options: processOptions): Clones | undefined;
|
|
21
|
+
/** Could be a regular tag or a component. Both are Tag.class */
|
|
22
|
+
export declare function processTag(tag: Tag, subject: TagSubject, // could be tag via result.tag
|
|
23
|
+
insertBefore: Element | Text | Template, // <template end interpolate /> (will be removed)
|
|
24
|
+
ownerTag: Tag): void;
|
|
25
|
+
export declare function applyFakeTemplater(tag: Tag, ownerTag: Tag, subject: TagSubject): void;
|
|
23
26
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { processSubjectComponent } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { ValueSubject } from "./ValueSubject.js";
|
|
8
|
-
import { processRegularValue } from "./processRegularValue.function.js";
|
|
1
|
+
import { processSubjectComponent } from './processSubjectComponent.function';
|
|
2
|
+
import { isTagArray, isTagComponent, isTagInstance } from './isInstance';
|
|
3
|
+
import { processTagArray } from './processTagArray';
|
|
4
|
+
import { TagSupport } from './TagSupport.class';
|
|
5
|
+
import { ValueSubject } from './ValueSubject';
|
|
6
|
+
import { processRegularValue } from './processRegularValue.function';
|
|
9
7
|
var ValueTypes;
|
|
10
8
|
(function (ValueTypes) {
|
|
11
9
|
ValueTypes["tag"] = "tag";
|
|
@@ -25,90 +23,68 @@ function getValueType(value) {
|
|
|
25
23
|
}
|
|
26
24
|
return ValueTypes.value;
|
|
27
25
|
}
|
|
28
|
-
export function processSubjectValue(value,
|
|
26
|
+
export function processSubjectValue(value, subject, // could be tag via result.tag
|
|
29
27
|
template, // <template end interpolate /> (will be removed)
|
|
30
28
|
ownerTag, // owner
|
|
31
29
|
options) {
|
|
32
30
|
const valueType = getValueType(value);
|
|
33
|
-
// Previously was simple value, now its a tag of some sort
|
|
34
|
-
const resultTag = result;
|
|
35
|
-
const clone = resultTag.clone;
|
|
36
|
-
const noLongerSimpleValue = valueType !== ValueTypes.value && clone;
|
|
37
|
-
if (noLongerSimpleValue) {
|
|
38
|
-
destroySimpleValue(template, resultTag);
|
|
39
|
-
}
|
|
40
31
|
switch (valueType) {
|
|
41
32
|
case ValueTypes.tag:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
33
|
+
processTag(value, subject, template, ownerTag);
|
|
34
|
+
return;
|
|
45
35
|
case ValueTypes.tagArray:
|
|
46
|
-
return
|
|
47
|
-
clones: processTagArray(result, value, template, ownerTag, options)
|
|
48
|
-
};
|
|
36
|
+
return processTagArray(subject, value, template, ownerTag, options);
|
|
49
37
|
case ValueTypes.tagComponent:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
// *if processing WAS a tag BUT NOW its some other non-tag value
|
|
55
|
-
if (result.tag) {
|
|
56
|
-
return {
|
|
57
|
-
clones: [],
|
|
58
|
-
promise: processWasTag(value, result, template, options),
|
|
59
|
-
};
|
|
38
|
+
processSubjectComponent(value, subject, template, ownerTag, options);
|
|
39
|
+
return;
|
|
60
40
|
}
|
|
61
|
-
|
|
62
|
-
clones: processRegularValue(value, result, template, ownerTag)
|
|
63
|
-
};
|
|
41
|
+
processRegularValue(value, subject, template);
|
|
64
42
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
43
|
+
/** Could be a regular tag or a component. Both are Tag.class */
|
|
44
|
+
export function processTag(tag, subject, // could be tag via result.tag
|
|
45
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
46
|
+
ownerTag) {
|
|
69
47
|
// first time seeing this tag?
|
|
70
|
-
if (!
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
ownerTag.
|
|
79
|
-
value.ownerTag = ownerTag;
|
|
48
|
+
if (!tag.tagSupport) {
|
|
49
|
+
if (!isTagInstance(tag)) {
|
|
50
|
+
throw new Error('issue non-tag here');
|
|
51
|
+
}
|
|
52
|
+
applyFakeTemplater(tag, ownerTag, subject);
|
|
53
|
+
if (ownerTag.childTags.find(x => x === tag)) {
|
|
54
|
+
throw new Error('about to reattach tag already present - 5');
|
|
55
|
+
}
|
|
56
|
+
ownerTag.childTags.push(tag);
|
|
80
57
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
tag.ownerTag = ownerTag;
|
|
59
|
+
subject.template = insertBefore;
|
|
60
|
+
tag.buildBeforeElement(insertBefore, {
|
|
61
|
+
counts: { added: 0, removed: 0 },
|
|
62
|
+
forceElement: true, test: false,
|
|
63
|
+
});
|
|
85
64
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
result.clone = clone;
|
|
99
|
-
// cleanup old
|
|
100
|
-
delete result.tag;
|
|
101
|
-
/* destroy logic */
|
|
102
|
-
const stagger = options.counts.removed;
|
|
103
|
-
const promise = tag.destroy({ stagger }).then(animated => options.counts.removed = stagger + animated);
|
|
104
|
-
/* end: destroy logic */
|
|
105
|
-
return promise;
|
|
65
|
+
export function applyFakeTemplater(tag, ownerTag, subject) {
|
|
66
|
+
if (!ownerTag) {
|
|
67
|
+
throw new Error('no owner error');
|
|
68
|
+
}
|
|
69
|
+
const fakeTemplater = getFakeTemplater();
|
|
70
|
+
tag.tagSupport = new TagSupport(ownerTag.tagSupport, fakeTemplater, // the template is provided via html`` call
|
|
71
|
+
subject);
|
|
72
|
+
fakeTemplater.global.oldest = tag;
|
|
73
|
+
fakeTemplater.global.newest = tag;
|
|
74
|
+
fakeTemplater.tagSupport = tag.tagSupport;
|
|
75
|
+
// asking me to render will cause my parent to render
|
|
76
|
+
tag.ownerTag = ownerTag;
|
|
106
77
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
78
|
+
function getFakeTemplater() {
|
|
79
|
+
return {
|
|
80
|
+
global: {
|
|
81
|
+
renderCount: 0,
|
|
82
|
+
providers: [],
|
|
83
|
+
context: {},
|
|
84
|
+
},
|
|
85
|
+
children: new ValueSubject([]), // no children
|
|
86
|
+
props: {},
|
|
87
|
+
isTag: true,
|
|
88
|
+
};
|
|
113
89
|
}
|
|
114
90
|
//# sourceMappingURL=processSubjectValue.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processSubjectValue.function.js","sourceRoot":"","sources":["../ts/processSubjectValue.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,
|
|
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,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAmB,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,oB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,CAAC,UAAU,EACnB,aAAa,EAAE,2CAA2C;IAC1D,OAAO,CACR,CAAA;IAED,aAAa,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAA;IACjC,aAAa,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAA;IACjC,aAAa,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;IAEzC,qDAAqD;IACrD,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;AACzB,CAAC;AAED,SAAS,gBAAgB;IACvB,OAAO;QACL,MAAM,EAAC;YACL,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ;QACD,QAAQ,EAAE,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE,cAAc;QAC9C,KAAK,EAAE,EAAW;QAClB,KAAK,EAAE,IAAI;KACkB,CAAA;AACjC,CAAC"}
|
package/js/processTagArray.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { Clones } from
|
|
2
|
-
import { Tag } from
|
|
3
|
-
import { ValueSubject } from
|
|
4
|
-
import { Counts } from
|
|
1
|
+
import { Clones } from './Clones.type';
|
|
2
|
+
import { Tag } from './Tag.class';
|
|
3
|
+
import { ValueSubject } from './ValueSubject';
|
|
4
|
+
import { Counts, Template } from './interpolateTemplate';
|
|
5
5
|
export type LastArrayItem = {
|
|
6
6
|
tag: Tag;
|
|
7
7
|
index: number;
|
|
8
|
+
deleted?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export type TagArraySubject = ValueSubject<Tag[]> & {
|
|
10
|
-
lastArray
|
|
11
|
-
template: Element;
|
|
11
|
+
lastArray?: LastArrayItem[];
|
|
12
|
+
template: Element | Text | Template;
|
|
12
13
|
isChildSubject?: boolean;
|
|
13
14
|
};
|
|
14
|
-
export declare function processTagArray(
|
|
15
|
-
template: Element, // <template end interpolate />
|
|
15
|
+
export declare function processTagArray(subject: TagArraySubject, value: Tag[], // arry of Tag classes
|
|
16
|
+
template: Element | Text | Template, // <template end interpolate />
|
|
16
17
|
ownerTag: Tag, options: {
|
|
17
18
|
counts: Counts;
|
|
18
19
|
forceElement?: boolean;
|
package/js/processTagArray.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { ValueSubject } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { ValueSubject } from './ValueSubject';
|
|
2
|
+
import { ArrayNoKeyError } from './errors';
|
|
3
|
+
import { destroyArrayTag } from './checkDestroyPrevious.function';
|
|
4
|
+
import { applyFakeTemplater } from './processSubjectValue.function';
|
|
5
|
+
export function processTagArray(subject, value, // arry of Tag classes
|
|
5
6
|
template, // <template end interpolate />
|
|
6
7
|
ownerTag, options) {
|
|
7
|
-
const clones = []
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const clones = ownerTag.clones; // []
|
|
9
|
+
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
10
|
+
subject.template = template;
|
|
10
11
|
let removed = 0;
|
|
11
12
|
/** 🗑️ remove previous items first */
|
|
12
|
-
|
|
13
|
+
lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {
|
|
13
14
|
const newLength = value.length - 1;
|
|
14
15
|
const at = index - removed;
|
|
15
16
|
const lessLength = newLength < at;
|
|
@@ -17,12 +18,10 @@ ownerTag, options) {
|
|
|
17
18
|
const subArrayValue = subTag?.arrayValue;
|
|
18
19
|
const destroyItem = lessLength || !areLikeValues(subArrayValue, item.tag.arrayValue);
|
|
19
20
|
if (destroyItem) {
|
|
20
|
-
const last =
|
|
21
|
+
const last = lastArray[index];
|
|
21
22
|
const tag = last.tag;
|
|
22
|
-
tag.
|
|
23
|
-
|
|
24
|
-
byParent: false
|
|
25
|
-
});
|
|
23
|
+
destroyArrayTag(tag, options.counts);
|
|
24
|
+
last.deleted = true;
|
|
26
25
|
++removed;
|
|
27
26
|
++options.counts.removed;
|
|
28
27
|
return false;
|
|
@@ -30,22 +29,16 @@ ownerTag, options) {
|
|
|
30
29
|
return true;
|
|
31
30
|
});
|
|
32
31
|
// const masterBefore = template || (template as any).clone
|
|
33
|
-
const before = template || template.clone;
|
|
32
|
+
const before = template || subject.value.insertBefore || template.clone;
|
|
34
33
|
value.forEach((subTag, index) => {
|
|
35
|
-
const previous =
|
|
36
|
-
const previousSupport =
|
|
37
|
-
|
|
34
|
+
const previous = lastArray[index];
|
|
35
|
+
const previousSupport = previous?.tag.tagSupport;
|
|
36
|
+
const fakeSubject = new ValueSubject({});
|
|
37
|
+
applyFakeTemplater(subTag, ownerTag, fakeSubject);
|
|
38
38
|
if (previousSupport) {
|
|
39
|
-
|
|
39
|
+
subTag.tagSupport.templater.global = previousSupport.templater.global;
|
|
40
|
+
previousSupport.templater.global.newest = subTag;
|
|
40
41
|
}
|
|
41
|
-
else {
|
|
42
|
-
subTag.tagSupport.mutatingRender = () => {
|
|
43
|
-
ownerTag.tagSupport.render(); // call owner for needed updates
|
|
44
|
-
return subTag;
|
|
45
|
-
};
|
|
46
|
-
ownerTag.children.push(subTag);
|
|
47
|
-
}
|
|
48
|
-
subTag.ownerTag = ownerTag;
|
|
49
42
|
// check for html``.key()
|
|
50
43
|
const keyNotSet = subTag.arrayValue;
|
|
51
44
|
if (keyNotSet?.isArrayValueNeverSet) {
|
|
@@ -59,33 +52,39 @@ ownerTag, options) {
|
|
|
59
52
|
const err = new ArrayNoKeyError(message, details);
|
|
60
53
|
throw err;
|
|
61
54
|
}
|
|
62
|
-
const couldBeSame =
|
|
55
|
+
const couldBeSame = lastArray.length > index;
|
|
63
56
|
if (couldBeSame) {
|
|
64
57
|
const isSame = areLikeValues(previous.tag.arrayValue, subTag.arrayValue);
|
|
65
58
|
if (isSame) {
|
|
66
59
|
subTag.tagSupport = subTag.tagSupport || previous.tag.tagSupport;
|
|
67
|
-
previous.tag.
|
|
60
|
+
const oldest = previous.tag.tagSupport.templater.global.oldest;
|
|
61
|
+
oldest.updateByTag(subTag);
|
|
68
62
|
return [];
|
|
69
63
|
}
|
|
70
|
-
|
|
64
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray, true);
|
|
65
|
+
throw new Error('item should be back');
|
|
66
|
+
// return [] // removed: item should have been previously deleted and will be added back
|
|
71
67
|
}
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray, true);
|
|
69
|
+
ownerTag.childTags.push(subTag);
|
|
74
70
|
});
|
|
75
71
|
return clones;
|
|
76
72
|
}
|
|
77
|
-
function processAddTagArrayItem(before, subTag,
|
|
78
|
-
|
|
79
|
-
result.lastArray.push({
|
|
73
|
+
function processAddTagArrayItem(before, subTag, index, options, lastArray, test) {
|
|
74
|
+
const lastValue = {
|
|
80
75
|
tag: subTag, index
|
|
81
|
-
}
|
|
76
|
+
};
|
|
77
|
+
// Added to previous array
|
|
78
|
+
lastArray.push(lastValue);
|
|
82
79
|
const counts = {
|
|
83
80
|
added: options.counts.added + index,
|
|
84
81
|
removed: options.counts.removed,
|
|
85
82
|
};
|
|
86
83
|
const lastFirstChild = before; // tag.clones[0] // insertBefore.lastFirstChild
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
if (!lastFirstChild.parentNode) {
|
|
85
|
+
throw new Error('issue adding array item');
|
|
86
|
+
}
|
|
87
|
+
subTag.buildBeforeElement(lastFirstChild, { counts, forceElement: options.forceElement, test });
|
|
89
88
|
}
|
|
90
89
|
/** compare two values. If both values are arrays then the items will be compared */
|
|
91
90
|
function areLikeValues(valueA, valueB) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processTagArray.js","sourceRoot":"","sources":["../ts/processTagArray.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"processTagArray.js","sourceRoot":"","sources":["../ts/processTagArray.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE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AAC,MAAM,CAAC,OAAO;KAChC,CAAA;IAED,MAAM,cAAc,GAAG,MAAM,CAAA,CAAC,mDAAmD;IACjF,IAAG,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAED,MAAM,CAAC,kBAAkB,CACvB,cAAc,EACd,EAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,IAAI,EAAC,CACnD,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,11 +1,10 @@
|
|
|
1
|
-
import { Tag } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
insertBefore: Element, // <template end interpolate />
|
|
1
|
+
import { Tag } from './Tag.class';
|
|
2
|
+
import { Counts, Template } from './interpolateTemplate';
|
|
3
|
+
import { TagArraySubject } from './processTagArray';
|
|
4
|
+
import { TagSubject } from './Tag.utils';
|
|
5
|
+
export declare function processTagResult(tag: Tag, subject: TagArraySubject | TagSubject | Function, // used for recording past and current value
|
|
6
|
+
insertBefore: Element | Text | Template, // <template end interpolate />
|
|
8
7
|
{ counts, forceElement, }: {
|
|
9
8
|
counts: Counts;
|
|
10
9
|
forceElement?: boolean;
|
|
11
|
-
}):
|
|
10
|
+
}): void;
|
|
@@ -1,27 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { destroyTagMemory } from './destroyTag.function';
|
|
2
|
+
export function processTagResult(tag, subject, // used for recording past and current value
|
|
2
3
|
insertBefore, // <template end interpolate />
|
|
3
4
|
{ counts, forceElement, }) {
|
|
5
|
+
if (!insertBefore.parentNode) {
|
|
6
|
+
throw new Error('before here processTagResult');
|
|
7
|
+
}
|
|
4
8
|
// *if appears we already have seen
|
|
5
|
-
const subjectTag =
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const subjectTag = subject;
|
|
10
|
+
const existingTag = subjectTag.tag;
|
|
11
|
+
const previousTag = existingTag?.tagSupport.templater.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
|
|
12
|
+
const justUpdate = previousTag; // && !forceElement
|
|
13
|
+
if (previousTag) {
|
|
14
|
+
if (justUpdate) {
|
|
15
|
+
const areLike = previousTag.isLikeTag(tag);
|
|
16
|
+
// are we just updating an if we already had?
|
|
17
|
+
if (areLike) {
|
|
18
|
+
// components
|
|
19
|
+
if (subject instanceof Function) {
|
|
20
|
+
const newTag = subject(previousTag.tagSupport);
|
|
21
|
+
previousTag.updateByTag(newTag);
|
|
22
|
+
if (!newTag.tagSupport.templater.global.oldest) {
|
|
23
|
+
throw new Error('maybe 0');
|
|
24
|
+
}
|
|
25
|
+
subjectTag.tag = newTag;
|
|
26
|
+
if (!newTag.hasLiveElements) {
|
|
27
|
+
throw new Error('44444 - 2');
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
previousTag.updateByTag(tag);
|
|
32
|
+
if (!tag.tagSupport.templater.global.oldest) {
|
|
33
|
+
throw new Error('maybe 1');
|
|
34
|
+
}
|
|
35
|
+
subjectTag.tag = tag;
|
|
36
|
+
if (!tag.hasLiveElements) {
|
|
37
|
+
throw new Error('44444 - 3');
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
15
40
|
}
|
|
16
|
-
|
|
17
|
-
|
|
41
|
+
destroyTagMemory(previousTag, subject);
|
|
42
|
+
throw new Error('585 - think we never get here');
|
|
18
43
|
}
|
|
19
44
|
}
|
|
20
|
-
|
|
45
|
+
tag.buildBeforeElement(insertBefore, {
|
|
21
46
|
counts,
|
|
22
|
-
forceElement,
|
|
47
|
+
forceElement, test: false,
|
|
23
48
|
});
|
|
24
|
-
subjectTag.tag = tag; // let reprocessing know we saw this previously as an if
|
|
25
|
-
return clones;
|
|
26
49
|
}
|
|
27
50
|
//# 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":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,UAAU,gBAAgB,CAC9B,GAAQ,EACR,OAAgD,EAAE,4CAA4C;AAC9F,YAAuC,EAAE,+BAA+B;AACxE,EACE,MAAM,EAAE,YAAY,GAIrB;IAED,IAAG,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACjD,CAAC;IAED,mCAAmC;IACnC,MAAM,UAAU,GAAG,OAAqB,CAAA;IACxC,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,CAAA;IAClC,MAAM,WAAW,GAAG,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,MAAa,IAAI,SAAS,CAAA,CAAC,6CAA6C;IACrI,MAAM,UAAU,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BAAkB,CAAC,YAAY,EAAE;QACnC,MAAM;QACN,YAAY,EAAE,IAAI,EAAE,KAAK;KAC1B,CAAC,CAAA;AACJ,CAAC"}
|
package/js/provider.utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tag } from
|
|
1
|
+
import { Tag } from './Tag.class';
|
|
2
2
|
export declare function providersChangeCheck(tag: Tag): void;
|