taggedjs 2.4.14 → 2.4.17
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 +707 -756
- package/bundle.js.map +1 -1
- package/js/Clones.type.d.ts +0 -1
- package/js/Clones.type.js +1 -1
- package/js/Clones.type.js.map +1 -1
- package/js/Tag.class.d.ts +1 -1
- package/js/Tag.class.js +52 -92
- package/js/Tag.class.js.map +1 -1
- package/js/TemplaterResult.class.d.ts +20 -19
- package/js/TemplaterResult.class.js +1 -1
- package/js/TemplaterResult.class.js.map +1 -1
- package/js/checkDestroyPrevious.function.js +5 -11
- package/js/checkDestroyPrevious.function.js.map +1 -1
- package/js/{Errors.d.ts → errors.d.ts} +3 -0
- package/js/{Errors.js → errors.js} +6 -0
- package/js/{Errors.js.map → errors.js.map} +1 -1
- package/js/index.d.ts +1 -9
- package/js/index.js +1 -12
- package/js/index.js.map +1 -1
- package/js/interpolateTemplate.js +3 -0
- package/js/interpolateTemplate.js.map +1 -1
- package/js/processSubjectComponent.function.js +4 -1
- package/js/processSubjectComponent.function.js.map +1 -1
- package/js/processTag.function.js +1 -1
- package/js/processTag.function.js.map +1 -1
- package/js/processTagArray.d.ts +1 -2
- package/js/processTagArray.js +12 -32
- package/js/processTagArray.js.map +1 -1
- package/js/processTagResult.function.d.ts +3 -2
- package/js/processTagResult.function.js +5 -3
- package/js/processTagResult.function.js.map +1 -1
- package/js/renderExistingTag.function.js +1 -1
- package/js/renderExistingTag.function.js.map +1 -1
- package/js/state/callbackMaker.function.d.ts +3 -0
- package/js/state/callbackMaker.function.js +52 -0
- package/js/state/callbackMaker.function.js.map +1 -0
- package/js/state/getCallback.d.ts +3 -0
- package/js/state/getCallback.js +51 -0
- package/js/state/getCallback.js.map +1 -0
- package/js/state/index.d.ts +10 -0
- package/js/state/index.js +10 -0
- package/js/state/index.js.map +1 -0
- package/js/state/letState.function.d.ts +3 -0
- package/js/state/letState.function.js +42 -0
- package/js/state/letState.function.js.map +1 -0
- package/js/state/onDestroy.d.ts +2 -0
- package/js/state/onDestroy.js +17 -0
- package/js/state/onDestroy.js.map +1 -0
- package/js/state/onInit.d.ts +2 -0
- package/js/state/onInit.js +17 -0
- package/js/state/onInit.js.map +1 -0
- package/js/state/provider.utils.d.ts +2 -0
- package/js/state/provider.utils.js +45 -0
- package/js/state/provider.utils.js.map +1 -0
- package/js/state/providers.d.ts +18 -0
- package/js/state/providers.js +86 -0
- package/js/state/providers.js.map +1 -0
- package/js/state/setProp.function.d.ts +3 -0
- package/js/state/setProp.function.js +37 -0
- package/js/state/setProp.function.js.map +1 -0
- package/js/state/setUse.function.d.ts +23 -0
- package/js/state/setUse.function.js +14 -0
- package/js/state/setUse.function.js.map +1 -0
- package/js/state/state.function.d.ts +2 -0
- package/js/state/state.function.js +34 -0
- package/js/state/state.function.js.map +1 -0
- package/js/state/state.utils.d.ts +22 -0
- package/js/state/state.utils.js +85 -0
- package/js/state/state.utils.js.map +1 -0
- package/js/state/watch.function.d.ts +3 -0
- package/js/state/watch.function.js +20 -0
- package/js/state/watch.function.js.map +1 -0
- package/js/subject/Subject.class.js +4 -4
- package/js/subject/Subject.class.js.map +1 -1
- package/js/subject/Subject.utils.d.ts +1 -1
- package/js/subject/ValueSubject.d.ts +1 -1
- package/js/subject/ValueSubject.js +1 -1
- package/js/subject/ValueSubject.js.map +1 -1
- package/js/tag.js +1 -1
- package/js/tag.js.map +1 -1
- package/js/tagRunner.js +1 -1
- package/js/tagRunner.js.map +1 -1
- package/js/updateExistingTagComponent.function.js +1 -6
- package/js/updateExistingTagComponent.function.js.map +1 -1
- package/js/updateExistingValue.function.js +4 -19
- package/js/updateExistingValue.function.js.map +1 -1
- package/package.json +1 -1
- package/js/Subject.d.ts +0 -17
- package/js/Subject.js +0 -47
- package/js/Subject.js.map +0 -1
- package/js/ValueSubject.d.ts +0 -8
- package/js/ValueSubject.js +0 -15
- package/js/ValueSubject.js.map +0 -1
- package/js/bindSubjectCallback.function 9.27.33/342/200/257AM.js" +0 -32
- package/js/bindSubjectCallback.function.d 9.27.33/342/200/257AM.ts" +0 -8
- package/js/redrawTag.function.d.ts +0 -5
- package/js/redrawTag.function.js +0 -18
- package/js/redrawTag.function.js.map +0 -1
- package/js/templater.utils.d.ts +0 -37
- package/js/templater.utils.js +0 -118
- package/js/templater.utils.js.map +0 -1
- package/js/updateExistingTag.function.d.ts +0 -4
- package/js/updateExistingTag.function.js +0 -24
- package/js/updateExistingTag.function.js.map +0 -1
package/bundle.js
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
/******/ var __webpack_modules__ = ({
|
|
2
2
|
|
|
3
|
-
/***/ "./ts/Clones.type.ts":
|
|
4
|
-
/*!***************************!*\
|
|
5
|
-
!*** ./ts/Clones.type.ts ***!
|
|
6
|
-
\***************************/
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
-
/* harmony export */ isRemoveTemplates: () => (/* binding */ isRemoveTemplates)
|
|
12
|
-
/* harmony export */ });
|
|
13
|
-
const isRemoveTemplates = true;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/***/ }),
|
|
17
|
-
|
|
18
3
|
/***/ "./ts/ElementTargetEvent.interface.ts":
|
|
19
4
|
/*!********************************************!*\
|
|
20
5
|
!*** ./ts/ElementTargetEvent.interface.ts ***!
|
|
@@ -48,11 +33,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
48
33
|
/* harmony import */ var _processNewValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processNewValue.function */ "./ts/processNewValue.function.ts");
|
|
49
34
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
50
35
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
51
|
-
/* harmony import */ var
|
|
52
|
-
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
53
|
-
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
56
37
|
|
|
57
38
|
|
|
58
39
|
|
|
@@ -105,15 +86,15 @@ class Tag {
|
|
|
105
86
|
const subject = tagSupport.subject;
|
|
106
87
|
// put back down the template tag
|
|
107
88
|
const insertBefore = global.insertBefore;
|
|
108
|
-
if (
|
|
109
|
-
const placeholder = global.
|
|
89
|
+
if (insertBefore.nodeName === 'TEMPLATE') {
|
|
90
|
+
const placeholder = global.placeholder;
|
|
110
91
|
if (placeholder && !('arrayValue' in this.memory)) {
|
|
111
92
|
if (!options.byParent) {
|
|
112
|
-
(0,
|
|
93
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_8__.restoreTagMarker)(this, insertBefore);
|
|
113
94
|
}
|
|
114
95
|
}
|
|
115
96
|
}
|
|
116
|
-
delete global.
|
|
97
|
+
delete global.placeholder;
|
|
117
98
|
// the isComponent check maybe able to be removed
|
|
118
99
|
const isComponent = tagSupport ? true : false;
|
|
119
100
|
if (isComponent) {
|
|
@@ -289,17 +270,20 @@ class Tag {
|
|
|
289
270
|
const subject = this.tagSupport.subject;
|
|
290
271
|
const thisTemplater = this.tagSupport.templater;
|
|
291
272
|
const global = thisTemplater.global;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
// ??? - removed as we don't steal clones anymore
|
|
298
|
-
// this.clones.push( placeholderElm ) // put back on chopping block
|
|
299
|
-
delete global.placeholderElm;
|
|
273
|
+
global.insertBefore = insertBefore;
|
|
274
|
+
if (!global.placeholder) {
|
|
275
|
+
if (insertBefore.nodeName !== 'TEMPLATE') {
|
|
276
|
+
throw new Error(' no template at insertBefore');
|
|
277
|
+
global.placeholder = insertBefore;
|
|
300
278
|
}
|
|
279
|
+
else {
|
|
280
|
+
setTagPlaceholder(global);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (!global.placeholder?.parentNode) {
|
|
284
|
+
throw new Error('????');
|
|
301
285
|
}
|
|
302
|
-
const
|
|
286
|
+
const placeholderElm = global.placeholder;
|
|
303
287
|
global.oldest = this;
|
|
304
288
|
global.newest = this;
|
|
305
289
|
subject.tag = this;
|
|
@@ -312,7 +296,7 @@ class Tag {
|
|
|
312
296
|
// const context = this.tagSupport.memory.context // this.update()
|
|
313
297
|
const context = this.update();
|
|
314
298
|
const template = this.getTemplate();
|
|
315
|
-
if (!
|
|
299
|
+
if (!placeholderElm.parentNode) {
|
|
316
300
|
throw new Error('no parent before building tag');
|
|
317
301
|
}
|
|
318
302
|
const elementContainer = document.createElement('div');
|
|
@@ -325,60 +309,45 @@ class Tag {
|
|
|
325
309
|
forceElement: options.forceElement,
|
|
326
310
|
counts: options.counts
|
|
327
311
|
});
|
|
328
|
-
if (!
|
|
329
|
-
throw new Error('no parent building tag');
|
|
312
|
+
if (!placeholderElm.parentNode) {
|
|
313
|
+
throw new Error('no parent after building tag');
|
|
330
314
|
}
|
|
331
|
-
afterInterpolateElement(elementContainer,
|
|
332
|
-
this, // ownerTag
|
|
315
|
+
afterInterpolateElement(elementContainer, placeholderElm, this, // ownerTag
|
|
333
316
|
context, options);
|
|
317
|
+
if (!global.placeholder?.parentNode) {
|
|
318
|
+
throw new Error('???? - 2');
|
|
319
|
+
}
|
|
334
320
|
// Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
|
|
335
321
|
let isForceElement = options.forceElement;
|
|
336
322
|
tagComponents.forEach(tagComponent => {
|
|
337
323
|
const tagSupport = tagComponent.ownerTag.tagSupport;
|
|
338
324
|
const tagGlobal = tagSupport.templater.global;
|
|
339
|
-
const placeholderElm = tagGlobal.
|
|
325
|
+
const placeholderElm = tagGlobal.placeholder; // global.placeholderElm
|
|
340
326
|
if (!placeholderElm && !insertBefore.parentNode) {
|
|
341
327
|
throw new Error('no parent building tag components');
|
|
342
328
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
tagComponent.subject, tagComponent.ownerTag, options.counts, { isForceElement });
|
|
346
|
-
const clones = afterInterpolateElement(elementContainer, before, // (will be removed)
|
|
347
|
-
tagComponent.ownerTag, // this, // ownerTag
|
|
348
|
-
context, options);
|
|
349
|
-
if (placeholderElm && !placeholderElm?.parentNode) {
|
|
350
|
-
const clone = clones[this.clones.length - 1];
|
|
351
|
-
if (clone) {
|
|
352
|
-
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_9__.restoreTagMarker)(tagComponent.ownerTag, clone);
|
|
353
|
-
}
|
|
329
|
+
if (!global.placeholder?.parentNode) {
|
|
330
|
+
throw new Error('???? - 3');
|
|
354
331
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
global.placeholderElm = placeholderElm;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (this.clones.length) {
|
|
362
|
-
if (insertBefore.parentNode) {
|
|
363
|
-
global.placeholderElm = insertBefore.previousSibling;
|
|
364
|
-
const parentNode = insertBefore.parentNode;
|
|
365
|
-
parentNode.removeChild(insertBefore);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
332
|
+
(0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerTag, options.counts, { isForceElement });
|
|
333
|
+
if (!global.placeholder?.parentNode) {
|
|
334
|
+
throw new Error('???? - 4');
|
|
368
335
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const clone = insertBefore.previousSibling;
|
|
374
|
-
if (clone) {
|
|
375
|
-
const parentNode = insertBefore.parentNode;
|
|
376
|
-
global.placeholderElm = clone;
|
|
377
|
-
parentNode.removeChild(insertBefore);
|
|
336
|
+
afterInterpolateElement(elementContainer, tagComponent.insertBefore, tagComponent.ownerTag, // this, // ownerTag
|
|
337
|
+
context, options);
|
|
338
|
+
if (!global.placeholder?.parentNode) {
|
|
339
|
+
throw new Error('???? - 5');
|
|
378
340
|
}
|
|
379
|
-
}
|
|
341
|
+
});
|
|
380
342
|
}
|
|
381
343
|
}
|
|
344
|
+
function setTagPlaceholder(global) {
|
|
345
|
+
const insertBefore = global.insertBefore;
|
|
346
|
+
const placeholder = global.placeholder = document.createTextNode('');
|
|
347
|
+
const parentNode = insertBefore.parentNode;
|
|
348
|
+
parentNode.insertBefore(placeholder, insertBefore);
|
|
349
|
+
parentNode.removeChild(insertBefore);
|
|
350
|
+
}
|
|
382
351
|
function afterInterpolateElement(container, insertBefore, tag,
|
|
383
352
|
// preClones: Clones,
|
|
384
353
|
context, options) {
|
|
@@ -386,37 +355,8 @@ context, options) {
|
|
|
386
355
|
if (!clones.length) {
|
|
387
356
|
return clones;
|
|
388
357
|
}
|
|
389
|
-
const ownerSupport = tag.tagSupport;
|
|
390
|
-
const ownerGlobal = ownerSupport.templater.global;
|
|
391
|
-
const hadBefore = _Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates && ownerGlobal.placeholderElm;
|
|
392
|
-
const parentNode = hadBefore ? ownerGlobal.placeholderElm?.parentNode : insertBefore.parentNode;
|
|
393
|
-
// we could now be processing same tag but more after components being rendered
|
|
394
|
-
if (hadBefore) {
|
|
395
|
-
// 0 put the template back down
|
|
396
|
-
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_10__.insertAfter)(insertBefore, hadBefore);
|
|
397
|
-
// ??? - removed as need for arrays
|
|
398
|
-
delete ownerGlobal.placeholderElm;
|
|
399
|
-
}
|
|
400
358
|
clones.forEach(clone => (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_3__.afterElmBuild)(clone, options, context, tag));
|
|
401
|
-
let hasPopClone;
|
|
402
|
-
if (_Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates) {
|
|
403
|
-
const clone = insertBefore.previousSibling; // clones[clones.length - 1]
|
|
404
|
-
if (clone) {
|
|
405
|
-
const isTemplate = clone.tagName === 'TEMPLATE' && clone.hasAttribute('interpolate');
|
|
406
|
-
if (!isTemplate) {
|
|
407
|
-
hasPopClone = ownerGlobal.placeholderElm = clone; // insertBefore
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
if (clones.find(x => x === insertBefore)) {
|
|
412
|
-
throw new Error('adding marker to owner in tag class');
|
|
413
|
-
}
|
|
414
359
|
tag.clones.push(...clones);
|
|
415
|
-
if (_Clones_type__WEBPACK_IMPORTED_MODULE_8__.isRemoveTemplates) {
|
|
416
|
-
if (hasPopClone) { // || hadBefore
|
|
417
|
-
parentNode.removeChild(insertBefore); // belongs to another tag
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
360
|
return clones;
|
|
421
361
|
}
|
|
422
362
|
function getChildTagsToDestroy(childTags, allTags = []) {
|
|
@@ -437,15 +377,9 @@ function updateContextItem(context, variableName, value) {
|
|
|
437
377
|
const tag = subject.tag;
|
|
438
378
|
if (tag) {
|
|
439
379
|
const oldTemp = tag.tagSupport.templater;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
const oldValueFn = oldWrap.original;
|
|
444
|
-
const newValueFn = value.wrapper?.original;
|
|
445
|
-
const fnMatched = oldValueFn === newValueFn;
|
|
446
|
-
if (fnMatched) {
|
|
447
|
-
value.global = oldTemp.global;
|
|
448
|
-
}
|
|
380
|
+
if (value && value.global !== oldTemp.global) {
|
|
381
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent)(value)) {
|
|
382
|
+
shareTemplaterGlobal(oldTemp, value);
|
|
449
383
|
}
|
|
450
384
|
}
|
|
451
385
|
}
|
|
@@ -456,6 +390,15 @@ function updateContextItem(context, variableName, value) {
|
|
|
456
390
|
subject.set(value); // listeners will evaluate updated values to possibly update display(s)
|
|
457
391
|
return;
|
|
458
392
|
}
|
|
393
|
+
function shareTemplaterGlobal(oldTemp, value) {
|
|
394
|
+
const oldWrap = oldTemp.wrapper; // tag versus component
|
|
395
|
+
const oldValueFn = oldWrap.original;
|
|
396
|
+
const newValueFn = value.wrapper?.original;
|
|
397
|
+
const fnMatched = oldValueFn === newValueFn;
|
|
398
|
+
if (fnMatched) {
|
|
399
|
+
value.global = oldTemp.global;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
459
402
|
|
|
460
403
|
|
|
461
404
|
/***/ }),
|
|
@@ -552,7 +495,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
552
495
|
/* harmony export */ renderWithSupport: () => (/* binding */ renderWithSupport)
|
|
553
496
|
/* harmony export */ });
|
|
554
497
|
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
555
|
-
/* harmony import */ var
|
|
498
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
556
499
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
557
500
|
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
558
501
|
|
|
@@ -602,7 +545,7 @@ function renderWithSupport(tagSupport, existingTag, subject, ownerTag) {
|
|
|
602
545
|
// first time render
|
|
603
546
|
(0,_tagRunner__WEBPACK_IMPORTED_MODULE_0__.runBeforeRender)(wrapTagSupport, runtimeOwnerTag);
|
|
604
547
|
// TODO: Logic below most likely could live within providers.ts inside the runBeforeRender function
|
|
605
|
-
const providers =
|
|
548
|
+
const providers = _state__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
606
549
|
providers.ownerTag = runtimeOwnerTag;
|
|
607
550
|
}
|
|
608
551
|
/* END: BEFORE RENDER */
|
|
@@ -779,9 +722,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
779
722
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
780
723
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
781
724
|
/* harmony import */ var _destroyTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./destroyTag.function */ "./ts/destroyTag.function.ts");
|
|
782
|
-
/* harmony import */ var
|
|
783
|
-
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
784
|
-
|
|
725
|
+
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
785
726
|
|
|
786
727
|
|
|
787
728
|
|
|
@@ -792,10 +733,10 @@ newValue, insertBefore) {
|
|
|
792
733
|
const wasArray = arraySubject.lastArray;
|
|
793
734
|
// no longer an array
|
|
794
735
|
if (wasArray && !(0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(newValue)) {
|
|
795
|
-
const placeholderElm = arraySubject.
|
|
736
|
+
const placeholderElm = arraySubject.placeholder;
|
|
796
737
|
delete arraySubject.lastArray;
|
|
797
|
-
delete arraySubject.
|
|
798
|
-
(0,
|
|
738
|
+
delete arraySubject.placeholder;
|
|
739
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_3__.insertAfter)(insertBefore, placeholderElm);
|
|
799
740
|
wasArray.forEach(({ tag }) => destroyArrayTag(tag, { added: 0, removed: 0 }));
|
|
800
741
|
return 'array';
|
|
801
742
|
}
|
|
@@ -810,9 +751,7 @@ newValue, insertBefore) {
|
|
|
810
751
|
// its a different tag now
|
|
811
752
|
if (!(0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_1__.isLikeTags)(newTag, existingTag)) {
|
|
812
753
|
// put template back down
|
|
813
|
-
|
|
814
|
-
restoreTagMarker(existingTag, insertBefore);
|
|
815
|
-
}
|
|
754
|
+
restoreTagMarker(existingTag, insertBefore);
|
|
816
755
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, tagSubject);
|
|
817
756
|
return 2;
|
|
818
757
|
}
|
|
@@ -823,9 +762,7 @@ newValue, insertBefore) {
|
|
|
823
762
|
return false; // its still a tag component
|
|
824
763
|
}
|
|
825
764
|
// put template back down
|
|
826
|
-
|
|
827
|
-
restoreTagMarker(existingTag, insertBefore);
|
|
828
|
-
}
|
|
765
|
+
restoreTagMarker(existingTag, insertBefore);
|
|
829
766
|
// destroy old component, value is not a component
|
|
830
767
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(existingTag, tagSubject);
|
|
831
768
|
return 'different-tag';
|
|
@@ -858,10 +795,9 @@ subject) {
|
|
|
858
795
|
}
|
|
859
796
|
function restoreTagMarker(existingTag, insertBefore) {
|
|
860
797
|
const global = existingTag.tagSupport.templater.global;
|
|
861
|
-
const placeholderElm = global.
|
|
798
|
+
const placeholderElm = global.placeholder;
|
|
862
799
|
if (placeholderElm) {
|
|
863
|
-
(0,
|
|
864
|
-
// delete global.placeholderElm
|
|
800
|
+
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_3__.insertAfter)(insertBefore, placeholderElm);
|
|
865
801
|
}
|
|
866
802
|
}
|
|
867
803
|
|
|
@@ -1080,6 +1016,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1080
1016
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1081
1017
|
/* harmony export */ ArrayNoKeyError: () => (/* binding */ ArrayNoKeyError),
|
|
1082
1018
|
/* harmony export */ StateMismatchError: () => (/* binding */ StateMismatchError),
|
|
1019
|
+
/* harmony export */ SyncCallbackError: () => (/* binding */ SyncCallbackError),
|
|
1083
1020
|
/* harmony export */ TagError: () => (/* binding */ TagError)
|
|
1084
1021
|
/* harmony export */ });
|
|
1085
1022
|
class TagError extends Error {
|
|
@@ -1102,71 +1039,10 @@ class StateMismatchError extends TagError {
|
|
|
1102
1039
|
this.name = StateMismatchError.name;
|
|
1103
1040
|
}
|
|
1104
1041
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
/***/ "./ts/getCallback.ts":
|
|
1110
|
-
/*!***************************!*\
|
|
1111
|
-
!*** ./ts/getCallback.ts ***!
|
|
1112
|
-
\***************************/
|
|
1113
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1114
|
-
|
|
1115
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1116
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1117
|
-
/* harmony export */ getCallback: () => (/* binding */ getCallback)
|
|
1118
|
-
/* harmony export */ });
|
|
1119
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1120
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
1121
|
-
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
let innerCallback = (callback) => () => {
|
|
1126
|
-
throw new Error('Callback function was called immediately in sync and must instead be call async');
|
|
1127
|
-
};
|
|
1128
|
-
const getCallback = () => innerCallback;
|
|
1129
|
-
const originalGetter = innerCallback; // getCallback
|
|
1130
|
-
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1131
|
-
beforeRender: (tagSupport) => initMemory(tagSupport),
|
|
1132
|
-
beforeRedraw: (tagSupport) => initMemory(tagSupport),
|
|
1133
|
-
afterRender: (_tagSupport) => {
|
|
1134
|
-
innerCallback = originalGetter; // prevent crossing callbacks with another tag
|
|
1135
|
-
},
|
|
1136
|
-
});
|
|
1137
|
-
function updateState(stateFrom, stateTo) {
|
|
1138
|
-
stateFrom.forEach((state, index) => {
|
|
1139
|
-
const fromValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(state);
|
|
1140
|
-
const callback = stateTo[index].callback;
|
|
1141
|
-
if (callback) {
|
|
1142
|
-
callback(fromValue); // set the value
|
|
1143
|
-
}
|
|
1144
|
-
stateTo[index].lastValue = fromValue; // record the value
|
|
1145
|
-
});
|
|
1146
|
-
}
|
|
1147
|
-
function initMemory(tagSupport) {
|
|
1148
|
-
const oldState = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig.array;
|
|
1149
|
-
innerCallback = (callback) => {
|
|
1150
|
-
const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);
|
|
1151
|
-
return trigger;
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
1155
|
-
const state = tagSupport.memory.state;
|
|
1156
|
-
const newest = state.newest;
|
|
1157
|
-
// ensure that the oldest has the latest values first
|
|
1158
|
-
updateState(newest, oldState);
|
|
1159
|
-
// run the callback
|
|
1160
|
-
const promise = callback(...args);
|
|
1161
|
-
// send the oldest state changes into the newest
|
|
1162
|
-
updateState(oldState, newest);
|
|
1163
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1164
|
-
if (promise instanceof Promise) {
|
|
1165
|
-
promise.finally(() => {
|
|
1166
|
-
// send the oldest state changes into the newest
|
|
1167
|
-
updateState(oldState, newest);
|
|
1168
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
1169
|
-
});
|
|
1042
|
+
class SyncCallbackError extends TagError {
|
|
1043
|
+
constructor(message, details) {
|
|
1044
|
+
super(message, 'sync-callback-error', details);
|
|
1045
|
+
this.name = SyncCallbackError.name;
|
|
1170
1046
|
}
|
|
1171
1047
|
}
|
|
1172
1048
|
|
|
@@ -1556,6 +1432,9 @@ function subscribeToTemplate(insertBefore, subject, ownerTag, counts, // used fo
|
|
|
1556
1432
|
(0,_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingValue)(subject, value, ownerTag, insertBefore);
|
|
1557
1433
|
return;
|
|
1558
1434
|
}
|
|
1435
|
+
if (!insertBefore.parentNode) {
|
|
1436
|
+
throw new Error('no insert before parent node - 3');
|
|
1437
|
+
}
|
|
1559
1438
|
(0,_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processSubjectValue)(value, subject, insertBefore, ownerTag, {
|
|
1560
1439
|
counts: { ...counts },
|
|
1561
1440
|
forceElement: isForceElement,
|
|
@@ -1698,68 +1577,6 @@ function isLikeTags(tag0, tag1) {
|
|
|
1698
1577
|
}
|
|
1699
1578
|
|
|
1700
1579
|
|
|
1701
|
-
/***/ }),
|
|
1702
|
-
|
|
1703
|
-
/***/ "./ts/onDestroy.ts":
|
|
1704
|
-
/*!*************************!*\
|
|
1705
|
-
!*** ./ts/onDestroy.ts ***!
|
|
1706
|
-
\*************************/
|
|
1707
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1708
|
-
|
|
1709
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1710
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1711
|
-
/* harmony export */ onDestroy: () => (/* binding */ onDestroy)
|
|
1712
|
-
/* harmony export */ });
|
|
1713
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1714
|
-
|
|
1715
|
-
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
1716
|
-
let destroyCurrentTagSupport;
|
|
1717
|
-
function onDestroy(callback) {
|
|
1718
|
-
destroyCurrentTagSupport.templater.global.destroyCallback = callback;
|
|
1719
|
-
}
|
|
1720
|
-
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1721
|
-
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
1722
|
-
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
1723
|
-
beforeDestroy: (tagSupport, tag) => {
|
|
1724
|
-
const callback = tagSupport.templater.global.destroyCallback;
|
|
1725
|
-
if (callback) {
|
|
1726
|
-
callback();
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
});
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
/***/ }),
|
|
1733
|
-
|
|
1734
|
-
/***/ "./ts/onInit.ts":
|
|
1735
|
-
/*!**********************!*\
|
|
1736
|
-
!*** ./ts/onInit.ts ***!
|
|
1737
|
-
\**********************/
|
|
1738
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1739
|
-
|
|
1740
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1741
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1742
|
-
/* harmony export */ onInit: () => (/* binding */ onInit)
|
|
1743
|
-
/* harmony export */ });
|
|
1744
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
1745
|
-
|
|
1746
|
-
function setCurrentTagSupport(support) {
|
|
1747
|
-
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater = support.templater;
|
|
1748
|
-
}
|
|
1749
|
-
function onInit(callback) {
|
|
1750
|
-
const templater = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater;
|
|
1751
|
-
if (!templater.global.init) {
|
|
1752
|
-
;
|
|
1753
|
-
templater.global.init = callback;
|
|
1754
|
-
callback(); // fire init
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
1758
|
-
beforeRender: tagSupport => setCurrentTagSupport(tagSupport),
|
|
1759
|
-
beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),
|
|
1760
|
-
});
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
1580
|
/***/ }),
|
|
1764
1581
|
|
|
1765
1582
|
/***/ "./ts/processAttribute.function.ts":
|
|
@@ -1982,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1982
1799
|
/* harmony export */ processSubjectComponent: () => (/* binding */ processSubjectComponent)
|
|
1983
1800
|
/* harmony export */ });
|
|
1984
1801
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
1985
|
-
/* harmony import */ var
|
|
1802
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
1986
1803
|
/* harmony import */ var _processTagResult_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagResult.function */ "./ts/processTagResult.function.ts");
|
|
1987
1804
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
1988
1805
|
|
|
@@ -2004,9 +1821,12 @@ function processSubjectComponent(templater, subject, insertBefore, ownerTag, opt
|
|
|
2004
1821
|
}
|
|
2005
1822
|
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(ownerTag.tagSupport, templater, subject);
|
|
2006
1823
|
// templater.oldest = subject.tag?.tagSupport.oldest || templater.oldest
|
|
1824
|
+
if (insertBefore.nodeName != 'TEMPLATE') {
|
|
1825
|
+
throw new Error('9');
|
|
1826
|
+
}
|
|
2007
1827
|
templater.global.insertBefore = insertBefore;
|
|
2008
1828
|
let retag = subject.tag;
|
|
2009
|
-
const providers =
|
|
1829
|
+
const providers = _state__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
2010
1830
|
providers.ownerTag = ownerTag;
|
|
2011
1831
|
const isRedraw = !retag || options.forceElement;
|
|
2012
1832
|
if (isRedraw) {
|
|
@@ -2135,7 +1955,7 @@ insertBefore, ownerTag) {
|
|
|
2135
1955
|
}
|
|
2136
1956
|
tag.ownerTag = ownerTag;
|
|
2137
1957
|
if (insertBefore.tagName !== 'TEMPLATE') {
|
|
2138
|
-
throw new Error(
|
|
1958
|
+
throw new Error(`processTag.function.ts - insertBefore is not TEMPLATE ${insertBefore.tagName}`);
|
|
2139
1959
|
}
|
|
2140
1960
|
tag.buildBeforeElement(insertBefore, {
|
|
2141
1961
|
counts: { added: 0, removed: 0 },
|
|
@@ -2192,8 +2012,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2192
2012
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
2193
2013
|
/* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./checkDestroyPrevious.function */ "./ts/checkDestroyPrevious.function.ts");
|
|
2194
2014
|
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
2195
|
-
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
2196
|
-
|
|
2197
2015
|
|
|
2198
2016
|
|
|
2199
2017
|
|
|
@@ -2203,17 +2021,10 @@ insertBefore, // <template end interpolate />
|
|
|
2203
2021
|
ownerTag, options) {
|
|
2204
2022
|
const clones = ownerTag.clones; // []
|
|
2205
2023
|
let lastArray = subject.lastArray = subject.lastArray || [];
|
|
2206
|
-
if (subject.
|
|
2207
|
-
|
|
2208
|
-
if (parentPlaceholder) {
|
|
2209
|
-
parentPlaceholder.appendChild(insertBefore);
|
|
2210
|
-
delete subject.placeholderElm;
|
|
2211
|
-
}
|
|
2212
|
-
else {
|
|
2213
|
-
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_4__.insertAfter)(insertBefore, subject.placeholderElm);
|
|
2214
|
-
}
|
|
2215
|
-
delete subject.placeholderElm;
|
|
2024
|
+
if (!subject.placeholder) {
|
|
2025
|
+
setPlaceholderElm(insertBefore, subject);
|
|
2216
2026
|
}
|
|
2027
|
+
const runtimeInsertBefore = subject.placeholder; // || insertBefore
|
|
2217
2028
|
let removed = 0;
|
|
2218
2029
|
/** 🗑️ remove previous items first */
|
|
2219
2030
|
lastArray = subject.lastArray = subject.lastArray.filter((item, index) => {
|
|
@@ -2235,8 +2046,6 @@ ownerTag, options) {
|
|
|
2235
2046
|
}
|
|
2236
2047
|
return true;
|
|
2237
2048
|
});
|
|
2238
|
-
// const masterBefore = template || (template as any).clone
|
|
2239
|
-
const before = insertBefore; // || (subject.value as any).insertBefore || (insertBefore as any).clone
|
|
2240
2049
|
value.forEach((subTag, index) => {
|
|
2241
2050
|
const previous = lastArray[index];
|
|
2242
2051
|
const previousSupport = previous?.tag.tagSupport;
|
|
@@ -2271,33 +2080,23 @@ ownerTag, options) {
|
|
|
2271
2080
|
return [];
|
|
2272
2081
|
}
|
|
2273
2082
|
// TODO: should not get here?
|
|
2274
|
-
processAddTagArrayItem(
|
|
2083
|
+
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
2275
2084
|
throw new Error('item should be back');
|
|
2276
2085
|
// return [] // removed: item should have been previously deleted and will be added back
|
|
2277
2086
|
}
|
|
2278
|
-
processAddTagArrayItem(
|
|
2087
|
+
processAddTagArrayItem(runtimeInsertBefore, subTag, index, options, lastArray);
|
|
2279
2088
|
ownerTag.childTags.push(subTag);
|
|
2280
2089
|
});
|
|
2281
|
-
if (value.length) {
|
|
2282
|
-
const lastClone = insertBefore.previousSibling;
|
|
2283
|
-
setPlaceholderElm(lastClone, insertBefore, subject);
|
|
2284
|
-
}
|
|
2285
|
-
else {
|
|
2286
|
-
const placeholderElm = insertBefore.previousSibling;
|
|
2287
|
-
if (placeholderElm) {
|
|
2288
|
-
setPlaceholderElm(placeholderElm, insertBefore, subject);
|
|
2289
|
-
}
|
|
2290
|
-
else {
|
|
2291
|
-
const parentNode = insertBefore.parentNode;
|
|
2292
|
-
setPlaceholderElm(parentNode, insertBefore, subject);
|
|
2293
|
-
subject.parentAsPlaceholder = parentNode;
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
2090
|
return clones;
|
|
2297
2091
|
}
|
|
2298
|
-
function setPlaceholderElm(
|
|
2299
|
-
|
|
2092
|
+
function setPlaceholderElm(insertBefore, subject) {
|
|
2093
|
+
if (insertBefore.nodeName !== 'TEMPLATE') {
|
|
2094
|
+
subject.placeholder = insertBefore;
|
|
2095
|
+
return;
|
|
2096
|
+
}
|
|
2097
|
+
const placeholder = subject.placeholder = document.createTextNode('');
|
|
2300
2098
|
const parentNode = insertBefore.parentNode;
|
|
2099
|
+
parentNode.insertBefore(placeholder, insertBefore);
|
|
2301
2100
|
parentNode.removeChild(insertBefore);
|
|
2302
2101
|
}
|
|
2303
2102
|
function processAddTagArrayItem(before, subTag, index, options, lastArray) {
|
|
@@ -2348,7 +2147,7 @@ function processTagResult(tag, subject, // used for recording past and current v
|
|
|
2348
2147
|
insertBefore, // <template end interpolate />
|
|
2349
2148
|
{ counts, forceElement, }) {
|
|
2350
2149
|
if (!insertBefore.parentNode) {
|
|
2351
|
-
throw new Error(
|
|
2150
|
+
throw new Error(`before here processTagResult ${insertBefore.nodeName}`);
|
|
2352
2151
|
}
|
|
2353
2152
|
// *if appears we already have seen
|
|
2354
2153
|
const subjectTag = subject;
|
|
@@ -2366,9 +2165,11 @@ insertBefore, // <template end interpolate />
|
|
|
2366
2165
|
*/
|
|
2367
2166
|
return processTagResultUpdate(tag, subjectTag, previousTag);
|
|
2368
2167
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2168
|
+
/*
|
|
2169
|
+
if(insertBefore.nodeName !== 'TEMPLATE') {
|
|
2170
|
+
throw new Error(`processTagResult.function.ts insertBefore is not template ${insertBefore.nodeName}`)
|
|
2371
2171
|
}
|
|
2172
|
+
*/
|
|
2372
2173
|
tag.buildBeforeElement(insertBefore, {
|
|
2373
2174
|
counts,
|
|
2374
2175
|
forceElement,
|
|
@@ -2391,85 +2192,478 @@ previousTag) {
|
|
|
2391
2192
|
|
|
2392
2193
|
/***/ }),
|
|
2393
2194
|
|
|
2394
|
-
/***/ "./ts/
|
|
2395
|
-
|
|
2396
|
-
!*** ./ts/
|
|
2397
|
-
|
|
2195
|
+
/***/ "./ts/render.ts":
|
|
2196
|
+
/*!**********************!*\
|
|
2197
|
+
!*** ./ts/render.ts ***!
|
|
2198
|
+
\**********************/
|
|
2398
2199
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2399
2200
|
|
|
2400
2201
|
__webpack_require__.r(__webpack_exports__);
|
|
2401
2202
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2402
|
-
/* harmony export */
|
|
2203
|
+
/* harmony export */ buildClones: () => (/* binding */ buildClones)
|
|
2403
2204
|
/* harmony export */ });
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
const appElement = tag.getAppElement();
|
|
2414
|
-
handleProviderChanges(appElement, provider);
|
|
2415
|
-
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2416
|
-
});
|
|
2417
|
-
}
|
|
2418
|
-
function handleProviderChanges(appElement, provider) {
|
|
2419
|
-
const tagsWithProvider = getTagsWithProvider(appElement, provider);
|
|
2420
|
-
tagsWithProvider.forEach(({ tag, renderCount, provider }) => {
|
|
2421
|
-
if (tag.tagSupport.templater.global.deleted) {
|
|
2422
|
-
return; // i was deleted after another tag processed
|
|
2423
|
-
}
|
|
2424
|
-
const notRendered = renderCount === tag.tagSupport.templater.global.renderCount;
|
|
2425
|
-
if (notRendered) {
|
|
2426
|
-
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2427
|
-
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tag.tagSupport, false);
|
|
2428
|
-
}
|
|
2429
|
-
});
|
|
2430
|
-
}
|
|
2431
|
-
function getTagsWithProvider(tag, provider, memory = []) {
|
|
2432
|
-
const global = tag.tagSupport.templater.global;
|
|
2433
|
-
const compare = global.providers;
|
|
2434
|
-
const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);
|
|
2435
|
-
if (hasProvider) {
|
|
2436
|
-
memory.push({
|
|
2437
|
-
tag,
|
|
2438
|
-
renderCount: global.renderCount,
|
|
2439
|
-
provider: hasProvider,
|
|
2440
|
-
});
|
|
2205
|
+
function buildClones(temporary, insertBefore) {
|
|
2206
|
+
const clones = [];
|
|
2207
|
+
const template = temporary.children[0];
|
|
2208
|
+
let nextSibling = template.content.firstChild;
|
|
2209
|
+
while (nextSibling) {
|
|
2210
|
+
const nextNextSibling = nextSibling.nextSibling;
|
|
2211
|
+
buildSibling(nextSibling, insertBefore);
|
|
2212
|
+
clones.push(nextSibling);
|
|
2213
|
+
nextSibling = nextNextSibling;
|
|
2441
2214
|
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
});
|
|
2448
|
-
return memory;
|
|
2215
|
+
return clones;
|
|
2216
|
+
}
|
|
2217
|
+
function buildSibling(nextSibling, insertBefore) {
|
|
2218
|
+
const parentNode = insertBefore.parentNode;
|
|
2219
|
+
parentNode.insertBefore(nextSibling, insertBefore);
|
|
2449
2220
|
}
|
|
2450
2221
|
|
|
2451
2222
|
|
|
2452
2223
|
/***/ }),
|
|
2453
2224
|
|
|
2454
|
-
/***/ "./ts/
|
|
2455
|
-
|
|
2456
|
-
!*** ./ts/
|
|
2457
|
-
|
|
2225
|
+
/***/ "./ts/renderExistingTag.function.ts":
|
|
2226
|
+
/*!******************************************!*\
|
|
2227
|
+
!*** ./ts/renderExistingTag.function.ts ***!
|
|
2228
|
+
\******************************************/
|
|
2458
2229
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2459
2230
|
|
|
2460
2231
|
__webpack_require__.r(__webpack_exports__);
|
|
2461
2232
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2462
|
-
/* harmony export */
|
|
2233
|
+
/* harmony export */ renderExistingTag: () => (/* binding */ renderExistingTag)
|
|
2463
2234
|
/* harmony export */ });
|
|
2464
|
-
/* harmony import */ var
|
|
2465
|
-
/* harmony import */ var
|
|
2235
|
+
/* harmony import */ var _state_provider_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state/provider.utils */ "./ts/state/provider.utils.ts");
|
|
2236
|
+
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
2237
|
+
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2466
2238
|
|
|
2467
2239
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2240
|
+
|
|
2241
|
+
/** Returns true when rendering owner is not needed. Returns false when rendering owner should occur */
|
|
2242
|
+
function renderExistingTag(oldestTag, // existing tag already there
|
|
2243
|
+
newTemplater, tagSupport, subject) {
|
|
2244
|
+
const tag = subject.tag;
|
|
2245
|
+
newTemplater.global = tag.tagSupport.templater.global;
|
|
2246
|
+
if (!oldestTag.hasLiveElements) {
|
|
2247
|
+
throw new Error('1080 - should have live elements');
|
|
2248
|
+
}
|
|
2249
|
+
const preRenderCount = tagSupport.templater.global.renderCount;
|
|
2250
|
+
(0,_state_provider_utils__WEBPACK_IMPORTED_MODULE_0__.providersChangeCheck)(oldestTag);
|
|
2251
|
+
// When the providers were checked, a render to myself occurred and I do not need to re-render again
|
|
2252
|
+
const latestTag = tagSupport.templater.global.newest;
|
|
2253
|
+
if (preRenderCount !== tagSupport.templater.global.renderCount) {
|
|
2254
|
+
oldestTag.updateByTag(latestTag);
|
|
2255
|
+
return latestTag;
|
|
2256
|
+
}
|
|
2257
|
+
const oldTemplater = tagSupport.templater || newTemplater;
|
|
2258
|
+
const toRedrawTag = subject.tag || oldTemplater.global.newest || oldTemplater.global.oldest; // hmmmmmm, why not newest?
|
|
2259
|
+
const redraw = (0,_TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.renderWithSupport)(newTemplater.tagSupport, toRedrawTag, subject, oldestTag.ownerTag);
|
|
2260
|
+
const oldest = tagSupport.templater.global.oldest || oldestTag;
|
|
2261
|
+
redraw.tagSupport.templater.global.oldest = oldest;
|
|
2262
|
+
if ((0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__.isLikeTags)(latestTag, redraw)) {
|
|
2263
|
+
subject.tag = redraw;
|
|
2264
|
+
oldest.updateByTag(redraw);
|
|
2265
|
+
}
|
|
2266
|
+
return redraw;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
/***/ }),
|
|
2271
|
+
|
|
2272
|
+
/***/ "./ts/renderTagSupport.function.ts":
|
|
2273
|
+
/*!*****************************************!*\
|
|
2274
|
+
!*** ./ts/renderTagSupport.function.ts ***!
|
|
2275
|
+
\*****************************************/
|
|
2276
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2277
|
+
|
|
2278
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2279
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2280
|
+
/* harmony export */ renderTagSupport: () => (/* binding */ renderTagSupport)
|
|
2281
|
+
/* harmony export */ });
|
|
2282
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
2283
|
+
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
2284
|
+
/* harmony import */ var _renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./renderExistingTag.function */ "./ts/renderExistingTag.function.ts");
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
/** Main function used by all other callers to render/update display of a tag component */
|
|
2289
|
+
function renderTagSupport(tagSupport, renderUp) {
|
|
2290
|
+
const global = tagSupport.templater.global;
|
|
2291
|
+
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(tagSupport.templater)) {
|
|
2292
|
+
const newTag = global.newest;
|
|
2293
|
+
const ownerTag = newTag.ownerTag;
|
|
2294
|
+
++global.renderCount;
|
|
2295
|
+
return renderTagSupport(ownerTag.tagSupport, true);
|
|
2296
|
+
}
|
|
2297
|
+
// const oldTagSetup = this
|
|
2298
|
+
const subject = tagSupport.subject;
|
|
2299
|
+
const templater = tagSupport.templater; // oldTagSetup.templater // templater
|
|
2300
|
+
const subjectTag = subject.tag;
|
|
2301
|
+
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2302
|
+
let ownerTag;
|
|
2303
|
+
let selfPropChange = false;
|
|
2304
|
+
const shouldRenderUp = renderUp && newest;
|
|
2305
|
+
if (shouldRenderUp) {
|
|
2306
|
+
ownerTag = newest.ownerTag;
|
|
2307
|
+
if (ownerTag) {
|
|
2308
|
+
const nowProps = templater.props;
|
|
2309
|
+
const latestProps = newest.tagSupport.propsConfig.latestCloned;
|
|
2310
|
+
selfPropChange = !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(nowProps, latestProps);
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
const useTagSupport = global.newest?.tagSupport; // oldTagSetup
|
|
2314
|
+
if (!templater.global.oldest) {
|
|
2315
|
+
throw new Error('already causing trouble');
|
|
2316
|
+
}
|
|
2317
|
+
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__.renderExistingTag)(templater.global.oldest, templater, useTagSupport, subject);
|
|
2318
|
+
const renderOwner = ownerTag && selfPropChange;
|
|
2319
|
+
if (renderOwner) {
|
|
2320
|
+
const ownerTagSupport = ownerTag.tagSupport;
|
|
2321
|
+
renderTagSupport(ownerTagSupport, true);
|
|
2322
|
+
return tag;
|
|
2323
|
+
}
|
|
2324
|
+
return tag;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
|
|
2328
|
+
/***/ }),
|
|
2329
|
+
|
|
2330
|
+
/***/ "./ts/scanTextAreaValue.function.ts":
|
|
2331
|
+
/*!******************************************!*\
|
|
2332
|
+
!*** ./ts/scanTextAreaValue.function.ts ***!
|
|
2333
|
+
\******************************************/
|
|
2334
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2335
|
+
|
|
2336
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2337
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2338
|
+
/* harmony export */ scanTextAreaValue: () => (/* binding */ scanTextAreaValue)
|
|
2339
|
+
/* harmony export */ });
|
|
2340
|
+
/* harmony import */ var _processAttribute_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processAttribute.function */ "./ts/processAttribute.function.ts");
|
|
2341
|
+
|
|
2342
|
+
const search = new RegExp('\\s*<template interpolate end id="__tagvar(\\d{1,4})"([^>]*)></template>(\\s*)');
|
|
2343
|
+
function scanTextAreaValue(textarea, context, ownerTag) {
|
|
2344
|
+
const value = textarea.value;
|
|
2345
|
+
if (value.search(search) >= 0) {
|
|
2346
|
+
const match = value.match(/__tagvar(\d{1,4})/);
|
|
2347
|
+
const token = match ? match[0] : '';
|
|
2348
|
+
const dynamic = '{' + token + '}';
|
|
2349
|
+
textarea.value = '';
|
|
2350
|
+
textarea.setAttribute('text-var-value', dynamic);
|
|
2351
|
+
const howToSet = (_elm, _name, value) => textarea.value = value;
|
|
2352
|
+
(0,_processAttribute_function__WEBPACK_IMPORTED_MODULE_0__.processAttribute)('text-var-value', dynamic, // realValue, // context[token].value,
|
|
2353
|
+
textarea, context, ownerTag, howToSet);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
/***/ }),
|
|
2359
|
+
|
|
2360
|
+
/***/ "./ts/state/callbackMaker.function.ts":
|
|
2361
|
+
/*!********************************************!*\
|
|
2362
|
+
!*** ./ts/state/callbackMaker.function.ts ***!
|
|
2363
|
+
\********************************************/
|
|
2364
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2365
|
+
|
|
2366
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2367
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2368
|
+
/* harmony export */ callbackMaker: () => (/* binding */ callbackMaker)
|
|
2369
|
+
/* harmony export */ });
|
|
2370
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2371
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2372
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
2373
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../errors */ "./ts/errors.ts");
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
let innerCallback = (callback) => (...args) => {
|
|
2379
|
+
throw new _errors__WEBPACK_IMPORTED_MODULE_3__.SyncCallbackError('Callback function was called immediately in sync and must instead be call async');
|
|
2380
|
+
};
|
|
2381
|
+
const callbackMaker = () => innerCallback;
|
|
2382
|
+
const originalGetter = innerCallback; // callbackMaker
|
|
2383
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2384
|
+
beforeRender: (tagSupport) => initMemory(tagSupport),
|
|
2385
|
+
beforeRedraw: (tagSupport) => initMemory(tagSupport),
|
|
2386
|
+
afterRender: (_tagSupport) => {
|
|
2387
|
+
innerCallback = originalGetter; // prevent crossing callbacks with another tag
|
|
2388
|
+
},
|
|
2389
|
+
});
|
|
2390
|
+
function updateState(stateFrom, stateTo) {
|
|
2391
|
+
stateFrom.forEach((state, index) => {
|
|
2392
|
+
const fromValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(state);
|
|
2393
|
+
const callback = stateTo[index].callback;
|
|
2394
|
+
if (callback) {
|
|
2395
|
+
callback(fromValue); // set the value
|
|
2396
|
+
}
|
|
2397
|
+
stateTo[index].lastValue = fromValue; // record the value
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
function initMemory(tagSupport) {
|
|
2401
|
+
const oldState = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig.array;
|
|
2402
|
+
innerCallback = (callback) => {
|
|
2403
|
+
const trigger = (...args) => triggerStateUpdate(tagSupport, callback, oldState, ...args);
|
|
2404
|
+
return trigger;
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
function triggerStateUpdate(tagSupport, callback, oldState, ...args) {
|
|
2408
|
+
const state = tagSupport.memory.state;
|
|
2409
|
+
const newest = state.newest;
|
|
2410
|
+
// ensure that the oldest has the latest values first
|
|
2411
|
+
updateState(newest, oldState);
|
|
2412
|
+
// run the callback
|
|
2413
|
+
const promise = callback(...args);
|
|
2414
|
+
// send the oldest state changes into the newest
|
|
2415
|
+
updateState(oldState, newest);
|
|
2416
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
2417
|
+
if (promise instanceof Promise) {
|
|
2418
|
+
promise.finally(() => {
|
|
2419
|
+
// send the oldest state changes into the newest
|
|
2420
|
+
updateState(oldState, newest);
|
|
2421
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_2__.renderTagSupport)(tagSupport, false);
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
/***/ }),
|
|
2428
|
+
|
|
2429
|
+
/***/ "./ts/state/index.ts":
|
|
2430
|
+
/*!***************************!*\
|
|
2431
|
+
!*** ./ts/state/index.ts ***!
|
|
2432
|
+
\***************************/
|
|
2433
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2434
|
+
|
|
2435
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2436
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2437
|
+
/* harmony export */ callbackMaker: () => (/* reexport safe */ _callbackMaker_function__WEBPACK_IMPORTED_MODULE_6__.callbackMaker),
|
|
2438
|
+
/* harmony export */ letState: () => (/* reexport safe */ _letState_function__WEBPACK_IMPORTED_MODULE_3__.letState),
|
|
2439
|
+
/* harmony export */ onDestroy: () => (/* reexport safe */ _onDestroy__WEBPACK_IMPORTED_MODULE_8__.onDestroy),
|
|
2440
|
+
/* harmony export */ onInit: () => (/* reexport safe */ _onInit__WEBPACK_IMPORTED_MODULE_7__.onInit),
|
|
2441
|
+
/* harmony export */ providers: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_5__.providers),
|
|
2442
|
+
/* harmony export */ setProp: () => (/* reexport safe */ _setProp_function__WEBPACK_IMPORTED_MODULE_4__.setProp),
|
|
2443
|
+
/* harmony export */ setUse: () => (/* reexport safe */ _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse),
|
|
2444
|
+
/* harmony export */ state: () => (/* reexport safe */ _state_function__WEBPACK_IMPORTED_MODULE_2__.state),
|
|
2445
|
+
/* harmony export */ watch: () => (/* reexport safe */ _watch_function__WEBPACK_IMPORTED_MODULE_0__.watch)
|
|
2446
|
+
/* harmony export */ });
|
|
2447
|
+
/* harmony import */ var _watch_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./watch.function */ "./ts/state/watch.function.ts");
|
|
2448
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2449
|
+
/* harmony import */ var _state_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./state.function */ "./ts/state/state.function.ts");
|
|
2450
|
+
/* harmony import */ var _letState_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./letState.function */ "./ts/state/letState.function.ts");
|
|
2451
|
+
/* harmony import */ var _setProp_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./setProp.function */ "./ts/state/setProp.function.ts");
|
|
2452
|
+
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./providers */ "./ts/state/providers.ts");
|
|
2453
|
+
/* harmony import */ var _callbackMaker_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./callbackMaker.function */ "./ts/state/callbackMaker.function.ts");
|
|
2454
|
+
/* harmony import */ var _onInit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./onInit */ "./ts/state/onInit.ts");
|
|
2455
|
+
/* harmony import */ var _onDestroy__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./onDestroy */ "./ts/state/onDestroy.ts");
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
|
|
2467
|
+
/***/ }),
|
|
2468
|
+
|
|
2469
|
+
/***/ "./ts/state/letState.function.ts":
|
|
2470
|
+
/*!***************************************!*\
|
|
2471
|
+
!*** ./ts/state/letState.function.ts ***!
|
|
2472
|
+
\***************************************/
|
|
2473
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2474
|
+
|
|
2475
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2476
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2477
|
+
/* harmony export */ letState: () => (/* binding */ letState)
|
|
2478
|
+
/* harmony export */ });
|
|
2479
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2480
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2484
|
+
function letState(defaultValue) {
|
|
2485
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2486
|
+
const rearray = config.rearray;
|
|
2487
|
+
let getSetMethod;
|
|
2488
|
+
const restate = rearray[config.array.length];
|
|
2489
|
+
if (restate) {
|
|
2490
|
+
let oldValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2491
|
+
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2492
|
+
const push = {
|
|
2493
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2494
|
+
callback: getSetMethod,
|
|
2495
|
+
lastValue: oldValue,
|
|
2496
|
+
defaultValue: restate.defaultValue,
|
|
2497
|
+
};
|
|
2498
|
+
config.array.push(push);
|
|
2499
|
+
return makeStateResult(oldValue, push);
|
|
2500
|
+
}
|
|
2501
|
+
// State first time run
|
|
2502
|
+
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2503
|
+
let initValue = defaultFn();
|
|
2504
|
+
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2505
|
+
const push = {
|
|
2506
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2507
|
+
callback: getSetMethod,
|
|
2508
|
+
lastValue: initValue,
|
|
2509
|
+
defaultValue: initValue,
|
|
2510
|
+
};
|
|
2511
|
+
config.array.push(push);
|
|
2512
|
+
return makeStateResult(initValue, push);
|
|
2513
|
+
}
|
|
2514
|
+
function makeStateResult(initValue, push) {
|
|
2515
|
+
// return initValue
|
|
2516
|
+
const result = (y) => {
|
|
2517
|
+
push.callback = y || (x => [initValue, initValue = x]);
|
|
2518
|
+
return initValue;
|
|
2519
|
+
};
|
|
2520
|
+
return result;
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
|
|
2524
|
+
/***/ }),
|
|
2525
|
+
|
|
2526
|
+
/***/ "./ts/state/onDestroy.ts":
|
|
2527
|
+
/*!*******************************!*\
|
|
2528
|
+
!*** ./ts/state/onDestroy.ts ***!
|
|
2529
|
+
\*******************************/
|
|
2530
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2531
|
+
|
|
2532
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2533
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2534
|
+
/* harmony export */ onDestroy: () => (/* binding */ onDestroy)
|
|
2535
|
+
/* harmony export */ });
|
|
2536
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2537
|
+
|
|
2538
|
+
/** When undefined, it means a tag is being built for the first time so do run destroy(s) */
|
|
2539
|
+
let destroyCurrentTagSupport;
|
|
2540
|
+
function onDestroy(callback) {
|
|
2541
|
+
destroyCurrentTagSupport.templater.global.destroyCallback = callback;
|
|
2542
|
+
}
|
|
2543
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2544
|
+
beforeRender: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
2545
|
+
beforeRedraw: tagSupport => destroyCurrentTagSupport = tagSupport,
|
|
2546
|
+
beforeDestroy: (tagSupport, tag) => {
|
|
2547
|
+
const callback = tagSupport.templater.global.destroyCallback;
|
|
2548
|
+
if (callback) {
|
|
2549
|
+
callback();
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
/***/ }),
|
|
2556
|
+
|
|
2557
|
+
/***/ "./ts/state/onInit.ts":
|
|
2558
|
+
/*!****************************!*\
|
|
2559
|
+
!*** ./ts/state/onInit.ts ***!
|
|
2560
|
+
\****************************/
|
|
2561
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2562
|
+
|
|
2563
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2564
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2565
|
+
/* harmony export */ onInit: () => (/* binding */ onInit)
|
|
2566
|
+
/* harmony export */ });
|
|
2567
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2568
|
+
|
|
2569
|
+
function setCurrentTagSupport(support) {
|
|
2570
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater = support.templater;
|
|
2571
|
+
}
|
|
2572
|
+
function onInit(callback) {
|
|
2573
|
+
const templater = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.initCurrentTemplater;
|
|
2574
|
+
if (!templater.global.init) {
|
|
2575
|
+
;
|
|
2576
|
+
templater.global.init = callback;
|
|
2577
|
+
callback(); // fire init
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
(0,_setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse)({
|
|
2581
|
+
beforeRender: tagSupport => setCurrentTagSupport(tagSupport),
|
|
2582
|
+
beforeRedraw: tagSupport => setCurrentTagSupport(tagSupport),
|
|
2583
|
+
});
|
|
2584
|
+
|
|
2585
|
+
|
|
2586
|
+
/***/ }),
|
|
2587
|
+
|
|
2588
|
+
/***/ "./ts/state/provider.utils.ts":
|
|
2589
|
+
/*!************************************!*\
|
|
2590
|
+
!*** ./ts/state/provider.utils.ts ***!
|
|
2591
|
+
\************************************/
|
|
2592
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2593
|
+
|
|
2594
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2595
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2596
|
+
/* harmony export */ providersChangeCheck: () => (/* binding */ providersChangeCheck)
|
|
2597
|
+
/* harmony export */ });
|
|
2598
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../deepFunctions */ "./ts/deepFunctions.ts");
|
|
2599
|
+
/* harmony import */ var _renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderTagSupport.function */ "./ts/renderTagSupport.function.ts");
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
function providersChangeCheck(tag) {
|
|
2603
|
+
const global = tag.tagSupport.templater.global;
|
|
2604
|
+
const providersWithChanges = global.providers.filter(provider => !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(provider.instance, provider.clone));
|
|
2605
|
+
// reset clones
|
|
2606
|
+
providersWithChanges.forEach(provider => {
|
|
2607
|
+
const appElement = tag.getAppElement();
|
|
2608
|
+
handleProviderChanges(appElement, provider);
|
|
2609
|
+
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2610
|
+
});
|
|
2611
|
+
}
|
|
2612
|
+
function handleProviderChanges(appElement, provider) {
|
|
2613
|
+
const tagsWithProvider = getTagsWithProvider(appElement, provider);
|
|
2614
|
+
tagsWithProvider.forEach(({ tag, renderCount, provider }) => {
|
|
2615
|
+
if (tag.tagSupport.templater.global.deleted) {
|
|
2616
|
+
return; // i was deleted after another tag processed
|
|
2617
|
+
}
|
|
2618
|
+
const notRendered = renderCount === tag.tagSupport.templater.global.renderCount;
|
|
2619
|
+
if (notRendered) {
|
|
2620
|
+
provider.clone = (0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepClone)(provider.instance);
|
|
2621
|
+
(0,_renderTagSupport_function__WEBPACK_IMPORTED_MODULE_1__.renderTagSupport)(tag.tagSupport, false);
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2625
|
+
function getTagsWithProvider(tag, provider, memory = []) {
|
|
2626
|
+
const global = tag.tagSupport.templater.global;
|
|
2627
|
+
const compare = global.providers;
|
|
2628
|
+
const hasProvider = compare.find(xProvider => xProvider.constructMethod === provider.constructMethod);
|
|
2629
|
+
if (hasProvider) {
|
|
2630
|
+
memory.push({
|
|
2631
|
+
tag,
|
|
2632
|
+
renderCount: global.renderCount,
|
|
2633
|
+
provider: hasProvider,
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
tag.childTags.forEach(child => getTagsWithProvider(child, provider, memory));
|
|
2637
|
+
memory.forEach(({ tag }) => {
|
|
2638
|
+
if (tag.tagSupport.templater.global.deleted) {
|
|
2639
|
+
throw new Error('do not get here - 0');
|
|
2640
|
+
}
|
|
2641
|
+
});
|
|
2642
|
+
return memory;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
|
|
2646
|
+
/***/ }),
|
|
2647
|
+
|
|
2648
|
+
/***/ "./ts/state/providers.ts":
|
|
2649
|
+
/*!*******************************!*\
|
|
2650
|
+
!*** ./ts/state/providers.ts ***!
|
|
2651
|
+
\*******************************/
|
|
2652
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2653
|
+
|
|
2654
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2655
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2656
|
+
/* harmony export */ providers: () => (/* binding */ providers)
|
|
2657
|
+
/* harmony export */ });
|
|
2658
|
+
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../deepFunctions */ "./ts/deepFunctions.ts");
|
|
2659
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
// TODO: rename
|
|
2663
|
+
_setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig = {
|
|
2664
|
+
providers: [],
|
|
2665
|
+
//currentTagSupport: undefined as TagSupport | undefined,
|
|
2666
|
+
ownerTag: undefined,
|
|
2473
2667
|
};
|
|
2474
2668
|
function get(constructMethod) {
|
|
2475
2669
|
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.providerConfig;
|
|
@@ -2552,185 +2746,147 @@ function run(tagSupport, ownerTag) {
|
|
|
2552
2746
|
|
|
2553
2747
|
/***/ }),
|
|
2554
2748
|
|
|
2555
|
-
/***/ "./ts/
|
|
2556
|
-
|
|
2557
|
-
!*** ./ts/
|
|
2558
|
-
|
|
2559
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2560
|
-
|
|
2561
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2562
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2563
|
-
/* harmony export */ buildClones: () => (/* binding */ buildClones)
|
|
2564
|
-
/* harmony export */ });
|
|
2565
|
-
function buildClones(temporary, insertBefore) {
|
|
2566
|
-
const clones = [];
|
|
2567
|
-
const template = temporary.children[0];
|
|
2568
|
-
let nextSibling = template.content.firstChild;
|
|
2569
|
-
while (nextSibling) {
|
|
2570
|
-
const nextNextSibling = nextSibling.nextSibling;
|
|
2571
|
-
buildSibling(nextSibling, insertBefore);
|
|
2572
|
-
clones.push(nextSibling);
|
|
2573
|
-
nextSibling = nextNextSibling;
|
|
2574
|
-
}
|
|
2575
|
-
return clones;
|
|
2576
|
-
}
|
|
2577
|
-
function buildSibling(nextSibling, insertBefore) {
|
|
2578
|
-
const parentNode = insertBefore.parentNode;
|
|
2579
|
-
parentNode.insertBefore(nextSibling, insertBefore);
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
/***/ }),
|
|
2584
|
-
|
|
2585
|
-
/***/ "./ts/renderExistingTag.function.ts":
|
|
2586
|
-
/*!******************************************!*\
|
|
2587
|
-
!*** ./ts/renderExistingTag.function.ts ***!
|
|
2588
|
-
\******************************************/
|
|
2749
|
+
/***/ "./ts/state/setProp.function.ts":
|
|
2750
|
+
/*!**************************************!*\
|
|
2751
|
+
!*** ./ts/state/setProp.function.ts ***!
|
|
2752
|
+
\**************************************/
|
|
2589
2753
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2590
2754
|
|
|
2591
2755
|
__webpack_require__.r(__webpack_exports__);
|
|
2592
2756
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2593
|
-
/* harmony export */
|
|
2757
|
+
/* harmony export */ setProp: () => (/* binding */ setProp)
|
|
2594
2758
|
/* harmony export */ });
|
|
2595
|
-
/* harmony import */ var
|
|
2596
|
-
/* harmony import */ var
|
|
2597
|
-
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
2759
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2760
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2598
2761
|
|
|
2599
2762
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
const
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
oldest.updateByTag(redraw);
|
|
2763
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2764
|
+
function setProp(getSet) {
|
|
2765
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2766
|
+
const rearray = config.rearray;
|
|
2767
|
+
const [propValue] = getSet(undefined);
|
|
2768
|
+
getSet(propValue); // restore original value instead of undefined
|
|
2769
|
+
const restate = rearray[config.array.length];
|
|
2770
|
+
if (restate) {
|
|
2771
|
+
let watchValue = restate.watch;
|
|
2772
|
+
let oldValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2773
|
+
const push = {
|
|
2774
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2775
|
+
callback: getSet,
|
|
2776
|
+
lastValue: oldValue,
|
|
2777
|
+
watch: restate.watch,
|
|
2778
|
+
};
|
|
2779
|
+
// has the prop value changed?
|
|
2780
|
+
if (propValue != watchValue) {
|
|
2781
|
+
push.watch = propValue;
|
|
2782
|
+
oldValue = push.lastValue = propValue;
|
|
2783
|
+
}
|
|
2784
|
+
config.array.push(push);
|
|
2785
|
+
getSet(oldValue);
|
|
2786
|
+
return oldValue;
|
|
2625
2787
|
}
|
|
2626
|
-
|
|
2788
|
+
const push = {
|
|
2789
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2790
|
+
callback: getSet,
|
|
2791
|
+
lastValue: propValue,
|
|
2792
|
+
watch: propValue,
|
|
2793
|
+
};
|
|
2794
|
+
config.array.push(push);
|
|
2795
|
+
return propValue;
|
|
2627
2796
|
}
|
|
2628
2797
|
|
|
2629
2798
|
|
|
2630
2799
|
/***/ }),
|
|
2631
2800
|
|
|
2632
|
-
/***/ "./ts/
|
|
2633
|
-
|
|
2634
|
-
!*** ./ts/
|
|
2635
|
-
|
|
2801
|
+
/***/ "./ts/state/setUse.function.ts":
|
|
2802
|
+
/*!*************************************!*\
|
|
2803
|
+
!*** ./ts/state/setUse.function.ts ***!
|
|
2804
|
+
\*************************************/
|
|
2636
2805
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2637
|
-
|
|
2638
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2639
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2640
|
-
/* harmony export */
|
|
2641
|
-
/* harmony export */ });
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
const newTag = global.newest;
|
|
2653
|
-
const ownerTag = newTag.ownerTag;
|
|
2654
|
-
++global.renderCount;
|
|
2655
|
-
return renderTagSupport(ownerTag.tagSupport, true);
|
|
2656
|
-
}
|
|
2657
|
-
// const oldTagSetup = this
|
|
2658
|
-
const subject = tagSupport.subject;
|
|
2659
|
-
const templater = tagSupport.templater; // oldTagSetup.templater // templater
|
|
2660
|
-
const subjectTag = subject.tag;
|
|
2661
|
-
const newest = subjectTag?.tagSupport.templater.global.newest;
|
|
2662
|
-
let ownerTag;
|
|
2663
|
-
let selfPropChange = false;
|
|
2664
|
-
const shouldRenderUp = renderUp && newest;
|
|
2665
|
-
if (shouldRenderUp) {
|
|
2666
|
-
ownerTag = newest.ownerTag;
|
|
2667
|
-
if (ownerTag) {
|
|
2668
|
-
const nowProps = templater.props;
|
|
2669
|
-
const latestProps = newest.tagSupport.propsConfig.latestCloned;
|
|
2670
|
-
selfPropChange = !(0,_deepFunctions__WEBPACK_IMPORTED_MODULE_0__.deepEqual)(nowProps, latestProps);
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
const useTagSupport = global.newest?.tagSupport; // oldTagSetup
|
|
2674
|
-
if (!templater.global.oldest) {
|
|
2675
|
-
throw new Error('already causing trouble');
|
|
2676
|
-
}
|
|
2677
|
-
const tag = (0,_renderExistingTag_function__WEBPACK_IMPORTED_MODULE_2__.renderExistingTag)(templater.global.oldest, templater, useTagSupport, subject);
|
|
2678
|
-
const renderOwner = ownerTag && selfPropChange;
|
|
2679
|
-
if (renderOwner) {
|
|
2680
|
-
const ownerTagSupport = ownerTag.tagSupport;
|
|
2681
|
-
renderTagSupport(ownerTagSupport, true);
|
|
2682
|
-
return tag;
|
|
2683
|
-
}
|
|
2684
|
-
return tag;
|
|
2806
|
+
|
|
2807
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2808
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2809
|
+
/* harmony export */ setUse: () => (/* binding */ setUse)
|
|
2810
|
+
/* harmony export */ });
|
|
2811
|
+
const tagUse = [];
|
|
2812
|
+
function setUse(use) {
|
|
2813
|
+
// must provide defaults
|
|
2814
|
+
const useMe = {
|
|
2815
|
+
beforeRender: use.beforeRender || (() => undefined),
|
|
2816
|
+
beforeRedraw: use.beforeRedraw || (() => undefined),
|
|
2817
|
+
afterRender: use.afterRender || (() => undefined),
|
|
2818
|
+
beforeDestroy: use.beforeDestroy || (() => undefined),
|
|
2819
|
+
};
|
|
2820
|
+
setUse.tagUse.push(useMe);
|
|
2685
2821
|
}
|
|
2822
|
+
setUse.tagUse = tagUse;
|
|
2823
|
+
setUse.memory = {};
|
|
2686
2824
|
|
|
2687
2825
|
|
|
2688
2826
|
/***/ }),
|
|
2689
2827
|
|
|
2690
|
-
/***/ "./ts/
|
|
2691
|
-
|
|
2692
|
-
!*** ./ts/
|
|
2693
|
-
|
|
2828
|
+
/***/ "./ts/state/state.function.ts":
|
|
2829
|
+
/*!************************************!*\
|
|
2830
|
+
!*** ./ts/state/state.function.ts ***!
|
|
2831
|
+
\************************************/
|
|
2694
2832
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2695
2833
|
|
|
2696
2834
|
__webpack_require__.r(__webpack_exports__);
|
|
2697
2835
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2698
|
-
/* harmony export */
|
|
2836
|
+
/* harmony export */ state: () => (/* binding */ state)
|
|
2699
2837
|
/* harmony export */ });
|
|
2700
|
-
/* harmony import */ var
|
|
2838
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2839
|
+
/* harmony import */ var _state_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state.utils */ "./ts/state/state.utils.ts");
|
|
2701
2840
|
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2841
|
+
|
|
2842
|
+
/** Used for variables that need to remain the same variable during render passes */
|
|
2843
|
+
function state(defaultValue) {
|
|
2844
|
+
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.stateConfig;
|
|
2845
|
+
let getSetMethod;
|
|
2846
|
+
const rearray = config.rearray;
|
|
2847
|
+
const restate = rearray[config.array.length];
|
|
2848
|
+
if (restate) {
|
|
2849
|
+
let oldValue = (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(restate);
|
|
2850
|
+
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2851
|
+
const push = {
|
|
2852
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(push),
|
|
2853
|
+
callback: getSetMethod,
|
|
2854
|
+
lastValue: oldValue,
|
|
2855
|
+
defaultValue: restate.defaultValue,
|
|
2856
|
+
};
|
|
2857
|
+
config.array.push(push);
|
|
2858
|
+
return oldValue;
|
|
2714
2859
|
}
|
|
2860
|
+
// State first time run
|
|
2861
|
+
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2862
|
+
let initValue = defaultFn();
|
|
2863
|
+
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2864
|
+
const push = {
|
|
2865
|
+
get: () => (0,_state_utils__WEBPACK_IMPORTED_MODULE_1__.getStateValue)(push),
|
|
2866
|
+
callback: getSetMethod,
|
|
2867
|
+
lastValue: initValue,
|
|
2868
|
+
defaultValue: initValue,
|
|
2869
|
+
};
|
|
2870
|
+
config.array.push(push);
|
|
2871
|
+
return initValue;
|
|
2715
2872
|
}
|
|
2716
2873
|
|
|
2717
2874
|
|
|
2718
2875
|
/***/ }),
|
|
2719
2876
|
|
|
2720
|
-
/***/ "./ts/
|
|
2721
|
-
|
|
2722
|
-
!*** ./ts/
|
|
2723
|
-
|
|
2877
|
+
/***/ "./ts/state/state.utils.ts":
|
|
2878
|
+
/*!*********************************!*\
|
|
2879
|
+
!*** ./ts/state/state.utils.ts ***!
|
|
2880
|
+
\*********************************/
|
|
2724
2881
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2725
2882
|
|
|
2726
2883
|
__webpack_require__.r(__webpack_exports__);
|
|
2727
2884
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2728
2885
|
/* harmony export */ StateEchoBack: () => (/* binding */ StateEchoBack),
|
|
2729
|
-
/* harmony export */ getStateValue: () => (/* binding */ getStateValue)
|
|
2730
|
-
/* harmony export */ set: () => (/* binding */ set)
|
|
2886
|
+
/* harmony export */ getStateValue: () => (/* binding */ getStateValue)
|
|
2731
2887
|
/* harmony export */ });
|
|
2732
|
-
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*!
|
|
2733
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2888
|
+
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../errors */ "./ts/errors.ts");
|
|
2889
|
+
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/state/setUse.function.ts");
|
|
2734
2890
|
|
|
2735
2891
|
|
|
2736
2892
|
// TODO: rename
|
|
@@ -2815,173 +2971,40 @@ function initState(tagSupport) {
|
|
|
2815
2971
|
}
|
|
2816
2972
|
config.tagSupport = tagSupport;
|
|
2817
2973
|
}
|
|
2818
|
-
/** Used for variables that need to remain the same variable during render passes */
|
|
2819
|
-
function set(defaultValue) {
|
|
2820
|
-
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2821
|
-
let getSetMethod;
|
|
2822
|
-
const rearray = config.rearray;
|
|
2823
|
-
const restate = rearray[config.array.length];
|
|
2824
|
-
if (restate) {
|
|
2825
|
-
let oldValue = getStateValue(restate);
|
|
2826
|
-
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2827
|
-
const push = {
|
|
2828
|
-
get: () => getStateValue(push),
|
|
2829
|
-
callback: getSetMethod,
|
|
2830
|
-
lastValue: oldValue,
|
|
2831
|
-
defaultValue: restate.defaultValue,
|
|
2832
|
-
};
|
|
2833
|
-
config.array.push(push);
|
|
2834
|
-
return oldValue;
|
|
2835
|
-
}
|
|
2836
|
-
// State first time run
|
|
2837
|
-
const defaultFn = defaultValue instanceof Function ? defaultValue : () => defaultValue;
|
|
2838
|
-
let initValue = defaultFn();
|
|
2839
|
-
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2840
|
-
const push = {
|
|
2841
|
-
get: () => getStateValue(push),
|
|
2842
|
-
callback: getSetMethod,
|
|
2843
|
-
lastValue: initValue,
|
|
2844
|
-
defaultValue: initValue,
|
|
2845
|
-
};
|
|
2846
|
-
config.array.push(push);
|
|
2847
|
-
return initValue;
|
|
2848
|
-
}
|
|
2849
2974
|
|
|
2850
2975
|
|
|
2851
2976
|
/***/ }),
|
|
2852
2977
|
|
|
2853
|
-
/***/ "./ts/
|
|
2854
|
-
|
|
2855
|
-
!*** ./ts/
|
|
2856
|
-
|
|
2978
|
+
/***/ "./ts/state/watch.function.ts":
|
|
2979
|
+
/*!************************************!*\
|
|
2980
|
+
!*** ./ts/state/watch.function.ts ***!
|
|
2981
|
+
\************************************/
|
|
2857
2982
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2858
2983
|
|
|
2859
2984
|
__webpack_require__.r(__webpack_exports__);
|
|
2860
2985
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2861
|
-
/* harmony export */
|
|
2986
|
+
/* harmony export */ watch: () => (/* binding */ watch)
|
|
2862
2987
|
/* harmony export */ });
|
|
2863
|
-
/* harmony import */ var
|
|
2864
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2988
|
+
/* harmony import */ var _letState_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./letState.function */ "./ts/state/letState.function.ts");
|
|
2865
2989
|
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
let oldValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2875
|
-
getSetMethod = ((x) => [oldValue, oldValue = x]);
|
|
2876
|
-
const push = {
|
|
2877
|
-
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2878
|
-
callback: getSetMethod,
|
|
2879
|
-
lastValue: oldValue,
|
|
2880
|
-
defaultValue: restate.defaultValue,
|
|
2881
|
-
};
|
|
2882
|
-
config.array.push(push);
|
|
2883
|
-
return makeStateResult(oldValue, push);
|
|
2990
|
+
/** When an item in watch array changes, callback function will be triggered */
|
|
2991
|
+
function watch(currentValues, callback) {
|
|
2992
|
+
let previousValues = (0,_letState_function__WEBPACK_IMPORTED_MODULE_0__.letState)(undefined)(x => [previousValues, previousValues = x]);
|
|
2993
|
+
if (previousValues === undefined) {
|
|
2994
|
+
callback(currentValues, previousValues);
|
|
2995
|
+
// const result = {currentValues, previousValues}
|
|
2996
|
+
previousValues = currentValues;
|
|
2997
|
+
return currentValues;
|
|
2884
2998
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
getSetMethod = ((x) => [initValue, initValue = x]);
|
|
2889
|
-
const push = {
|
|
2890
|
-
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2891
|
-
callback: getSetMethod,
|
|
2892
|
-
lastValue: initValue,
|
|
2893
|
-
defaultValue: initValue,
|
|
2894
|
-
};
|
|
2895
|
-
config.array.push(push);
|
|
2896
|
-
return makeStateResult(initValue, push);
|
|
2897
|
-
}
|
|
2898
|
-
function makeStateResult(initValue, push) {
|
|
2899
|
-
// return initValue
|
|
2900
|
-
const result = (y) => {
|
|
2901
|
-
push.callback = y || (x => [initValue, initValue = x]);
|
|
2902
|
-
return initValue;
|
|
2903
|
-
};
|
|
2904
|
-
return result;
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
/***/ }),
|
|
2909
|
-
|
|
2910
|
-
/***/ "./ts/setProp.function.ts":
|
|
2911
|
-
/*!********************************!*\
|
|
2912
|
-
!*** ./ts/setProp.function.ts ***!
|
|
2913
|
-
\********************************/
|
|
2914
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2915
|
-
|
|
2916
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2917
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2918
|
-
/* harmony export */ setProp: () => (/* binding */ setProp)
|
|
2919
|
-
/* harmony export */ });
|
|
2920
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
2921
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
/** Used for variables that need to remain the same variable during render passes */
|
|
2925
|
-
function setProp(getSet) {
|
|
2926
|
-
const config = _setUse_function__WEBPACK_IMPORTED_MODULE_1__.setUse.memory.stateConfig;
|
|
2927
|
-
const rearray = config.rearray;
|
|
2928
|
-
const [propValue] = getSet(undefined);
|
|
2929
|
-
getSet(propValue); // restore original value instead of undefined
|
|
2930
|
-
const restate = rearray[config.array.length];
|
|
2931
|
-
if (restate) {
|
|
2932
|
-
let watchValue = restate.watch;
|
|
2933
|
-
let oldValue = (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(restate);
|
|
2934
|
-
const push = {
|
|
2935
|
-
get: () => (0,_set_function__WEBPACK_IMPORTED_MODULE_0__.getStateValue)(push),
|
|
2936
|
-
callback: getSet,
|
|
2937
|
-
lastValue: oldValue,
|
|
2938
|
-
watch: restate.watch,
|
|
2939
|
-
};
|
|
2940
|
-
// has the prop value changed?
|
|
2941
|
-
if (propValue != watchValue) {
|
|
2942
|
-
push.watch = propValue;
|
|
2943
|
-
oldValue = push.lastValue = propValue;
|
|
2944
|
-
}
|
|
2945
|
-
config.array.push(push);
|
|
2946
|
-
getSet(oldValue);
|
|
2947
|
-
return oldValue;
|
|
2999
|
+
const allExact = currentValues.every((item, index) => item === previousValues[index]);
|
|
3000
|
+
if (allExact) {
|
|
3001
|
+
return currentValues;
|
|
2948
3002
|
}
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
watch: propValue,
|
|
2954
|
-
};
|
|
2955
|
-
config.array.push(push);
|
|
2956
|
-
return propValue;
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
/***/ }),
|
|
2961
|
-
|
|
2962
|
-
/***/ "./ts/setUse.function.ts":
|
|
2963
|
-
/*!*******************************!*\
|
|
2964
|
-
!*** ./ts/setUse.function.ts ***!
|
|
2965
|
-
\*******************************/
|
|
2966
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2967
|
-
|
|
2968
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2969
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2970
|
-
/* harmony export */ setUse: () => (/* binding */ setUse)
|
|
2971
|
-
/* harmony export */ });
|
|
2972
|
-
const tagUse = [];
|
|
2973
|
-
function setUse(use) {
|
|
2974
|
-
// must provide defaults
|
|
2975
|
-
const useMe = {
|
|
2976
|
-
beforeRender: use.beforeRender || (() => undefined),
|
|
2977
|
-
beforeRedraw: use.beforeRedraw || (() => undefined),
|
|
2978
|
-
afterRender: use.afterRender || (() => undefined),
|
|
2979
|
-
beforeDestroy: use.beforeDestroy || (() => undefined),
|
|
2980
|
-
};
|
|
2981
|
-
setUse.tagUse.push(useMe);
|
|
3003
|
+
callback(currentValues, previousValues);
|
|
3004
|
+
previousValues.length = 0;
|
|
3005
|
+
previousValues.push(...currentValues);
|
|
3006
|
+
return currentValues;
|
|
2982
3007
|
}
|
|
2983
|
-
setUse.tagUse = tagUse;
|
|
2984
|
-
setUse.memory = {};
|
|
2985
3008
|
|
|
2986
3009
|
|
|
2987
3010
|
/***/ }),
|
|
@@ -3013,8 +3036,8 @@ class Subject {
|
|
|
3013
3036
|
// are we in a pipe?
|
|
3014
3037
|
if (this.methods.length) {
|
|
3015
3038
|
const orgCallback = callback;
|
|
3016
|
-
callback = (value
|
|
3017
|
-
runPipedMethods(value,
|
|
3039
|
+
callback = (value) => {
|
|
3040
|
+
runPipedMethods(value, this.methods, lastValue => orgCallback(lastValue));
|
|
3018
3041
|
};
|
|
3019
3042
|
}
|
|
3020
3043
|
return subscribeWith(callback);
|
|
@@ -3082,12 +3105,12 @@ function getSubscription(subject, callback) {
|
|
|
3082
3105
|
};
|
|
3083
3106
|
return subscription;
|
|
3084
3107
|
}
|
|
3085
|
-
function runPipedMethods(value,
|
|
3108
|
+
function runPipedMethods(value, methods, onComplete) {
|
|
3086
3109
|
const cloneMethods = [...methods];
|
|
3087
3110
|
const firstMethod = cloneMethods.shift();
|
|
3088
3111
|
const next = (newValue) => {
|
|
3089
3112
|
if (cloneMethods.length) {
|
|
3090
|
-
return runPipedMethods(newValue,
|
|
3113
|
+
return runPipedMethods(newValue, cloneMethods, onComplete);
|
|
3091
3114
|
}
|
|
3092
3115
|
onComplete(newValue);
|
|
3093
3116
|
// return newValue = next
|
|
@@ -3123,7 +3146,7 @@ class ValueSubject extends _Subject_class__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
|
|
3123
3146
|
subscribe(callback) {
|
|
3124
3147
|
const subscription = super.subscribe(callback);
|
|
3125
3148
|
// Call the callback immediately with the current value
|
|
3126
|
-
callback(this.value
|
|
3149
|
+
callback(this.value);
|
|
3127
3150
|
return subscription;
|
|
3128
3151
|
}
|
|
3129
3152
|
}
|
|
@@ -3255,7 +3278,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3255
3278
|
/* harmony export */ tags: () => (/* binding */ tags)
|
|
3256
3279
|
/* harmony export */ });
|
|
3257
3280
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3258
|
-
/* harmony import */ var
|
|
3281
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
3259
3282
|
/* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
|
|
3260
3283
|
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
3261
3284
|
/* harmony import */ var _deepFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deepFunctions */ "./ts/deepFunctions.ts");
|
|
@@ -3320,7 +3343,7 @@ function updateResult(result, tagComponent) {
|
|
|
3320
3343
|
}
|
|
3321
3344
|
function updateComponent(tagComponent) {
|
|
3322
3345
|
tagComponent.tags = tags;
|
|
3323
|
-
tagComponent.setUse =
|
|
3346
|
+
tagComponent.setUse = _state__WEBPACK_IMPORTED_MODULE_1__.setUse;
|
|
3324
3347
|
tagComponent.tagIndex = tagCount++; // needed for things like HMR
|
|
3325
3348
|
}
|
|
3326
3349
|
/** creates/returns a function that when called then calls the original component function */
|
|
@@ -3470,24 +3493,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3470
3493
|
/* harmony export */ runBeforeRedraw: () => (/* binding */ runBeforeRedraw),
|
|
3471
3494
|
/* harmony export */ runBeforeRender: () => (/* binding */ runBeforeRender)
|
|
3472
3495
|
/* harmony export */ });
|
|
3473
|
-
/* harmony import */ var
|
|
3496
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state */ "./ts/state/index.ts");
|
|
3474
3497
|
// TODO: This should be more like `new TaggedJs().use({})`
|
|
3475
3498
|
|
|
3476
3499
|
// Life cycle 1
|
|
3477
3500
|
function runBeforeRender(tagSupport, tagOwner) {
|
|
3478
|
-
|
|
3501
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, tagOwner));
|
|
3479
3502
|
}
|
|
3480
3503
|
// Life cycle 2
|
|
3481
3504
|
function runAfterRender(tagSupport, tag) {
|
|
3482
|
-
|
|
3505
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, tag));
|
|
3483
3506
|
}
|
|
3484
3507
|
// Life cycle 3
|
|
3485
3508
|
function runBeforeRedraw(tagSupport, tag) {
|
|
3486
|
-
|
|
3509
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, tag));
|
|
3487
3510
|
}
|
|
3488
3511
|
// Life cycle 4 - end of life
|
|
3489
3512
|
function runBeforeDestroy(tagSupport, tag) {
|
|
3490
|
-
|
|
3513
|
+
_state__WEBPACK_IMPORTED_MODULE_0__.setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, tag));
|
|
3491
3514
|
}
|
|
3492
3515
|
|
|
3493
3516
|
|
|
@@ -3554,18 +3577,13 @@ function updateExistingTagComponent(ownerTag, templater, subject, insertBefore)
|
|
|
3554
3577
|
}
|
|
3555
3578
|
const oldTagSupport = existingTag.tagSupport;
|
|
3556
3579
|
const oldGlobal = oldTagSupport.templater.global;
|
|
3557
|
-
const globalInsert = oldGlobal.insertBefore;
|
|
3558
|
-
const oldInsertBefore = globalInsert?.parentNode ? globalInsert : insertBefore;
|
|
3559
3580
|
// const placeholderElm = ownerTag.tagSupport.templater.global.placeholderElm
|
|
3560
|
-
const placeholderElm = oldGlobal.
|
|
3581
|
+
const placeholderElm = oldGlobal.placeholder;
|
|
3561
3582
|
if (placeholderElm) {
|
|
3562
3583
|
if (!placeholderElm.parentNode) {
|
|
3563
3584
|
throw new Error('stop here no subject parent node update existing tag');
|
|
3564
3585
|
}
|
|
3565
3586
|
}
|
|
3566
|
-
else if (!oldInsertBefore.parentNode) {
|
|
3567
|
-
//throw new Error('stop here no parent node update existing tag')
|
|
3568
|
-
}
|
|
3569
3587
|
if (!isSameTag) {
|
|
3570
3588
|
(0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldTagSupport.templater.global.oldest, subject);
|
|
3571
3589
|
return (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject,
|
|
@@ -3713,8 +3731,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3713
3731
|
/* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isLikeTags.function */ "./ts/isLikeTags.function.ts");
|
|
3714
3732
|
/* harmony import */ var _bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./bindSubjectCallback.function */ "./ts/bindSubjectCallback.function.ts");
|
|
3715
3733
|
/* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./processTag.function */ "./ts/processTag.function.ts");
|
|
3716
|
-
/* harmony import */ var _insertAfter_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./insertAfter.function */ "./ts/insertAfter.function.ts");
|
|
3717
|
-
|
|
3718
3734
|
|
|
3719
3735
|
|
|
3720
3736
|
|
|
@@ -3728,37 +3744,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3728
3744
|
function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
3729
3745
|
const subjectTag = subject;
|
|
3730
3746
|
const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value);
|
|
3731
|
-
|
|
3732
|
-
// const placeholderElm = global?.placeholderElm || global?.insertBefore || (subject as DisplaySubject).insertBefore
|
|
3733
|
-
// const oldInsertBefore = placeholderElm || (subject as DisplaySubject).clone
|
|
3734
|
-
const destroyType = (0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_5__.checkDestroyPrevious)(subject, value, insertBefore);
|
|
3747
|
+
(0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_5__.checkDestroyPrevious)(subject, value, insertBefore);
|
|
3735
3748
|
// handle already seen tag components
|
|
3736
3749
|
if (isComponent) {
|
|
3737
3750
|
const templater = value;
|
|
3738
3751
|
// When was something before component
|
|
3739
3752
|
if (!subjectTag.tag) {
|
|
3740
|
-
|
|
3753
|
+
(0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_6__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
|
|
3741
3754
|
ownerTag, {
|
|
3742
3755
|
forceElement: true,
|
|
3743
3756
|
counts: { added: 0, removed: 0 },
|
|
3744
3757
|
});
|
|
3745
3758
|
return subjectTag;
|
|
3746
3759
|
}
|
|
3747
|
-
// ??? - new put back down template tag before redraw
|
|
3748
|
-
const placeholderElm = subjectTag.tag.tagSupport.templater.global.placeholderElm;
|
|
3749
|
-
if (placeholderElm) {
|
|
3750
|
-
(0,_insertAfter_function__WEBPACK_IMPORTED_MODULE_10__.insertAfter)(insertBefore, placeholderElm);
|
|
3751
|
-
delete subjectTag.tag.tagSupport.templater.global.placeholderElm;
|
|
3752
|
-
}
|
|
3753
3760
|
templater.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__.TagSupport(
|
|
3754
3761
|
// subjectTag.tag.tagSupport.ownerTagSupport,
|
|
3755
3762
|
ownerTag.tagSupport, templater, subjectTag);
|
|
3756
|
-
|
|
3763
|
+
(0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_3__.updateExistingTagComponent)(ownerTag, templater, // latest value
|
|
3757
3764
|
subjectTag, insertBefore);
|
|
3758
|
-
if (insertBefore.parentNode) {
|
|
3759
|
-
tag.tagSupport.templater.global.placeholderElm = insertBefore.previousSibling;
|
|
3760
|
-
insertBefore.parentNode.removeChild(insertBefore);
|
|
3761
|
-
}
|
|
3762
3765
|
return subjectTag;
|
|
3763
3766
|
}
|
|
3764
3767
|
// was component but no longer
|
|
@@ -3784,7 +3787,7 @@ function updateExistingValue(subject, value, ownerTag, insertBefore) {
|
|
|
3784
3787
|
return subject;
|
|
3785
3788
|
}
|
|
3786
3789
|
if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagInstance)(value)) {
|
|
3787
|
-
if (insertBefore.
|
|
3790
|
+
if (insertBefore.nodeName !== 'TEMPLATE') {
|
|
3788
3791
|
throw new Error(`expected template - ${insertBefore.nodeName}`);
|
|
3789
3792
|
}
|
|
3790
3793
|
(0,_processTag_function__WEBPACK_IMPORTED_MODULE_9__.processTag)(value, subjectTag, insertBefore, ownerTag);
|
|
@@ -3816,7 +3819,6 @@ function handleStillTag(existingTag, subject, value, ownerTag) {
|
|
|
3816
3819
|
if (isSameTag || isSameTag2) {
|
|
3817
3820
|
const subjectTag = subject;
|
|
3818
3821
|
const global = existingTag.tagSupport.templater.global;
|
|
3819
|
-
delete global.placeholderElm;
|
|
3820
3822
|
const insertBefore = global.insertBefore;
|
|
3821
3823
|
return (0,_processTag_function__WEBPACK_IMPORTED_MODULE_9__.processTag)(value, subjectTag, insertBefore, ownerTag);
|
|
3822
3824
|
}
|
|
@@ -3824,40 +3826,6 @@ function handleStillTag(existingTag, subject, value, ownerTag) {
|
|
|
3824
3826
|
}
|
|
3825
3827
|
|
|
3826
3828
|
|
|
3827
|
-
/***/ }),
|
|
3828
|
-
|
|
3829
|
-
/***/ "./ts/watch.function.ts":
|
|
3830
|
-
/*!******************************!*\
|
|
3831
|
-
!*** ./ts/watch.function.ts ***!
|
|
3832
|
-
\******************************/
|
|
3833
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3834
|
-
|
|
3835
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3836
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3837
|
-
/* harmony export */ watch: () => (/* binding */ watch)
|
|
3838
|
-
/* harmony export */ });
|
|
3839
|
-
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3840
|
-
|
|
3841
|
-
/** When an item in watch array changes, callback function will be triggered */
|
|
3842
|
-
function watch(currentValues, callback) {
|
|
3843
|
-
let previousValues = (0,_setLet_function__WEBPACK_IMPORTED_MODULE_0__.setLet)(undefined)(x => [previousValues, previousValues = x]);
|
|
3844
|
-
if (previousValues === undefined) {
|
|
3845
|
-
callback(currentValues, previousValues);
|
|
3846
|
-
// const result = {currentValues, previousValues}
|
|
3847
|
-
previousValues = currentValues;
|
|
3848
|
-
return currentValues;
|
|
3849
|
-
}
|
|
3850
|
-
const allExact = currentValues.every((item, index) => item === previousValues[index]);
|
|
3851
|
-
if (allExact) {
|
|
3852
|
-
return currentValues;
|
|
3853
|
-
}
|
|
3854
|
-
callback(currentValues, previousValues);
|
|
3855
|
-
previousValues.length = 0;
|
|
3856
|
-
previousValues.push(...currentValues);
|
|
3857
|
-
return currentValues;
|
|
3858
|
-
}
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
3829
|
/***/ })
|
|
3862
3830
|
|
|
3863
3831
|
/******/ });
|
|
@@ -3928,12 +3896,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3928
3896
|
/* harmony export */ BaseTagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__.BaseTagSupport),
|
|
3929
3897
|
/* harmony export */ StateMismatchError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.StateMismatchError),
|
|
3930
3898
|
/* harmony export */ Subject: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.Subject),
|
|
3899
|
+
/* harmony export */ SyncCallbackError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.SyncCallbackError),
|
|
3931
3900
|
/* harmony export */ Tag: () => (/* reexport safe */ _Tag_class__WEBPACK_IMPORTED_MODULE_10__.Tag),
|
|
3932
3901
|
/* harmony export */ TagError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_4__.TagError),
|
|
3933
3902
|
/* harmony export */ TagSupport: () => (/* reexport safe */ _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__.TagSupport),
|
|
3934
3903
|
/* harmony export */ ValueSubject: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.ValueSubject),
|
|
3904
|
+
/* harmony export */ callbackMaker: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.callbackMaker),
|
|
3935
3905
|
/* harmony export */ combineLatest: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.combineLatest),
|
|
3936
|
-
/* harmony export */ getCallback: () => (/* reexport safe */ _getCallback__WEBPACK_IMPORTED_MODULE_19__.getCallback),
|
|
3937
3906
|
/* harmony export */ hmr: () => (/* binding */ hmr),
|
|
3938
3907
|
/* harmony export */ html: () => (/* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_3__.html),
|
|
3939
3908
|
/* harmony export */ interpolateElement: () => (/* reexport safe */ _interpolateElement__WEBPACK_IMPORTED_MODULE_9__.interpolateElement),
|
|
@@ -3942,18 +3911,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3942
3911
|
/* harmony export */ isTagArray: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagArray),
|
|
3943
3912
|
/* harmony export */ isTagComponent: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagComponent),
|
|
3944
3913
|
/* harmony export */ isTagInstance: () => (/* reexport safe */ _isInstance__WEBPACK_IMPORTED_MODULE_6__.isTagInstance),
|
|
3945
|
-
/* harmony export */
|
|
3946
|
-
/* harmony export */
|
|
3947
|
-
/* harmony export */
|
|
3914
|
+
/* harmony export */ letState: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.letState),
|
|
3915
|
+
/* harmony export */ onDestroy: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.onDestroy),
|
|
3916
|
+
/* harmony export */ onInit: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.onInit),
|
|
3917
|
+
/* harmony export */ providers: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.providers),
|
|
3948
3918
|
/* harmony export */ runBeforeRender: () => (/* reexport safe */ _tagRunner__WEBPACK_IMPORTED_MODULE_11__.runBeforeRender),
|
|
3949
|
-
/* harmony export */
|
|
3950
|
-
/* harmony export */
|
|
3951
|
-
/* harmony export */
|
|
3952
|
-
/* harmony export */ setUse: () => (/* reexport safe */ _setUse_function__WEBPACK_IMPORTED_MODULE_12__.setUse),
|
|
3919
|
+
/* harmony export */ setProp: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.setProp),
|
|
3920
|
+
/* harmony export */ setUse: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.setUse),
|
|
3921
|
+
/* harmony export */ state: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.state),
|
|
3953
3922
|
/* harmony export */ tag: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tag),
|
|
3954
3923
|
/* harmony export */ tagElement: () => (/* reexport safe */ _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement),
|
|
3955
3924
|
/* harmony export */ tags: () => (/* reexport safe */ _tag__WEBPACK_IMPORTED_MODULE_2__.tags),
|
|
3956
|
-
/* harmony export */ watch: () => (/* reexport safe */
|
|
3925
|
+
/* harmony export */ watch: () => (/* reexport safe */ _state_index__WEBPACK_IMPORTED_MODULE_7__.watch),
|
|
3957
3926
|
/* harmony export */ willCallback: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willCallback),
|
|
3958
3927
|
/* harmony export */ willPromise: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willPromise),
|
|
3959
3928
|
/* harmony export */ willSubscribe: () => (/* reexport safe */ _subject_index__WEBPACK_IMPORTED_MODULE_5__.willSubscribe)
|
|
@@ -3965,19 +3934,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3965
3934
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors */ "./ts/errors.ts");
|
|
3966
3935
|
/* harmony import */ var _subject_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./subject/index */ "./ts/subject/index.ts");
|
|
3967
3936
|
/* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isInstance */ "./ts/isInstance.ts");
|
|
3968
|
-
/* harmony import */ var
|
|
3937
|
+
/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./state/index */ "./ts/state/index.ts");
|
|
3969
3938
|
/* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TagSupport.class */ "./ts/TagSupport.class.ts");
|
|
3970
3939
|
/* harmony import */ var _interpolateElement__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interpolateElement */ "./ts/interpolateElement.ts");
|
|
3971
3940
|
/* harmony import */ var _Tag_class__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Tag.class */ "./ts/Tag.class.ts");
|
|
3972
3941
|
/* harmony import */ var _tagRunner__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./tagRunner */ "./ts/tagRunner.ts");
|
|
3973
|
-
/* harmony import */ var _setUse_function__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./setUse.function */ "./ts/setUse.function.ts");
|
|
3974
|
-
/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./providers */ "./ts/providers.ts");
|
|
3975
|
-
/* harmony import */ var _set_function__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./set.function */ "./ts/set.function.ts");
|
|
3976
|
-
/* harmony import */ var _setLet_function__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./setLet.function */ "./ts/setLet.function.ts");
|
|
3977
|
-
/* harmony import */ var _setProp_function__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./setProp.function */ "./ts/setProp.function.ts");
|
|
3978
|
-
/* harmony import */ var _onInit__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./onInit */ "./ts/onInit.ts");
|
|
3979
|
-
/* harmony import */ var _onDestroy__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./onDestroy */ "./ts/onDestroy.ts");
|
|
3980
|
-
/* harmony import */ var _getCallback__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./getCallback */ "./ts/getCallback.ts");
|
|
3981
3942
|
// import { redrawTag } from "./redrawTag.function"
|
|
3982
3943
|
|
|
3983
3944
|
|
|
@@ -3994,17 +3955,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3994
3955
|
|
|
3995
3956
|
|
|
3996
3957
|
|
|
3997
|
-
|
|
3998
|
-
/* hooks */
|
|
3999
|
-
// TODO: export *
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
/* end: hooks */
|
|
4008
3958
|
const hmr = {
|
|
4009
3959
|
tagElement: _tagElement__WEBPACK_IMPORTED_MODULE_0__.tagElement,
|
|
4010
3960
|
// redrawTag
|
|
@@ -4016,12 +3966,13 @@ var __webpack_exports__ArrayNoKeyError = __webpack_exports__.ArrayNoKeyError;
|
|
|
4016
3966
|
var __webpack_exports__BaseTagSupport = __webpack_exports__.BaseTagSupport;
|
|
4017
3967
|
var __webpack_exports__StateMismatchError = __webpack_exports__.StateMismatchError;
|
|
4018
3968
|
var __webpack_exports__Subject = __webpack_exports__.Subject;
|
|
3969
|
+
var __webpack_exports__SyncCallbackError = __webpack_exports__.SyncCallbackError;
|
|
4019
3970
|
var __webpack_exports__Tag = __webpack_exports__.Tag;
|
|
4020
3971
|
var __webpack_exports__TagError = __webpack_exports__.TagError;
|
|
4021
3972
|
var __webpack_exports__TagSupport = __webpack_exports__.TagSupport;
|
|
4022
3973
|
var __webpack_exports__ValueSubject = __webpack_exports__.ValueSubject;
|
|
3974
|
+
var __webpack_exports__callbackMaker = __webpack_exports__.callbackMaker;
|
|
4023
3975
|
var __webpack_exports__combineLatest = __webpack_exports__.combineLatest;
|
|
4024
|
-
var __webpack_exports__getCallback = __webpack_exports__.getCallback;
|
|
4025
3976
|
var __webpack_exports__hmr = __webpack_exports__.hmr;
|
|
4026
3977
|
var __webpack_exports__html = __webpack_exports__.html;
|
|
4027
3978
|
var __webpack_exports__interpolateElement = __webpack_exports__.interpolateElement;
|
|
@@ -4030,14 +3981,14 @@ var __webpack_exports__isSubjectInstance = __webpack_exports__.isSubjectInstance
|
|
|
4030
3981
|
var __webpack_exports__isTagArray = __webpack_exports__.isTagArray;
|
|
4031
3982
|
var __webpack_exports__isTagComponent = __webpack_exports__.isTagComponent;
|
|
4032
3983
|
var __webpack_exports__isTagInstance = __webpack_exports__.isTagInstance;
|
|
3984
|
+
var __webpack_exports__letState = __webpack_exports__.letState;
|
|
4033
3985
|
var __webpack_exports__onDestroy = __webpack_exports__.onDestroy;
|
|
4034
3986
|
var __webpack_exports__onInit = __webpack_exports__.onInit;
|
|
4035
3987
|
var __webpack_exports__providers = __webpack_exports__.providers;
|
|
4036
3988
|
var __webpack_exports__runBeforeRender = __webpack_exports__.runBeforeRender;
|
|
4037
|
-
var __webpack_exports__set = __webpack_exports__.set;
|
|
4038
|
-
var __webpack_exports__setLet = __webpack_exports__.setLet;
|
|
4039
3989
|
var __webpack_exports__setProp = __webpack_exports__.setProp;
|
|
4040
3990
|
var __webpack_exports__setUse = __webpack_exports__.setUse;
|
|
3991
|
+
var __webpack_exports__state = __webpack_exports__.state;
|
|
4041
3992
|
var __webpack_exports__tag = __webpack_exports__.tag;
|
|
4042
3993
|
var __webpack_exports__tagElement = __webpack_exports__.tagElement;
|
|
4043
3994
|
var __webpack_exports__tags = __webpack_exports__.tags;
|
|
@@ -4045,6 +3996,6 @@ var __webpack_exports__watch = __webpack_exports__.watch;
|
|
|
4045
3996
|
var __webpack_exports__willCallback = __webpack_exports__.willCallback;
|
|
4046
3997
|
var __webpack_exports__willPromise = __webpack_exports__.willPromise;
|
|
4047
3998
|
var __webpack_exports__willSubscribe = __webpack_exports__.willSubscribe;
|
|
4048
|
-
export { __webpack_exports__ArrayNoKeyError as ArrayNoKeyError, __webpack_exports__BaseTagSupport as BaseTagSupport, __webpack_exports__StateMismatchError as StateMismatchError, __webpack_exports__Subject as Subject, __webpack_exports__Tag as Tag, __webpack_exports__TagError as TagError, __webpack_exports__TagSupport as TagSupport, __webpack_exports__ValueSubject as ValueSubject,
|
|
3999
|
+
export { __webpack_exports__ArrayNoKeyError as ArrayNoKeyError, __webpack_exports__BaseTagSupport as BaseTagSupport, __webpack_exports__StateMismatchError as StateMismatchError, __webpack_exports__Subject as Subject, __webpack_exports__SyncCallbackError as SyncCallbackError, __webpack_exports__Tag as Tag, __webpack_exports__TagError as TagError, __webpack_exports__TagSupport as TagSupport, __webpack_exports__ValueSubject as ValueSubject, __webpack_exports__callbackMaker as callbackMaker, __webpack_exports__combineLatest as combineLatest, __webpack_exports__hmr as hmr, __webpack_exports__html as html, __webpack_exports__interpolateElement as interpolateElement, __webpack_exports__interpolateString as interpolateString, __webpack_exports__isSubjectInstance as isSubjectInstance, __webpack_exports__isTagArray as isTagArray, __webpack_exports__isTagComponent as isTagComponent, __webpack_exports__isTagInstance as isTagInstance, __webpack_exports__letState as letState, __webpack_exports__onDestroy as onDestroy, __webpack_exports__onInit as onInit, __webpack_exports__providers as providers, __webpack_exports__runBeforeRender as runBeforeRender, __webpack_exports__setProp as setProp, __webpack_exports__setUse as setUse, __webpack_exports__state as state, __webpack_exports__tag as tag, __webpack_exports__tagElement as tagElement, __webpack_exports__tags as tags, __webpack_exports__watch as watch, __webpack_exports__willCallback as willCallback, __webpack_exports__willPromise as willPromise, __webpack_exports__willSubscribe as willSubscribe };
|
|
4049
4000
|
|
|
4050
4001
|
//# sourceMappingURL=bundle.js.map
|