native-document 1.0.112 → 1.0.113-clear

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.
@@ -2524,7 +2524,7 @@ var NativeComponents = (function (exports) {
2524
2524
  * @param {HTMLElement} element
2525
2525
  * @param {Object} data
2526
2526
  */
2527
- function bindClassAttribute(element, data) {
2527
+ const bindClassAttribute = (element, data) => {
2528
2528
  for(const className in data) {
2529
2529
  const value = data[className];
2530
2530
  if(value.__$isObservable) {
@@ -2544,14 +2544,14 @@ var NativeComponents = (function (exports) {
2544
2544
  element.classes.toggle(className, value);
2545
2545
  }
2546
2546
  data = null;
2547
- }
2547
+ };
2548
2548
 
2549
2549
  /**
2550
2550
  *
2551
2551
  * @param {HTMLElement} element
2552
2552
  * @param {Object} data
2553
2553
  */
2554
- function bindStyleAttribute(element, data) {
2554
+ const bindStyleAttribute = (element, data) => {
2555
2555
  for(const styleName in data) {
2556
2556
  const value = data[styleName];
2557
2557
  if(value.__$isObservable) {
@@ -2561,7 +2561,7 @@ var NativeComponents = (function (exports) {
2561
2561
  }
2562
2562
  element.style[styleName] = value;
2563
2563
  }
2564
- }
2564
+ };
2565
2565
 
2566
2566
  /**
2567
2567
  *
@@ -2569,7 +2569,7 @@ var NativeComponents = (function (exports) {
2569
2569
  * @param {string} attributeName
2570
2570
  * @param {boolean|number|Observable} value
2571
2571
  */
2572
- function bindBooleanAttribute(element, attributeName, value) {
2572
+ const bindBooleanAttribute = (element, attributeName, value) => {
2573
2573
  const isObservable = value.__$isObservable;
2574
2574
  const defaultValue = isObservable? value.val() : value;
2575
2575
  if(Validator.isBoolean(defaultValue)) {
@@ -2591,7 +2591,7 @@ var NativeComponents = (function (exports) {
2591
2591
  }
2592
2592
  value.subscribe((newValue) => element[attributeName] = (newValue === element.value));
2593
2593
  }
2594
- }
2594
+ };
2595
2595
 
2596
2596
 
2597
2597
  /**
@@ -2600,7 +2600,7 @@ var NativeComponents = (function (exports) {
2600
2600
  * @param {string} attributeName
2601
2601
  * @param {Observable} value
2602
2602
  */
2603
- function bindAttributeWithObservable(element, attributeName, value) {
2603
+ const bindAttributeWithObservable = (element, attributeName, value) => {
2604
2604
  const applyValue = attributeName === 'value' ? (newValue) => element.value = newValue : (newValue) => element.setAttribute(attributeName, newValue);
2605
2605
  value.subscribe(applyValue);
2606
2606
 
@@ -2610,14 +2610,14 @@ var NativeComponents = (function (exports) {
2610
2610
  return;
2611
2611
  }
2612
2612
  element.setAttribute(attributeName, value.val());
2613
- }
2613
+ };
2614
2614
 
2615
2615
  /**
2616
2616
  *
2617
2617
  * @param {HTMLElement} element
2618
2618
  * @param {Object} attributes
2619
2619
  */
2620
- function AttributesWrapper(element, attributes) {
2620
+ const AttributesWrapper = (element, attributes) => {
2621
2621
 
2622
2622
  for(const originalAttributeName in attributes) {
2623
2623
  const attributeName = originalAttributeName.toLowerCase();
@@ -2647,7 +2647,7 @@ var NativeComponents = (function (exports) {
2647
2647
  element.setAttribute(attributeName, value);
2648
2648
  }
2649
2649
  return element;
2650
- }
2650
+ };
2651
2651
 
2652
2652
  String.prototype.toNdElement = function () {
2653
2653
  return ElementCreator.createStaticTextNode(null, this);
@@ -2800,6 +2800,7 @@ var NativeComponents = (function (exports) {
2800
2800
  createTextNode() {
2801
2801
  if(!$textNodeCache) {
2802
2802
  $textNodeCache = document.createTextNode('');
2803
+ ElementCreator.createTextNode = () => $textNodeCache.cloneNode();
2803
2804
  }
2804
2805
  return $textNodeCache.cloneNode();
2805
2806
  },
@@ -2809,7 +2810,7 @@ var NativeComponents = (function (exports) {
2809
2810
  * @param {ObservableItem} observable
2810
2811
  * @returns {Text}
2811
2812
  */
2812
- createObservableNode(parent, observable) {
2813
+ createObservableNode: (parent, observable) => {
2813
2814
  const text = ElementCreator.createTextNode();
2814
2815
  observable.subscribe(value => text.nodeValue = value);
2815
2816
  text.nodeValue = observable.val();
@@ -2845,7 +2846,7 @@ var NativeComponents = (function (exports) {
2845
2846
  * @param {string} name
2846
2847
  * @returns {HTMLElement|DocumentFragment}
2847
2848
  */
2848
- createElement(name) {
2849
+ createElement: (name) => {
2849
2850
  if(name) {
2850
2851
  const cacheNode = $nodeCache.get(name);
2851
2852
  if(cacheNode) {
@@ -2857,7 +2858,7 @@ var NativeComponents = (function (exports) {
2857
2858
  }
2858
2859
  return Anchor('Fragment');
2859
2860
  },
2860
- bindTextNode(textNode, value) {
2861
+ bindTextNode: (textNode, value) => {
2861
2862
  if(value?.__$isObservable) {
2862
2863
  value.subscribe(newValue => textNode.nodeValue = newValue);
2863
2864
  textNode.nodeValue = value.val();
@@ -2881,7 +2882,7 @@ var NativeComponents = (function (exports) {
2881
2882
  await element.remove();
2882
2883
 
2883
2884
  },
2884
- getChild(child) {
2885
+ getChild: (child) => {
2885
2886
  if(child == null) {
2886
2887
  return null;
2887
2888
  }
@@ -2901,7 +2902,7 @@ var NativeComponents = (function (exports) {
2901
2902
  * @param {HTMLElement} element
2902
2903
  * @param {Object} attributes
2903
2904
  */
2904
- processAttributes(element, attributes) {
2905
+ processAttributes: (element, attributes) => {
2905
2906
  if (attributes) {
2906
2907
  AttributesWrapper(element, attributes);
2907
2908
  }
@@ -2357,7 +2357,7 @@ var NativeDocument = (function (exports) {
2357
2357
  * @param {HTMLElement} element
2358
2358
  * @param {Object} data
2359
2359
  */
2360
- function bindClassAttribute(element, data) {
2360
+ const bindClassAttribute = (element, data) => {
2361
2361
  for(const className in data) {
2362
2362
  const value = data[className];
2363
2363
  if(value.__$isObservable) {
@@ -2377,14 +2377,14 @@ var NativeDocument = (function (exports) {
2377
2377
  element.classes.toggle(className, value);
2378
2378
  }
2379
2379
  data = null;
2380
- }
2380
+ };
2381
2381
 
2382
2382
  /**
2383
2383
  *
2384
2384
  * @param {HTMLElement} element
2385
2385
  * @param {Object} data
2386
2386
  */
2387
- function bindStyleAttribute(element, data) {
2387
+ const bindStyleAttribute = (element, data) => {
2388
2388
  for(const styleName in data) {
2389
2389
  const value = data[styleName];
2390
2390
  if(value.__$isObservable) {
@@ -2394,7 +2394,7 @@ var NativeDocument = (function (exports) {
2394
2394
  }
2395
2395
  element.style[styleName] = value;
2396
2396
  }
2397
- }
2397
+ };
2398
2398
 
2399
2399
  /**
2400
2400
  *
@@ -2402,7 +2402,7 @@ var NativeDocument = (function (exports) {
2402
2402
  * @param {string} attributeName
2403
2403
  * @param {boolean|number|Observable} value
2404
2404
  */
2405
- function bindBooleanAttribute(element, attributeName, value) {
2405
+ const bindBooleanAttribute = (element, attributeName, value) => {
2406
2406
  const isObservable = value.__$isObservable;
2407
2407
  const defaultValue = isObservable? value.val() : value;
2408
2408
  if(Validator.isBoolean(defaultValue)) {
@@ -2424,7 +2424,7 @@ var NativeDocument = (function (exports) {
2424
2424
  }
2425
2425
  value.subscribe((newValue) => element[attributeName] = (newValue === element.value));
2426
2426
  }
2427
- }
2427
+ };
2428
2428
 
2429
2429
 
2430
2430
  /**
@@ -2433,7 +2433,7 @@ var NativeDocument = (function (exports) {
2433
2433
  * @param {string} attributeName
2434
2434
  * @param {Observable} value
2435
2435
  */
2436
- function bindAttributeWithObservable(element, attributeName, value) {
2436
+ const bindAttributeWithObservable = (element, attributeName, value) => {
2437
2437
  const applyValue = attributeName === 'value' ? (newValue) => element.value = newValue : (newValue) => element.setAttribute(attributeName, newValue);
2438
2438
  value.subscribe(applyValue);
2439
2439
 
@@ -2443,14 +2443,14 @@ var NativeDocument = (function (exports) {
2443
2443
  return;
2444
2444
  }
2445
2445
  element.setAttribute(attributeName, value.val());
2446
- }
2446
+ };
2447
2447
 
2448
2448
  /**
2449
2449
  *
2450
2450
  * @param {HTMLElement} element
2451
2451
  * @param {Object} attributes
2452
2452
  */
2453
- function AttributesWrapper(element, attributes) {
2453
+ const AttributesWrapper = (element, attributes) => {
2454
2454
 
2455
2455
  {
2456
2456
  Validator.validateAttributes(attributes);
@@ -2484,7 +2484,7 @@ var NativeDocument = (function (exports) {
2484
2484
  element.setAttribute(attributeName, value);
2485
2485
  }
2486
2486
  return element;
2487
- }
2487
+ };
2488
2488
 
2489
2489
  function TemplateBinding(hydrate) {
2490
2490
  this.$hydrate = hydrate;
@@ -2654,6 +2654,7 @@ var NativeDocument = (function (exports) {
2654
2654
  createTextNode() {
2655
2655
  if(!$textNodeCache) {
2656
2656
  $textNodeCache = document.createTextNode('');
2657
+ ElementCreator.createTextNode = () => $textNodeCache.cloneNode();
2657
2658
  }
2658
2659
  return $textNodeCache.cloneNode();
2659
2660
  },
@@ -2663,7 +2664,7 @@ var NativeDocument = (function (exports) {
2663
2664
  * @param {ObservableItem} observable
2664
2665
  * @returns {Text}
2665
2666
  */
2666
- createObservableNode(parent, observable) {
2667
+ createObservableNode: (parent, observable) => {
2667
2668
  const text = ElementCreator.createTextNode();
2668
2669
  observable.subscribe(value => text.nodeValue = value);
2669
2670
  text.nodeValue = observable.val();
@@ -2699,7 +2700,7 @@ var NativeDocument = (function (exports) {
2699
2700
  * @param {string} name
2700
2701
  * @returns {HTMLElement|DocumentFragment}
2701
2702
  */
2702
- createElement(name) {
2703
+ createElement: (name) => {
2703
2704
  if(name) {
2704
2705
  const cacheNode = $nodeCache.get(name);
2705
2706
  if(cacheNode) {
@@ -2711,7 +2712,7 @@ var NativeDocument = (function (exports) {
2711
2712
  }
2712
2713
  return Anchor('Fragment');
2713
2714
  },
2714
- bindTextNode(textNode, value) {
2715
+ bindTextNode: (textNode, value) => {
2715
2716
  if(value?.__$isObservable) {
2716
2717
  value.subscribe(newValue => textNode.nodeValue = newValue);
2717
2718
  textNode.nodeValue = value.val();
@@ -2741,7 +2742,7 @@ var NativeDocument = (function (exports) {
2741
2742
  await element.remove();
2742
2743
 
2743
2744
  },
2744
- getChild(child) {
2745
+ getChild: (child) => {
2745
2746
  if(child == null) {
2746
2747
  return null;
2747
2748
  }
@@ -2761,7 +2762,7 @@ var NativeDocument = (function (exports) {
2761
2762
  * @param {HTMLElement} element
2762
2763
  * @param {Object} attributes
2763
2764
  */
2764
- processAttributes(element, attributes) {
2765
+ processAttributes: (element, attributes) => {
2765
2766
  if (attributes) {
2766
2767
  AttributesWrapper(element, attributes);
2767
2768
  }
@@ -3567,7 +3568,7 @@ var NativeDocument = (function (exports) {
3567
3568
  }
3568
3569
 
3569
3570
 
3570
- function createTemplateCloner($binder) {
3571
+ const createTemplateCloner = ($binder) => {
3571
3572
  return new Proxy($binder, {
3572
3573
  get(target, prop) {
3573
3574
  if(prop in target) {
@@ -3577,7 +3578,7 @@ var NativeDocument = (function (exports) {
3577
3578
  return target.value(prop);
3578
3579
  }
3579
3580
  });
3580
- }
3581
+ };
3581
3582
 
3582
3583
  function useCache(fn) {
3583
3584
  let $cache = null;
@@ -5116,7 +5117,7 @@ var NativeDocument = (function (exports) {
5116
5117
  }
5117
5118
  };
5118
5119
 
5119
- const removeByItem = function(item, fragment) {
5120
+ const removeByItem = (item, fragment) => {
5120
5121
  const cacheItem = cache.get(item);
5121
5122
  if(!cacheItem) {
5122
5123
  return null;