taggedjs 2.5.11 → 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 +140 -105
- package/bundle.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/processAttribute.function.js +6 -5
- package/js/interpolations/processAttribute.function.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.js.map +1 -1
- package/js/tag/TagSupport.class.d.ts +0 -2
- package/js/tag/TagSupport.class.js +20 -24
- package/js/tag/TagSupport.class.js.map +1 -1
- package/js/tag/checkDestroyPrevious.function.js +4 -1
- 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/tagRunner.js +20 -5
- package/js/tag/tagRunner.js.map +1 -1
- package/js/tag/update/processTagArray.js +6 -4
- package/js/tag/update/processTagArray.js.map +1 -1
- package/js/tag/update/updateExistingTagComponent.function.js +9 -9
- package/js/tag/update/updateExistingTagComponent.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
|
|
|
@@ -815,7 +814,9 @@ function processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet
|
|
|
815
814
|
child.removeAttribute(lastValue);
|
|
816
815
|
}
|
|
817
816
|
else if (lastValue instanceof Object) {
|
|
818
|
-
|
|
817
|
+
for (const name in lastValue) {
|
|
818
|
+
child.removeAttribute(name);
|
|
819
|
+
}
|
|
819
820
|
}
|
|
820
821
|
}
|
|
821
822
|
if (typeof (attrValue) === 'string') {
|
|
@@ -826,20 +827,19 @@ function processNameOnlyAttr(attrValue, lastValue, child, ownerSupport, howToSet
|
|
|
826
827
|
return;
|
|
827
828
|
}
|
|
828
829
|
if (attrValue instanceof Object) {
|
|
829
|
-
|
|
830
|
-
|
|
830
|
+
for (const name in attrValue) {
|
|
831
|
+
processNameValueAttr(name, attrValue[name], child, ownerSupport, howToSet);
|
|
832
|
+
}
|
|
831
833
|
}
|
|
832
834
|
}
|
|
833
835
|
function processNameValueAttr(attrName, result, child, ownerSupport, howToSet) {
|
|
834
836
|
const isSpecial = isSpecialAttr(attrName);
|
|
835
|
-
// attach as callback?
|
|
836
837
|
if (result instanceof Function) {
|
|
837
838
|
const action = function (...args) {
|
|
838
839
|
const result2 = result(child, args);
|
|
839
840
|
return result2;
|
|
840
841
|
};
|
|
841
842
|
child[attrName].action = action;
|
|
842
|
-
// child.addEventListener(attrName, action)
|
|
843
843
|
}
|
|
844
844
|
// Most every variable comes in here since everything is made a ValueSubject
|
|
845
845
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(result)) {
|
|
@@ -1332,25 +1332,29 @@ function providersChangeCheck(tagSupport) {
|
|
|
1332
1332
|
const global = tagSupport.global;
|
|
1333
1333
|
const providersWithChanges = global.providers.filter(provider => !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(provider.instance, provider.clone));
|
|
1334
1334
|
// reset clones
|
|
1335
|
-
providersWithChanges.
|
|
1335
|
+
for (let index = providersWithChanges.length - 1; index >= 0; --index) {
|
|
1336
|
+
const provider = providersWithChanges[index];
|
|
1336
1337
|
const appSupport = tagSupport.getAppTagSupport();
|
|
1337
1338
|
handleProviderChanges(appSupport, provider);
|
|
1338
1339
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
1339
|
-
}
|
|
1340
|
+
}
|
|
1340
1341
|
}
|
|
1341
1342
|
function handleProviderChanges(appSupport, provider) {
|
|
1342
1343
|
const tagsWithProvider = getTagsWithProvider(appSupport, provider);
|
|
1343
|
-
tagsWithProvider.
|
|
1344
|
+
for (let index = tagsWithProvider.length - 1; index >= 0; --index) {
|
|
1345
|
+
const { tagSupport, renderCount, provider } = tagsWithProvider[index];
|
|
1344
1346
|
if (tagSupport.global.deleted) {
|
|
1345
|
-
|
|
1347
|
+
continue; // i was deleted after another tag processed
|
|
1346
1348
|
}
|
|
1347
1349
|
const notRendered = renderCount === tagSupport.global.renderCount;
|
|
1348
1350
|
if (notRendered) {
|
|
1349
1351
|
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
1350
|
-
|
|
1352
|
+
(0,_tag_render_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tagSupport, false);
|
|
1353
|
+
continue;
|
|
1351
1354
|
}
|
|
1352
|
-
}
|
|
1355
|
+
}
|
|
1353
1356
|
}
|
|
1357
|
+
/** Updates and returns memory of tag providers */
|
|
1354
1358
|
function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
1355
1359
|
const global = tagSupport.global;
|
|
1356
1360
|
const compare = global.providers;
|
|
@@ -1362,7 +1366,10 @@ function getTagsWithProvider(tagSupport, provider, memory = []) {
|
|
|
1362
1366
|
provider: hasProvider,
|
|
1363
1367
|
});
|
|
1364
1368
|
}
|
|
1365
|
-
tagSupport.childTags
|
|
1369
|
+
const childTags = tagSupport.childTags;
|
|
1370
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
1371
|
+
getTagsWithProvider(childTags[index], provider, memory);
|
|
1372
|
+
}
|
|
1366
1373
|
return memory;
|
|
1367
1374
|
}
|
|
1368
1375
|
|
|
@@ -1606,7 +1613,6 @@ const beforeRender = (tagSupport) => initState(tagSupport);
|
|
|
1606
1613
|
beforeRedraw: beforeRender,
|
|
1607
1614
|
afterRender: (tagSupport) => {
|
|
1608
1615
|
const memory = tagSupport.memory;
|
|
1609
|
-
// const state: State = memory.state
|
|
1610
1616
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
1611
1617
|
const rearray = config.rearray;
|
|
1612
1618
|
if (rearray.length) {
|
|
@@ -1623,13 +1629,15 @@ const beforeRender = (tagSupport) => initState(tagSupport);
|
|
|
1623
1629
|
throw error;
|
|
1624
1630
|
}
|
|
1625
1631
|
}
|
|
1626
|
-
const cTagConfig = config.tagSupport;
|
|
1627
1632
|
delete config.rearray; // clean up any previous runs
|
|
1628
1633
|
delete config.tagSupport;
|
|
1629
1634
|
memory.state.length = 0;
|
|
1630
1635
|
memory.state.push(...config.array);
|
|
1631
|
-
|
|
1632
|
-
|
|
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
|
+
}
|
|
1633
1641
|
config.array = [];
|
|
1634
1642
|
}
|
|
1635
1643
|
});
|
|
@@ -1655,15 +1663,18 @@ function initState(tagSupport) {
|
|
|
1655
1663
|
const memory = tagSupport.memory;
|
|
1656
1664
|
const state = memory.state;
|
|
1657
1665
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
1658
|
-
// TODO:
|
|
1666
|
+
// TODO: The following two blocks of code are state protects, have a production mode that removes this checks
|
|
1659
1667
|
/*
|
|
1660
1668
|
if (config.rearray) {
|
|
1661
1669
|
checkStateMismatch(tagSupport, config, state)
|
|
1662
1670
|
}
|
|
1663
1671
|
*/
|
|
1664
1672
|
config.rearray = [];
|
|
1665
|
-
|
|
1666
|
-
|
|
1673
|
+
const stateLength = state?.length;
|
|
1674
|
+
if (stateLength) {
|
|
1675
|
+
for (let index = 0; index < stateLength; ++index) {
|
|
1676
|
+
getStateValue(state[index]);
|
|
1677
|
+
}
|
|
1667
1678
|
config.rearray.push(...state);
|
|
1668
1679
|
}
|
|
1669
1680
|
config.tagSupport = tagSupport;
|
|
@@ -1760,14 +1771,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1760
1771
|
/* harmony export */ syncStates: () => (/* binding */ syncStates)
|
|
1761
1772
|
/* harmony export */ });
|
|
1762
1773
|
function syncStates(stateFrom, stateTo) {
|
|
1763
|
-
stateFrom.
|
|
1774
|
+
for (let index = stateFrom.length - 1; index >= 0; --index) {
|
|
1775
|
+
const state = stateFrom[index];
|
|
1764
1776
|
const fromValue = state.get();
|
|
1765
1777
|
const callback = stateTo[index].callback;
|
|
1766
1778
|
if (callback) {
|
|
1767
1779
|
callback(fromValue); // set the value
|
|
1768
1780
|
}
|
|
1769
1781
|
stateTo[index].lastValue = fromValue; // record the value
|
|
1770
|
-
}
|
|
1782
|
+
}
|
|
1771
1783
|
}
|
|
1772
1784
|
|
|
1773
1785
|
|
|
@@ -1966,15 +1978,17 @@ class Subject {
|
|
|
1966
1978
|
set(value) {
|
|
1967
1979
|
this.value = value;
|
|
1968
1980
|
// Notify all subscribers with the new value
|
|
1969
|
-
this.subscribers
|
|
1970
|
-
|
|
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];
|
|
1971
1985
|
sub.callback(value, sub);
|
|
1972
|
-
}
|
|
1986
|
+
}
|
|
1973
1987
|
}
|
|
1974
1988
|
// next() is available for rxjs compatibility
|
|
1975
1989
|
next = this.set;
|
|
1976
1990
|
toPromise() {
|
|
1977
|
-
return new Promise(
|
|
1991
|
+
return new Promise(res => {
|
|
1978
1992
|
this.subscribe((x, subscription) => {
|
|
1979
1993
|
subscription.unsubscribe();
|
|
1980
1994
|
res(x);
|
|
@@ -2151,7 +2165,10 @@ function getSubscription(subject, callback) {
|
|
|
2151
2165
|
// any double unsubscribes will be ignored
|
|
2152
2166
|
subscription.unsubscribe = () => subscription;
|
|
2153
2167
|
// unsubscribe from any combined subjects
|
|
2154
|
-
|
|
2168
|
+
const subscriptions = subscription.subscriptions;
|
|
2169
|
+
for (let index = subscriptions.length - 1; index >= 0; --index) {
|
|
2170
|
+
subscriptions[index].unsubscribe();
|
|
2171
|
+
}
|
|
2155
2172
|
return subscription;
|
|
2156
2173
|
};
|
|
2157
2174
|
subscription.add = (sub) => {
|
|
@@ -2171,7 +2188,6 @@ function runPipedMethods(value, methods, onComplete) {
|
|
|
2171
2188
|
return runPipedMethods(newValue, cloneMethods, onComplete);
|
|
2172
2189
|
}
|
|
2173
2190
|
onComplete(newValue);
|
|
2174
|
-
// return newValue = next
|
|
2175
2191
|
};
|
|
2176
2192
|
let handler = next;
|
|
2177
2193
|
const setHandler = (x) => handler = x;
|
|
@@ -2298,8 +2314,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2298
2314
|
/* harmony import */ var _interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../interpolations/interpolateElement */ "./ts/interpolations/interpolateElement.ts");
|
|
2299
2315
|
/* harmony import */ var _interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../interpolations/interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
|
|
2300
2316
|
/* harmony import */ var _interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../interpolations/afterInterpolateElement.function */ "./ts/interpolations/afterInterpolateElement.function.ts");
|
|
2301
|
-
/* harmony import */ var _render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./render/renderSubjectComponent.function */ "./ts/tag/render/renderSubjectComponent.function.ts");
|
|
2302
|
-
|
|
2303
2317
|
|
|
2304
2318
|
|
|
2305
2319
|
|
|
@@ -2384,10 +2398,12 @@ class BaseTagSupport {
|
|
|
2384
2398
|
(0,_interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, placeholderElm, this, // ownerSupport
|
|
2385
2399
|
context, options);
|
|
2386
2400
|
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
2387
|
-
tagComponents.
|
|
2401
|
+
const length = tagComponents.length;
|
|
2402
|
+
for (let index = 0; index < length; ++index) {
|
|
2403
|
+
const tagComponent = tagComponents[index];
|
|
2388
2404
|
(0,_interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts);
|
|
2389
2405
|
(0,_interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, tagComponent.insertBefore, tagComponent.ownerSupport, context, options);
|
|
2390
|
-
}
|
|
2406
|
+
}
|
|
2391
2407
|
}
|
|
2392
2408
|
getTemplate() {
|
|
2393
2409
|
const thisTag = this.templater.tag;
|
|
@@ -2461,14 +2477,15 @@ class TagSupport extends BaseTagSupport {
|
|
|
2461
2477
|
}
|
|
2462
2478
|
this.destroySubscriptions();
|
|
2463
2479
|
// signify immediately child has been deleted (looked for during event processing)
|
|
2464
|
-
childTags.
|
|
2480
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
2481
|
+
const child = childTags[index];
|
|
2465
2482
|
const subGlobal = child.global;
|
|
2466
2483
|
delete subGlobal.newest;
|
|
2467
2484
|
subGlobal.deleted = true;
|
|
2468
2485
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(child.templater)) {
|
|
2469
2486
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_5__.runBeforeDestroy)(child, child);
|
|
2470
2487
|
}
|
|
2471
|
-
}
|
|
2488
|
+
}
|
|
2472
2489
|
// HTML DOM manipulation. Put back down the template tag
|
|
2473
2490
|
const insertBefore = global.insertBefore;
|
|
2474
2491
|
if (insertBefore.nodeName === 'TEMPLATE') {
|
|
@@ -2514,9 +2531,11 @@ class TagSupport extends BaseTagSupport {
|
|
|
2514
2531
|
return mainPromise.then(() => options.stagger);
|
|
2515
2532
|
}
|
|
2516
2533
|
destroySubscriptions() {
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
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;
|
|
2520
2539
|
}
|
|
2521
2540
|
destroyClones({ stagger } = {
|
|
2522
2541
|
stagger: 0,
|
|
@@ -2526,12 +2545,13 @@ class TagSupport extends BaseTagSupport {
|
|
|
2526
2545
|
const promises = oldClones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises
|
|
2527
2546
|
// check subjects that may have clones attached to them
|
|
2528
2547
|
const oldContext = this.global.context;
|
|
2529
|
-
|
|
2548
|
+
for (const name in oldContext) {
|
|
2549
|
+
const value = oldContext[name];
|
|
2530
2550
|
const clone = value.clone;
|
|
2531
|
-
if (clone
|
|
2551
|
+
if (clone?.parentNode) {
|
|
2532
2552
|
clone.parentNode.removeChild(clone);
|
|
2533
2553
|
}
|
|
2534
|
-
}
|
|
2554
|
+
}
|
|
2535
2555
|
if (promises.length) {
|
|
2536
2556
|
return { promise: Promise.all(promises), stagger };
|
|
2537
2557
|
}
|
|
@@ -2575,18 +2595,6 @@ class TagSupport extends BaseTagSupport {
|
|
|
2575
2595
|
this.values = values;
|
|
2576
2596
|
return this.updateContext(this.global.context);
|
|
2577
2597
|
}
|
|
2578
|
-
/** Used during HMR only where static content itself could have been edited */
|
|
2579
|
-
async rebuild() {
|
|
2580
|
-
delete this.strings; // seek the templater strings instead now
|
|
2581
|
-
delete this.values; // seek the templater strings instead now
|
|
2582
|
-
restoreTagMarkers(this);
|
|
2583
|
-
const newSupport = (0,_render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_14__.renderSubjectComponent)(this.subject, this, this.ownerTagSupport);
|
|
2584
|
-
await this.destroy();
|
|
2585
|
-
newSupport.buildBeforeElement(this.global.insertBefore, {
|
|
2586
|
-
counts: { added: 0, removed: 0 },
|
|
2587
|
-
});
|
|
2588
|
-
return newSupport;
|
|
2589
|
-
}
|
|
2590
2598
|
getAppTagSupport() {
|
|
2591
2599
|
let tag = this;
|
|
2592
2600
|
while (tag.ownerTagSupport) {
|
|
@@ -2597,7 +2605,10 @@ class TagSupport extends BaseTagSupport {
|
|
|
2597
2605
|
}
|
|
2598
2606
|
function restoreTagMarkers(support) {
|
|
2599
2607
|
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_4__.restoreTagMarker)(support);
|
|
2600
|
-
|
|
2608
|
+
const childTags = support.childTags;
|
|
2609
|
+
for (let index = childTags.length - 1; index >= 0; --index) {
|
|
2610
|
+
restoreTagMarkers(childTags[index].global.oldest);
|
|
2611
|
+
}
|
|
2601
2612
|
}
|
|
2602
2613
|
|
|
2603
2614
|
|
|
@@ -2649,7 +2660,10 @@ newValue, insertBefore) {
|
|
|
2649
2660
|
delete arraySubject.lastArray;
|
|
2650
2661
|
delete arraySubject.placeholder;
|
|
2651
2662
|
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_3__.insertAfter)(insertBefore, placeholderElm);
|
|
2652
|
-
|
|
2663
|
+
for (let index = wasArray.length - 1; index >= 0; --index) {
|
|
2664
|
+
const { tagSupport } = wasArray[index];
|
|
2665
|
+
destroyArrayTag(tagSupport, { added: 0, removed: 0 });
|
|
2666
|
+
}
|
|
2653
2667
|
return 'array';
|
|
2654
2668
|
}
|
|
2655
2669
|
const tagSubject = subject;
|
|
@@ -3428,14 +3442,18 @@ function getTagWrap(templater, result) {
|
|
|
3428
3442
|
};
|
|
3429
3443
|
tagSupport.memory = newTagSupport.memory; // state handover
|
|
3430
3444
|
if (templater.madeChildIntoSubject) {
|
|
3431
|
-
childSubject.value
|
|
3432
|
-
|
|
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];
|
|
3433
3451
|
if (!(value instanceof Function)) {
|
|
3434
|
-
|
|
3452
|
+
continue;
|
|
3435
3453
|
}
|
|
3436
3454
|
const valuesValue = kid.values[index];
|
|
3437
3455
|
if (valuesValue.isChildOverride) {
|
|
3438
|
-
|
|
3456
|
+
continue; // already overwritten
|
|
3439
3457
|
}
|
|
3440
3458
|
// all functions need to report to me
|
|
3441
3459
|
kid.values[index] = function (...args) {
|
|
@@ -3445,8 +3463,8 @@ function getTagWrap(templater, result) {
|
|
|
3445
3463
|
args);
|
|
3446
3464
|
};
|
|
3447
3465
|
valuesValue.isChildOverride = true;
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3450
3468
|
}
|
|
3451
3469
|
return tagSupport;
|
|
3452
3470
|
};
|
|
@@ -3553,7 +3571,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3553
3571
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../state */ "./ts/state/index.ts");
|
|
3554
3572
|
/* harmony import */ var _subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../subject */ "./ts/subject/index.ts");
|
|
3555
3573
|
/* harmony import */ var _getSupportInCycle_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getSupportInCycle.function */ "./ts/tag/getSupportInCycle.function.ts");
|
|
3556
|
-
// TODO: This should be more like `new TaggedJs().use({})`
|
|
3557
3574
|
|
|
3558
3575
|
|
|
3559
3576
|
|
|
@@ -3565,20 +3582,36 @@ _state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.tagClosed$ = new _subject__WEB
|
|
|
3565
3582
|
});
|
|
3566
3583
|
// Life cycle 1
|
|
3567
3584
|
function runBeforeRender(tagSupport, ownerSupport) {
|
|
3568
|
-
_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
|
+
}
|
|
3569
3590
|
}
|
|
3570
3591
|
// Life cycle 2
|
|
3571
3592
|
function runAfterRender(tagSupport, ownerTagSupport) {
|
|
3572
|
-
_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
|
+
}
|
|
3573
3598
|
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.tagClosed$.next(ownerTagSupport);
|
|
3574
3599
|
}
|
|
3575
3600
|
// Life cycle 3
|
|
3576
3601
|
function runBeforeRedraw(tagSupport, ownerTagSupport) {
|
|
3577
|
-
_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
|
+
}
|
|
3578
3607
|
}
|
|
3579
3608
|
// Life cycle 4 - end of life
|
|
3580
3609
|
function runBeforeDestroy(tagSupport, ownerTagSupport) {
|
|
3581
|
-
_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
|
+
}
|
|
3582
3615
|
}
|
|
3583
3616
|
|
|
3584
3617
|
|
|
@@ -3963,7 +3996,9 @@ ownerSupport, options) {
|
|
|
3963
3996
|
}
|
|
3964
3997
|
return true;
|
|
3965
3998
|
});
|
|
3966
|
-
|
|
3999
|
+
const length = value.length;
|
|
4000
|
+
for (let index = 0; index < length; ++index) {
|
|
4001
|
+
const item = value[index];
|
|
3967
4002
|
const previous = lastArray[index];
|
|
3968
4003
|
const previousSupport = previous?.tagSupport;
|
|
3969
4004
|
const subTag = item;
|
|
@@ -3971,7 +4006,6 @@ ownerSupport, options) {
|
|
|
3971
4006
|
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.tagFakeTemplater)(subTag);
|
|
3972
4007
|
}
|
|
3973
4008
|
const tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_4__.TagSupport(subTag.templater, ownerSupport, new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(undefined));
|
|
3974
|
-
// tagSupport.templater = subTag.templater
|
|
3975
4009
|
if (previousSupport) {
|
|
3976
4010
|
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.setupNewTemplater)(tagSupport, ownerSupport, previousSupport.subject);
|
|
3977
4011
|
const global = previousSupport.global;
|
|
@@ -3997,11 +4031,12 @@ ownerSupport, options) {
|
|
|
3997
4031
|
// subTag.tagSupport = subTag.tagSupport || prevSupport
|
|
3998
4032
|
const oldest = prevGlobal.oldest;
|
|
3999
4033
|
oldest.updateBy(tagSupport);
|
|
4000
|
-
return []
|
|
4034
|
+
// return []
|
|
4035
|
+
continue;
|
|
4001
4036
|
}
|
|
4002
4037
|
processAddTagArrayItem(runtimeInsertBefore, tagSupport, index, options, lastArray);
|
|
4003
4038
|
ownerSupport.childTags.push(tagSupport);
|
|
4004
|
-
}
|
|
4039
|
+
}
|
|
4005
4040
|
return clones;
|
|
4006
4041
|
}
|
|
4007
4042
|
function setPlaceholderElm(insertBefore, subject) {
|
|
@@ -4182,8 +4217,7 @@ subject, insertBefore) {
|
|
|
4182
4217
|
const oldFunction = oldWrapper.parentWrap.original;
|
|
4183
4218
|
const newFunction = newWrapper.parentWrap.original;
|
|
4184
4219
|
// string compare both functions
|
|
4185
|
-
|
|
4186
|
-
isSameTag = oldFunction === newFunction; // ???
|
|
4220
|
+
isSameTag = oldFunction === newFunction;
|
|
4187
4221
|
}
|
|
4188
4222
|
const templater = tagSupport.templater;
|
|
4189
4223
|
if (!isSameTag) {
|
|
@@ -4252,7 +4286,8 @@ function syncFunctionProps(lastSupport, ownerSupport, newPropsArray) {
|
|
|
4252
4286
|
const priorPropConfig = lastSupport.propsConfig;
|
|
4253
4287
|
const priorPropsArray = priorPropConfig.latestCloned;
|
|
4254
4288
|
const prevSupport = ownerSupport.global.newest;
|
|
4255
|
-
newPropsArray.
|
|
4289
|
+
for (let index = newPropsArray.length - 1; index >= 0; --index) {
|
|
4290
|
+
const argPosition = newPropsArray[index];
|
|
4256
4291
|
if (typeof (argPosition) !== 'object') {
|
|
4257
4292
|
return;
|
|
4258
4293
|
}
|
|
@@ -4260,23 +4295,23 @@ function syncFunctionProps(lastSupport, ownerSupport, newPropsArray) {
|
|
|
4260
4295
|
if (typeof (priorProps) !== 'object') {
|
|
4261
4296
|
return;
|
|
4262
4297
|
}
|
|
4263
|
-
|
|
4298
|
+
for (const name in argPosition) {
|
|
4299
|
+
const value = argPosition[name];
|
|
4264
4300
|
if (!(value instanceof Function)) {
|
|
4265
|
-
|
|
4301
|
+
continue;
|
|
4266
4302
|
}
|
|
4267
4303
|
const newCallback = argPosition[name]; // || value
|
|
4268
4304
|
const original = newCallback instanceof Function && newCallback.toCall;
|
|
4269
4305
|
if (original) {
|
|
4270
|
-
|
|
4306
|
+
continue; // already previously converted
|
|
4271
4307
|
}
|
|
4272
4308
|
// Currently, call self but over parent state changes, I may need to call a newer parent tag owner
|
|
4273
4309
|
priorProps[name].toCall = (...args) => {
|
|
4274
4310
|
return (0,_alterProps_function__WEBPACK_IMPORTED_MODULE_4__.callbackPropOwner)(newCallback, // value, // newOriginal,
|
|
4275
4311
|
args, prevSupport);
|
|
4276
4312
|
};
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
});
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4280
4315
|
}
|
|
4281
4316
|
|
|
4282
4317
|
|