taggedjs 2.4.10 → 2.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +96 -159
- package/bundle.js.map +1 -1
- package/js/Tag.class.d.ts +1 -0
- package/js/Tag.class.js +11 -8
- package/js/Tag.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +4 -2
- package/js/TemplaterResult.class.js +0 -6
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/alterProps.function.js +1 -2
- package/js/alterProps.function.js.map +1 -1
- package/js/destroyTag.function.js +0 -1
- 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 -1
- package/js/hasTagSupportChanged.function.js.map +1 -1
- package/js/onInit.js +5 -3
- package/js/onInit.js.map +1 -1
- package/js/processSubjectComponent.function.js +6 -6
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processSubjectValue.function.d.ts +2 -1
- package/js/processSubjectValue.function.js.map +1 -1
- package/js/renderExistingTag.function.js +6 -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/tag.js +1 -3
- package/js/tag.js.map +1 -1
- package/js/updateExistingTagComponent.function.d.ts +1 -1
- package/js/updateExistingTagComponent.function.js +12 -22
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.js +19 -15
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -2
package/bundle.js
CHANGED
|
@@ -112,6 +112,7 @@ class ArrayValueNeverSet {
|
|
|
112
112
|
class Tag {
|
|
113
113
|
strings;
|
|
114
114
|
values;
|
|
115
|
+
version = 0;
|
|
115
116
|
isTag = true;
|
|
116
117
|
hasLiveElements = false;
|
|
117
118
|
clones = []; // elements on document. Needed at destroy process to know what to destroy
|
|
@@ -421,14 +422,16 @@ function updateContextItem(context, variableName, value) {
|
|
|
421
422
|
const subject = context[variableName];
|
|
422
423
|
const tag = subject.tag;
|
|
423
424
|
if (tag) {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
|
|
425
|
+
const oldTemp = tag.tagSupport.templater;
|
|
426
|
+
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
427
|
+
if (value.global !== oldTemp.global) {
|
|
428
|
+
if (oldWrap && (0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent)(value)) {
|
|
429
|
+
const oldValueFn = oldWrap.original;
|
|
430
|
+
const newValueFn = value.wrapper?.original;
|
|
431
|
+
const fnMatched = oldValueFn === newValueFn;
|
|
432
|
+
if (fnMatched) {
|
|
433
|
+
value.global = oldTemp.global;
|
|
434
|
+
}
|
|
432
435
|
}
|
|
433
436
|
}
|
|
434
437
|
}
|
|
@@ -570,16 +573,10 @@ class TemplaterResult {
|
|
|
570
573
|
}
|
|
571
574
|
function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {
|
|
572
575
|
const wrapTagSupport = tagSupport; // this.tagSupport
|
|
573
|
-
// const wrapTagSupport = existingTag?.tagSupport.templater.global.newest?.tagSupport || tagSupport
|
|
574
|
-
// this.tagSupport = wrapTagSupport
|
|
575
576
|
/* BEFORE RENDER */
|
|
576
|
-
// signify to other operations that a rendering has occurred so they do not need to render again
|
|
577
|
-
// ++wrapTagSupport.memory.renderCount
|
|
578
577
|
const runtimeOwnerTag = existingTag?.ownerTag || ownerTag;
|
|
579
578
|
if (existingTag) {
|
|
580
|
-
// wrapTagSupport.templater.props = existingTag.tagSupport.templater.global.newest?.tagSupport.templater.props || wrapTagSupport.templater.props
|
|
581
579
|
wrapTagSupport.memory.state.newest = [...existingTag.tagSupport.memory.state.newest];
|
|
582
|
-
// ??? - new
|
|
583
580
|
wrapTagSupport.templater.global = existingTag.tagSupport.templater.global;
|
|
584
581
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRedraw)(wrapTagSupport, existingTag);
|
|
585
582
|
}
|
|
@@ -672,8 +669,7 @@ function alterProps(props, templater, ownerSupport) {
|
|
|
672
669
|
throw new Error('already rendered');
|
|
673
670
|
}
|
|
674
671
|
const lastestOwner = ownerSupport.templater.global.newest;
|
|
675
|
-
const newOwner = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner.tagSupport,
|
|
676
|
-
true);
|
|
672
|
+
const newOwner = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(lastestOwner.tagSupport, true);
|
|
677
673
|
if (newOwner.tagSupport.templater.global.newest != newOwner) {
|
|
678
674
|
throw new Error('newest assignment issue?');
|
|
679
675
|
}
|
|
@@ -979,7 +975,6 @@ function destroyTagMemory(tag, subject) {
|
|
|
979
975
|
const oldest = tag.tagSupport.templater.global.oldest;
|
|
980
976
|
oldest.destroy();
|
|
981
977
|
destroyTagSupportPast(oldTagSupport);
|
|
982
|
-
// ???
|
|
983
978
|
tag.tagSupport.templater.global.context = {};
|
|
984
979
|
}
|
|
985
980
|
function destroyTagSupportPast(oldTagSupport) {
|
|
@@ -1104,7 +1099,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1104
1099
|
|
|
1105
1100
|
|
|
1106
1101
|
let innerCallback = (callback) => () => {
|
|
1107
|
-
throw new Error('
|
|
1102
|
+
throw new Error('Callback function was called immediately in sync and must instead be call async');
|
|
1108
1103
|
};
|
|
1109
1104
|
const getCallback = () => innerCallback;
|
|
1110
1105
|
const originalGetter = innerCallback; // getCallback
|
|
@@ -1142,7 +1137,6 @@ function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
|
1142
1137
|
// send the oldest state changes into the newest
|
|
1143
1138
|
updateState(oldState, newest);
|
|
1144
1139
|
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1145
|
-
// TODO: turn back on below
|
|
1146
1140
|
if (promise instanceof Promise) {
|
|
1147
1141
|
promise.finally(() => {
|
|
1148
1142
|
// send the oldest state changes into the newest
|
|
@@ -1240,7 +1234,6 @@ pastCloneProps) {
|
|
|
1240
1234
|
return 6; // a change has been detected by function comparisons
|
|
1241
1235
|
}
|
|
1242
1236
|
}
|
|
1243
|
-
// ???
|
|
1244
1237
|
const isEqual = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(castedPastProps, castedProps);
|
|
1245
1238
|
return isEqual ? false : 7; // if equal then no changes
|
|
1246
1239
|
}
|
|
@@ -1728,11 +1721,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1728
1721
|
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1729
1722
|
|
|
1730
1723
|
function setCurrentTagSupport(support) {
|
|
1731
|
-
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.
|
|
1724
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater = support.templater;
|
|
1732
1725
|
}
|
|
1733
1726
|
function onInit(callback) {
|
|
1734
|
-
|
|
1735
|
-
|
|
1727
|
+
const templater = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater;
|
|
1728
|
+
if (!templater.global.init) {
|
|
1729
|
+
;
|
|
1730
|
+
templater.global.init = callback;
|
|
1736
1731
|
callback(); // fire init
|
|
1737
1732
|
}
|
|
1738
1733
|
}
|
|
@@ -1974,17 +1969,16 @@ function processSubjectComponent(templater, subject, template, ownerTag, options
|
|
|
1974
1969
|
// Check if function component is wrapped in a tag() call
|
|
1975
1970
|
// TODO: This below check not needed in production mode
|
|
1976
1971
|
if (templater.tagged !== true) {
|
|
1977
|
-
|
|
1972
|
+
const original = templater.wrapper.original;
|
|
1973
|
+
let name = original.name || original.constructor?.name;
|
|
1978
1974
|
if (name === 'Function') {
|
|
1979
1975
|
name = undefined;
|
|
1980
1976
|
}
|
|
1981
|
-
const label = name ||
|
|
1977
|
+
const label = name || original.toString().substring(0, 120);
|
|
1982
1978
|
const error = new Error(`Not a tag component. Wrap your function with tag(). Example tag(props => html\`\`) on component:\n\n${label}\n\n`);
|
|
1983
1979
|
throw error;
|
|
1984
1980
|
}
|
|
1985
|
-
|
|
1986
|
-
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, templater, subject);
|
|
1987
|
-
}
|
|
1981
|
+
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, templater, subject);
|
|
1988
1982
|
// templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest
|
|
1989
1983
|
templater.global.insertBefore = template;
|
|
1990
1984
|
let retag = subject.tag;
|
|
@@ -1993,7 +1987,8 @@ function processSubjectComponent(templater, subject, template, ownerTag, options
|
|
|
1993
1987
|
const isRedraw = !retag || options.forceElement;
|
|
1994
1988
|
if (isRedraw) {
|
|
1995
1989
|
const preClones = ownerTag.clones.map(clone => clone);
|
|
1996
|
-
retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(templater.tagSupport, subject.tag,
|
|
1990
|
+
retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(templater.tagSupport, subject.tag, // existing tag
|
|
1991
|
+
subject, ownerTag);
|
|
1997
1992
|
if (retag.tagSupport.templater.global.newest != retag) {
|
|
1998
1993
|
throw new Error('mismatch result newest');
|
|
1999
1994
|
}
|
|
@@ -2467,38 +2462,6 @@ function run(tagSupport, ownerTag) {
|
|
|
2467
2462
|
}
|
|
2468
2463
|
|
|
2469
2464
|
|
|
2470
|
-
/***/ }),
|
|
2471
|
-
|
|
2472
|
-
/***/ "./ts/redrawTag.function.ts":
|
|
2473
|
-
/*!**********************************!*\
|
|
2474
|
-
!*** ./ts/redrawTag.function.ts ***!
|
|
2475
|
-
\**********************************/
|
|
2476
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2477
|
-
|
|
2478
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2479
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2480
|
-
/* harmony export */ redrawTag: () => (/* binding */ redrawTag)
|
|
2481
|
-
/* harmony export */ });
|
|
2482
|
-
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2483
|
-
|
|
2484
|
-
/** for components */
|
|
2485
|
-
function redrawTag(subject, templater, ownerTag) {
|
|
2486
|
-
const existingTag = subject.tag || templater.global.newest || templater.global.oldest;
|
|
2487
|
-
if (!templater.global.oldest) {
|
|
2488
|
-
throw new Error('issue before event redraw');
|
|
2489
|
-
}
|
|
2490
|
-
const tagSupport = templater.tagSupport; // || existingTag?.tagSupport
|
|
2491
|
-
if (!templater.tagSupport) {
|
|
2492
|
-
throw new Error('need tag support');
|
|
2493
|
-
}
|
|
2494
|
-
if (!tagSupport.templater.global.oldest) {
|
|
2495
|
-
throw new Error('33333');
|
|
2496
|
-
}
|
|
2497
|
-
let retag = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__.renderWithSupport)(tagSupport, existingTag, subject, ownerTag);
|
|
2498
|
-
return retag;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
2465
|
/***/ }),
|
|
2503
2466
|
|
|
2504
2467
|
/***/ "./ts/render.ts":
|
|
@@ -2542,19 +2505,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2542
2505
|
/* harmony export */ renderExistingTag: () => (/* binding */ renderExistingTag)
|
|
2543
2506
|
/* harmony export */ });
|
|
2544
2507
|
/* harmony import */ var _provider_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./provider.utils */ "./ts/provider.utils.ts");
|
|
2545
|
-
/* harmony import */ var
|
|
2546
|
-
/* harmony import */ var
|
|
2508
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2509
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2547
2510
|
|
|
2548
2511
|
|
|
2549
2512
|
|
|
2550
2513
|
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
2551
2514
|
function renderExistingTag(oldestTag, // existing tag already there
|
|
2552
2515
|
newTemplater, tagSupport, subject) {
|
|
2553
|
-
|
|
2554
|
-
newTemplater.global = subject.tag.tagSupport.templater.global;
|
|
2555
|
-
}
|
|
2516
|
+
newTemplater.global = subject.tag.tagSupport.templater.global;
|
|
2556
2517
|
if (!oldestTag.hasLiveElements) {
|
|
2557
|
-
throw new Error('1080');
|
|
2518
|
+
throw new Error('1080 - should have live elements');
|
|
2558
2519
|
}
|
|
2559
2520
|
const preRenderCount = tagSupport.templater.global.renderCount;
|
|
2560
2521
|
(0,_provider_utils__WEBPACK_IMPORTED_MODULE_0__.providersChangeCheck)(oldestTag);
|
|
@@ -2565,20 +2526,12 @@ newTemplater, tagSupport, subject) {
|
|
|
2565
2526
|
return latestTag;
|
|
2566
2527
|
}
|
|
2567
2528
|
const oldTemplater = tagSupport.templater || newTemplater;
|
|
2568
|
-
const redraw = (0,
|
|
2529
|
+
const redraw = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.renderWithSupport)(newTemplater.tagSupport, subject.tag || oldTemplater.global.newest || oldTemplater.global.oldest, // hmmmmmm, why not newest?
|
|
2530
|
+
subject, oldestTag.ownerTag);
|
|
2569
2531
|
const oldest = tagSupport.templater.global.oldest || oldestTag;
|
|
2570
2532
|
redraw.tagSupport.templater.global.oldest = oldest;
|
|
2571
|
-
if (
|
|
2572
|
-
|
|
2573
|
-
}
|
|
2574
|
-
if (!redraw.tagSupport.templater.global.oldest) {
|
|
2575
|
-
throw new Error('8888888 - 0');
|
|
2576
|
-
}
|
|
2577
|
-
if (!oldTemplater.global.oldest) {
|
|
2578
|
-
throw new Error('8888888');
|
|
2579
|
-
}
|
|
2580
|
-
// ??? - add to ensure setProps causes lower redraw
|
|
2581
|
-
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(latestTag, redraw)) {
|
|
2533
|
+
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(latestTag, redraw)) {
|
|
2534
|
+
subject.tag = redraw;
|
|
2582
2535
|
oldest.updateByTag(redraw);
|
|
2583
2536
|
}
|
|
2584
2537
|
return redraw;
|
|
@@ -2619,7 +2572,8 @@ function renderTagSupport(tagSupport, renderUp) {
|
|
|
2619
2572
|
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2620
2573
|
let ownerTag;
|
|
2621
2574
|
let selfPropChange = false;
|
|
2622
|
-
|
|
2575
|
+
const shouldRenderUp = renderUp && newest;
|
|
2576
|
+
if (shouldRenderUp) {
|
|
2623
2577
|
ownerTag = newest.ownerTag;
|
|
2624
2578
|
if (ownerTag) {
|
|
2625
2579
|
const nowProps = templater.props;
|
|
@@ -2632,17 +2586,8 @@ function renderTagSupport(tagSupport, renderUp) {
|
|
|
2632
2586
|
throw new Error('already causing trouble');
|
|
2633
2587
|
}
|
|
2634
2588
|
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__.renderExistingTag)(templater.global.oldest, templater, useTagSupport, subject);
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
if(exit.remit) {
|
|
2639
|
-
return tag
|
|
2640
|
-
}
|
|
2641
|
-
*/
|
|
2642
|
-
// Have owner re-render
|
|
2643
|
-
// ??? - recently removed. As causes some sort of owner newest disconnect during prop testing
|
|
2644
|
-
// ??? - restored with condition - must render parent if I modified my props
|
|
2645
|
-
if (ownerTag && selfPropChange) {
|
|
2589
|
+
const renderOwner = ownerTag && selfPropChange;
|
|
2590
|
+
if (renderOwner) {
|
|
2646
2591
|
const ownerTagSupport = ownerTag.tagSupport;
|
|
2647
2592
|
renderTagSupport(ownerTagSupport, true);
|
|
2648
2593
|
return tag;
|
|
@@ -3050,9 +2995,7 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3050
2995
|
if (oldest && !oldest.hasLiveElements) {
|
|
3051
2996
|
throw new Error('issue already 22');
|
|
3052
2997
|
}
|
|
3053
|
-
// ???
|
|
3054
2998
|
let props = templater.props;
|
|
3055
|
-
// let props = oldTagSetup.propsConfig.latest
|
|
3056
2999
|
const ownerTagSupport = oldTagSetup.ownerTagSupport;
|
|
3057
3000
|
const oldTemplater = ownerTagSupport?.templater;
|
|
3058
3001
|
const oldLatest = oldTemplater?.global.newest;
|
|
@@ -3060,11 +3003,11 @@ function getTagWrap(templater, madeSubject) {
|
|
|
3060
3003
|
if (oldLatest && !newestOwnerTemplater) {
|
|
3061
3004
|
throw new Error('what to do here?');
|
|
3062
3005
|
}
|
|
3063
|
-
// ???
|
|
3064
3006
|
let castedProps = (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_7__.alterProps)(props, newestOwnerTemplater, oldTagSetup.ownerTagSupport);
|
|
3065
3007
|
const clonedProps = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_5__.deepClone)(props); // castedProps
|
|
3066
3008
|
// CALL ORIGINAL COMPONENT FUNCTION
|
|
3067
3009
|
const tag = originalFunction(castedProps, childSubject);
|
|
3010
|
+
tag.version = global.renderCount;
|
|
3068
3011
|
tag.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_6__.TagSupport(oldTagSetup.ownerTagSupport, templater, subject);
|
|
3069
3012
|
tag.tagSupport.propsConfig = {
|
|
3070
3013
|
latest: props, // castedProps
|
|
@@ -3215,16 +3158,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3215
3158
|
/* harmony export */ updateExistingTagComponent: () => (/* binding */ updateExistingTagComponent)
|
|
3216
3159
|
/* harmony export */ });
|
|
3217
3160
|
/* harmony import */ var _hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasTagSupportChanged.function */ "./ts/hasTagSupportChanged.function.ts");
|
|
3218
|
-
/* harmony import */ var
|
|
3219
|
-
/* harmony import */ var
|
|
3220
|
-
/* harmony import */ var
|
|
3221
|
-
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3222
|
-
|
|
3161
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3162
|
+
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
3163
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
3223
3164
|
|
|
3224
3165
|
|
|
3225
3166
|
|
|
3226
3167
|
|
|
3227
|
-
function updateExistingTagComponent(ownerTag,
|
|
3168
|
+
function updateExistingTagComponent(ownerTag, templater, subject, insertBefore) {
|
|
3228
3169
|
let existingTag = subject.tag;
|
|
3229
3170
|
/*
|
|
3230
3171
|
if(existingTag && !existingTag.hasLiveElements) {
|
|
@@ -3232,9 +3173,9 @@ function updateExistingTagComponent(ownerTag, tempResult, subject, insertBefore)
|
|
|
3232
3173
|
}
|
|
3233
3174
|
*/
|
|
3234
3175
|
const oldWrapper = existingTag.tagSupport.templater.wrapper;
|
|
3235
|
-
const newWrapper =
|
|
3176
|
+
const newWrapper = templater.wrapper;
|
|
3236
3177
|
let isSameTag = false;
|
|
3237
|
-
if (
|
|
3178
|
+
if (templater.global.oldest && !templater.global.oldest.hasLiveElements) {
|
|
3238
3179
|
throw new Error('88893434');
|
|
3239
3180
|
}
|
|
3240
3181
|
if (oldWrapper && newWrapper) {
|
|
@@ -3250,38 +3191,35 @@ function updateExistingTagComponent(ownerTag, tempResult, subject, insertBefore)
|
|
|
3250
3191
|
throw new Error('stop here no parent node update existing tag');
|
|
3251
3192
|
}
|
|
3252
3193
|
if (!isSameTag) {
|
|
3253
|
-
(0,
|
|
3254
|
-
(0,
|
|
3194
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldTagSupport.templater.global.oldest, subject);
|
|
3195
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject, oldInsertBefore, ownerTag, {
|
|
3255
3196
|
forceElement: false,
|
|
3256
3197
|
counts: { added: 0, removed: 0 },
|
|
3257
3198
|
});
|
|
3258
3199
|
return;
|
|
3259
3200
|
}
|
|
3260
3201
|
else {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
}
|
|
3264
|
-
const newTagSupport = tempResult.tagSupport;
|
|
3265
|
-
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(oldTagSupport, newTagSupport, tempResult);
|
|
3202
|
+
const newTagSupport = templater.tagSupport;
|
|
3203
|
+
const hasChanged = (0,_hasTagSupportChanged_function__WEBPACK_IMPORTED_MODULE_0__.hasTagSupportChanged)(oldTagSupport, newTagSupport, templater);
|
|
3266
3204
|
if (!hasChanged) {
|
|
3267
3205
|
return; // its the same tag component
|
|
3268
3206
|
}
|
|
3269
3207
|
}
|
|
3270
|
-
const oldestTag =
|
|
3271
|
-
const previous =
|
|
3208
|
+
const oldestTag = templater.global.oldest; // oldTagSupport.oldest as Tag // existingTag
|
|
3209
|
+
const previous = templater.global.newest;
|
|
3272
3210
|
if (!previous || !oldestTag) {
|
|
3273
3211
|
throw new Error('how no previous or oldest nor newest?');
|
|
3274
3212
|
}
|
|
3275
|
-
const newTag = (0,
|
|
3213
|
+
const newTag = (0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_3__.renderTagSupport)(templater.tagSupport, false);
|
|
3276
3214
|
existingTag = subject.tag;
|
|
3277
3215
|
const newOldest = newTag.tagSupport.templater.global.oldest;
|
|
3278
3216
|
const hasOldest = newOldest ? true : false;
|
|
3279
3217
|
if (!hasOldest) {
|
|
3280
3218
|
return buildNewTag(newTag, oldInsertBefore, oldTagSupport, subject);
|
|
3281
3219
|
}
|
|
3282
|
-
if (newOldest &&
|
|
3220
|
+
if (newOldest && templater.children.value.length) {
|
|
3283
3221
|
const oldKidsSub = newOldest.tagSupport.templater.children;
|
|
3284
|
-
oldKidsSub.set(
|
|
3222
|
+
oldKidsSub.set(templater.children.value);
|
|
3285
3223
|
}
|
|
3286
3224
|
// const newTag = tempResult.newest as Tag
|
|
3287
3225
|
if (previous && !oldestTag) {
|
|
@@ -3298,22 +3236,16 @@ function updateExistingTagComponent(ownerTag, tempResult, subject, insertBefore)
|
|
|
3298
3236
|
throw new Error('maybe 6');
|
|
3299
3237
|
}
|
|
3300
3238
|
subject.tag = newTag;
|
|
3301
|
-
/*
|
|
3302
|
-
if(!newTag.hasLiveElements) {
|
|
3303
|
-
throw new Error('44444 - 6')
|
|
3304
|
-
}
|
|
3305
|
-
*/
|
|
3306
3239
|
oldestTag.updateByTag(newTag); // the oldest tag has element references
|
|
3240
|
+
return;
|
|
3307
3241
|
}
|
|
3308
3242
|
else {
|
|
3309
3243
|
// Although function looked the same it returned a different html result
|
|
3310
3244
|
if (isSameTag && existingTag) {
|
|
3311
|
-
(0,
|
|
3245
|
+
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, subject);
|
|
3312
3246
|
newTag.tagSupport.templater.global.context = {}; // do not share previous outputs
|
|
3313
3247
|
}
|
|
3314
3248
|
oldest = undefined;
|
|
3315
|
-
// ??? - new remove
|
|
3316
|
-
// subject.tag = newTag
|
|
3317
3249
|
}
|
|
3318
3250
|
if (!oldest) {
|
|
3319
3251
|
buildNewTag(newTag, oldTagSupport.templater.global.insertBefore, oldTagSupport, subject);
|
|
@@ -3364,15 +3296,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3364
3296
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3365
3297
|
/* harmony export */ updateExistingValue: () => (/* binding */ updateExistingValue)
|
|
3366
3298
|
/* harmony export */ });
|
|
3367
|
-
/* harmony import */ var
|
|
3368
|
-
/* harmony import */ var
|
|
3369
|
-
/* harmony import */ var
|
|
3370
|
-
/* harmony import */ var
|
|
3371
|
-
/* harmony import */ var
|
|
3372
|
-
/* harmony import */ var
|
|
3373
|
-
/* harmony import */ var
|
|
3374
|
-
/* harmony import */ var
|
|
3375
|
-
/* harmony import */ var
|
|
3299
|
+
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3300
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3301
|
+
/* harmony import */ var _processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processSubjectValue.function */ "./ts/processSubjectValue.function.ts");
|
|
3302
|
+
/* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTagArray */ "./ts/processTagArray.ts");
|
|
3303
|
+
/* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/updateExistingTagComponent.function.ts");
|
|
3304
|
+
/* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/processRegularValue.function.ts");
|
|
3305
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
3306
|
+
/* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/processSubjectComponent.function.ts");
|
|
3307
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
3308
|
+
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
3309
|
+
|
|
3376
3310
|
|
|
3377
3311
|
|
|
3378
3312
|
|
|
@@ -3383,34 +3317,37 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3383
3317
|
|
|
3384
3318
|
|
|
3385
3319
|
function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
3386
|
-
const
|
|
3387
|
-
const isComponent = (0,
|
|
3388
|
-
const oldInsertBefore = subject.template ||
|
|
3389
|
-
(0,
|
|
3320
|
+
const subjectTag = subject;
|
|
3321
|
+
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value);
|
|
3322
|
+
const oldInsertBefore = subject.template || subjectTag.tag?.tagSupport.templater.global.insertBefore || subject.clone;
|
|
3323
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__.checkDestroyPrevious)(subject, value);
|
|
3390
3324
|
// handle already seen tag components
|
|
3391
3325
|
if (isComponent) {
|
|
3392
3326
|
const templater = value;
|
|
3393
3327
|
// When was something before component
|
|
3394
|
-
if (!
|
|
3395
|
-
(0,
|
|
3328
|
+
if (!subjectTag.tag) {
|
|
3329
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__.processSubjectComponent)(templater, subjectTag, oldInsertBefore, ownerTag, {
|
|
3396
3330
|
forceElement: true,
|
|
3397
3331
|
counts: { added: 0, removed: 0 },
|
|
3398
3332
|
});
|
|
3399
|
-
return
|
|
3333
|
+
return subjectTag;
|
|
3400
3334
|
}
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3335
|
+
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(
|
|
3336
|
+
// subjectTag.tag.tagSupport.ownerTagSupport,
|
|
3337
|
+
ownerTag.tagSupport, templater, subjectTag);
|
|
3338
|
+
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__.updateExistingTagComponent)(ownerTag, templater, // latest value
|
|
3339
|
+
subjectTag, insertBefore);
|
|
3340
|
+
return subjectTag;
|
|
3404
3341
|
}
|
|
3405
3342
|
// was component but no longer
|
|
3406
|
-
const
|
|
3407
|
-
if (
|
|
3408
|
-
handleStillTag(
|
|
3409
|
-
return
|
|
3343
|
+
const tag = subjectTag.tag;
|
|
3344
|
+
if (tag) {
|
|
3345
|
+
handleStillTag(tag, subject, value, ownerTag);
|
|
3346
|
+
return subjectTag;
|
|
3410
3347
|
}
|
|
3411
3348
|
// its another tag array
|
|
3412
|
-
if ((0,
|
|
3413
|
-
(0,
|
|
3349
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
|
|
3350
|
+
(0,_processTagArray__WEBPACK_IMPORTED_MODULE_3__.processTagArray)(subject, value, oldInsertBefore, ownerTag, { counts: {
|
|
3414
3351
|
added: 0,
|
|
3415
3352
|
removed: 0,
|
|
3416
3353
|
} });
|
|
@@ -3419,39 +3356,39 @@ function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
|
3419
3356
|
// now its a function
|
|
3420
3357
|
if (value instanceof Function) {
|
|
3421
3358
|
// const newSubject = getSubjectFunction(value, ownerTag)
|
|
3422
|
-
const bound = (0,
|
|
3359
|
+
const bound = (0,_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_9__.bindSubjectCallback)(value, ownerTag);
|
|
3423
3360
|
subject.set(bound);
|
|
3424
3361
|
return subject;
|
|
3425
3362
|
}
|
|
3426
|
-
if ((0,
|
|
3427
|
-
|
|
3428
|
-
(0,
|
|
3429
|
-
return
|
|
3363
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(value)) {
|
|
3364
|
+
subjectTag.template = oldInsertBefore;
|
|
3365
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processTag)(value, subjectTag, subjectTag.template, ownerTag);
|
|
3366
|
+
return subjectTag;
|
|
3430
3367
|
}
|
|
3431
3368
|
// we have been given a subject
|
|
3432
|
-
if ((0,
|
|
3369
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
|
|
3433
3370
|
return value;
|
|
3434
3371
|
}
|
|
3435
3372
|
// This will cause all other values to render
|
|
3436
|
-
(0,
|
|
3437
|
-
return
|
|
3373
|
+
(0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, oldInsertBefore);
|
|
3374
|
+
return subjectTag;
|
|
3438
3375
|
}
|
|
3439
3376
|
function handleStillTag(existingTag, subject, value, ownerTag) {
|
|
3440
3377
|
// TODO: We shouldn't need both of these
|
|
3441
|
-
const isSameTag = value && (0,
|
|
3378
|
+
const isSameTag = value && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_8__.isLikeTags)(existingTag, value);
|
|
3442
3379
|
const isSameTag2 = value && value.getTemplate && existingTag.isLikeTag(value);
|
|
3443
3380
|
const tag = value;
|
|
3444
3381
|
if (!tag.tagSupport) {
|
|
3445
|
-
(0,
|
|
3382
|
+
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.applyFakeTemplater)(tag, ownerTag, subject);
|
|
3446
3383
|
}
|
|
3447
3384
|
if (isSameTag) {
|
|
3448
3385
|
existingTag.updateByTag(tag);
|
|
3449
3386
|
return;
|
|
3450
3387
|
}
|
|
3451
3388
|
if (isSameTag || isSameTag2) {
|
|
3452
|
-
return (0,
|
|
3389
|
+
return (0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processTag)(value, subject, subject.template, ownerTag);
|
|
3453
3390
|
}
|
|
3454
|
-
return (0,
|
|
3391
|
+
return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, subject.template);
|
|
3455
3392
|
}
|
|
3456
3393
|
|
|
3457
3394
|
|