taggedjs 2.5.9 → 2.5.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 +413 -339
- package/bundle.js.map +1 -1
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/alterProps.function.js +13 -16
- package/js/alterProps.function.js.map +1 -1
- package/js/interpolations/afterInterpolateElement.function.d.ts +1 -1
- package/js/interpolations/afterInterpolateElement.function.js +5 -2
- package/js/interpolations/afterInterpolateElement.function.js.map +1 -1
- package/js/interpolations/inputAttribute.js +6 -3
- package/js/interpolations/inputAttribute.js.map +1 -1
- package/js/interpolations/interpolateAttributes.js +3 -7
- package/js/interpolations/interpolateAttributes.js.map +1 -1
- package/js/interpolations/interpolateContentTemplates.d.ts +1 -1
- package/js/interpolations/interpolateContentTemplates.js +10 -12
- package/js/interpolations/interpolateContentTemplates.js.map +1 -1
- package/js/interpolations/interpolateElement.d.ts +1 -3
- package/js/interpolations/interpolateElement.js +5 -4
- package/js/interpolations/interpolateElement.js.map +1 -1
- package/js/interpolations/interpolateTemplate.d.ts +2 -5
- package/js/interpolations/interpolateTemplate.js +8 -12
- package/js/interpolations/interpolateTemplate.js.map +1 -1
- package/js/interpolations/processAttribute.function.js +6 -5
- package/js/interpolations/processAttribute.function.js.map +1 -1
- package/js/isInstance.d.ts +1 -1
- package/js/isInstance.js +4 -3
- package/js/isInstance.js.map +1 -1
- package/js/render.d.ts +1 -1
- package/js/render.js.map +1 -1
- package/js/state/provider.utils.js +14 -7
- package/js/state/provider.utils.js.map +1 -1
- package/js/state/state.utils.js +11 -7
- package/js/state/state.utils.js.map +1 -1
- package/js/state/syncStates.function.js +3 -2
- package/js/state/syncStates.function.js.map +1 -1
- package/js/subject/Subject.class.js +6 -4
- package/js/subject/Subject.class.js.map +1 -1
- package/js/subject/subject.utils.js +4 -2
- package/js/subject/subject.utils.js.map +1 -1
- package/js/tag/Tag.class.d.ts +1 -2
- package/js/tag/Tag.class.js.map +1 -1
- package/js/tag/TagSupport.class.d.ts +0 -3
- package/js/tag/TagSupport.class.js +32 -41
- package/js/tag/TagSupport.class.js.map +1 -1
- package/js/tag/checkDestroyPrevious.function.d.ts +3 -2
- package/js/tag/checkDestroyPrevious.function.js +22 -9
- package/js/tag/checkDestroyPrevious.function.js.map +1 -1
- package/js/tag/destroy.support.js.map +1 -1
- package/js/tag/tag.js +10 -6
- package/js/tag/tag.js.map +1 -1
- package/js/tag/tagElement.js.map +1 -1
- package/js/tag/tagRunner.js +20 -5
- package/js/tag/tagRunner.js.map +1 -1
- package/js/tag/update/processFirstSubject.utils.d.ts +34 -0
- package/js/tag/update/processFirstSubject.utils.js +48 -0
- package/js/tag/update/processFirstSubject.utils.js.map +1 -0
- package/js/tag/update/processFirstSubjectValue.function.d.ts +7 -0
- package/js/tag/update/processFirstSubjectValue.function.js +31 -0
- package/js/tag/update/processFirstSubjectValue.function.js.map +1 -0
- package/js/tag/update/processNewValue.function.d.ts +2 -2
- package/js/tag/update/processNewValue.function.js +16 -24
- package/js/tag/update/processNewValue.function.js.map +1 -1
- package/js/tag/update/processRegularValue.function.d.ts +2 -0
- package/js/tag/update/processRegularValue.function.js +17 -2
- package/js/tag/update/processRegularValue.function.js.map +1 -1
- package/js/tag/update/processSubjectComponent.function.d.ts +0 -1
- package/js/tag/update/processSubjectComponent.function.js +1 -1
- package/js/tag/update/processSubjectComponent.function.js.map +1 -1
- package/js/tag/update/processSubjectValue.function.d.ts +3 -23
- package/js/tag/update/processSubjectValue.function.js +1 -25
- package/js/tag/update/processSubjectValue.function.js.map +1 -1
- package/js/tag/update/processTag.function.js +0 -1
- package/js/tag/update/processTag.function.js.map +1 -1
- package/js/tag/update/processTagArray.d.ts +0 -1
- package/js/tag/update/processTagArray.js +7 -6
- package/js/tag/update/processTagArray.js.map +1 -1
- package/js/tag/update/processTagResult.function.d.ts +1 -2
- package/js/tag/update/processTagResult.function.js +3 -4
- package/js/tag/update/processTagResult.function.js.map +1 -1
- package/js/tag/update/updateContextItem.function.d.ts +1 -1
- package/js/tag/update/updateExistingTagComponent.function.js +9 -11
- package/js/tag/update/updateExistingTagComponent.function.js.map +1 -1
- package/js/tag/update/updateExistingValue.function.d.ts +1 -1
- package/js/tag/update/updateExistingValue.function.js +36 -47
- package/js/tag/update/updateExistingValue.function.js.map +1 -1
- package/js/updateBeforeTemplate.function.d.ts +5 -1
- package/js/updateBeforeTemplate.function.js +10 -7
- package/js/updateBeforeTemplate.function.js.map +1 -1
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -73,23 +73,20 @@ function resetFunctionProps(newProps, ownerSupport) {
|
|
|
73
73
|
}
|
|
74
74
|
// BELOW: Do not clone because if first argument is object, the memory ref back is lost
|
|
75
75
|
// const newProps = {...props}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return; // already previously converted
|
|
81
|
-
}
|
|
82
|
-
newProps[name] = (...args) => {
|
|
83
|
-
return newProps[name].toCall(...args); // what gets called can switch over parent state changes
|
|
84
|
-
};
|
|
85
|
-
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
86
|
-
newProps[name].toCall = (...args) => {
|
|
87
|
-
return callbackPropOwner(value, args, ownerSupport);
|
|
88
|
-
};
|
|
89
|
-
newProps[name].original = value;
|
|
90
|
-
return;
|
|
76
|
+
for (const name in newProps) {
|
|
77
|
+
const value = newProps[name];
|
|
78
|
+
if (!(value instanceof Function)) {
|
|
79
|
+
continue;
|
|
91
80
|
}
|
|
92
|
-
|
|
81
|
+
const toCall = newProps[name].toCall;
|
|
82
|
+
if (toCall) {
|
|
83
|
+
continue; // already previously converted
|
|
84
|
+
}
|
|
85
|
+
newProps[name] = (...args) => newProps[name].toCall(...args); // what gets called can switch over parent state changes
|
|
86
|
+
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
87
|
+
newProps[name].toCall = (...args) => callbackPropOwner(value, args, ownerSupport);
|
|
88
|
+
newProps[name].original = value;
|
|
89
|
+
}
|
|
93
90
|
return newProps;
|
|
94
91
|
}
|
|
95
92
|
function callbackPropOwner(toCall, callWith, ownerSupport) {
|
|
@@ -333,8 +330,11 @@ function afterInterpolateElement(container, insertBefore, tagSupport, context, o
|
|
|
333
330
|
if (!clones.length) {
|
|
334
331
|
return clones;
|
|
335
332
|
}
|
|
336
|
-
|
|
337
|
-
|
|
333
|
+
for (let index = clones.length - 1; index >= 0; --index) {
|
|
334
|
+
const clone = clones[index];
|
|
335
|
+
(0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_1__.afterElmBuild)(clone, options, context, tagSupport);
|
|
336
|
+
tagSupport.clones.push(clone);
|
|
337
|
+
}
|
|
338
338
|
return clones;
|
|
339
339
|
}
|
|
340
340
|
|
|
@@ -451,12 +451,15 @@ function inputAttribute(name, value, element) {
|
|
|
451
451
|
if (names[0] === 'class') {
|
|
452
452
|
names.shift();
|
|
453
453
|
if (value) {
|
|
454
|
-
|
|
454
|
+
for (let index = 0; index < names.length; ++index) {
|
|
455
|
+
element.classList.add(names[index]);
|
|
456
|
+
}
|
|
455
457
|
}
|
|
456
458
|
else {
|
|
457
|
-
|
|
459
|
+
for (let index = 0; index < names.length; ++index) {
|
|
460
|
+
element.classList.remove(names[index]);
|
|
461
|
+
}
|
|
458
462
|
}
|
|
459
|
-
return;
|
|
460
463
|
}
|
|
461
464
|
}
|
|
462
465
|
|
|
@@ -479,24 +482,20 @@ function howToSetAttribute(element, name, value) {
|
|
|
479
482
|
element.setAttribute(name, value);
|
|
480
483
|
}
|
|
481
484
|
function howToSetInputValue(element, name, value) {
|
|
482
|
-
/*
|
|
483
|
-
if((element as any)[name] === value) {
|
|
484
|
-
return // its already the value we are setting
|
|
485
|
-
}
|
|
486
|
-
*/
|
|
487
485
|
element[name] = value;
|
|
488
486
|
}
|
|
489
487
|
function interpolateAttributes(child, scope, ownerSupport) {
|
|
490
488
|
const attrNames = child.getAttributeNames();
|
|
491
489
|
let howToSet = howToSetAttribute;
|
|
492
|
-
attrNames.
|
|
490
|
+
for (let index = 0; index < attrNames.length; ++index) {
|
|
491
|
+
const attrName = attrNames[index];
|
|
493
492
|
if (child.nodeName === 'INPUT' && attrName === 'value') {
|
|
494
493
|
howToSet = howToSetInputValue;
|
|
495
494
|
}
|
|
496
495
|
const value = child.getAttribute(attrName);
|
|
497
496
|
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)(attrName, value, child, scope, ownerSupport, howToSet);
|
|
498
497
|
howToSet = howToSetAttribute; // put back
|
|
499
|
-
}
|
|
498
|
+
}
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
|
|
@@ -514,25 +513,23 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
514
513
|
/* harmony export */ });
|
|
515
514
|
/* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
|
|
516
515
|
|
|
517
|
-
function interpolateContentTemplates(
|
|
518
|
-
if (!children || element.tagName === 'TEMPLATE') {
|
|
519
|
-
return { clones: [], tagComponents: [] }; // done
|
|
520
|
-
}
|
|
516
|
+
function interpolateContentTemplates(context, tagSupport, options, children) {
|
|
521
517
|
// counting for animation stagger computing
|
|
522
518
|
const counts = options.counts;
|
|
523
519
|
const clones = [];
|
|
524
520
|
const tagComponents = [];
|
|
525
|
-
const
|
|
526
|
-
|
|
521
|
+
const childLength = children.length;
|
|
522
|
+
for (let index = childLength - 1; index >= 0; --index) {
|
|
523
|
+
const child = children[index];
|
|
527
524
|
const { clones: nextClones, tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(child, context, tagSupport, counts, options);
|
|
528
525
|
clones.push(...nextClones);
|
|
529
526
|
if (tagComponent) {
|
|
530
527
|
tagComponents.push(tagComponent);
|
|
531
|
-
|
|
528
|
+
continue;
|
|
532
529
|
}
|
|
533
530
|
if (child.children) {
|
|
534
|
-
|
|
535
|
-
|
|
531
|
+
for (let index = child.children.length - 1; index >= 0; --index) {
|
|
532
|
+
const subChild = child.children[index];
|
|
536
533
|
// IF <template end /> its a variable to be processed
|
|
537
534
|
if (isRenderEndTemplate(subChild)) {
|
|
538
535
|
const { tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(subChild, context, tagSupport, counts, options);
|
|
@@ -540,12 +537,12 @@ function interpolateContentTemplates(element, context, tagSupport, options, chil
|
|
|
540
537
|
tagComponents.push(tagComponent);
|
|
541
538
|
}
|
|
542
539
|
}
|
|
543
|
-
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(
|
|
540
|
+
const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(context, tagSupport, options, subChild.children);
|
|
544
541
|
clones.push(...nextClones);
|
|
545
542
|
tagComponents.push(...nextTagComponent);
|
|
546
|
-
}
|
|
543
|
+
}
|
|
547
544
|
}
|
|
548
|
-
}
|
|
545
|
+
}
|
|
549
546
|
return { clones, tagComponents };
|
|
550
547
|
}
|
|
551
548
|
function isRenderEndTemplate(child) {
|
|
@@ -587,21 +584,22 @@ interpolatedTemplates, ownerSupport, options) {
|
|
|
587
584
|
const template = container.children[0];
|
|
588
585
|
const children = template.content.children;
|
|
589
586
|
if (result.keys.length) {
|
|
590
|
-
const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(
|
|
587
|
+
const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(context, ownerSupport, options, children);
|
|
591
588
|
clones.push(...nextClones);
|
|
592
589
|
tagComponents.push(...nextTagComponents);
|
|
593
590
|
}
|
|
594
|
-
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(
|
|
591
|
+
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(template, context, ownerSupport);
|
|
595
592
|
processChildrenAttributes(children, context, ownerSupport);
|
|
596
593
|
return { clones, tagComponents };
|
|
597
594
|
}
|
|
598
595
|
function processChildrenAttributes(children, context, ownerSupport) {
|
|
599
|
-
|
|
596
|
+
for (let index = children.length - 1; index >= 0; --index) {
|
|
597
|
+
const child = children[index];
|
|
600
598
|
(0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context, ownerSupport);
|
|
601
599
|
if (child.children) {
|
|
602
600
|
processChildrenAttributes(child.children, context, ownerSupport);
|
|
603
601
|
}
|
|
604
|
-
}
|
|
602
|
+
}
|
|
605
603
|
}
|
|
606
604
|
function interpolateString(string) {
|
|
607
605
|
const result = (0,_interpolations__WEBPACK_IMPORTED_MODULE_1__.interpolateToTemplates)(string);
|
|
@@ -626,7 +624,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
626
624
|
/* harmony export */ });
|
|
627
625
|
/* harmony import */ var _tag_Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tag/Tag.class */ "./ts/tag/Tag.class.ts");
|
|
628
626
|
/* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/interpolations/elementInitCheck.ts");
|
|
629
|
-
/* harmony import */ var
|
|
627
|
+
/* harmony import */ var _tag_update_processFirstSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tag/update/processFirstSubjectValue.function */ "./ts/tag/update/processFirstSubjectValue.function.ts");
|
|
630
628
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../isInstance */ "./ts/isInstance.ts");
|
|
631
629
|
/* harmony import */ var _scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scanTextAreaValue.function */ "./ts/interpolations/scanTextAreaValue.function.ts");
|
|
632
630
|
/* harmony import */ var _tag_update_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tag/update/updateExistingValue.function */ "./ts/tag/update/updateExistingValue.function.ts");
|
|
@@ -666,12 +664,10 @@ options) {
|
|
|
666
664
|
}
|
|
667
665
|
};
|
|
668
666
|
}
|
|
669
|
-
|
|
670
|
-
subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts, { isForceElement });
|
|
667
|
+
subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts);
|
|
671
668
|
return { clones };
|
|
672
669
|
}
|
|
673
|
-
function subscribeToTemplate(insertBefore, subject, ownerSupport, counts
|
|
674
|
-
{ isForceElement }) {
|
|
670
|
+
function subscribeToTemplate(insertBefore, subject, ownerSupport, counts) {
|
|
675
671
|
let called = false;
|
|
676
672
|
const onValue = (value) => {
|
|
677
673
|
if (called) {
|
|
@@ -679,13 +675,9 @@ function subscribeToTemplate(insertBefore, subject, ownerSupport, counts, // use
|
|
|
679
675
|
return;
|
|
680
676
|
}
|
|
681
677
|
const templater = value;
|
|
682
|
-
(0,
|
|
678
|
+
(0,_tag_update_processFirstSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processFirstSubjectValue)(templater, subject, insertBefore, ownerSupport, {
|
|
683
679
|
counts: { ...counts },
|
|
684
|
-
forceElement: isForceElement,
|
|
685
680
|
});
|
|
686
|
-
if (isForceElement) {
|
|
687
|
-
isForceElement = false; // only can happen once
|
|
688
|
-
}
|
|
689
681
|
called = true;
|
|
690
682
|
};
|
|
691
683
|
let mutatingCallback = onValue;
|
|
@@ -716,13 +708,15 @@ function afterElmBuild(elm, options, context, ownerSupport) {
|
|
|
716
708
|
let diff = options.counts.added;
|
|
717
709
|
diff = (0,_elementInitCheck__WEBPACK_IMPORTED_MODULE_1__.elementInitCheck)(elm, options.counts) - diff;
|
|
718
710
|
if (elm.children) {
|
|
719
|
-
|
|
711
|
+
const children = elm.children;
|
|
712
|
+
for (let index = children.length - 1; index >= 0; --index) {
|
|
713
|
+
const child = children[index];
|
|
720
714
|
const subOptions = {
|
|
721
715
|
...options,
|
|
722
716
|
counts: options.counts,
|
|
723
717
|
};
|
|
724
718
|
return afterElmBuild(child, subOptions, context, ownerSupport);
|
|
725
|
-
}
|
|
719
|
+
}
|
|
726
720
|
}
|
|
727
721
|
}
|
|
728
722
|
|
|
@@ -820,7 +814,9 @@ function processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet
|
|
|
820
814
|
child.removeAttribute(lastValue);
|
|
821
815
|
}
|
|
822
816
|
else if (lastValue instanceof Object) {
|
|
823
|
-
|
|
817
|
+
for (const name in lastValue) {
|
|
818
|
+
child.removeAttribute(name);
|
|
819
|
+
}
|
|
824
820
|
}
|
|
825
821
|
}
|
|
826
822
|
if (typeof (attrValue) === 'string') {
|
|
@@ -831,20 +827,19 @@ function processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet
|
|
|
831
827
|
return;
|
|
832
828
|
}
|
|
833
829
|
if (attrValue instanceof Object) {
|
|
834
|
-
|
|
835
|
-
|
|
830
|
+
for (const name in attrValue) {
|
|
831
|
+
processNameValueAttr(name, attrValue[name], child, ownerSupport, howToSet);
|
|
832
|
+
}
|
|
836
833
|
}
|
|
837
834
|
}
|
|
838
835
|
function processNameValueAttr(attrName, result, child, ownerSupport, howToSet) {
|
|
839
836
|
const isSpecial = isSpecialAttr(attrName);
|
|
840
|
-
// attach as callback?
|
|
841
837
|
if (result instanceof Function) {
|
|
842
838
|
const action = function (...args) {
|
|
843
839
|
const result2 = result(child, args);
|
|
844
840
|
return result2;
|
|
845
841
|
};
|
|
846
842
|
child[attrName].action = action;
|
|
847
|
-
// child.addEventListener(attrName, action)
|
|
848
843
|
}
|
|
849
844
|
// Most every variable comes in here since everything is made a ValueSubject
|
|
850
845
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(result)) {
|
|
@@ -944,9 +939,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
944
939
|
/* harmony export */ isTagComponent: () => (/* binding */ isTagComponent),
|
|
945
940
|
/* harmony export */ isTagTemplater: () => (/* binding */ isTagTemplater)
|
|
946
941
|
/* harmony export */ });
|
|
947
|
-
function isTagComponent(value) {
|
|
948
|
-
return value?.wrapper?.parentWrap.original instanceof Function;
|
|
949
|
-
}
|
|
950
942
|
function isTag(value) {
|
|
951
943
|
return isTagTemplater(value) || isTagClass(value);
|
|
952
944
|
}
|
|
@@ -954,6 +946,10 @@ function isTagTemplater(value) {
|
|
|
954
946
|
const templater = value;
|
|
955
947
|
return templater?.isTemplater === true && templater.wrapper === undefined;
|
|
956
948
|
}
|
|
949
|
+
// TODO: whats the difference between isTagClass and isTagComponent
|
|
950
|
+
function isTagComponent(value) {
|
|
951
|
+
return value?.wrapper?.parentWrap.original instanceof Function;
|
|
952
|
+
}
|
|
957
953
|
function isTagClass(value) {
|
|
958
954
|
const templater = value;
|
|
959
955
|
return templater?.isTagClass === true;
|
|
@@ -1336,25 +1332,29 @@ function providersChangeCheck(tagSupport) {
|
|
|
1336
1332
|
const global = tagSupport.global;
|
|
1337
1333
|
const providersWithChanges = global.providers.filter(provider => !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(provider.instance, provider.clone));
|
|
1338
1334
|
// reset clones
|
|
1339
|
-
providersWithChanges.
|
|
1335
|
+
for (let index = providersWithChanges.length - 1; index >= 0; --index) {
|
|
1336
|
+
const provider = providersWithChanges[index];
|
|
1340
1337
|
const appSupport = tagSupport.getAppTagSupport();
|
|
1341
1338
|
handleProviderChanges(appSupport, provider);
|
|
1342
1339
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
1343
|
-
}
|
|
1340
|
+
}
|
|
1344
1341
|
}
|
|
1345
1342
|
function handleProviderChanges(appSupport, provider) {
|
|
1346
1343
|
const tagsWithProvider = getTagsWithProvider(appSupport, provider);
|
|
1347
|
-
tagsWithProvider.
|
|
1344
|
+
for (let index = tagsWithProvider.length - 1; index >= 0; --index) {
|
|
1345
|
+
const { tagSupport, renderCount, provider } = tagsWithProvider[index];
|
|
1348
1346
|
if (tagSupport.global.deleted) {
|
|
1349
|
-
|
|
1347
|
+
continue; // i was deleted after another tag processed
|
|
1350
1348
|
}
|
|
1351
1349
|
const notRendered = renderCount === tagSupport.global.renderCount;
|
|
1352
1350
|
if (notRendered) {
|
|
1353
1351
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
1354
|
-
|
|
1352
|
+
(0,_tag_render_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tagSupport, false);
|
|
1353
|
+
continue;
|
|
1355
1354
|
}
|
|
1356
|
-
}
|
|
1355
|
+
}
|
|
1357
1356
|
}
|
|
1357
|
+
/** Updates and returns memory of tag providers */
|
|
1358
1358
|
function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
1359
1359
|
const global = tagSupport.global;
|
|
1360
1360
|
const compare = global.providers;
|
|
@@ -1366,7 +1366,10 @@ function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
|
1366
1366
|
provider: hasProvider,
|
|
1367
1367
|
});
|
|
1368
1368
|
}
|
|
1369
|
-
tagSupport.childTags
|
|
1369
|
+
const childTags = tagSupport.childTags;
|
|
1370
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
1371
|
+
getTagsWithProvider(childTags[index], provider, memory);
|
|
1372
|
+
}
|
|
1370
1373
|
return memory;
|
|
1371
1374
|
}
|
|
1372
1375
|
|
|
@@ -1610,7 +1613,6 @@ const beforeRender = (tagSupport) => initState(tagSupport);
|
|
|
1610
1613
|
beforeRedraw: beforeRender,
|
|
1611
1614
|
afterRender: (tagSupport) => {
|
|
1612
1615
|
const memory = tagSupport.memory;
|
|
1613
|
-
// const state: State = memory.state
|
|
1614
1616
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
1615
1617
|
const rearray = config.rearray;
|
|
1616
1618
|
if (rearray.length) {
|
|
@@ -1627,13 +1629,15 @@ const beforeRender = (tagSupport) => initState(tagSupport);
|
|
|
1627
1629
|
throw error;
|
|
1628
1630
|
}
|
|
1629
1631
|
}
|
|
1630
|
-
const cTagConfig = config.tagSupport;
|
|
1631
1632
|
delete config.rearray; // clean up any previous runs
|
|
1632
1633
|
delete config.tagSupport;
|
|
1633
1634
|
memory.state.length = 0;
|
|
1634
1635
|
memory.state.push(...config.array);
|
|
1635
|
-
|
|
1636
|
-
|
|
1636
|
+
const state = memory.state;
|
|
1637
|
+
for (let index = state.length - 1; index >= 0; --index) {
|
|
1638
|
+
const item = state[index];
|
|
1639
|
+
item.lastValue = getStateValue(item); // set last values
|
|
1640
|
+
}
|
|
1637
1641
|
config.array = [];
|
|
1638
1642
|
}
|
|
1639
1643
|
});
|
|
@@ -1659,15 +1663,18 @@ function initState(tagSupport) {
|
|
|
1659
1663
|
const memory = tagSupport.memory;
|
|
1660
1664
|
const state = memory.state;
|
|
1661
1665
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
1662
|
-
// TODO:
|
|
1666
|
+
// TODO: The following two blocks of code are state protects, have a production mode that removes this checks
|
|
1663
1667
|
/*
|
|
1664
1668
|
if (config.rearray) {
|
|
1665
1669
|
checkStateMismatch(tagSupport, config, state)
|
|
1666
1670
|
}
|
|
1667
1671
|
*/
|
|
1668
1672
|
config.rearray = [];
|
|
1669
|
-
|
|
1670
|
-
|
|
1673
|
+
const stateLength = state?.length;
|
|
1674
|
+
if (stateLength) {
|
|
1675
|
+
for (let index = 0; index < stateLength; ++index) {
|
|
1676
|
+
getStateValue(state[index]);
|
|
1677
|
+
}
|
|
1671
1678
|
config.rearray.push(...state);
|
|
1672
1679
|
}
|
|
1673
1680
|
config.tagSupport = tagSupport;
|
|
@@ -1764,14 +1771,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1764
1771
|
/* harmony export */ syncStates: () => (/* binding */ syncStates)
|
|
1765
1772
|
/* harmony export */ });
|
|
1766
1773
|
function syncStates(stateFrom, stateTo) {
|
|
1767
|
-
stateFrom.
|
|
1774
|
+
for (let index = stateFrom.length - 1; index >= 0; --index) {
|
|
1775
|
+
const state = stateFrom[index];
|
|
1768
1776
|
const fromValue = state.get();
|
|
1769
1777
|
const callback = stateTo[index].callback;
|
|
1770
1778
|
if (callback) {
|
|
1771
1779
|
callback(fromValue); // set the value
|
|
1772
1780
|
}
|
|
1773
1781
|
stateTo[index].lastValue = fromValue; // record the value
|
|
1774
|
-
}
|
|
1782
|
+
}
|
|
1775
1783
|
}
|
|
1776
1784
|
|
|
1777
1785
|
|
|
@@ -1970,15 +1978,17 @@ class Subject {
|
|
|
1970
1978
|
set(value) {
|
|
1971
1979
|
this.value = value;
|
|
1972
1980
|
// Notify all subscribers with the new value
|
|
1973
|
-
this.subscribers
|
|
1974
|
-
|
|
1981
|
+
const subs = [...this.subscribers]; // subs may change as we call callbacks
|
|
1982
|
+
const length = subs.length;
|
|
1983
|
+
for (let index = 0; index < length; ++index) {
|
|
1984
|
+
const sub = subs[index];
|
|
1975
1985
|
sub.callback(value, sub);
|
|
1976
|
-
}
|
|
1986
|
+
}
|
|
1977
1987
|
}
|
|
1978
1988
|
// next() is available for rxjs compatibility
|
|
1979
1989
|
next = this.set;
|
|
1980
1990
|
toPromise() {
|
|
1981
|
-
return new Promise(
|
|
1991
|
+
return new Promise(res => {
|
|
1982
1992
|
this.subscribe((x, subscription) => {
|
|
1983
1993
|
subscription.unsubscribe();
|
|
1984
1994
|
res(x);
|
|
@@ -2155,7 +2165,10 @@ function getSubscription(subject, callback) {
|
|
|
2155
2165
|
// any double unsubscribes will be ignored
|
|
2156
2166
|
subscription.unsubscribe = () => subscription;
|
|
2157
2167
|
// unsubscribe from any combined subjects
|
|
2158
|
-
|
|
2168
|
+
const subscriptions = subscription.subscriptions;
|
|
2169
|
+
for (let index = subscriptions.length - 1; index >= 0; --index) {
|
|
2170
|
+
subscriptions[index].unsubscribe();
|
|
2171
|
+
}
|
|
2159
2172
|
return subscription;
|
|
2160
2173
|
};
|
|
2161
2174
|
subscription.add = (sub) => {
|
|
@@ -2175,7 +2188,6 @@ function runPipedMethods(value, methods, onComplete) {
|
|
|
2175
2188
|
return runPipedMethods(newValue, cloneMethods, onComplete);
|
|
2176
2189
|
}
|
|
2177
2190
|
onComplete(newValue);
|
|
2178
|
-
// return newValue = next
|
|
2179
2191
|
};
|
|
2180
2192
|
let handler = next;
|
|
2181
2193
|
const setHandler = (x) => handler = x;
|
|
@@ -2302,8 +2314,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2302
2314
|
/* harmony import */ var _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../interpolations/interpolateElement */ "./ts/interpolations/interpolateElement.ts");
|
|
2303
2315
|
/* harmony import */ var _interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../interpolations/interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
|
|
2304
2316
|
/* harmony import */ var _interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../interpolations/afterInterpolateElement.function */ "./ts/interpolations/afterInterpolateElement.function.ts");
|
|
2305
|
-
/* harmony import */ var _render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./render/renderSubjectComponent.function */ "./ts/tag/render/renderSubjectComponent.function.ts");
|
|
2306
|
-
|
|
2307
2317
|
|
|
2308
2318
|
|
|
2309
2319
|
|
|
@@ -2327,7 +2337,6 @@ class BaseTagSupport {
|
|
|
2327
2337
|
appElement; // only seen on this.getAppTagSupport().appElement
|
|
2328
2338
|
strings;
|
|
2329
2339
|
values;
|
|
2330
|
-
lastTemplateString = undefined; // used to compare templates for updates
|
|
2331
2340
|
propsConfig;
|
|
2332
2341
|
// stays with current render
|
|
2333
2342
|
memory = {
|
|
@@ -2362,7 +2371,6 @@ class BaseTagSupport {
|
|
|
2362
2371
|
}
|
|
2363
2372
|
/** Function that kicks off actually putting tags down as HTML elements */
|
|
2364
2373
|
buildBeforeElement(insertBefore, options = {
|
|
2365
|
-
forceElement: false,
|
|
2366
2374
|
counts: { added: 0, removed: 0 },
|
|
2367
2375
|
}) {
|
|
2368
2376
|
const subject = this.subject;
|
|
@@ -2378,24 +2386,24 @@ class BaseTagSupport {
|
|
|
2378
2386
|
this.hasLiveElements = true;
|
|
2379
2387
|
const context = this.update();
|
|
2380
2388
|
const template = this.getTemplate();
|
|
2381
|
-
const
|
|
2382
|
-
const
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
elementContainer.innerHTML = `<template id="temp-template-tag-wrap">${template.string}</template>`;
|
|
2389
|
+
const elementContainer = document.createDocumentFragment();
|
|
2390
|
+
const tempDraw = document.createElement('template');
|
|
2391
|
+
tempDraw.innerHTML = template.string;
|
|
2392
|
+
elementContainer.appendChild(tempDraw);
|
|
2386
2393
|
// Search/replace innerHTML variables but don't interpolate tag components just yet
|
|
2387
2394
|
const { tagComponents } = (0,_interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__.interpolateElement)(elementContainer, context, template, this, // ownerSupport,
|
|
2388
2395
|
{
|
|
2389
|
-
forceElement: options.forceElement,
|
|
2390
2396
|
counts: options.counts
|
|
2391
2397
|
});
|
|
2392
2398
|
(0,_interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, placeholderElm, this, // ownerSupport
|
|
2393
2399
|
context, options);
|
|
2394
2400
|
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
2395
|
-
tagComponents.
|
|
2396
|
-
|
|
2401
|
+
const length = tagComponents.length;
|
|
2402
|
+
for (let index = 0; index < length; ++index) {
|
|
2403
|
+
const tagComponent = tagComponents[index];
|
|
2404
|
+
(0,_interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts);
|
|
2397
2405
|
(0,_interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, tagComponent.insertBefore, tagComponent.ownerSupport, context, options);
|
|
2398
|
-
}
|
|
2406
|
+
}
|
|
2399
2407
|
}
|
|
2400
2408
|
getTemplate() {
|
|
2401
2409
|
const thisTag = this.templater.tag;
|
|
@@ -2408,7 +2416,6 @@ class BaseTagSupport {
|
|
|
2408
2416
|
return trimString;
|
|
2409
2417
|
}).join('');
|
|
2410
2418
|
const interpolation = (0,_interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__.interpolateString)(string);
|
|
2411
|
-
this.lastTemplateString = interpolation.string;
|
|
2412
2419
|
return {
|
|
2413
2420
|
interpolation,
|
|
2414
2421
|
string: interpolation.string,
|
|
@@ -2425,19 +2432,19 @@ class BaseTagSupport {
|
|
|
2425
2432
|
const strings = this.strings || thisTag.strings;
|
|
2426
2433
|
const values = this.values || thisTag.values;
|
|
2427
2434
|
strings.map((_string, index) => {
|
|
2428
|
-
const variableName = _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix + index;
|
|
2429
2435
|
const hasValue = values.length > index;
|
|
2436
|
+
if (!hasValue) {
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
const variableName = _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix + index;
|
|
2430
2440
|
const value = values[index];
|
|
2431
2441
|
// is something already there?
|
|
2432
2442
|
const exists = variableName in context;
|
|
2433
2443
|
if (exists) {
|
|
2434
2444
|
return (0,_update_updateContextItem_function__WEBPACK_IMPORTED_MODULE_8__.updateContextItem)(context, variableName, value);
|
|
2435
2445
|
}
|
|
2436
|
-
if (!hasValue) {
|
|
2437
|
-
return;
|
|
2438
|
-
}
|
|
2439
2446
|
// 🆕 First time values below
|
|
2440
|
-
context[variableName] = (0,_update_processNewValue_function__WEBPACK_IMPORTED_MODULE_9__.processNewValue)(
|
|
2447
|
+
context[variableName] = (0,_update_processNewValue_function__WEBPACK_IMPORTED_MODULE_9__.processNewValue)(value, this);
|
|
2441
2448
|
});
|
|
2442
2449
|
return context;
|
|
2443
2450
|
}
|
|
@@ -2468,15 +2475,17 @@ class TagSupport extends BaseTagSupport {
|
|
|
2468
2475
|
if (firstDestroy && (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(this.templater)) {
|
|
2469
2476
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_5__.runBeforeDestroy)(this, this);
|
|
2470
2477
|
}
|
|
2478
|
+
this.destroySubscriptions();
|
|
2471
2479
|
// signify immediately child has been deleted (looked for during event processing)
|
|
2472
|
-
childTags.
|
|
2480
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
2481
|
+
const child = childTags[index];
|
|
2473
2482
|
const subGlobal = child.global;
|
|
2474
2483
|
delete subGlobal.newest;
|
|
2475
2484
|
subGlobal.deleted = true;
|
|
2476
2485
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(child.templater)) {
|
|
2477
2486
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_5__.runBeforeDestroy)(child, child);
|
|
2478
2487
|
}
|
|
2479
|
-
}
|
|
2488
|
+
}
|
|
2480
2489
|
// HTML DOM manipulation. Put back down the template tag
|
|
2481
2490
|
const insertBefore = global.insertBefore;
|
|
2482
2491
|
if (insertBefore.nodeName === 'TEMPLATE') {
|
|
@@ -2487,7 +2496,6 @@ class TagSupport extends BaseTagSupport {
|
|
|
2487
2496
|
}
|
|
2488
2497
|
}
|
|
2489
2498
|
}
|
|
2490
|
-
this.destroySubscriptions();
|
|
2491
2499
|
let mainPromise;
|
|
2492
2500
|
if (this.ownerTagSupport) {
|
|
2493
2501
|
this.ownerTagSupport.childTags = this.ownerTagSupport.childTags.filter(child => child !== this);
|
|
@@ -2523,9 +2531,11 @@ class TagSupport extends BaseTagSupport {
|
|
|
2523
2531
|
return mainPromise.then(() => options.stagger);
|
|
2524
2532
|
}
|
|
2525
2533
|
destroySubscriptions() {
|
|
2526
|
-
const
|
|
2527
|
-
|
|
2528
|
-
|
|
2534
|
+
const subs = this.global.subscriptions;
|
|
2535
|
+
for (let index = subs.length - 1; index >= 0; --index) {
|
|
2536
|
+
subs[index].unsubscribe();
|
|
2537
|
+
}
|
|
2538
|
+
subs.length = 0;
|
|
2529
2539
|
}
|
|
2530
2540
|
destroyClones({ stagger } = {
|
|
2531
2541
|
stagger: 0,
|
|
@@ -2533,13 +2543,15 @@ class TagSupport extends BaseTagSupport {
|
|
|
2533
2543
|
const oldClones = [...this.clones];
|
|
2534
2544
|
this.clones.length = 0; // tag maybe used for something else
|
|
2535
2545
|
const promises = oldClones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises
|
|
2546
|
+
// check subjects that may have clones attached to them
|
|
2536
2547
|
const oldContext = this.global.context;
|
|
2537
|
-
|
|
2548
|
+
for (const name in oldContext) {
|
|
2549
|
+
const value = oldContext[name];
|
|
2538
2550
|
const clone = value.clone;
|
|
2539
|
-
if (clone
|
|
2551
|
+
if (clone?.parentNode) {
|
|
2540
2552
|
clone.parentNode.removeChild(clone);
|
|
2541
2553
|
}
|
|
2542
|
-
}
|
|
2554
|
+
}
|
|
2543
2555
|
if (promises.length) {
|
|
2544
2556
|
return { promise: Promise.all(promises), stagger };
|
|
2545
2557
|
}
|
|
@@ -2583,19 +2595,6 @@ class TagSupport extends BaseTagSupport {
|
|
|
2583
2595
|
this.values = values;
|
|
2584
2596
|
return this.updateContext(this.global.context);
|
|
2585
2597
|
}
|
|
2586
|
-
/** Used during HMR only where static content itself could have been edited */
|
|
2587
|
-
async rebuild() {
|
|
2588
|
-
delete this.strings; // seek the templater strings instead now
|
|
2589
|
-
delete this.values; // seek the templater strings instead now
|
|
2590
|
-
restoreTagMarkers(this);
|
|
2591
|
-
const newSupport = (0,_render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_14__.renderSubjectComponent)(this.subject, this, this.ownerTagSupport);
|
|
2592
|
-
await this.destroy();
|
|
2593
|
-
newSupport.buildBeforeElement(this.global.insertBefore, {
|
|
2594
|
-
forceElement: true,
|
|
2595
|
-
counts: { added: 0, removed: 0 },
|
|
2596
|
-
});
|
|
2597
|
-
return newSupport;
|
|
2598
|
-
}
|
|
2599
2598
|
getAppTagSupport() {
|
|
2600
2599
|
let tag = this;
|
|
2601
2600
|
while (tag.ownerTagSupport) {
|
|
@@ -2606,7 +2605,10 @@ class TagSupport extends BaseTagSupport {
|
|
|
2606
2605
|
}
|
|
2607
2606
|
function restoreTagMarkers(support) {
|
|
2608
2607
|
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_4__.restoreTagMarker)(support);
|
|
2609
|
-
|
|
2608
|
+
const childTags = support.childTags;
|
|
2609
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
2610
|
+
restoreTagMarkers(childTags[index].global.oldest);
|
|
2611
|
+
}
|
|
2610
2612
|
}
|
|
2611
2613
|
|
|
2612
2614
|
|
|
@@ -2622,6 +2624,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2622
2624
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2623
2625
|
/* harmony export */ checkDestroyPrevious: () => (/* binding */ checkDestroyPrevious),
|
|
2624
2626
|
/* harmony export */ destroyArrayTag: () => (/* binding */ destroyArrayTag),
|
|
2627
|
+
/* harmony export */ isSimpleType: () => (/* binding */ isSimpleType),
|
|
2625
2628
|
/* harmony export */ restoreTagMarker: () => (/* binding */ restoreTagMarker)
|
|
2626
2629
|
/* harmony export */ });
|
|
2627
2630
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../isInstance */ "./ts/isInstance.ts");
|
|
@@ -2634,6 +2637,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2634
2637
|
|
|
2635
2638
|
function checkDestroyPrevious(subject, // existing.value is the old value
|
|
2636
2639
|
newValue, insertBefore) {
|
|
2640
|
+
const displaySubject = subject;
|
|
2641
|
+
const hasLastValue = 'lastValue' in displaySubject;
|
|
2642
|
+
const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue
|
|
2643
|
+
// was simple value but now something bigger
|
|
2644
|
+
if (hasLastValue && lastValue !== newValue) {
|
|
2645
|
+
const newType = typeof (newValue);
|
|
2646
|
+
if (isSimpleType(newType) && typeof (lastValue) === newType) {
|
|
2647
|
+
return false;
|
|
2648
|
+
}
|
|
2649
|
+
if (newValue instanceof Function && lastValue instanceof Function) {
|
|
2650
|
+
return false;
|
|
2651
|
+
}
|
|
2652
|
+
destroySimpleValue(insertBefore, displaySubject);
|
|
2653
|
+
return 'changed-simple-value';
|
|
2654
|
+
}
|
|
2637
2655
|
const arraySubject = subject;
|
|
2638
2656
|
const wasArray = arraySubject.lastArray;
|
|
2639
2657
|
// no longer an array
|
|
@@ -2642,7 +2660,10 @@ newValue, insertBefore) {
|
|
|
2642
2660
|
delete arraySubject.lastArray;
|
|
2643
2661
|
delete arraySubject.placeholder;
|
|
2644
2662
|
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_3__.insertAfter)(insertBefore, placeholderElm);
|
|
2645
|
-
|
|
2663
|
+
for (let index = wasArray.length - 1; index >= 0; --index) {
|
|
2664
|
+
const { tagSupport } = wasArray[index];
|
|
2665
|
+
destroyArrayTag(tagSupport, { added: 0, removed: 0 });
|
|
2666
|
+
}
|
|
2646
2667
|
return 'array';
|
|
2647
2668
|
}
|
|
2648
2669
|
const tagSubject = subject;
|
|
@@ -2672,16 +2693,11 @@ newValue, insertBefore) {
|
|
|
2672
2693
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(lastSupport);
|
|
2673
2694
|
return 'different-tag';
|
|
2674
2695
|
}
|
|
2675
|
-
const displaySubject = subject;
|
|
2676
|
-
const hasLastValue = 'lastValue' in displaySubject;
|
|
2677
|
-
const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue
|
|
2678
|
-
// was simple value but now something bigger
|
|
2679
|
-
if (hasLastValue && lastValue !== newValue) {
|
|
2680
|
-
destroySimpleValue(insertBefore, displaySubject);
|
|
2681
|
-
return 'changed-simple-value';
|
|
2682
|
-
}
|
|
2683
2696
|
return false;
|
|
2684
2697
|
}
|
|
2698
|
+
function isSimpleType(value) {
|
|
2699
|
+
return ['string', 'number', 'boolean'].includes(value);
|
|
2700
|
+
}
|
|
2685
2701
|
function destroyArrayTag(tagSupport, counts) {
|
|
2686
2702
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagSupportPast)(tagSupport);
|
|
2687
2703
|
tagSupport.destroy({
|
|
@@ -3426,14 +3442,18 @@ function getTagWrap(templater, result) {
|
|
|
3426
3442
|
};
|
|
3427
3443
|
tagSupport.memory = newTagSupport.memory; // state handover
|
|
3428
3444
|
if (templater.madeChildIntoSubject) {
|
|
3429
|
-
childSubject.value
|
|
3430
|
-
|
|
3445
|
+
const value = childSubject.value;
|
|
3446
|
+
for (let index = value.length - 1; index >= 0; --index) {
|
|
3447
|
+
const kid = value[index];
|
|
3448
|
+
const values = kid.values;
|
|
3449
|
+
for (let index = values.length - 1; index >= 0; --index) {
|
|
3450
|
+
const value = values[index];
|
|
3431
3451
|
if (!(value instanceof Function)) {
|
|
3432
|
-
|
|
3452
|
+
continue;
|
|
3433
3453
|
}
|
|
3434
3454
|
const valuesValue = kid.values[index];
|
|
3435
3455
|
if (valuesValue.isChildOverride) {
|
|
3436
|
-
|
|
3456
|
+
continue; // already overwritten
|
|
3437
3457
|
}
|
|
3438
3458
|
// all functions need to report to me
|
|
3439
3459
|
kid.values[index] = function (...args) {
|
|
@@ -3443,8 +3463,8 @@ function getTagWrap(templater, result) {
|
|
|
3443
3463
|
args);
|
|
3444
3464
|
};
|
|
3445
3465
|
valuesValue.isChildOverride = true;
|
|
3446
|
-
}
|
|
3447
|
-
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3448
3468
|
}
|
|
3449
3469
|
return tagSupport;
|
|
3450
3470
|
};
|
|
@@ -3551,7 +3571,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3551
3571
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../state */ "./ts/state/index.ts");
|
|
3552
3572
|
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../subject */ "./ts/subject/index.ts");
|
|
3553
3573
|
/* harmony import */ var _getSupportInCycle_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getSupportInCycle.function */ "./ts/tag/getSupportInCycle.function.ts");
|
|
3554
|
-
// TODO: This should be more like `new TaggedJs().use({})`
|
|
3555
3574
|
|
|
3556
3575
|
|
|
3557
3576
|
|
|
@@ -3563,20 +3582,149 @@ _state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.tagClosed$ = new _subject__WEB
|
|
|
3563
3582
|
});
|
|
3564
3583
|
// Life cycle 1
|
|
3565
3584
|
function runBeforeRender(tagSupport, ownerSupport) {
|
|
3566
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse
|
|
3585
|
+
const tagUse = _state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse;
|
|
3586
|
+
const length = tagUse.length;
|
|
3587
|
+
for (let index = 0; index < length; ++index) {
|
|
3588
|
+
tagUse[index].beforeRender(tagSupport, ownerSupport);
|
|
3589
|
+
}
|
|
3567
3590
|
}
|
|
3568
3591
|
// Life cycle 2
|
|
3569
3592
|
function runAfterRender(tagSupport, ownerTagSupport) {
|
|
3570
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse
|
|
3593
|
+
const tagUse = _state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse;
|
|
3594
|
+
const length = tagUse.length;
|
|
3595
|
+
for (let index = 0; index < length; ++index) {
|
|
3596
|
+
tagUse[index].afterRender(tagSupport, ownerTagSupport);
|
|
3597
|
+
}
|
|
3571
3598
|
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.tagClosed$.next(ownerTagSupport);
|
|
3572
3599
|
}
|
|
3573
3600
|
// Life cycle 3
|
|
3574
3601
|
function runBeforeRedraw(tagSupport, ownerTagSupport) {
|
|
3575
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse
|
|
3602
|
+
const tagUse = _state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse;
|
|
3603
|
+
const length = tagUse.length;
|
|
3604
|
+
for (let index = 0; index < length; ++index) {
|
|
3605
|
+
tagUse[index].beforeRedraw(tagSupport, ownerTagSupport);
|
|
3606
|
+
}
|
|
3576
3607
|
}
|
|
3577
3608
|
// Life cycle 4 - end of life
|
|
3578
3609
|
function runBeforeDestroy(tagSupport, ownerTagSupport) {
|
|
3579
|
-
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse
|
|
3610
|
+
const tagUse = _state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse;
|
|
3611
|
+
const length = tagUse.length;
|
|
3612
|
+
for (let index = 0; index < length; ++index) {
|
|
3613
|
+
tagUse[index].beforeDestroy(tagSupport, ownerTagSupport);
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
|
|
3618
|
+
/***/ }),
|
|
3619
|
+
|
|
3620
|
+
/***/ "./ts/tag/update/processFirstSubject.utils.ts":
|
|
3621
|
+
/*!****************************************************!*\
|
|
3622
|
+
!*** ./ts/tag/update/processFirstSubject.utils.ts ***!
|
|
3623
|
+
\****************************************************/
|
|
3624
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3625
|
+
|
|
3626
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3627
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3628
|
+
/* harmony export */ ValueTypes: () => (/* binding */ ValueTypes),
|
|
3629
|
+
/* harmony export */ getValueType: () => (/* binding */ getValueType)
|
|
3630
|
+
/* harmony export */ });
|
|
3631
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
|
|
3632
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../checkDestroyPrevious.function */ "./ts/tag/checkDestroyPrevious.function.ts");
|
|
3633
|
+
|
|
3634
|
+
|
|
3635
|
+
var ValueTypes;
|
|
3636
|
+
(function (ValueTypes) {
|
|
3637
|
+
ValueTypes["unknown"] = "unknown";
|
|
3638
|
+
ValueTypes["tag"] = "tag";
|
|
3639
|
+
ValueTypes["templater"] = "templater";
|
|
3640
|
+
ValueTypes["tagArray"] = "tag-array";
|
|
3641
|
+
ValueTypes["tagComponent"] = "tag-component";
|
|
3642
|
+
ValueTypes["subject"] = "subject";
|
|
3643
|
+
ValueTypes["date"] = "date";
|
|
3644
|
+
ValueTypes["string"] = "string";
|
|
3645
|
+
ValueTypes["boolean"] = "boolean";
|
|
3646
|
+
ValueTypes["function"] = "function";
|
|
3647
|
+
ValueTypes["undefined"] = "undefined";
|
|
3648
|
+
})(ValueTypes || (ValueTypes = {}));
|
|
3649
|
+
function getValueType(value) {
|
|
3650
|
+
if (value === undefined || value === null) {
|
|
3651
|
+
return ValueTypes.undefined;
|
|
3652
|
+
}
|
|
3653
|
+
if (value instanceof Date) {
|
|
3654
|
+
return ValueTypes.date;
|
|
3655
|
+
}
|
|
3656
|
+
if (value instanceof Function) {
|
|
3657
|
+
return ValueTypes.function;
|
|
3658
|
+
}
|
|
3659
|
+
const type = typeof (value);
|
|
3660
|
+
if ((0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_1__.isSimpleType)(type)) {
|
|
3661
|
+
return type;
|
|
3662
|
+
}
|
|
3663
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagComponent)(value)) {
|
|
3664
|
+
return ValueTypes.tagComponent;
|
|
3665
|
+
}
|
|
3666
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagTemplater)(value)) {
|
|
3667
|
+
return ValueTypes.templater;
|
|
3668
|
+
}
|
|
3669
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagClass)(value)) {
|
|
3670
|
+
return ValueTypes.tag;
|
|
3671
|
+
}
|
|
3672
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(value)) {
|
|
3673
|
+
return ValueTypes.tagArray;
|
|
3674
|
+
}
|
|
3675
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isSubjectInstance)(value)) {
|
|
3676
|
+
return ValueTypes.subject;
|
|
3677
|
+
}
|
|
3678
|
+
return ValueTypes.unknown;
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
|
|
3682
|
+
/***/ }),
|
|
3683
|
+
|
|
3684
|
+
/***/ "./ts/tag/update/processFirstSubjectValue.function.ts":
|
|
3685
|
+
/*!************************************************************!*\
|
|
3686
|
+
!*** ./ts/tag/update/processFirstSubjectValue.function.ts ***!
|
|
3687
|
+
\************************************************************/
|
|
3688
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3689
|
+
|
|
3690
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3691
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3692
|
+
/* harmony export */ processFirstSubjectValue: () => (/* binding */ processFirstSubjectValue)
|
|
3693
|
+
/* harmony export */ });
|
|
3694
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
|
|
3695
|
+
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
|
|
3696
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
|
|
3697
|
+
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTag.function */ "./ts/tag/update/processTag.function.ts");
|
|
3698
|
+
/* harmony import */ var _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processFirstSubject.utils */ "./ts/tag/update/processFirstSubject.utils.ts");
|
|
3699
|
+
|
|
3700
|
+
|
|
3701
|
+
|
|
3702
|
+
|
|
3703
|
+
|
|
3704
|
+
function processFirstSubjectValue(value, subject, // could be tag via result.tag
|
|
3705
|
+
insertBefore, // <template end interpolate /> (will be removed)
|
|
3706
|
+
ownerSupport, // owner
|
|
3707
|
+
options) {
|
|
3708
|
+
const valueType = (0,_processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.getValueType)(value);
|
|
3709
|
+
switch (valueType) {
|
|
3710
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.templater:
|
|
3711
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.processTag)(value, insertBefore, ownerSupport, subject);
|
|
3712
|
+
return;
|
|
3713
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.tag:
|
|
3714
|
+
const tag = value;
|
|
3715
|
+
let templater = tag.templater;
|
|
3716
|
+
if (!templater) {
|
|
3717
|
+
templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.tagFakeTemplater)(tag);
|
|
3718
|
+
}
|
|
3719
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.processTag)(templater, insertBefore, ownerSupport, subject);
|
|
3720
|
+
return;
|
|
3721
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.tagArray:
|
|
3722
|
+
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_1__.processTagArray)(subject, value, insertBefore, ownerSupport, options);
|
|
3723
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.tagComponent:
|
|
3724
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore, ownerSupport, options);
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_2__.processFirstRegularValue)(value, subject, insertBefore);
|
|
3580
3728
|
}
|
|
3581
3729
|
|
|
3582
3730
|
|
|
@@ -3593,35 +3741,27 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3593
3741
|
/* harmony export */ processNewValue: () => (/* binding */ processNewValue)
|
|
3594
3742
|
/* harmony export */ });
|
|
3595
3743
|
/* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
|
|
3596
|
-
/* harmony import */ var
|
|
3597
|
-
/* harmony import */ var
|
|
3598
|
-
/* harmony import */ var
|
|
3744
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
3745
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../TagSupport.class */ "./ts/tag/TagSupport.class.ts");
|
|
3746
|
+
/* harmony import */ var _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processFirstSubject.utils */ "./ts/tag/update/processFirstSubject.utils.ts");
|
|
3599
3747
|
|
|
3600
3748
|
|
|
3601
3749
|
|
|
3602
3750
|
|
|
3603
|
-
function processNewValue(
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
return processNewTag(tag, ownerSupport);
|
|
3618
|
-
}
|
|
3619
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(value)) {
|
|
3620
|
-
return processNewTag(value, ownerSupport);
|
|
3621
|
-
}
|
|
3622
|
-
// is already a value subject?
|
|
3623
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
3624
|
-
return value;
|
|
3751
|
+
function processNewValue(value, ownerSupport) {
|
|
3752
|
+
const valueType = (0,_processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.getValueType)(value);
|
|
3753
|
+
switch (valueType) {
|
|
3754
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tagComponent:
|
|
3755
|
+
const tagSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
3756
|
+
return tagSubject;
|
|
3757
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.templater:
|
|
3758
|
+
const templater = value;
|
|
3759
|
+
const tag = templater.tag;
|
|
3760
|
+
return processNewTag(tag, ownerSupport);
|
|
3761
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tag:
|
|
3762
|
+
return processNewTag(value, ownerSupport);
|
|
3763
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.subject:
|
|
3764
|
+
return value;
|
|
3625
3765
|
}
|
|
3626
3766
|
return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
|
|
3627
3767
|
}
|
|
@@ -3629,12 +3769,12 @@ function processNewTag(value, ownerSupport) {
|
|
|
3629
3769
|
const tag = value;
|
|
3630
3770
|
let templater = tag.templater;
|
|
3631
3771
|
if (!templater) {
|
|
3632
|
-
templater = new
|
|
3772
|
+
templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.TemplaterResult([]);
|
|
3633
3773
|
templater.tag = tag;
|
|
3634
3774
|
tag.templater = templater;
|
|
3635
3775
|
}
|
|
3636
3776
|
const subject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(templater);
|
|
3637
|
-
|
|
3777
|
+
subject.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_2__.TagSupport(templater, ownerSupport, subject);
|
|
3638
3778
|
return subject;
|
|
3639
3779
|
}
|
|
3640
3780
|
|
|
@@ -3649,6 +3789,7 @@ function processNewTag(value, ownerSupport) {
|
|
|
3649
3789
|
|
|
3650
3790
|
__webpack_require__.r(__webpack_exports__);
|
|
3651
3791
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3792
|
+
/* harmony export */ processFirstRegularValue: () => (/* binding */ processFirstRegularValue),
|
|
3652
3793
|
/* harmony export */ processRegularValue: () => (/* binding */ processRegularValue)
|
|
3653
3794
|
/* harmony export */ });
|
|
3654
3795
|
/* harmony import */ var _updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../updateBeforeTemplate.function */ "./ts/updateBeforeTemplate.function.ts");
|
|
@@ -3662,10 +3803,25 @@ insertBefore) {
|
|
|
3662
3803
|
return; // no need to update display, its the same
|
|
3663
3804
|
}
|
|
3664
3805
|
subject.lastValue = value;
|
|
3806
|
+
const castedValue = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.castTextValue)(value);
|
|
3807
|
+
// replace existing string?
|
|
3808
|
+
const oldClone = subject.clone;
|
|
3809
|
+
if (oldClone) {
|
|
3810
|
+
oldClone.textContent = castedValue;
|
|
3811
|
+
return;
|
|
3812
|
+
}
|
|
3665
3813
|
// Processing of regular values
|
|
3666
|
-
const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(
|
|
3814
|
+
const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(castedValue, before);
|
|
3667
3815
|
subject.clone = clone; // remember single element put down, for future updates
|
|
3668
3816
|
}
|
|
3817
|
+
function processFirstRegularValue(value, subject, // could be tag via subject.tag
|
|
3818
|
+
insertBefore) {
|
|
3819
|
+
subject.lastValue = value;
|
|
3820
|
+
const castedValue = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.castTextValue)(value);
|
|
3821
|
+
// Processing of regular values
|
|
3822
|
+
const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(castedValue, insertBefore);
|
|
3823
|
+
subject.clone = clone; // remember single element put down, for future updates
|
|
3824
|
+
}
|
|
3669
3825
|
|
|
3670
3826
|
|
|
3671
3827
|
/***/ }),
|
|
@@ -3708,7 +3864,7 @@ function processSubjectComponent(templater, subject, insertBefore, ownerSupport,
|
|
|
3708
3864
|
global.insertBefore = insertBefore;
|
|
3709
3865
|
const providers = _state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.providerConfig;
|
|
3710
3866
|
providers.ownerSupport = ownerSupport;
|
|
3711
|
-
const isRender = !reSupport
|
|
3867
|
+
const isRender = !reSupport;
|
|
3712
3868
|
if (isRender) {
|
|
3713
3869
|
const support = reSupport || tagSupport;
|
|
3714
3870
|
reSupport = (0,_render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_3__.renderSubjectComponent)(subject, support, ownerSupport);
|
|
@@ -3720,79 +3876,6 @@ function processSubjectComponent(templater, subject, insertBefore, ownerSupport,
|
|
|
3720
3876
|
}
|
|
3721
3877
|
|
|
3722
3878
|
|
|
3723
|
-
/***/ }),
|
|
3724
|
-
|
|
3725
|
-
/***/ "./ts/tag/update/processSubjectValue.function.ts":
|
|
3726
|
-
/*!*******************************************************!*\
|
|
3727
|
-
!*** ./ts/tag/update/processSubjectValue.function.ts ***!
|
|
3728
|
-
\*******************************************************/
|
|
3729
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3730
|
-
|
|
3731
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3732
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3733
|
-
/* harmony export */ processSubjectValue: () => (/* binding */ processSubjectValue)
|
|
3734
|
-
/* harmony export */ });
|
|
3735
|
-
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
|
|
3736
|
-
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
|
|
3737
|
-
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
|
|
3738
|
-
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
|
|
3739
|
-
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processTag.function */ "./ts/tag/update/processTag.function.ts");
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
var ValueTypes;
|
|
3746
|
-
(function (ValueTypes) {
|
|
3747
|
-
ValueTypes["tag"] = "tag";
|
|
3748
|
-
ValueTypes["templater"] = "templater";
|
|
3749
|
-
ValueTypes["tagArray"] = "tag-array";
|
|
3750
|
-
ValueTypes["tagComponent"] = "tag-component";
|
|
3751
|
-
ValueTypes["value"] = "value";
|
|
3752
|
-
})(ValueTypes || (ValueTypes = {}));
|
|
3753
|
-
function getValueType(value) {
|
|
3754
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
|
|
3755
|
-
return ValueTypes.tagComponent;
|
|
3756
|
-
}
|
|
3757
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagTemplater)(value)) {
|
|
3758
|
-
return ValueTypes.templater;
|
|
3759
|
-
}
|
|
3760
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(value)) {
|
|
3761
|
-
return ValueTypes.tag;
|
|
3762
|
-
}
|
|
3763
|
-
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
3764
|
-
return ValueTypes.tagArray;
|
|
3765
|
-
}
|
|
3766
|
-
return ValueTypes.value;
|
|
3767
|
-
}
|
|
3768
|
-
// export type ExistingValue = TemplaterResult | Tag[] | TagSupport | Function | Subject<unknown> | RegularValue | Tag
|
|
3769
|
-
function processSubjectValue(value, subject, // could be tag via result.tag
|
|
3770
|
-
insertBefore, // <template end interpolate /> (will be removed)
|
|
3771
|
-
ownerSupport, // owner
|
|
3772
|
-
options) {
|
|
3773
|
-
const valueType = getValueType(value);
|
|
3774
|
-
switch (valueType) {
|
|
3775
|
-
case ValueTypes.templater:
|
|
3776
|
-
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(value, insertBefore, ownerSupport, subject);
|
|
3777
|
-
return;
|
|
3778
|
-
case ValueTypes.tag:
|
|
3779
|
-
const tag = value;
|
|
3780
|
-
let templater = tag.templater;
|
|
3781
|
-
if (!templater) {
|
|
3782
|
-
templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.tagFakeTemplater)(tag);
|
|
3783
|
-
}
|
|
3784
|
-
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(templater, insertBefore, ownerSupport, subject);
|
|
3785
|
-
return;
|
|
3786
|
-
case ValueTypes.tagArray:
|
|
3787
|
-
return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, insertBefore, ownerSupport, options);
|
|
3788
|
-
case ValueTypes.tagComponent:
|
|
3789
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore, ownerSupport, options);
|
|
3790
|
-
return;
|
|
3791
|
-
}
|
|
3792
|
-
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__.processRegularValue)(value, subject, insertBefore);
|
|
3793
|
-
}
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
3879
|
/***/ }),
|
|
3797
3880
|
|
|
3798
3881
|
/***/ "./ts/tag/update/processTag.function.ts":
|
|
@@ -3826,7 +3909,6 @@ subject) {
|
|
|
3826
3909
|
tagSupport.ownerTagSupport = ownerSupport;
|
|
3827
3910
|
tagSupport.buildBeforeElement(insertBefore, {
|
|
3828
3911
|
counts: { added: 0, removed: 0 },
|
|
3829
|
-
forceElement: true,
|
|
3830
3912
|
});
|
|
3831
3913
|
}
|
|
3832
3914
|
function setupNewTemplater(tagSupport, ownerSupport, subject) {
|
|
@@ -3914,7 +3996,9 @@ ownerSupport, options) {
|
|
|
3914
3996
|
}
|
|
3915
3997
|
return true;
|
|
3916
3998
|
});
|
|
3917
|
-
|
|
3999
|
+
const length = value.length;
|
|
4000
|
+
for (let index = 0; index < length; ++index) {
|
|
4001
|
+
const item = value[index];
|
|
3918
4002
|
const previous = lastArray[index];
|
|
3919
4003
|
const previousSupport = previous?.tagSupport;
|
|
3920
4004
|
const subTag = item;
|
|
@@ -3922,7 +4006,6 @@ ownerSupport, options) {
|
|
|
3922
4006
|
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.tagFakeTemplater)(subTag);
|
|
3923
4007
|
}
|
|
3924
4008
|
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_4__.TagSupport(subTag.templater, ownerSupport, new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(undefined));
|
|
3925
|
-
// tagSupport.templater = subTag.templater
|
|
3926
4009
|
if (previousSupport) {
|
|
3927
4010
|
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.setupNewTemplater)(tagSupport, ownerSupport, previousSupport.subject);
|
|
3928
4011
|
const global = previousSupport.global;
|
|
@@ -3935,7 +4018,6 @@ ownerSupport, options) {
|
|
|
3935
4018
|
const details = {
|
|
3936
4019
|
template: tagSupport.getTemplate().string,
|
|
3937
4020
|
array: value,
|
|
3938
|
-
ownerTagContent: ownerSupport.lastTemplateString,
|
|
3939
4021
|
};
|
|
3940
4022
|
const message = 'Use html`...`.key(item) instead of html`...` to template an Array';
|
|
3941
4023
|
console.error(message, details);
|
|
@@ -3949,11 +4031,12 @@ ownerSupport, options) {
|
|
|
3949
4031
|
// subTag.tagSupport = subTag.tagSupport || prevSupport
|
|
3950
4032
|
const oldest = prevGlobal.oldest;
|
|
3951
4033
|
oldest.updateBy(tagSupport);
|
|
3952
|
-
return []
|
|
4034
|
+
// return []
|
|
4035
|
+
continue;
|
|
3953
4036
|
}
|
|
3954
4037
|
processAddTagArrayItem(runtimeInsertBefore, tagSupport, index, options, lastArray);
|
|
3955
4038
|
ownerSupport.childTags.push(tagSupport);
|
|
3956
|
-
}
|
|
4039
|
+
}
|
|
3957
4040
|
return clones;
|
|
3958
4041
|
}
|
|
3959
4042
|
function setPlaceholderElm(insertBefore, subject) {
|
|
@@ -3980,7 +4063,7 @@ function processAddTagArrayItem(before, tagSupport, index, options, lastArray) {
|
|
|
3980
4063
|
const newTempElm = document.createElement('template');
|
|
3981
4064
|
fragment.appendChild(newTempElm);
|
|
3982
4065
|
tagSupport.buildBeforeElement(newTempElm, // before,
|
|
3983
|
-
{ counts
|
|
4066
|
+
{ counts });
|
|
3984
4067
|
const parent = before.parentNode;
|
|
3985
4068
|
parent.insertBefore(fragment, before);
|
|
3986
4069
|
}
|
|
@@ -4012,18 +4095,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4012
4095
|
/* harmony export */ });
|
|
4013
4096
|
function processTagResult(tagSupport, subject, // used for recording past and current value
|
|
4014
4097
|
insertBefore, // <template end interpolate />
|
|
4015
|
-
{ counts,
|
|
4098
|
+
{ counts, }) {
|
|
4016
4099
|
// *if appears we already have seen
|
|
4017
4100
|
const subjectTag = subject;
|
|
4018
4101
|
const lastSupport = subjectTag.tagSupport;
|
|
4019
|
-
const prevSupport = lastSupport?.global.oldest || undefined;
|
|
4020
|
-
const justUpdate = prevSupport;
|
|
4102
|
+
const prevSupport = lastSupport?.global.oldest || undefined;
|
|
4103
|
+
const justUpdate = prevSupport;
|
|
4021
4104
|
if (prevSupport && justUpdate) {
|
|
4022
4105
|
return processTagResultUpdate(tagSupport, subjectTag, prevSupport);
|
|
4023
4106
|
}
|
|
4024
4107
|
tagSupport.buildBeforeElement(insertBefore, {
|
|
4025
4108
|
counts,
|
|
4026
|
-
forceElement,
|
|
4027
4109
|
});
|
|
4028
4110
|
}
|
|
4029
4111
|
function processTagResultUpdate(tagSupport, subject, // used for recording past and current value
|
|
@@ -4135,15 +4217,13 @@ subject, insertBefore) {
|
|
|
4135
4217
|
const oldFunction = oldWrapper.parentWrap.original;
|
|
4136
4218
|
const newFunction = newWrapper.parentWrap.original;
|
|
4137
4219
|
// string compare both functions
|
|
4138
|
-
|
|
4139
|
-
isSameTag = oldFunction === newFunction; // ???
|
|
4220
|
+
isSameTag = oldFunction === newFunction;
|
|
4140
4221
|
}
|
|
4141
4222
|
const templater = tagSupport.templater;
|
|
4142
4223
|
if (!isSameTag) {
|
|
4143
4224
|
const oldestSupport = lastSupport.global.oldest;
|
|
4144
4225
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldestSupport);
|
|
4145
4226
|
return (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject, insertBefore, ownerSupport, {
|
|
4146
|
-
forceElement: false,
|
|
4147
4227
|
counts: { added: 0, removed: 0 },
|
|
4148
4228
|
});
|
|
4149
4229
|
}
|
|
@@ -4192,7 +4272,6 @@ subject, insertBefore) {
|
|
|
4192
4272
|
}
|
|
4193
4273
|
function buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {
|
|
4194
4274
|
newSupport.buildBeforeElement(oldInsertBefore, {
|
|
4195
|
-
forceElement: true,
|
|
4196
4275
|
counts: { added: 0, removed: 0 },
|
|
4197
4276
|
});
|
|
4198
4277
|
newSupport.global.oldest = newSupport;
|
|
@@ -4207,7 +4286,8 @@ function syncFunctionProps(lastSupport, ownerSupport, newPropsArray) {
|
|
|
4207
4286
|
const priorPropConfig = lastSupport.propsConfig;
|
|
4208
4287
|
const priorPropsArray = priorPropConfig.latestCloned;
|
|
4209
4288
|
const prevSupport = ownerSupport.global.newest;
|
|
4210
|
-
newPropsArray.
|
|
4289
|
+
for (let index = newPropsArray.length - 1; index >= 0; --index) {
|
|
4290
|
+
const argPosition = newPropsArray[index];
|
|
4211
4291
|
if (typeof (argPosition) !== 'object') {
|
|
4212
4292
|
return;
|
|
4213
4293
|
}
|
|
@@ -4215,23 +4295,23 @@ function syncFunctionProps(lastSupport, ownerSupport, newPropsArray) {
|
|
|
4215
4295
|
if (typeof (priorProps) !== 'object') {
|
|
4216
4296
|
return;
|
|
4217
4297
|
}
|
|
4218
|
-
|
|
4298
|
+
for (const name in argPosition) {
|
|
4299
|
+
const value = argPosition[name];
|
|
4219
4300
|
if (!(value instanceof Function)) {
|
|
4220
|
-
|
|
4301
|
+
continue;
|
|
4221
4302
|
}
|
|
4222
4303
|
const newCallback = argPosition[name]; // || value
|
|
4223
4304
|
const original = newCallback instanceof Function && newCallback.toCall;
|
|
4224
4305
|
if (original) {
|
|
4225
|
-
|
|
4306
|
+
continue; // already previously converted
|
|
4226
4307
|
}
|
|
4227
4308
|
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
4228
4309
|
priorProps[name].toCall = (...args) => {
|
|
4229
4310
|
return (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_4__.callbackPropOwner)(newCallback, // value, // newOriginal,
|
|
4230
4311
|
args, prevSupport);
|
|
4231
4312
|
};
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
});
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4235
4315
|
}
|
|
4236
4316
|
|
|
4237
4317
|
|
|
@@ -4250,14 +4330,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4250
4330
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../TagSupport.class */ "./ts/tag/TagSupport.class.ts");
|
|
4251
4331
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
4252
4332
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
|
|
4253
|
-
/* harmony import */ var
|
|
4254
|
-
/* harmony import */ var
|
|
4255
|
-
/* harmony import */ var
|
|
4256
|
-
/* harmony import */ var
|
|
4257
|
-
/* harmony import */ var
|
|
4258
|
-
/* harmony import */ var
|
|
4259
|
-
/* harmony import */ var
|
|
4333
|
+
/* harmony import */ var _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processFirstSubject.utils */ "./ts/tag/update/processFirstSubject.utils.ts");
|
|
4334
|
+
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
|
|
4335
|
+
/* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/tag/update/updateExistingTagComponent.function.ts");
|
|
4336
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
|
|
4337
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../checkDestroyPrevious.function */ "./ts/tag/checkDestroyPrevious.function.ts");
|
|
4338
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
|
|
4339
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../isLikeTags.function */ "./ts/tag/isLikeTags.function.ts");
|
|
4260
4340
|
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./processTag.function */ "./ts/tag/update/processTag.function.ts");
|
|
4341
|
+
/* harmony import */ var _setTagPlaceholder_function__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../setTagPlaceholder.function */ "./ts/tag/setTagPlaceholder.function.ts");
|
|
4342
|
+
|
|
4261
4343
|
|
|
4262
4344
|
|
|
4263
4345
|
|
|
@@ -4271,10 +4353,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4271
4353
|
|
|
4272
4354
|
function updateExistingValue(subject, value, ownerSupport, insertBefore) {
|
|
4273
4355
|
const subjectTag = subject;
|
|
4274
|
-
const
|
|
4275
|
-
(0,
|
|
4356
|
+
const valueType = (0,_processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.getValueType)(value);
|
|
4357
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_7__.checkDestroyPrevious)(subject, value, insertBefore);
|
|
4276
4358
|
// handle already seen tag components
|
|
4277
|
-
if (
|
|
4359
|
+
if (valueType === _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tagComponent) {
|
|
4278
4360
|
return prepareUpdateToComponent(value, subjectTag, insertBefore, ownerSupport);
|
|
4279
4361
|
}
|
|
4280
4362
|
// was component but no longer
|
|
@@ -4283,42 +4365,40 @@ function updateExistingValue(subject, value, ownerSupport, insertBefore) {
|
|
|
4283
4365
|
handleStillTag(subject, value, ownerSupport);
|
|
4284
4366
|
return subjectTag;
|
|
4285
4367
|
}
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
templater
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
subject.set(bound);
|
|
4318
|
-
return subject;
|
|
4368
|
+
switch (valueType) {
|
|
4369
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tagArray:
|
|
4370
|
+
(0,_processTagArray__WEBPACK_IMPORTED_MODULE_4__.processTagArray)(subject, value, insertBefore, // oldInsertBefore as InsertBefore,
|
|
4371
|
+
ownerSupport, { counts: {
|
|
4372
|
+
added: 0,
|
|
4373
|
+
removed: 0,
|
|
4374
|
+
} });
|
|
4375
|
+
return subject;
|
|
4376
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.templater:
|
|
4377
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(value, insertBefore, ownerSupport, subjectTag);
|
|
4378
|
+
return subjectTag;
|
|
4379
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tag:
|
|
4380
|
+
const tag = value;
|
|
4381
|
+
let templater = tag.templater;
|
|
4382
|
+
if (!templater) {
|
|
4383
|
+
templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.getFakeTemplater)();
|
|
4384
|
+
tag.templater = templater;
|
|
4385
|
+
templater.tag = tag;
|
|
4386
|
+
}
|
|
4387
|
+
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(templater, insertBefore, ownerSupport, subjectTag);
|
|
4388
|
+
return subjectTag;
|
|
4389
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.subject:
|
|
4390
|
+
return value;
|
|
4391
|
+
// now its a useless function (we don't automatically call functions)
|
|
4392
|
+
case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.function:
|
|
4393
|
+
// const bound = bindSubjectCallback(value as Callback, ownerSupport)
|
|
4394
|
+
// subject.set(bound)
|
|
4395
|
+
if (!subject.clone) {
|
|
4396
|
+
subject.clone = (0,_setTagPlaceholder_function__WEBPACK_IMPORTED_MODULE_11__.swapInsertBefore)(insertBefore);
|
|
4397
|
+
}
|
|
4398
|
+
return subject;
|
|
4319
4399
|
}
|
|
4320
4400
|
// This will cause all other values to render
|
|
4321
|
-
(0,
|
|
4401
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_6__.processRegularValue)(value, subject, insertBefore);
|
|
4322
4402
|
return subjectTag;
|
|
4323
4403
|
}
|
|
4324
4404
|
function handleStillTag(subject, value, ownerSupport) {
|
|
@@ -4338,7 +4418,7 @@ function handleStillTag(subject, value, ownerSupport) {
|
|
|
4338
4418
|
if (isClass) {
|
|
4339
4419
|
valueSupport.global = lastSupport.global;
|
|
4340
4420
|
}
|
|
4341
|
-
const isSameTag = value && (0,
|
|
4421
|
+
const isSameTag = value && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_9__.isLikeTags)(lastSupport, valueSupport);
|
|
4342
4422
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagTemplater)(value)) {
|
|
4343
4423
|
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.setupNewTemplater)(valueSupport, ownerSupport, subject);
|
|
4344
4424
|
}
|
|
@@ -4352,14 +4432,13 @@ function handleStillTag(subject, value, ownerSupport) {
|
|
|
4352
4432
|
const insertBefore = global.insertBefore;
|
|
4353
4433
|
return (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(templater, insertBefore, ownerSupport, subject);
|
|
4354
4434
|
}
|
|
4355
|
-
return (0,
|
|
4435
|
+
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_6__.processRegularValue)(value, subject, subject.insertBefore);
|
|
4356
4436
|
}
|
|
4357
4437
|
function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupport) {
|
|
4358
4438
|
// When last value was not a component
|
|
4359
4439
|
if (!subjectTag.tagSupport) {
|
|
4360
|
-
(0,
|
|
4440
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
|
|
4361
4441
|
ownerSupport, {
|
|
4362
|
-
forceElement: true,
|
|
4363
4442
|
counts: { added: 0, removed: 0 },
|
|
4364
4443
|
});
|
|
4365
4444
|
return subjectTag;
|
|
@@ -4369,28 +4448,19 @@ function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupp
|
|
|
4369
4448
|
const prevSupport = subjectSup.global.newest;
|
|
4370
4449
|
if (prevSupport) {
|
|
4371
4450
|
const newestState = prevSupport.memory.state;
|
|
4372
|
-
// tagSupport.memory.state = [...newestState]
|
|
4373
4451
|
tagSupport.memory.state.length = 0;
|
|
4374
4452
|
tagSupport.memory.state.push(...newestState);
|
|
4375
4453
|
}
|
|
4376
4454
|
else {
|
|
4377
|
-
(0,
|
|
4378
|
-
|
|
4379
|
-
const placeholder = subjectSup.global.placeholder
|
|
4380
|
-
if(placeholder && !insertBefore.parentNode) {
|
|
4381
|
-
insertAfter(insertBefore,placeholder)
|
|
4382
|
-
delete subjectSup.global.placeholder
|
|
4383
|
-
}
|
|
4384
|
-
*/
|
|
4385
|
-
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__.processSubjectComponent)(templater, subjectTag, insertBefore, ownerSupport, {
|
|
4386
|
-
forceElement: true,
|
|
4455
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_7__.restoreTagMarker)(subjectSup);
|
|
4456
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__.processSubjectComponent)(templater, subjectTag, insertBefore, ownerSupport, {
|
|
4387
4457
|
counts: { added: 0, removed: 0 },
|
|
4388
4458
|
});
|
|
4389
4459
|
return subjectTag;
|
|
4390
4460
|
}
|
|
4391
4461
|
tagSupport.global = subjectSup.global;
|
|
4392
4462
|
subjectTag.tagSupport = tagSupport;
|
|
4393
|
-
(0,
|
|
4463
|
+
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingTagComponent)(ownerSupport, tagSupport, // latest value
|
|
4394
4464
|
subjectTag, insertBefore);
|
|
4395
4465
|
return subjectTag;
|
|
4396
4466
|
}
|
|
@@ -4406,23 +4476,27 @@ function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupp
|
|
|
4406
4476
|
|
|
4407
4477
|
__webpack_require__.r(__webpack_exports__);
|
|
4408
4478
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4479
|
+
/* harmony export */ castTextValue: () => (/* binding */ castTextValue),
|
|
4409
4480
|
/* harmony export */ updateBeforeTemplate: () => (/* binding */ updateBeforeTemplate)
|
|
4410
4481
|
/* harmony export */ });
|
|
4411
4482
|
// Function to update the value of x
|
|
4412
|
-
function updateBeforeTemplate(value,
|
|
4483
|
+
function updateBeforeTemplate(value, // value should be casted before calling here
|
|
4484
|
+
lastFirstChild) {
|
|
4413
4485
|
const parent = lastFirstChild.parentNode;
|
|
4414
|
-
let castedValue = value;
|
|
4415
|
-
// mimic React skipping to display EXCEPT for true does display on page
|
|
4416
|
-
if ([undefined, false, null].includes(value)) { // || value === true
|
|
4417
|
-
castedValue = '';
|
|
4418
|
-
}
|
|
4419
4486
|
// Insert the new value (never use innerHTML here)
|
|
4420
|
-
const textNode = document.createTextNode(
|
|
4487
|
+
const textNode = document.createTextNode(value); // never innerHTML
|
|
4421
4488
|
parent.insertBefore(textNode, lastFirstChild);
|
|
4422
4489
|
/* remove existing nodes */
|
|
4423
4490
|
parent.removeChild(lastFirstChild);
|
|
4424
4491
|
return textNode;
|
|
4425
4492
|
}
|
|
4493
|
+
function castTextValue(value) {
|
|
4494
|
+
// mimic React skipping to display EXCEPT for true does display on page
|
|
4495
|
+
if ([undefined, false, null].includes(value)) { // || value === true
|
|
4496
|
+
return '';
|
|
4497
|
+
}
|
|
4498
|
+
return value;
|
|
4499
|
+
}
|
|
4426
4500
|
|
|
4427
4501
|
|
|
4428
4502
|
/***/ })
|