taggedjs 2.4.10 → 2.4.14
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 +918 -543
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +4 -1
- package/js/Clones.type.js +1 -1
- package/js/Clones.type.js.map +1 -1
- package/js/Tag.class.d.ts +8 -10
- package/js/Tag.class.js +131 -71
- package/js/Tag.class.js.map +1 -1
- package/js/Tag.utils.d.ts +5 -5
- package/js/Tag.utils.js +1 -1
- package/js/Tag.utils.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +9 -3
- package/js/TemplaterResult.class.js +19 -18
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/alterProps.function.d.ts +2 -0
- package/js/alterProps.function.js +18 -13
- package/js/alterProps.function.js.map +1 -1
- package/js/checkDestroyPrevious.function.d.ts +3 -1
- package/js/checkDestroyPrevious.function.js +33 -11
- package/js/checkDestroyPrevious.function.js.map +1 -1
- package/js/destroyTag.function.js +4 -5
- package/js/destroyTag.function.js.map +1 -1
- package/js/getCallback.js +1 -2
- package/js/getCallback.js.map +1 -1
- package/js/hasTagSupportChanged.function.js +0 -4
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/index.d.ts +1 -2
- package/js/index.js +1 -2
- package/js/index.js.map +1 -1
- package/js/insertAfter.function.d.ts +2 -0
- package/js/insertAfter.function.js +6 -0
- package/js/insertAfter.function.js.map +1 -0
- package/js/interpolateElement.d.ts +3 -2
- package/js/interpolateElement.js +3 -2
- package/js/interpolateElement.js.map +1 -1
- package/js/interpolateTemplate.d.ts +2 -3
- package/js/interpolateTemplate.js +6 -24
- package/js/interpolateTemplate.js.map +1 -1
- package/js/interpolations.js +2 -1
- package/js/interpolations.js.map +1 -1
- package/js/isInstance.d.ts +2 -2
- package/js/isInstance.js.map +1 -1
- package/js/onInit.js +5 -3
- package/js/onInit.js.map +1 -1
- package/js/processAttribute.function.d.ts +1 -0
- package/js/processAttribute.function.js +3 -3
- package/js/processAttribute.function.js.map +1 -1
- package/js/processNewValue.function.js +1 -1
- package/js/processNewValue.function.js.map +1 -1
- package/js/processRegularValue.function.d.ts +2 -2
- package/js/processRegularValue.function.js +7 -6
- package/js/processRegularValue.function.js.map +1 -1
- package/js/processSubjectComponent.function.d.ts +4 -3
- package/js/processSubjectComponent.function.js +30 -22
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +6 -10
- package/js/processSubjectValue.function.js +6 -54
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/processTag.function.d.ts +7 -0
- package/js/processTag.function.js +59 -0
- package/js/processTag.function.js.map +1 -0
- package/js/processTagArray.d.ts +7 -5
- package/js/processTagArray.js +55 -18
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +1 -1
- package/js/processTagResult.function.js +26 -32
- package/js/processTagResult.function.js.map +1 -1
- package/js/render.d.ts +2 -1
- package/js/render.js.map +1 -1
- package/js/renderExistingTag.function.js +7 -16
- package/js/renderExistingTag.function.js.map +1 -1
- package/js/renderTagSupport.function.js +4 -12
- package/js/renderTagSupport.function.js.map +1 -1
- package/js/subject/Subject.class.d.ts +24 -0
- package/js/subject/Subject.class.js +103 -0
- package/js/subject/Subject.class.js.map +1 -0
- package/js/subject/Subject.utils.d.ts +27 -0
- package/js/subject/Subject.utils.js +4 -0
- package/js/subject/Subject.utils.js.map +1 -0
- package/js/subject/ValueSubject.d.ts +9 -0
- package/js/subject/ValueSubject.js +15 -0
- package/js/subject/ValueSubject.js.map +1 -0
- package/js/subject/combineLatest.function.d.ts +2 -0
- package/js/subject/combineLatest.function.js +24 -0
- package/js/subject/combineLatest.function.js.map +1 -0
- package/js/subject/index.d.ts +4 -0
- package/js/subject/index.js +5 -0
- package/js/subject/index.js.map +1 -0
- package/js/subject/will.functions.d.ts +8 -0
- package/js/subject/will.functions.js +32 -0
- package/js/subject/will.functions.js.map +1 -0
- package/js/tag.d.ts +1 -1
- package/js/tag.js +3 -5
- package/js/tag.js.map +1 -1
- package/js/tagElement.js +1 -1
- package/js/tagElement.js.map +1 -1
- package/js/updateBeforeTemplate.function.d.ts +3 -0
- package/js/updateBeforeTemplate.function.js +16 -0
- package/js/updateBeforeTemplate.function.js.map +1 -0
- package/js/updateExistingTagComponent.function.d.ts +2 -1
- package/js/updateExistingTagComponent.function.js +64 -43
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.d.ts +3 -2
- package/js/updateExistingValue.function.js +50 -22
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -2
- /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,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { updateBeforeTemplate } from './updateBeforeTemplate.function';
|
|
2
2
|
export function processRegularValue(value, subject, // could be tag via subject.tag
|
|
3
|
-
|
|
4
|
-
subject.
|
|
5
|
-
const before = subject.clone ||
|
|
6
|
-
|
|
3
|
+
insertBefore) {
|
|
4
|
+
subject.insertBefore = insertBefore;
|
|
5
|
+
const before = subject.clone || insertBefore; // Either the template is on the doc OR its the first element we last put on doc
|
|
6
|
+
// matches but also was defined at some point
|
|
7
|
+
if (subject.lastValue === value && 'lastValue' in subject) {
|
|
7
8
|
return; // no need to update display, its the same
|
|
8
9
|
}
|
|
9
10
|
subject.lastValue = value;
|
|
10
11
|
// Processing of regular values
|
|
11
|
-
const clone =
|
|
12
|
+
const clone = updateBeforeTemplate(value, before);
|
|
12
13
|
subject.clone = clone; // remember single element put down, for future updates
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=processRegularValue.function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRegularValue.function.js","sourceRoot":"","sources":["../ts/processRegularValue.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processRegularValue.function.js","sourceRoot":"","sources":["../ts/processRegularValue.function.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAItE,MAAM,UAAU,mBAAmB,CACjC,KAAmB,EACnB,OAAuB,EAAE,+BAA+B;AACxD,YAA0B;IAE1B,OAAO,CAAC,YAAY,GAAG,YAAY,CAAA;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,CAAA,CAAC,gFAAgF;IAE7H,6CAA6C;IAC7C,IAAG,OAAO,CAAC,SAAS,KAAK,KAAK,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;QACzD,OAAM,CAAC,0CAA0C;IACnD,CAAC;IAED,OAAO,CAAC,SAAS,GAAG,KAAK,CAAA;IAEzB,+BAA+B;IAC/B,MAAM,KAAK,GAAG,oBAAoB,CAChC,KAAK,EACL,MAAM,CACP,CAAA;IAED,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA,CAAC,uDAAuD;AAC/E,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TemplaterResult } from './TemplaterResult.class';
|
|
2
|
-
import { Counts
|
|
2
|
+
import { Counts } from './interpolateTemplate';
|
|
3
3
|
import { Tag } from './Tag.class';
|
|
4
4
|
import { TagSubject } from './Tag.utils';
|
|
5
|
-
|
|
5
|
+
import { InsertBefore } from './Clones.type';
|
|
6
|
+
export declare function processSubjectComponent(templater: TemplaterResult, subject: TagSubject, insertBefore: InsertBefore, ownerTag: Tag, options: {
|
|
6
7
|
counts: Counts;
|
|
7
8
|
forceElement?: boolean;
|
|
8
|
-
}):
|
|
9
|
+
}): Tag;
|
|
@@ -2,45 +2,53 @@ import { renderWithSupport } from './TemplaterResult.class';
|
|
|
2
2
|
import { setUse } from './setUse.function';
|
|
3
3
|
import { processTagResult } from './processTagResult.function';
|
|
4
4
|
import { TagSupport } from './TagSupport.class';
|
|
5
|
-
export function processSubjectComponent(templater, subject,
|
|
5
|
+
export function processSubjectComponent(templater, subject, insertBefore, ownerTag, 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
|
-
|
|
9
|
+
const original = templater.wrapper.original;
|
|
10
|
+
let name = original.name || original.constructor?.name;
|
|
10
11
|
if (name === 'Function') {
|
|
11
12
|
name = undefined;
|
|
12
13
|
}
|
|
13
|
-
const label = name ||
|
|
14
|
+
const label = name || original.toString().substring(0, 120);
|
|
14
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`);
|
|
15
16
|
throw error;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
templater.tagSupport = new TagSupport(ownerTag.tagSupport, templater, subject);
|
|
19
|
-
}
|
|
18
|
+
templater.tagSupport = new TagSupport(ownerTag.tagSupport, templater, subject);
|
|
20
19
|
// templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest
|
|
21
|
-
templater.global.insertBefore =
|
|
20
|
+
templater.global.insertBefore = insertBefore;
|
|
22
21
|
let retag = subject.tag;
|
|
23
22
|
const providers = setUse.memory.providerConfig;
|
|
24
23
|
providers.ownerTag = ownerTag;
|
|
25
24
|
const isRedraw = !retag || options.forceElement;
|
|
26
25
|
if (isRedraw) {
|
|
27
|
-
|
|
28
|
-
retag = renderWithSupport(templater.tagSupport, subject.tag, subject, ownerTag);
|
|
29
|
-
if (retag.tagSupport.templater.global.newest != retag) {
|
|
30
|
-
throw new Error('mismatch result newest');
|
|
31
|
-
}
|
|
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);
|
|
36
|
-
}
|
|
37
|
-
if (ownerTag.childTags.find(x => x === retag)) {
|
|
38
|
-
throw new Error('about to reattach tag already present');
|
|
39
|
-
}
|
|
40
|
-
ownerTag.childTags.push(retag);
|
|
26
|
+
retag = redrawSubjectComponent(templater, subject, retag, ownerTag, insertBefore);
|
|
41
27
|
}
|
|
42
28
|
processTagResult(retag, subject, // The element set here will be removed from document. Also result.tag will be added in here
|
|
43
|
-
|
|
29
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
44
30
|
options);
|
|
31
|
+
return retag;
|
|
32
|
+
}
|
|
33
|
+
function redrawSubjectComponent(templater, subject, retag, ownerTag, insertBefore) {
|
|
34
|
+
const preClones = ownerTag.clones.map(clone => clone);
|
|
35
|
+
retag = renderWithSupport(templater.tagSupport, subject.tag, // existing tag
|
|
36
|
+
subject, ownerTag);
|
|
37
|
+
if (retag.tagSupport.templater.global.newest != retag) {
|
|
38
|
+
throw new Error('mismatch result newest');
|
|
39
|
+
}
|
|
40
|
+
templater.global.newest = retag;
|
|
41
|
+
if (ownerTag.clones.length > preClones.length) {
|
|
42
|
+
const myClones = ownerTag.clones.filter(fClone => !preClones.find(clone => clone === fClone));
|
|
43
|
+
retag.clones.push(...myClones);
|
|
44
|
+
if (myClones.find(x => x === insertBefore)) {
|
|
45
|
+
throw new Error('way back here we add marker');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (ownerTag.childTags.find(x => x === retag)) {
|
|
49
|
+
throw new Error('about to reattach tag already present');
|
|
50
|
+
}
|
|
51
|
+
ownerTag.childTags.push(retag);
|
|
52
|
+
return retag;
|
|
45
53
|
}
|
|
46
54
|
//# sourceMappingURL=processSubjectComponent.function.js.map
|
|
@@ -1 +1 @@
|
|
|
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,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AAG,QAAQ,CAAC,CAAA;QAE9B,IAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,IAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;IAED,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAE9B,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { TagArraySubject } from './processTagArray';
|
|
2
|
-
import {
|
|
2
|
+
import { TemplaterResult } from './TemplaterResult.class';
|
|
3
|
+
import { Clones, InsertBefore } from './Clones.type';
|
|
3
4
|
import { Tag } from './Tag.class';
|
|
4
|
-
import { Counts
|
|
5
|
+
import { Counts } from './interpolateTemplate';
|
|
5
6
|
import { DisplaySubject, TagSubject } from './Tag.utils';
|
|
6
|
-
import { ValueSubject } from './ValueSubject';
|
|
7
|
+
import { ValueSubject } from './subject/ValueSubject';
|
|
7
8
|
import { Callback } from './bindSubjectCallback.function';
|
|
8
9
|
type processOptions = {
|
|
9
10
|
forceElement?: boolean;
|
|
@@ -13,13 +14,8 @@ export type ClonesAndPromise = {
|
|
|
13
14
|
clones: Clones;
|
|
14
15
|
};
|
|
15
16
|
export type InterpolateSubject = TagArraySubject | TagSubject | DisplaySubject | ValueSubject<Callback>;
|
|
16
|
-
export declare function processSubjectValue(value: any, subject: InterpolateSubject, // could be tag via result.tag
|
|
17
|
-
|
|
17
|
+
export declare function processSubjectValue(value: any | TemplaterResult, subject: InterpolateSubject, // could be tag via result.tag
|
|
18
|
+
insertBefore: InsertBefore, // <template end interpolate /> (will be removed)
|
|
18
19
|
ownerTag: Tag, // owner
|
|
19
20
|
options: processOptions): Clones | undefined;
|
|
20
|
-
/** Could be a regular tag or a component. Both are Tag.class */
|
|
21
|
-
export declare function processTag(tag: Tag, subject: TagSubject, // could be tag via result.tag
|
|
22
|
-
insertBefore: Element | Text | Template, // <template end interpolate /> (will be removed)
|
|
23
|
-
ownerTag: Tag): void;
|
|
24
|
-
export declare function applyFakeTemplater(tag: Tag, ownerTag: Tag, subject: TagSubject): void;
|
|
25
21
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { processSubjectComponent } from './processSubjectComponent.function';
|
|
2
2
|
import { isTagArray, isTagComponent, isTagInstance } from './isInstance';
|
|
3
3
|
import { processTagArray } from './processTagArray';
|
|
4
|
-
import { TagSupport } from './TagSupport.class';
|
|
5
|
-
import { ValueSubject } from './ValueSubject';
|
|
6
4
|
import { processRegularValue } from './processRegularValue.function';
|
|
5
|
+
import { processTag } from './processTag.function';
|
|
7
6
|
var ValueTypes;
|
|
8
7
|
(function (ValueTypes) {
|
|
9
8
|
ValueTypes["tag"] = "tag";
|
|
@@ -24,67 +23,20 @@ function getValueType(value) {
|
|
|
24
23
|
return ValueTypes.value;
|
|
25
24
|
}
|
|
26
25
|
export function processSubjectValue(value, subject, // could be tag via result.tag
|
|
27
|
-
|
|
26
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
28
27
|
ownerTag, // owner
|
|
29
28
|
options) {
|
|
30
29
|
const valueType = getValueType(value);
|
|
31
30
|
switch (valueType) {
|
|
32
31
|
case ValueTypes.tag:
|
|
33
|
-
processTag(value, subject,
|
|
32
|
+
processTag(value, subject, insertBefore, ownerTag);
|
|
34
33
|
return;
|
|
35
34
|
case ValueTypes.tagArray:
|
|
36
|
-
return processTagArray(subject, value,
|
|
35
|
+
return processTagArray(subject, value, insertBefore, ownerTag, options);
|
|
37
36
|
case ValueTypes.tagComponent:
|
|
38
|
-
processSubjectComponent(value, subject,
|
|
37
|
+
processSubjectComponent(value, subject, insertBefore, ownerTag, options);
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
41
|
-
processRegularValue(value, subject,
|
|
42
|
-
}
|
|
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) {
|
|
47
|
-
// first time seeing this tag?
|
|
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);
|
|
57
|
-
}
|
|
58
|
-
tag.ownerTag = ownerTag;
|
|
59
|
-
subject.template = insertBefore;
|
|
60
|
-
tag.buildBeforeElement(insertBefore, {
|
|
61
|
-
counts: { added: 0, removed: 0 },
|
|
62
|
-
forceElement: true, test: false,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
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;
|
|
77
|
-
}
|
|
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
|
-
};
|
|
40
|
+
processRegularValue(value, subject, insertBefore);
|
|
89
41
|
}
|
|
90
42
|
//# 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,oCAAoC,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,EAAmB,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
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;AAOpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,IAAK,UAKJ;AALD,WAAK,UAAU;IACb,yBAAW,CAAA;IACX,oCAAsB,CAAA;IACtB,4CAA8B,CAAA;IAC9B,6BAAe,CAAA;AACjB,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;AAED,SAAS,YAAY,CAAC,KAAU;IAC9B,IAAG,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC,YAAY,CAAA;IAChC,CAAC;IAED,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC,GAAG,CAAA;IACvB,CAAC;IAED,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,UAAU,CAAC,QAAQ,CAAA;IAC5B,CAAC;IAED,OAAO,UAAU,CAAC,KAAK,CAAA;AACzB,CAAC;AAcD,MAAM,UAAU,mBAAmB,CACjC,KAA4B,EAC5B,OAA2B,EAAE,8BAA8B;AAC3D,YAA0B,EAAE,iDAAiD;AAC7E,QAAa,EAAE,QAAQ;AACvB,OAAuB;IAEvB,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAErC,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,UAAU,CAAC,GAAG;YACjB,UAAU,CACR,KAAK,EACL,OAAqB,EACrB,YAAY,EACZ,QAAQ,CACT,CAAA;YACD,OAAM;QAER,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,eAAe,CACpB,OAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,OAAO,CACR,CAAA;QAEH,KAAK,UAAU,CAAC,YAAY;YAC1B,uBAAuB,CACrB,KAAwB,EACxB,OAAqB,EACrB,YAAY,EACZ,QAAQ,EACR,OAAO,CACR,CAAA;YACD,OAAM;IACV,CAAC;IAED,mBAAmB,CACjB,KAAK,EACL,OAAyB,EACzB,YAAY,CACb,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InsertBefore } from './Clones.type';
|
|
2
|
+
import { Tag } from './Tag.class';
|
|
3
|
+
import { TagSubject } from './Tag.utils';
|
|
4
|
+
/** Could be a regular tag or a component. Both are Tag.class */
|
|
5
|
+
export declare function processTag(tag: Tag, subject: TagSubject, // could be tag via result.tag
|
|
6
|
+
insertBefore: InsertBefore, ownerTag: Tag): void;
|
|
7
|
+
export declare function applyFakeTemplater(tag: Tag, ownerTag: Tag, subject: TagSubject): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isTagInstance } from './isInstance';
|
|
2
|
+
import { TagSupport } from './TagSupport.class';
|
|
3
|
+
import { ValueSubject } from './subject';
|
|
4
|
+
/** Could be a regular tag or a component. Both are Tag.class */
|
|
5
|
+
export function processTag(tag, subject, // could be tag via result.tag
|
|
6
|
+
insertBefore, ownerTag) {
|
|
7
|
+
// first time seeing this tag?
|
|
8
|
+
if (!tag.tagSupport) {
|
|
9
|
+
if (!isTagInstance(tag)) {
|
|
10
|
+
throw new Error('issue non-tag here');
|
|
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);
|
|
17
|
+
}
|
|
18
|
+
tag.ownerTag = ownerTag;
|
|
19
|
+
if (insertBefore.tagName !== 'TEMPLATE') {
|
|
20
|
+
throw new Error(`;;;; - ${insertBefore.nodeName}`);
|
|
21
|
+
}
|
|
22
|
+
tag.buildBeforeElement(insertBefore, {
|
|
23
|
+
counts: { added: 0, removed: 0 },
|
|
24
|
+
forceElement: true,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function applyFakeTemplater(tag, ownerTag, subject) {
|
|
28
|
+
if (!ownerTag) {
|
|
29
|
+
throw new Error('no owner error');
|
|
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;
|
|
37
|
+
// asking me to render will cause my parent to render
|
|
38
|
+
tag.ownerTag = ownerTag;
|
|
39
|
+
}
|
|
40
|
+
function getFakeTemplater() {
|
|
41
|
+
return {
|
|
42
|
+
global: {
|
|
43
|
+
renderCount: 0,
|
|
44
|
+
providers: [],
|
|
45
|
+
context: {},
|
|
46
|
+
subscriptions: [],
|
|
47
|
+
deleted: false,
|
|
48
|
+
newestTemplater: {},
|
|
49
|
+
},
|
|
50
|
+
children: new ValueSubject([]), // no children
|
|
51
|
+
props: {},
|
|
52
|
+
isTag: true,
|
|
53
|
+
isTemplater: false,
|
|
54
|
+
tagged: false,
|
|
55
|
+
wrapper: (() => undefined),
|
|
56
|
+
tagSupport: {},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=processTag.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processTag.function.js","sourceRoot":"","sources":["../ts/processTag.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAI5C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,gEAAgE;AAChE,MAAM,UAAU,UAAU,CACxB,GAAQ,EACR,OAAmB,EAAE,8BAA8B;AACnD,YAA0B,EAC1B,QAAa;IAEb,8BAA8B;IAC9B,IAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QACnB,IAAG,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACvC,CAAC;QAED,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;QAE1C,IAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAC9D,CAAC;QAED,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAU,CAAC,CAAA;IACrC,CAAC;IAED,GAAG,CAAC,QAAQ,GAAG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AK;QACb,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAuB;QAChD,UAAU,EAAE,EAAgB;KACV,CAAA;AACtB,CAAC"}
|
package/js/processTagArray.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { Clones } from './Clones.type';
|
|
1
|
+
import { Clones, InsertBefore } from './Clones.type';
|
|
2
2
|
import { Tag } from './Tag.class';
|
|
3
|
-
import { ValueSubject } from './ValueSubject';
|
|
4
|
-
import { Counts
|
|
3
|
+
import { ValueSubject } from './subject/ValueSubject';
|
|
4
|
+
import { Counts } from './interpolateTemplate';
|
|
5
5
|
export type LastArrayItem = {
|
|
6
6
|
tag: Tag;
|
|
7
7
|
index: number;
|
|
8
8
|
deleted?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type TagArraySubject = ValueSubject<Tag[]> & {
|
|
11
|
+
insertBefore: InsertBefore;
|
|
12
|
+
placeholderElm?: InsertBefore;
|
|
13
|
+
parentAsPlaceholder?: ParentNode;
|
|
11
14
|
lastArray?: LastArrayItem[];
|
|
12
|
-
template: Element | Text | Template;
|
|
13
15
|
isChildSubject?: boolean;
|
|
14
16
|
};
|
|
15
17
|
export declare function processTagArray(subject: TagArraySubject, value: Tag[], // arry of Tag classes
|
|
16
|
-
|
|
18
|
+
insertBefore: InsertBefore, // <template end interpolate />
|
|
17
19
|
ownerTag: Tag, options: {
|
|
18
20
|
counts: Counts;
|
|
19
21
|
forceElement?: boolean;
|
package/js/processTagArray.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { ValueSubject } from './ValueSubject';
|
|
1
|
+
import { ValueSubject } from './subject/ValueSubject';
|
|
2
2
|
import { ArrayNoKeyError } from './errors';
|
|
3
3
|
import { destroyArrayTag } from './checkDestroyPrevious.function';
|
|
4
|
-
import { applyFakeTemplater } from './
|
|
4
|
+
import { applyFakeTemplater } from './processTag.function';
|
|
5
|
+
import { insertAfter } from './insertAfter.function';
|
|
5
6
|
export function processTagArray(subject, value, // arry of Tag classes
|
|
6
|
-
|
|
7
|
+
insertBefore, // <template end interpolate />
|
|
7
8
|
ownerTag, options) {
|
|
8
9
|
const clones = ownerTag.clones; // []
|
|
9
10
|
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
10
|
-
subject.
|
|
11
|
+
if (subject.placeholderElm) {
|
|
12
|
+
const parentPlaceholder = subject.parentAsPlaceholder;
|
|
13
|
+
if (parentPlaceholder) {
|
|
14
|
+
parentPlaceholder.appendChild(insertBefore);
|
|
15
|
+
delete subject.placeholderElm;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
insertAfter(insertBefore, subject.placeholderElm);
|
|
19
|
+
}
|
|
20
|
+
delete subject.placeholderElm;
|
|
21
|
+
}
|
|
11
22
|
let removed = 0;
|
|
12
23
|
/** 🗑️ remove previous items first */
|
|
13
24
|
lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {
|
|
@@ -15,8 +26,9 @@ ownerTag, options) {
|
|
|
15
26
|
const at = index - removed;
|
|
16
27
|
const lessLength = newLength < at;
|
|
17
28
|
const subTag = value[index - removed];
|
|
18
|
-
const subArrayValue = subTag?.arrayValue;
|
|
19
|
-
const
|
|
29
|
+
const subArrayValue = subTag?.memory.arrayValue;
|
|
30
|
+
const tag = item.tag;
|
|
31
|
+
const destroyItem = lessLength || !areLikeValues(subArrayValue, tag.memory.arrayValue);
|
|
20
32
|
if (destroyItem) {
|
|
21
33
|
const last = lastArray[index];
|
|
22
34
|
const tag = last.tag;
|
|
@@ -29,7 +41,7 @@ ownerTag, options) {
|
|
|
29
41
|
return true;
|
|
30
42
|
});
|
|
31
43
|
// const masterBefore = template || (template as any).clone
|
|
32
|
-
const before =
|
|
44
|
+
const before = insertBefore; // || (subject.value as any).insertBefore || (insertBefore as any).clone
|
|
33
45
|
value.forEach((subTag, index) => {
|
|
34
46
|
const previous = lastArray[index];
|
|
35
47
|
const previousSupport = previous?.tag.tagSupport;
|
|
@@ -40,8 +52,8 @@ ownerTag, options) {
|
|
|
40
52
|
previousSupport.templater.global.newest = subTag;
|
|
41
53
|
}
|
|
42
54
|
// check for html``.key()
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
55
|
+
const keySet = 'arrayValue' in subTag.memory;
|
|
56
|
+
if (!keySet) {
|
|
45
57
|
const details = {
|
|
46
58
|
template: subTag.getTemplate().string,
|
|
47
59
|
array: value,
|
|
@@ -54,23 +66,46 @@ ownerTag, options) {
|
|
|
54
66
|
}
|
|
55
67
|
const couldBeSame = lastArray.length > index;
|
|
56
68
|
if (couldBeSame) {
|
|
57
|
-
const
|
|
69
|
+
const prevSupport = previous.tag.tagSupport;
|
|
70
|
+
const prevGlobal = prevSupport.templater.global;
|
|
71
|
+
const isSame = areLikeValues(previous.tag.memory.arrayValue, subTag.memory.arrayValue);
|
|
58
72
|
if (isSame) {
|
|
59
|
-
subTag.tagSupport = subTag.tagSupport ||
|
|
60
|
-
const oldest =
|
|
73
|
+
subTag.tagSupport = subTag.tagSupport || prevSupport;
|
|
74
|
+
const oldest = prevGlobal.oldest;
|
|
61
75
|
oldest.updateByTag(subTag);
|
|
62
76
|
return [];
|
|
63
77
|
}
|
|
64
|
-
|
|
78
|
+
// TODO: should not get here?
|
|
79
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray);
|
|
65
80
|
throw new Error('item should be back');
|
|
66
81
|
// return [] // removed: item should have been previously deleted and will be added back
|
|
67
82
|
}
|
|
68
|
-
processAddTagArrayItem(before, subTag, index, options, lastArray
|
|
83
|
+
processAddTagArrayItem(before, subTag, index, options, lastArray);
|
|
69
84
|
ownerTag.childTags.push(subTag);
|
|
70
85
|
});
|
|
86
|
+
if (value.length) {
|
|
87
|
+
const lastClone = insertBefore.previousSibling;
|
|
88
|
+
setPlaceholderElm(lastClone, insertBefore, subject);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const placeholderElm = insertBefore.previousSibling;
|
|
92
|
+
if (placeholderElm) {
|
|
93
|
+
setPlaceholderElm(placeholderElm, insertBefore, subject);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const parentNode = insertBefore.parentNode;
|
|
97
|
+
setPlaceholderElm(parentNode, insertBefore, subject);
|
|
98
|
+
subject.parentAsPlaceholder = parentNode;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
71
101
|
return clones;
|
|
72
102
|
}
|
|
73
|
-
function
|
|
103
|
+
function setPlaceholderElm(lastClone, insertBefore, subject) {
|
|
104
|
+
subject.placeholderElm = lastClone;
|
|
105
|
+
const parentNode = insertBefore.parentNode;
|
|
106
|
+
parentNode.removeChild(insertBefore);
|
|
107
|
+
}
|
|
108
|
+
function processAddTagArrayItem(before, subTag, index, options, lastArray) {
|
|
74
109
|
const lastValue = {
|
|
75
110
|
tag: subTag, index
|
|
76
111
|
};
|
|
@@ -80,11 +115,13 @@ function processAddTagArrayItem(before, subTag, index, options, lastArray, test)
|
|
|
80
115
|
added: options.counts.added + index,
|
|
81
116
|
removed: options.counts.removed,
|
|
82
117
|
};
|
|
83
|
-
|
|
84
|
-
if (!lastFirstChild.parentNode) {
|
|
118
|
+
if (!before.parentNode) {
|
|
85
119
|
throw new Error('issue adding array item');
|
|
86
120
|
}
|
|
87
|
-
|
|
121
|
+
const newTempElm = document.createElement('template');
|
|
122
|
+
before.parentNode.insertBefore(newTempElm, before);
|
|
123
|
+
subTag.buildBeforeElement(newTempElm, // before,
|
|
124
|
+
{ counts, forceElement: options.forceElement });
|
|
88
125
|
}
|
|
89
126
|
/** compare two values. If both values are arrays then the items will be compared */
|
|
90
127
|
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,YAA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AM,CAAC,OAAO;KAChC,CAAA;IAED,IAAG,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;IACrD,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAElD,MAAM,CAAC,kBAAkB,CACvB,UAAU,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"}
|
|
@@ -3,7 +3,7 @@ import { Counts, Template } from './interpolateTemplate';
|
|
|
3
3
|
import { TagArraySubject } from './processTagArray';
|
|
4
4
|
import { TagSubject } from './Tag.utils';
|
|
5
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 />
|
|
6
|
+
insertBefore: Element | Text | Template | ChildNode, // <template end interpolate />
|
|
7
7
|
{ counts, forceElement, }: {
|
|
8
8
|
counts: Counts;
|
|
9
9
|
forceElement?: boolean;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { destroyTagMemory } from './destroyTag.function';
|
|
2
1
|
export function processTagResult(tag, subject, // used for recording past and current value
|
|
3
2
|
insertBefore, // <template end interpolate />
|
|
4
3
|
{ counts, forceElement, }) {
|
|
@@ -10,41 +9,36 @@ insertBefore, // <template end interpolate />
|
|
|
10
9
|
const existingTag = subjectTag.tag;
|
|
11
10
|
const previousTag = existingTag?.tagSupport.templater.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
|
|
12
11
|
const justUpdate = previousTag; // && !forceElement
|
|
13
|
-
if (previousTag) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
|
40
|
-
}
|
|
41
|
-
destroyTagMemory(previousTag, subject);
|
|
42
|
-
throw new Error('585 - think we never get here');
|
|
12
|
+
if (previousTag && justUpdate) {
|
|
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)
|
|
43
19
|
}
|
|
20
|
+
*/
|
|
21
|
+
return processTagResultUpdate(tag, subjectTag, previousTag);
|
|
22
|
+
}
|
|
23
|
+
if (insertBefore.nodeName !== 'TEMPLATE') {
|
|
24
|
+
throw new Error(';;;;');
|
|
44
25
|
}
|
|
45
26
|
tag.buildBeforeElement(insertBefore, {
|
|
46
27
|
counts,
|
|
47
|
-
forceElement,
|
|
28
|
+
forceElement,
|
|
48
29
|
});
|
|
49
30
|
}
|
|
31
|
+
function processTagResultUpdate(tag, subject, // used for recording past and current value
|
|
32
|
+
previousTag) {
|
|
33
|
+
// components
|
|
34
|
+
if (subject instanceof Function) {
|
|
35
|
+
const newTag = subject(previousTag.tagSupport);
|
|
36
|
+
previousTag.updateByTag(newTag);
|
|
37
|
+
subject.tag = newTag;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
previousTag.updateByTag(tag);
|
|
41
|
+
subject.tag = tag;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
50
44
|
//# 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":"AAKA,MAAM,UAAU,gBAAgB,CAC9B,GAAQ,EACR,OAAgD,EAAE,4CAA4C;AAC9F,YAAmD,EAAE,+BAA+B;AACpF,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,GAAG,WAAW,CAAA,CAAC,mBAAmB;IAElD,IAAG,WAAW,IAAI,UAAU,EAAE,CAAC;QAC7B;;;;;;;UAOE;QACF,OAAO,sBAAsB,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,CAAC,CAAA;IAC7D,CAAC;IAED,IAAG,YAAY,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IACD,GAAG,CAAC,kBAAkB,CAAC,YAAY,EAAE;QACnC,MAAM;QACN,YAAY;KACb,CAAC,CAAA;AACJ,CAAC;AAGD,SAAS,sBAAsB,CAC7B,GAAQ,EACR,OAAmB,EAAE,4CAA4C;AACjE,WAAgB;IAEhB,aAAa;IACb,IAAG,OAAO,YAAY,QAAQ,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAQ,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;QACnD,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QAC/B,OAAO,CAAC,GAAG,GAAG,MAAM,CAAA;QAEpB,OAAM;IACR,CAAC;IAED,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAC5B,OAAO,CAAC,GAAG,GAAG,GAAG,CAAA;IAEjB,OAAM;AACR,CAAC"}
|
package/js/render.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { InsertBefore } from "./Clones.type";
|
|
2
|
+
export declare function buildClones(temporary: Element, insertBefore: InsertBefore): ChildNode[];
|
package/js/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../ts/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../ts/render.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CACzB,SAAkB,EAClB,YAA0B;IAE1B,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAwB,CAAA;IAC7D,IAAI,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;IAE7C,OAAO,WAAW,EAAE,CAAC;QACnB,MAAM,eAAe,GAAG,WAAW,CAAC,WAAW,CAAA;QAC/C,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;QACvC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACxB,WAAW,GAAG,eAAe,CAAA;IAC/B,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,YAAY,CACnB,WAAsB,EACtB,YAA0B;IAE1B,MAAM,UAAU,GAAG,YAAY,CAAC,UAAwB,CAAA;IACxD,UAAU,CAAC,YAAY,CACrB,WAAW,EACX,YAAY,CACb,CAAA;AACH,CAAC"}
|