taggedjs 2.5.9 → 2.5.11

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.
Files changed (61) hide show
  1. package/bundle.js +273 -234
  2. package/bundle.js.map +1 -1
  3. package/js/TemplaterResult.class.js.map +1 -1
  4. package/js/interpolations/interpolateContentTemplates.d.ts +1 -1
  5. package/js/interpolations/interpolateContentTemplates.js +10 -12
  6. package/js/interpolations/interpolateContentTemplates.js.map +1 -1
  7. package/js/interpolations/interpolateElement.d.ts +1 -3
  8. package/js/interpolations/interpolateElement.js +5 -4
  9. package/js/interpolations/interpolateElement.js.map +1 -1
  10. package/js/interpolations/interpolateTemplate.d.ts +2 -5
  11. package/js/interpolations/interpolateTemplate.js +8 -12
  12. package/js/interpolations/interpolateTemplate.js.map +1 -1
  13. package/js/isInstance.d.ts +1 -1
  14. package/js/isInstance.js +4 -3
  15. package/js/isInstance.js.map +1 -1
  16. package/js/tag/Tag.class.d.ts +1 -2
  17. package/js/tag/Tag.class.js.map +1 -1
  18. package/js/tag/TagSupport.class.d.ts +0 -1
  19. package/js/tag/TagSupport.class.js +12 -17
  20. package/js/tag/TagSupport.class.js.map +1 -1
  21. package/js/tag/checkDestroyPrevious.function.d.ts +3 -2
  22. package/js/tag/checkDestroyPrevious.function.js +18 -8
  23. package/js/tag/checkDestroyPrevious.function.js.map +1 -1
  24. package/js/tag/tag.js.map +1 -1
  25. package/js/tag/tagElement.js.map +1 -1
  26. package/js/tag/update/processFirstSubject.utils.d.ts +34 -0
  27. package/js/tag/update/processFirstSubject.utils.js +48 -0
  28. package/js/tag/update/processFirstSubject.utils.js.map +1 -0
  29. package/js/tag/update/processFirstSubjectValue.function.d.ts +7 -0
  30. package/js/tag/update/processFirstSubjectValue.function.js +31 -0
  31. package/js/tag/update/processFirstSubjectValue.function.js.map +1 -0
  32. package/js/tag/update/processNewValue.function.d.ts +2 -2
  33. package/js/tag/update/processNewValue.function.js +16 -24
  34. package/js/tag/update/processNewValue.function.js.map +1 -1
  35. package/js/tag/update/processRegularValue.function.d.ts +2 -0
  36. package/js/tag/update/processRegularValue.function.js +17 -2
  37. package/js/tag/update/processRegularValue.function.js.map +1 -1
  38. package/js/tag/update/processSubjectComponent.function.d.ts +0 -1
  39. package/js/tag/update/processSubjectComponent.function.js +1 -1
  40. package/js/tag/update/processSubjectComponent.function.js.map +1 -1
  41. package/js/tag/update/processSubjectValue.function.d.ts +3 -23
  42. package/js/tag/update/processSubjectValue.function.js +1 -25
  43. package/js/tag/update/processSubjectValue.function.js.map +1 -1
  44. package/js/tag/update/processTag.function.js +0 -1
  45. package/js/tag/update/processTag.function.js.map +1 -1
  46. package/js/tag/update/processTagArray.d.ts +0 -1
  47. package/js/tag/update/processTagArray.js +1 -2
  48. package/js/tag/update/processTagArray.js.map +1 -1
  49. package/js/tag/update/processTagResult.function.d.ts +1 -2
  50. package/js/tag/update/processTagResult.function.js +3 -4
  51. package/js/tag/update/processTagResult.function.js.map +1 -1
  52. package/js/tag/update/updateContextItem.function.d.ts +1 -1
  53. package/js/tag/update/updateExistingTagComponent.function.js +0 -2
  54. package/js/tag/update/updateExistingTagComponent.function.js.map +1 -1
  55. package/js/tag/update/updateExistingValue.function.d.ts +1 -1
  56. package/js/tag/update/updateExistingValue.function.js +36 -47
  57. package/js/tag/update/updateExistingValue.function.js.map +1 -1
  58. package/js/updateBeforeTemplate.function.d.ts +5 -1
  59. package/js/updateBeforeTemplate.function.js +10 -7
  60. package/js/updateBeforeTemplate.function.js.map +1 -1
  61. package/package.json +1 -1
package/bundle.js CHANGED
@@ -514,25 +514,23 @@ __webpack_require__.r(__webpack_exports__);
514
514
  /* harmony export */ });
515
515
  /* harmony import */ var _interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interpolateTemplate */ "./ts/interpolations/interpolateTemplate.ts");
516
516
 
517
- function interpolateContentTemplates(element, context, tagSupport, options, children) {
518
- if (!children || element.tagName === 'TEMPLATE') {
519
- return { clones: [], tagComponents: [] }; // done
520
- }
517
+ function interpolateContentTemplates(context, tagSupport, options, children) {
521
518
  // counting for animation stagger computing
522
519
  const counts = options.counts;
523
520
  const clones = [];
524
521
  const tagComponents = [];
525
- const childArray = new Array(...children);
526
- childArray.forEach(child => {
522
+ const childLength = children.length;
523
+ for (let index = childLength - 1; index >= 0; --index) {
524
+ const child = children[index];
527
525
  const { clones: nextClones, tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(child, context, tagSupport, counts, options);
528
526
  clones.push(...nextClones);
529
527
  if (tagComponent) {
530
528
  tagComponents.push(tagComponent);
531
- return;
529
+ continue;
532
530
  }
533
531
  if (child.children) {
534
- const nextKids = new Array(...child.children);
535
- nextKids.forEach((subChild, index) => {
532
+ for (let index = child.children.length - 1; index >= 0; --index) {
533
+ const subChild = child.children[index];
536
534
  // IF <template end /> its a variable to be processed
537
535
  if (isRenderEndTemplate(subChild)) {
538
536
  const { tagComponent } = (0,_interpolateTemplate__WEBPACK_IMPORTED_MODULE_0__.interpolateTemplate)(subChild, context, tagSupport, counts, options);
@@ -540,12 +538,12 @@ function interpolateContentTemplates(element, context, tagSupport, options, chil
540
538
  tagComponents.push(tagComponent);
541
539
  }
542
540
  }
543
- const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(subChild, context, tagSupport, options, subChild.children);
541
+ const { clones: nextClones, tagComponents: nextTagComponent } = interpolateContentTemplates(context, tagSupport, options, subChild.children);
544
542
  clones.push(...nextClones);
545
543
  tagComponents.push(...nextTagComponent);
546
- });
544
+ }
547
545
  }
548
- });
546
+ }
549
547
  return { clones, tagComponents };
550
548
  }
551
549
  function isRenderEndTemplate(child) {
@@ -587,21 +585,22 @@ interpolatedTemplates, ownerSupport, options) {
587
585
  const template = container.children[0];
588
586
  const children = template.content.children;
589
587
  if (result.keys.length) {
590
- const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(container, context, ownerSupport, options, children);
588
+ const { clones: nextClones, tagComponents: nextTagComponents } = (0,_interpolateContentTemplates__WEBPACK_IMPORTED_MODULE_2__.interpolateContentTemplates)(context, ownerSupport, options, children);
591
589
  clones.push(...nextClones);
592
590
  tagComponents.push(...nextTagComponents);
593
591
  }
594
- (0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(container, context, ownerSupport);
592
+ (0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(template, context, ownerSupport);
595
593
  processChildrenAttributes(children, context, ownerSupport);
596
594
  return { clones, tagComponents };
597
595
  }
598
596
  function processChildrenAttributes(children, context, ownerSupport) {
599
- new Array(...children).forEach(child => {
597
+ for (let index = children.length - 1; index >= 0; --index) {
598
+ const child = children[index];
600
599
  (0,_interpolateAttributes__WEBPACK_IMPORTED_MODULE_0__.interpolateAttributes)(child, context, ownerSupport);
601
600
  if (child.children) {
602
601
  processChildrenAttributes(child.children, context, ownerSupport);
603
602
  }
604
- });
603
+ }
605
604
  }
606
605
  function interpolateString(string) {
607
606
  const result = (0,_interpolations__WEBPACK_IMPORTED_MODULE_1__.interpolateToTemplates)(string);
@@ -626,7 +625,7 @@ __webpack_require__.r(__webpack_exports__);
626
625
  /* harmony export */ });
627
626
  /* harmony import */ var _tag_Tag_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tag/Tag.class */ "./ts/tag/Tag.class.ts");
628
627
  /* harmony import */ var _elementInitCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./elementInitCheck */ "./ts/interpolations/elementInitCheck.ts");
629
- /* harmony import */ var _tag_update_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tag/update/processSubjectValue.function */ "./ts/tag/update/processSubjectValue.function.ts");
628
+ /* harmony import */ var _tag_update_processFirstSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tag/update/processFirstSubjectValue.function */ "./ts/tag/update/processFirstSubjectValue.function.ts");
630
629
  /* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../isInstance */ "./ts/isInstance.ts");
631
630
  /* harmony import */ var _scanTextAreaValue_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scanTextAreaValue.function */ "./ts/interpolations/scanTextAreaValue.function.ts");
632
631
  /* harmony import */ var _tag_update_updateExistingValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tag/update/updateExistingValue.function */ "./ts/tag/update/updateExistingValue.function.ts");
@@ -666,12 +665,10 @@ options) {
666
665
  }
667
666
  };
668
667
  }
669
- let isForceElement = options.forceElement;
670
- subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts, { isForceElement });
668
+ subscribeToTemplate(insertBefore, existingSubject, ownerSupport, counts);
671
669
  return { clones };
672
670
  }
673
- function subscribeToTemplate(insertBefore, subject, ownerSupport, counts, // used for animation stagger computing
674
- { isForceElement }) {
671
+ function subscribeToTemplate(insertBefore, subject, ownerSupport, counts) {
675
672
  let called = false;
676
673
  const onValue = (value) => {
677
674
  if (called) {
@@ -679,13 +676,9 @@ function subscribeToTemplate(insertBefore, subject, ownerSupport, counts, // use
679
676
  return;
680
677
  }
681
678
  const templater = value;
682
- (0,_tag_update_processSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processSubjectValue)(templater, subject, insertBefore, ownerSupport, {
679
+ (0,_tag_update_processFirstSubjectValue_function__WEBPACK_IMPORTED_MODULE_2__.processFirstSubjectValue)(templater, subject, insertBefore, ownerSupport, {
683
680
  counts: { ...counts },
684
- forceElement: isForceElement,
685
681
  });
686
- if (isForceElement) {
687
- isForceElement = false; // only can happen once
688
- }
689
682
  called = true;
690
683
  };
691
684
  let mutatingCallback = onValue;
@@ -716,13 +709,15 @@ function afterElmBuild(elm, options, context, ownerSupport) {
716
709
  let diff = options.counts.added;
717
710
  diff = (0,_elementInitCheck__WEBPACK_IMPORTED_MODULE_1__.elementInitCheck)(elm, options.counts) - diff;
718
711
  if (elm.children) {
719
- new Array(...elm.children).forEach((child, index) => {
712
+ const children = elm.children;
713
+ for (let index = children.length - 1; index >= 0; --index) {
714
+ const child = children[index];
720
715
  const subOptions = {
721
716
  ...options,
722
717
  counts: options.counts,
723
718
  };
724
719
  return afterElmBuild(child, subOptions, context, ownerSupport);
725
- });
720
+ }
726
721
  }
727
722
  }
728
723
 
@@ -944,9 +939,6 @@ __webpack_require__.r(__webpack_exports__);
944
939
  /* harmony export */ isTagComponent: () => (/* binding */ isTagComponent),
945
940
  /* harmony export */ isTagTemplater: () => (/* binding */ isTagTemplater)
946
941
  /* harmony export */ });
947
- function isTagComponent(value) {
948
- return value?.wrapper?.parentWrap.original instanceof Function;
949
- }
950
942
  function isTag(value) {
951
943
  return isTagTemplater(value) || isTagClass(value);
952
944
  }
@@ -954,6 +946,10 @@ function isTagTemplater(value) {
954
946
  const templater = value;
955
947
  return templater?.isTemplater === true && templater.wrapper === undefined;
956
948
  }
949
+ // TODO: whats the difference between isTagClass and isTagComponent
950
+ function isTagComponent(value) {
951
+ return value?.wrapper?.parentWrap.original instanceof Function;
952
+ }
957
953
  function isTagClass(value) {
958
954
  const templater = value;
959
955
  return templater?.isTagClass === true;
@@ -2327,7 +2323,6 @@ class BaseTagSupport {
2327
2323
  appElement; // only seen on this.getAppTagSupport().appElement
2328
2324
  strings;
2329
2325
  values;
2330
- lastTemplateString = undefined; // used to compare templates for updates
2331
2326
  propsConfig;
2332
2327
  // stays with current render
2333
2328
  memory = {
@@ -2362,7 +2357,6 @@ class BaseTagSupport {
2362
2357
  }
2363
2358
  /** Function that kicks off actually putting tags down as HTML elements */
2364
2359
  buildBeforeElement(insertBefore, options = {
2365
- forceElement: false,
2366
2360
  counts: { added: 0, removed: 0 },
2367
2361
  }) {
2368
2362
  const subject = this.subject;
@@ -2378,22 +2372,20 @@ class BaseTagSupport {
2378
2372
  this.hasLiveElements = true;
2379
2373
  const context = this.update();
2380
2374
  const template = this.getTemplate();
2381
- const isForceElement = options.forceElement;
2382
- const elementContainer = document.createElement('div');
2383
- elementContainer.id = 'tag-temp-holder';
2384
- // render content with a first child that we can know is our first element
2385
- elementContainer.innerHTML = `<template id="temp-template-tag-wrap">${template.string}</template>`;
2375
+ const elementContainer = document.createDocumentFragment();
2376
+ const tempDraw = document.createElement('template');
2377
+ tempDraw.innerHTML = template.string;
2378
+ elementContainer.appendChild(tempDraw);
2386
2379
  // Search/replace innerHTML variables but don't interpolate tag components just yet
2387
2380
  const { tagComponents } = (0,_interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__.interpolateElement)(elementContainer, context, template, this, // ownerSupport,
2388
2381
  {
2389
- forceElement: options.forceElement,
2390
2382
  counts: options.counts
2391
2383
  });
2392
2384
  (0,_interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, placeholderElm, this, // ownerSupport
2393
2385
  context, options);
2394
2386
  // Any tag components that were found should be processed AFTER the owner processes its elements. Avoid double processing of elements attributes like (oninit)=${}
2395
2387
  tagComponents.forEach(tagComponent => {
2396
- (0,_interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts, { isForceElement });
2388
+ (0,_interpolations_interpolateTemplate__WEBPACK_IMPORTED_MODULE_12__.subscribeToTemplate)(tagComponent.insertBefore, tagComponent.subject, tagComponent.ownerSupport, options.counts);
2397
2389
  (0,_interpolations_afterInterpolateElement_function__WEBPACK_IMPORTED_MODULE_13__.afterInterpolateElement)(elementContainer, tagComponent.insertBefore, tagComponent.ownerSupport, context, options);
2398
2390
  });
2399
2391
  }
@@ -2408,7 +2400,6 @@ class BaseTagSupport {
2408
2400
  return trimString;
2409
2401
  }).join('');
2410
2402
  const interpolation = (0,_interpolations_interpolateElement__WEBPACK_IMPORTED_MODULE_11__.interpolateString)(string);
2411
- this.lastTemplateString = interpolation.string;
2412
2403
  return {
2413
2404
  interpolation,
2414
2405
  string: interpolation.string,
@@ -2425,19 +2416,19 @@ class BaseTagSupport {
2425
2416
  const strings = this.strings || thisTag.strings;
2426
2417
  const values = this.values || thisTag.values;
2427
2418
  strings.map((_string, index) => {
2428
- const variableName = _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix + index;
2429
2419
  const hasValue = values.length > index;
2420
+ if (!hasValue) {
2421
+ return;
2422
+ }
2423
+ const variableName = _Tag_class__WEBPACK_IMPORTED_MODULE_0__.variablePrefix + index;
2430
2424
  const value = values[index];
2431
2425
  // is something already there?
2432
2426
  const exists = variableName in context;
2433
2427
  if (exists) {
2434
2428
  return (0,_update_updateContextItem_function__WEBPACK_IMPORTED_MODULE_8__.updateContextItem)(context, variableName, value);
2435
2429
  }
2436
- if (!hasValue) {
2437
- return;
2438
- }
2439
2430
  // 🆕 First time values below
2440
- context[variableName] = (0,_update_processNewValue_function__WEBPACK_IMPORTED_MODULE_9__.processNewValue)(hasValue, value, this);
2431
+ context[variableName] = (0,_update_processNewValue_function__WEBPACK_IMPORTED_MODULE_9__.processNewValue)(value, this);
2441
2432
  });
2442
2433
  return context;
2443
2434
  }
@@ -2468,6 +2459,7 @@ class TagSupport extends BaseTagSupport {
2468
2459
  if (firstDestroy && (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(this.templater)) {
2469
2460
  (0,_tagRunner__WEBPACK_IMPORTED_MODULE_5__.runBeforeDestroy)(this, this);
2470
2461
  }
2462
+ this.destroySubscriptions();
2471
2463
  // signify immediately child has been deleted (looked for during event processing)
2472
2464
  childTags.forEach(child => {
2473
2465
  const subGlobal = child.global;
@@ -2487,7 +2479,6 @@ class TagSupport extends BaseTagSupport {
2487
2479
  }
2488
2480
  }
2489
2481
  }
2490
- this.destroySubscriptions();
2491
2482
  let mainPromise;
2492
2483
  if (this.ownerTagSupport) {
2493
2484
  this.ownerTagSupport.childTags = this.ownerTagSupport.childTags.filter(child => child !== this);
@@ -2533,6 +2524,7 @@ class TagSupport extends BaseTagSupport {
2533
2524
  const oldClones = [...this.clones];
2534
2525
  this.clones.length = 0; // tag maybe used for something else
2535
2526
  const promises = oldClones.map(clone => this.checkCloneRemoval(clone, stagger)).filter(x => x); // only return promises
2527
+ // check subjects that may have clones attached to them
2536
2528
  const oldContext = this.global.context;
2537
2529
  Object.values(oldContext).forEach(value => {
2538
2530
  const clone = value.clone;
@@ -2591,7 +2583,6 @@ class TagSupport extends BaseTagSupport {
2591
2583
  const newSupport = (0,_render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_14__.renderSubjectComponent)(this.subject, this, this.ownerTagSupport);
2592
2584
  await this.destroy();
2593
2585
  newSupport.buildBeforeElement(this.global.insertBefore, {
2594
- forceElement: true,
2595
2586
  counts: { added: 0, removed: 0 },
2596
2587
  });
2597
2588
  return newSupport;
@@ -2622,6 +2613,7 @@ __webpack_require__.r(__webpack_exports__);
2622
2613
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2623
2614
  /* harmony export */ checkDestroyPrevious: () => (/* binding */ checkDestroyPrevious),
2624
2615
  /* harmony export */ destroyArrayTag: () => (/* binding */ destroyArrayTag),
2616
+ /* harmony export */ isSimpleType: () => (/* binding */ isSimpleType),
2625
2617
  /* harmony export */ restoreTagMarker: () => (/* binding */ restoreTagMarker)
2626
2618
  /* harmony export */ });
2627
2619
  /* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../isInstance */ "./ts/isInstance.ts");
@@ -2634,6 +2626,21 @@ __webpack_require__.r(__webpack_exports__);
2634
2626
 
2635
2627
  function checkDestroyPrevious(subject, // existing.value is the old value
2636
2628
  newValue, insertBefore) {
2629
+ const displaySubject = subject;
2630
+ const hasLastValue = 'lastValue' in displaySubject;
2631
+ const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue
2632
+ // was simple value but now something bigger
2633
+ if (hasLastValue && lastValue !== newValue) {
2634
+ const newType = typeof (newValue);
2635
+ if (isSimpleType(newType) && typeof (lastValue) === newType) {
2636
+ return false;
2637
+ }
2638
+ if (newValue instanceof Function && lastValue instanceof Function) {
2639
+ return false;
2640
+ }
2641
+ destroySimpleValue(insertBefore, displaySubject);
2642
+ return 'changed-simple-value';
2643
+ }
2637
2644
  const arraySubject = subject;
2638
2645
  const wasArray = arraySubject.lastArray;
2639
2646
  // no longer an array
@@ -2672,16 +2679,11 @@ newValue, insertBefore) {
2672
2679
  (0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(lastSupport);
2673
2680
  return 'different-tag';
2674
2681
  }
2675
- const displaySubject = subject;
2676
- const hasLastValue = 'lastValue' in displaySubject;
2677
- const lastValue = displaySubject.lastValue; // TODO: we maybe able to use displaySubject.value and remove concept of lastValue
2678
- // was simple value but now something bigger
2679
- if (hasLastValue && lastValue !== newValue) {
2680
- destroySimpleValue(insertBefore, displaySubject);
2681
- return 'changed-simple-value';
2682
- }
2683
2682
  return false;
2684
2683
  }
2684
+ function isSimpleType(value) {
2685
+ return ['string', 'number', 'boolean'].includes(value);
2686
+ }
2685
2687
  function destroyArrayTag(tagSupport, counts) {
2686
2688
  (0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagSupportPast)(tagSupport);
2687
2689
  tagSupport.destroy({
@@ -3580,6 +3582,119 @@ function runBeforeDestroy(tagSupport, ownerTagSupport) {
3580
3582
  }
3581
3583
 
3582
3584
 
3585
+ /***/ }),
3586
+
3587
+ /***/ "./ts/tag/update/processFirstSubject.utils.ts":
3588
+ /*!****************************************************!*\
3589
+ !*** ./ts/tag/update/processFirstSubject.utils.ts ***!
3590
+ \****************************************************/
3591
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3592
+
3593
+ __webpack_require__.r(__webpack_exports__);
3594
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3595
+ /* harmony export */ ValueTypes: () => (/* binding */ ValueTypes),
3596
+ /* harmony export */ getValueType: () => (/* binding */ getValueType)
3597
+ /* harmony export */ });
3598
+ /* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
3599
+ /* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../checkDestroyPrevious.function */ "./ts/tag/checkDestroyPrevious.function.ts");
3600
+
3601
+
3602
+ var ValueTypes;
3603
+ (function (ValueTypes) {
3604
+ ValueTypes["unknown"] = "unknown";
3605
+ ValueTypes["tag"] = "tag";
3606
+ ValueTypes["templater"] = "templater";
3607
+ ValueTypes["tagArray"] = "tag-array";
3608
+ ValueTypes["tagComponent"] = "tag-component";
3609
+ ValueTypes["subject"] = "subject";
3610
+ ValueTypes["date"] = "date";
3611
+ ValueTypes["string"] = "string";
3612
+ ValueTypes["boolean"] = "boolean";
3613
+ ValueTypes["function"] = "function";
3614
+ ValueTypes["undefined"] = "undefined";
3615
+ })(ValueTypes || (ValueTypes = {}));
3616
+ function getValueType(value) {
3617
+ if (value === undefined || value === null) {
3618
+ return ValueTypes.undefined;
3619
+ }
3620
+ if (value instanceof Date) {
3621
+ return ValueTypes.date;
3622
+ }
3623
+ if (value instanceof Function) {
3624
+ return ValueTypes.function;
3625
+ }
3626
+ const type = typeof (value);
3627
+ if ((0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_1__.isSimpleType)(type)) {
3628
+ return type;
3629
+ }
3630
+ if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagComponent)(value)) {
3631
+ return ValueTypes.tagComponent;
3632
+ }
3633
+ if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagTemplater)(value)) {
3634
+ return ValueTypes.templater;
3635
+ }
3636
+ if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagClass)(value)) {
3637
+ return ValueTypes.tag;
3638
+ }
3639
+ if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isTagArray)(value)) {
3640
+ return ValueTypes.tagArray;
3641
+ }
3642
+ if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_0__.isSubjectInstance)(value)) {
3643
+ return ValueTypes.subject;
3644
+ }
3645
+ return ValueTypes.unknown;
3646
+ }
3647
+
3648
+
3649
+ /***/ }),
3650
+
3651
+ /***/ "./ts/tag/update/processFirstSubjectValue.function.ts":
3652
+ /*!************************************************************!*\
3653
+ !*** ./ts/tag/update/processFirstSubjectValue.function.ts ***!
3654
+ \************************************************************/
3655
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3656
+
3657
+ __webpack_require__.r(__webpack_exports__);
3658
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3659
+ /* harmony export */ processFirstSubjectValue: () => (/* binding */ processFirstSubjectValue)
3660
+ /* harmony export */ });
3661
+ /* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
3662
+ /* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
3663
+ /* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
3664
+ /* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTag.function */ "./ts/tag/update/processTag.function.ts");
3665
+ /* harmony import */ var _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processFirstSubject.utils */ "./ts/tag/update/processFirstSubject.utils.ts");
3666
+
3667
+
3668
+
3669
+
3670
+
3671
+ function processFirstSubjectValue(value, subject, // could be tag via result.tag
3672
+ insertBefore, // <template end interpolate /> (will be removed)
3673
+ ownerSupport, // owner
3674
+ options) {
3675
+ const valueType = (0,_processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.getValueType)(value);
3676
+ switch (valueType) {
3677
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.templater:
3678
+ (0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.processTag)(value, insertBefore, ownerSupport, subject);
3679
+ return;
3680
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.tag:
3681
+ const tag = value;
3682
+ let templater = tag.templater;
3683
+ if (!templater) {
3684
+ templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.tagFakeTemplater)(tag);
3685
+ }
3686
+ (0,_processTag_function__WEBPACK_IMPORTED_MODULE_3__.processTag)(templater, insertBefore, ownerSupport, subject);
3687
+ return;
3688
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.tagArray:
3689
+ return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_1__.processTagArray)(subject, value, insertBefore, ownerSupport, options);
3690
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_4__.ValueTypes.tagComponent:
3691
+ (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore, ownerSupport, options);
3692
+ return;
3693
+ }
3694
+ (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_2__.processFirstRegularValue)(value, subject, insertBefore);
3695
+ }
3696
+
3697
+
3583
3698
  /***/ }),
3584
3699
 
3585
3700
  /***/ "./ts/tag/update/processNewValue.function.ts":
@@ -3593,35 +3708,27 @@ __webpack_require__.r(__webpack_exports__);
3593
3708
  /* harmony export */ processNewValue: () => (/* binding */ processNewValue)
3594
3709
  /* harmony export */ });
3595
3710
  /* harmony import */ var _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../subject/ValueSubject */ "./ts/subject/ValueSubject.ts");
3596
- /* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
3597
- /* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
3598
- /* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../TagSupport.class */ "./ts/tag/TagSupport.class.ts");
3711
+ /* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
3712
+ /* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../TagSupport.class */ "./ts/tag/TagSupport.class.ts");
3713
+ /* harmony import */ var _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processFirstSubject.utils */ "./ts/tag/update/processFirstSubject.utils.ts");
3599
3714
 
3600
3715
 
3601
3716
 
3602
3717
 
3603
- function processNewValue(hasValue, value, ownerSupport) {
3604
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
3605
- const tagSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
3606
- return tagSubject;
3607
- }
3608
- if (value instanceof Function) {
3609
- return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
3610
- }
3611
- if (!hasValue) {
3612
- return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(undefined);
3613
- }
3614
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagTemplater)(value)) {
3615
- const templater = value;
3616
- const tag = templater.tag;
3617
- return processNewTag(tag, ownerSupport);
3618
- }
3619
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(value)) {
3620
- return processNewTag(value, ownerSupport);
3621
- }
3622
- // is already a value subject?
3623
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isSubjectInstance)(value)) {
3624
- return value;
3718
+ function processNewValue(value, ownerSupport) {
3719
+ const valueType = (0,_processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.getValueType)(value);
3720
+ switch (valueType) {
3721
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tagComponent:
3722
+ const tagSubject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
3723
+ return tagSubject;
3724
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.templater:
3725
+ const templater = value;
3726
+ const tag = templater.tag;
3727
+ return processNewTag(tag, ownerSupport);
3728
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tag:
3729
+ return processNewTag(value, ownerSupport);
3730
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.subject:
3731
+ return value;
3625
3732
  }
3626
3733
  return new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(value);
3627
3734
  }
@@ -3629,12 +3736,12 @@ function processNewTag(value, ownerSupport) {
3629
3736
  const tag = value;
3630
3737
  let templater = tag.templater;
3631
3738
  if (!templater) {
3632
- templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_2__.TemplaterResult([]);
3739
+ templater = new _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__.TemplaterResult([]);
3633
3740
  templater.tag = tag;
3634
3741
  tag.templater = templater;
3635
3742
  }
3636
3743
  const subject = new _subject_ValueSubject__WEBPACK_IMPORTED_MODULE_0__.ValueSubject(templater);
3637
- const tagSupport = subject.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_3__.TagSupport(templater, ownerSupport, subject);
3744
+ subject.tagSupport = new _TagSupport_class__WEBPACK_IMPORTED_MODULE_2__.TagSupport(templater, ownerSupport, subject);
3638
3745
  return subject;
3639
3746
  }
3640
3747
 
@@ -3649,6 +3756,7 @@ function processNewTag(value, ownerSupport) {
3649
3756
 
3650
3757
  __webpack_require__.r(__webpack_exports__);
3651
3758
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3759
+ /* harmony export */ processFirstRegularValue: () => (/* binding */ processFirstRegularValue),
3652
3760
  /* harmony export */ processRegularValue: () => (/* binding */ processRegularValue)
3653
3761
  /* harmony export */ });
3654
3762
  /* harmony import */ var _updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../updateBeforeTemplate.function */ "./ts/updateBeforeTemplate.function.ts");
@@ -3662,10 +3770,25 @@ insertBefore) {
3662
3770
  return; // no need to update display, its the same
3663
3771
  }
3664
3772
  subject.lastValue = value;
3773
+ const castedValue = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.castTextValue)(value);
3774
+ // replace existing string?
3775
+ const oldClone = subject.clone;
3776
+ if (oldClone) {
3777
+ oldClone.textContent = castedValue;
3778
+ return;
3779
+ }
3665
3780
  // Processing of regular values
3666
- const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(value, before);
3781
+ const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(castedValue, before);
3667
3782
  subject.clone = clone; // remember single element put down, for future updates
3668
3783
  }
3784
+ function processFirstRegularValue(value, subject, // could be tag via subject.tag
3785
+ insertBefore) {
3786
+ subject.lastValue = value;
3787
+ const castedValue = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.castTextValue)(value);
3788
+ // Processing of regular values
3789
+ const clone = (0,_updateBeforeTemplate_function__WEBPACK_IMPORTED_MODULE_0__.updateBeforeTemplate)(castedValue, insertBefore);
3790
+ subject.clone = clone; // remember single element put down, for future updates
3791
+ }
3669
3792
 
3670
3793
 
3671
3794
  /***/ }),
@@ -3708,7 +3831,7 @@ function processSubjectComponent(templater, subject, insertBefore, ownerSupport,
3708
3831
  global.insertBefore = insertBefore;
3709
3832
  const providers = _state__WEBPACK_IMPORTED_MODULE_0__.setUse.memory.providerConfig;
3710
3833
  providers.ownerSupport = ownerSupport;
3711
- const isRender = !reSupport || options.forceElement;
3834
+ const isRender = !reSupport;
3712
3835
  if (isRender) {
3713
3836
  const support = reSupport || tagSupport;
3714
3837
  reSupport = (0,_render_renderSubjectComponent_function__WEBPACK_IMPORTED_MODULE_3__.renderSubjectComponent)(subject, support, ownerSupport);
@@ -3720,79 +3843,6 @@ function processSubjectComponent(templater, subject, insertBefore, ownerSupport,
3720
3843
  }
3721
3844
 
3722
3845
 
3723
- /***/ }),
3724
-
3725
- /***/ "./ts/tag/update/processSubjectValue.function.ts":
3726
- /*!*******************************************************!*\
3727
- !*** ./ts/tag/update/processSubjectValue.function.ts ***!
3728
- \*******************************************************/
3729
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3730
-
3731
- __webpack_require__.r(__webpack_exports__);
3732
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3733
- /* harmony export */ processSubjectValue: () => (/* binding */ processSubjectValue)
3734
- /* harmony export */ });
3735
- /* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
3736
- /* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
3737
- /* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
3738
- /* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
3739
- /* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processTag.function */ "./ts/tag/update/processTag.function.ts");
3740
-
3741
-
3742
-
3743
-
3744
-
3745
- var ValueTypes;
3746
- (function (ValueTypes) {
3747
- ValueTypes["tag"] = "tag";
3748
- ValueTypes["templater"] = "templater";
3749
- ValueTypes["tagArray"] = "tag-array";
3750
- ValueTypes["tagComponent"] = "tag-component";
3751
- ValueTypes["value"] = "value";
3752
- })(ValueTypes || (ValueTypes = {}));
3753
- function getValueType(value) {
3754
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagComponent)(value)) {
3755
- return ValueTypes.tagComponent;
3756
- }
3757
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagTemplater)(value)) {
3758
- return ValueTypes.templater;
3759
- }
3760
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagClass)(value)) {
3761
- return ValueTypes.tag;
3762
- }
3763
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_1__.isTagArray)(value)) {
3764
- return ValueTypes.tagArray;
3765
- }
3766
- return ValueTypes.value;
3767
- }
3768
- // export type ExistingValue = TemplaterResult | Tag[] | TagSupport | Function | Subject<unknown> | RegularValue | Tag
3769
- function processSubjectValue(value, subject, // could be tag via result.tag
3770
- insertBefore, // <template end interpolate /> (will be removed)
3771
- ownerSupport, // owner
3772
- options) {
3773
- const valueType = getValueType(value);
3774
- switch (valueType) {
3775
- case ValueTypes.templater:
3776
- (0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(value, insertBefore, ownerSupport, subject);
3777
- return;
3778
- case ValueTypes.tag:
3779
- const tag = value;
3780
- let templater = tag.templater;
3781
- if (!templater) {
3782
- templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.tagFakeTemplater)(tag);
3783
- }
3784
- (0,_processTag_function__WEBPACK_IMPORTED_MODULE_4__.processTag)(templater, insertBefore, ownerSupport, subject);
3785
- return;
3786
- case ValueTypes.tagArray:
3787
- return (0,_processTagArray__WEBPACK_IMPORTED_MODULE_2__.processTagArray)(subject, value, insertBefore, ownerSupport, options);
3788
- case ValueTypes.tagComponent:
3789
- (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_0__.processSubjectComponent)(value, subject, insertBefore, ownerSupport, options);
3790
- return;
3791
- }
3792
- (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_3__.processRegularValue)(value, subject, insertBefore);
3793
- }
3794
-
3795
-
3796
3846
  /***/ }),
3797
3847
 
3798
3848
  /***/ "./ts/tag/update/processTag.function.ts":
@@ -3826,7 +3876,6 @@ subject) {
3826
3876
  tagSupport.ownerTagSupport = ownerSupport;
3827
3877
  tagSupport.buildBeforeElement(insertBefore, {
3828
3878
  counts: { added: 0, removed: 0 },
3829
- forceElement: true,
3830
3879
  });
3831
3880
  }
3832
3881
  function setupNewTemplater(tagSupport, ownerSupport, subject) {
@@ -3935,7 +3984,6 @@ ownerSupport, options) {
3935
3984
  const details = {
3936
3985
  template: tagSupport.getTemplate().string,
3937
3986
  array: value,
3938
- ownerTagContent: ownerSupport.lastTemplateString,
3939
3987
  };
3940
3988
  const message = 'Use html`...`.key(item) instead of html`...` to template an Array';
3941
3989
  console.error(message, details);
@@ -3980,7 +4028,7 @@ function processAddTagArrayItem(before, tagSupport, index, options, lastArray) {
3980
4028
  const newTempElm = document.createElement('template');
3981
4029
  fragment.appendChild(newTempElm);
3982
4030
  tagSupport.buildBeforeElement(newTempElm, // before,
3983
- { counts, forceElement: options.forceElement });
4031
+ { counts });
3984
4032
  const parent = before.parentNode;
3985
4033
  parent.insertBefore(fragment, before);
3986
4034
  }
@@ -4012,18 +4060,17 @@ __webpack_require__.r(__webpack_exports__);
4012
4060
  /* harmony export */ });
4013
4061
  function processTagResult(tagSupport, subject, // used for recording past and current value
4014
4062
  insertBefore, // <template end interpolate />
4015
- { counts, forceElement, }) {
4063
+ { counts, }) {
4016
4064
  // *if appears we already have seen
4017
4065
  const subjectTag = subject;
4018
4066
  const lastSupport = subjectTag.tagSupport;
4019
- const prevSupport = lastSupport?.global.oldest || undefined; // || tag.tagSupport.oldest // subjectTag.tag
4020
- const justUpdate = prevSupport; // && !forceElement
4067
+ const prevSupport = lastSupport?.global.oldest || undefined;
4068
+ const justUpdate = prevSupport;
4021
4069
  if (prevSupport && justUpdate) {
4022
4070
  return processTagResultUpdate(tagSupport, subjectTag, prevSupport);
4023
4071
  }
4024
4072
  tagSupport.buildBeforeElement(insertBefore, {
4025
4073
  counts,
4026
- forceElement,
4027
4074
  });
4028
4075
  }
4029
4076
  function processTagResultUpdate(tagSupport, subject, // used for recording past and current value
@@ -4143,7 +4190,6 @@ subject, insertBefore) {
4143
4190
  const oldestSupport = lastSupport.global.oldest;
4144
4191
  (0,_destroyTag_function__WEBPACK_IMPORTED_MODULE_2__.destroyTagMemory)(oldestSupport);
4145
4192
  return (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_1__.processSubjectComponent)(templater, subject, insertBefore, ownerSupport, {
4146
- forceElement: false,
4147
4193
  counts: { added: 0, removed: 0 },
4148
4194
  });
4149
4195
  }
@@ -4192,7 +4238,6 @@ subject, insertBefore) {
4192
4238
  }
4193
4239
  function buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {
4194
4240
  newSupport.buildBeforeElement(oldInsertBefore, {
4195
- forceElement: true,
4196
4241
  counts: { added: 0, removed: 0 },
4197
4242
  });
4198
4243
  newSupport.global.oldest = newSupport;
@@ -4250,14 +4295,16 @@ __webpack_require__.r(__webpack_exports__);
4250
4295
  /* harmony import */ var _TagSupport_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../TagSupport.class */ "./ts/tag/TagSupport.class.ts");
4251
4296
  /* harmony import */ var _TemplaterResult_class__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../TemplaterResult.class */ "./ts/TemplaterResult.class.ts");
4252
4297
  /* harmony import */ var _isInstance__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../isInstance */ "./ts/isInstance.ts");
4253
- /* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
4254
- /* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/tag/update/updateExistingTagComponent.function.ts");
4255
- /* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
4256
- /* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../checkDestroyPrevious.function */ "./ts/tag/checkDestroyPrevious.function.ts");
4257
- /* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
4258
- /* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../isLikeTags.function */ "./ts/tag/isLikeTags.function.ts");
4259
- /* harmony import */ var _interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../interpolations/bindSubjectCallback.function */ "./ts/interpolations/bindSubjectCallback.function.ts");
4298
+ /* harmony import */ var _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./processFirstSubject.utils */ "./ts/tag/update/processFirstSubject.utils.ts");
4299
+ /* harmony import */ var _processTagArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processTagArray */ "./ts/tag/update/processTagArray.ts");
4300
+ /* harmony import */ var _updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./updateExistingTagComponent.function */ "./ts/tag/update/updateExistingTagComponent.function.ts");
4301
+ /* harmony import */ var _processRegularValue_function__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./processRegularValue.function */ "./ts/tag/update/processRegularValue.function.ts");
4302
+ /* harmony import */ var _checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../checkDestroyPrevious.function */ "./ts/tag/checkDestroyPrevious.function.ts");
4303
+ /* harmony import */ var _processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./processSubjectComponent.function */ "./ts/tag/update/processSubjectComponent.function.ts");
4304
+ /* harmony import */ var _isLikeTags_function__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../isLikeTags.function */ "./ts/tag/isLikeTags.function.ts");
4260
4305
  /* harmony import */ var _processTag_function__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./processTag.function */ "./ts/tag/update/processTag.function.ts");
4306
+ /* harmony import */ var _setTagPlaceholder_function__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../setTagPlaceholder.function */ "./ts/tag/setTagPlaceholder.function.ts");
4307
+
4261
4308
 
4262
4309
 
4263
4310
 
@@ -4271,10 +4318,10 @@ __webpack_require__.r(__webpack_exports__);
4271
4318
 
4272
4319
  function updateExistingValue(subject, value, ownerSupport, insertBefore) {
4273
4320
  const subjectTag = subject;
4274
- const isComponent = (0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagComponent)(value);
4275
- (0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__.checkDestroyPrevious)(subject, value, insertBefore);
4321
+ const valueType = (0,_processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.getValueType)(value);
4322
+ (0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_7__.checkDestroyPrevious)(subject, value, insertBefore);
4276
4323
  // handle already seen tag components
4277
- if (isComponent) {
4324
+ if (valueType === _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tagComponent) {
4278
4325
  return prepareUpdateToComponent(value, subjectTag, insertBefore, ownerSupport);
4279
4326
  }
4280
4327
  // was component but no longer
@@ -4283,42 +4330,40 @@ function updateExistingValue(subject, value, ownerSupport, insertBefore) {
4283
4330
  handleStillTag(subject, value, ownerSupport);
4284
4331
  return subjectTag;
4285
4332
  }
4286
- // its another tag array
4287
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagArray)(value)) {
4288
- (0,_processTagArray__WEBPACK_IMPORTED_MODULE_3__.processTagArray)(subject, value, insertBefore, // oldInsertBefore as InsertBefore,
4289
- ownerSupport, { counts: {
4290
- added: 0,
4291
- removed: 0,
4292
- } });
4293
- return subject;
4294
- }
4295
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagTemplater)(value)) {
4296
- (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(value, insertBefore, ownerSupport, subjectTag);
4297
- return subjectTag;
4298
- }
4299
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagClass)(value)) {
4300
- const tag = value;
4301
- let templater = tag.templater;
4302
- if (!templater) {
4303
- templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.getFakeTemplater)();
4304
- tag.templater = templater;
4305
- templater.tag = tag;
4306
- }
4307
- (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(templater, insertBefore, ownerSupport, subjectTag);
4308
- return subjectTag;
4309
- }
4310
- // we have been given a subject
4311
- if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isSubjectInstance)(value)) {
4312
- return value;
4313
- }
4314
- // now its a function
4315
- if (value instanceof Function) {
4316
- const bound = (0,_interpolations_bindSubjectCallback_function__WEBPACK_IMPORTED_MODULE_9__.bindSubjectCallback)(value, ownerSupport);
4317
- subject.set(bound);
4318
- return subject;
4333
+ switch (valueType) {
4334
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tagArray:
4335
+ (0,_processTagArray__WEBPACK_IMPORTED_MODULE_4__.processTagArray)(subject, value, insertBefore, // oldInsertBefore as InsertBefore,
4336
+ ownerSupport, { counts: {
4337
+ added: 0,
4338
+ removed: 0,
4339
+ } });
4340
+ return subject;
4341
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.templater:
4342
+ (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(value, insertBefore, ownerSupport, subjectTag);
4343
+ return subjectTag;
4344
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.tag:
4345
+ const tag = value;
4346
+ let templater = tag.templater;
4347
+ if (!templater) {
4348
+ templater = (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.getFakeTemplater)();
4349
+ tag.templater = templater;
4350
+ templater.tag = tag;
4351
+ }
4352
+ (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(templater, insertBefore, ownerSupport, subjectTag);
4353
+ return subjectTag;
4354
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.subject:
4355
+ return value;
4356
+ // now its a useless function (we don't automatically call functions)
4357
+ case _processFirstSubject_utils__WEBPACK_IMPORTED_MODULE_3__.ValueTypes.function:
4358
+ // const bound = bindSubjectCallback(value as Callback, ownerSupport)
4359
+ // subject.set(bound)
4360
+ if (!subject.clone) {
4361
+ subject.clone = (0,_setTagPlaceholder_function__WEBPACK_IMPORTED_MODULE_11__.swapInsertBefore)(insertBefore);
4362
+ }
4363
+ return subject;
4319
4364
  }
4320
4365
  // This will cause all other values to render
4321
- (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, insertBefore);
4366
+ (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_6__.processRegularValue)(value, subject, insertBefore);
4322
4367
  return subjectTag;
4323
4368
  }
4324
4369
  function handleStillTag(subject, value, ownerSupport) {
@@ -4338,7 +4383,7 @@ function handleStillTag(subject, value, ownerSupport) {
4338
4383
  if (isClass) {
4339
4384
  valueSupport.global = lastSupport.global;
4340
4385
  }
4341
- const isSameTag = value && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_8__.isLikeTags)(lastSupport, valueSupport);
4386
+ const isSameTag = value && (0,_isLikeTags_function__WEBPACK_IMPORTED_MODULE_9__.isLikeTags)(lastSupport, valueSupport);
4342
4387
  if ((0,_isInstance__WEBPACK_IMPORTED_MODULE_2__.isTagTemplater)(value)) {
4343
4388
  (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.setupNewTemplater)(valueSupport, ownerSupport, subject);
4344
4389
  }
@@ -4352,14 +4397,13 @@ function handleStillTag(subject, value, ownerSupport) {
4352
4397
  const insertBefore = global.insertBefore;
4353
4398
  return (0,_processTag_function__WEBPACK_IMPORTED_MODULE_10__.processTag)(templater, insertBefore, ownerSupport, subject);
4354
4399
  }
4355
- return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_5__.processRegularValue)(value, subject, subject.insertBefore);
4400
+ return (0,_processRegularValue_function__WEBPACK_IMPORTED_MODULE_6__.processRegularValue)(value, subject, subject.insertBefore);
4356
4401
  }
4357
4402
  function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupport) {
4358
4403
  // When last value was not a component
4359
4404
  if (!subjectTag.tagSupport) {
4360
- (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
4405
+ (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__.processSubjectComponent)(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
4361
4406
  ownerSupport, {
4362
- forceElement: true,
4363
4407
  counts: { added: 0, removed: 0 },
4364
4408
  });
4365
4409
  return subjectTag;
@@ -4369,28 +4413,19 @@ function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupp
4369
4413
  const prevSupport = subjectSup.global.newest;
4370
4414
  if (prevSupport) {
4371
4415
  const newestState = prevSupport.memory.state;
4372
- // tagSupport.memory.state = [...newestState]
4373
4416
  tagSupport.memory.state.length = 0;
4374
4417
  tagSupport.memory.state.push(...newestState);
4375
4418
  }
4376
4419
  else {
4377
- (0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_6__.restoreTagMarker)(subjectSup);
4378
- /*
4379
- const placeholder = subjectSup.global.placeholder
4380
- if(placeholder && !insertBefore.parentNode) {
4381
- insertAfter(insertBefore,placeholder)
4382
- delete subjectSup.global.placeholder
4383
- }
4384
- */
4385
- (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_7__.processSubjectComponent)(templater, subjectTag, insertBefore, ownerSupport, {
4386
- forceElement: true,
4420
+ (0,_checkDestroyPrevious_function__WEBPACK_IMPORTED_MODULE_7__.restoreTagMarker)(subjectSup);
4421
+ (0,_processSubjectComponent_function__WEBPACK_IMPORTED_MODULE_8__.processSubjectComponent)(templater, subjectTag, insertBefore, ownerSupport, {
4387
4422
  counts: { added: 0, removed: 0 },
4388
4423
  });
4389
4424
  return subjectTag;
4390
4425
  }
4391
4426
  tagSupport.global = subjectSup.global;
4392
4427
  subjectTag.tagSupport = tagSupport;
4393
- (0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_4__.updateExistingTagComponent)(ownerSupport, tagSupport, // latest value
4428
+ (0,_updateExistingTagComponent_function__WEBPACK_IMPORTED_MODULE_5__.updateExistingTagComponent)(ownerSupport, tagSupport, // latest value
4394
4429
  subjectTag, insertBefore);
4395
4430
  return subjectTag;
4396
4431
  }
@@ -4406,23 +4441,27 @@ function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupp
4406
4441
 
4407
4442
  __webpack_require__.r(__webpack_exports__);
4408
4443
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4444
+ /* harmony export */ castTextValue: () => (/* binding */ castTextValue),
4409
4445
  /* harmony export */ updateBeforeTemplate: () => (/* binding */ updateBeforeTemplate)
4410
4446
  /* harmony export */ });
4411
4447
  // Function to update the value of x
4412
- function updateBeforeTemplate(value, lastFirstChild) {
4448
+ function updateBeforeTemplate(value, // value should be casted before calling here
4449
+ lastFirstChild) {
4413
4450
  const parent = lastFirstChild.parentNode;
4414
- let castedValue = value;
4415
- // mimic React skipping to display EXCEPT for true does display on page
4416
- if ([undefined, false, null].includes(value)) { // || value === true
4417
- castedValue = '';
4418
- }
4419
4451
  // Insert the new value (never use innerHTML here)
4420
- const textNode = document.createTextNode(castedValue); // never innerHTML
4452
+ const textNode = document.createTextNode(value); // never innerHTML
4421
4453
  parent.insertBefore(textNode, lastFirstChild);
4422
4454
  /* remove existing nodes */
4423
4455
  parent.removeChild(lastFirstChild);
4424
4456
  return textNode;
4425
4457
  }
4458
+ function castTextValue(value) {
4459
+ // mimic React skipping to display EXCEPT for true does display on page
4460
+ if ([undefined, false, null].includes(value)) { // || value === true
4461
+ return '';
4462
+ }
4463
+ return value;
4464
+ }
4426
4465
 
4427
4466
 
4428
4467
  /***/ })