native-document 1.0.111 → 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.
@@ -1,10 +1,10 @@
1
1
  var NativeDocument = (function (exports) {
2
2
  'use strict';
3
3
 
4
- let DebugManager = {};
4
+ let DebugManager$1 = {};
5
5
 
6
6
  {
7
- DebugManager = {
7
+ DebugManager$1 = {
8
8
  enabled: false,
9
9
 
10
10
  enable() {
@@ -35,7 +35,7 @@ var NativeDocument = (function (exports) {
35
35
  };
36
36
 
37
37
  }
38
- var DebugManager$1 = DebugManager;
38
+ var DebugManager = DebugManager$1;
39
39
 
40
40
  class NativeDocumentError extends Error {
41
41
  constructor(message, context = {}) {
@@ -313,10 +313,10 @@ var NativeDocument = (function (exports) {
313
313
  subtree: true,
314
314
  });
315
315
 
316
- let PluginsManager = null;
316
+ let PluginsManager$1 = null;
317
317
 
318
318
  {
319
- PluginsManager = (function() {
319
+ PluginsManager$1 = (function() {
320
320
 
321
321
  const $plugins = new Map();
322
322
  const $pluginByEvents = new Map();
@@ -382,7 +382,7 @@ var NativeDocument = (function (exports) {
382
382
  try{
383
383
  callback.call(plugin, ...data);
384
384
  } catch (error) {
385
- DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
385
+ DebugManager.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
386
386
  }
387
387
  }
388
388
  }
@@ -391,12 +391,12 @@ var NativeDocument = (function (exports) {
391
391
  }());
392
392
  }
393
393
 
394
- var PluginsManager$1 = PluginsManager;
394
+ var PluginsManager = PluginsManager$1;
395
395
 
396
396
  function NDElement(element) {
397
397
  this.$element = element;
398
398
  {
399
- PluginsManager$1.emit('NDElementCreated', element, this);
399
+ PluginsManager.emit('NDElementCreated', element, this);
400
400
  }
401
401
  }
402
402
 
@@ -576,7 +576,7 @@ var NativeDocument = (function (exports) {
576
576
  }
577
577
  {
578
578
  if (this[name] && !this.$localExtensions.has(name)) {
579
- DebugManager$1.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
579
+ DebugManager.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
580
580
  }
581
581
  this.$localExtensions.set(name, method);
582
582
  }
@@ -627,23 +627,23 @@ var NativeDocument = (function (exports) {
627
627
  const method = methods[name];
628
628
 
629
629
  if (typeof method !== 'function') {
630
- DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
630
+ DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
631
631
  continue;
632
632
  }
633
633
 
634
634
  if (protectedMethods.has(name)) {
635
- DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
635
+ DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
636
636
  throw new NativeDocumentError(`Cannot override protected method "${name}"`);
637
637
  }
638
638
 
639
639
  if (NDElement.prototype[name]) {
640
- DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
640
+ DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
641
641
  }
642
642
 
643
643
  NDElement.prototype[name] = method;
644
644
  }
645
645
  {
646
- PluginsManager$1.emit('NDElementExtended', methods);
646
+ PluginsManager.emit('NDElementExtended', methods);
647
647
  }
648
648
 
649
649
  return NDElement;
@@ -794,7 +794,7 @@ var NativeDocument = (function (exports) {
794
794
  const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
795
795
 
796
796
  if (foundReserved.length > 0) {
797
- DebugManager$1.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
797
+ DebugManager.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
798
798
  }
799
799
 
800
800
  return attributes;
@@ -845,7 +845,7 @@ var NativeDocument = (function (exports) {
845
845
  anchorFragment.appendChild = function(child, before = null) {
846
846
  const parent = anchorEnd.parentNode;
847
847
  if(!parent) {
848
- DebugManager$1.error('Anchor', 'Anchor : parent not found', child);
848
+ DebugManager.error('Anchor', 'Anchor : parent not found', child);
849
849
  return;
850
850
  }
851
851
  before = before ?? anchorEnd;
@@ -1039,7 +1039,7 @@ var NativeDocument = (function (exports) {
1039
1039
  }
1040
1040
  }
1041
1041
  if (cleanedCount > 0) {
1042
- DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
1042
+ DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
1043
1043
  }
1044
1044
  }
1045
1045
  };
@@ -1241,7 +1241,7 @@ var NativeDocument = (function (exports) {
1241
1241
  const $getStoreOrThrow = (method, name) => {
1242
1242
  const item = $stores.get(name);
1243
1243
  if (!item) {
1244
- DebugManager$1.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
1244
+ DebugManager.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
1245
1245
  throw new NativeDocumentError(
1246
1246
  `Store.${method}('${name}') : store not found.`
1247
1247
  );
@@ -1254,7 +1254,7 @@ var NativeDocument = (function (exports) {
1254
1254
  */
1255
1255
  const $applyReadOnly = (observer, name, context) => {
1256
1256
  const readOnlyError = (method) => () => {
1257
- DebugManager$1.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
1257
+ DebugManager.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
1258
1258
  throw new NativeDocumentError(
1259
1259
  `Store.${context}('${name}') is read-only.`
1260
1260
  );
@@ -1285,7 +1285,7 @@ var NativeDocument = (function (exports) {
1285
1285
  */
1286
1286
  create(name, value) {
1287
1287
  if ($stores.has(name)) {
1288
- DebugManager$1.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
1288
+ DebugManager.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
1289
1289
  throw new NativeDocumentError(
1290
1290
  `Store.create('${name}') : a store with this name already exists.`
1291
1291
  );
@@ -1306,7 +1306,7 @@ var NativeDocument = (function (exports) {
1306
1306
  */
1307
1307
  createResettable(name, value) {
1308
1308
  if ($stores.has(name)) {
1309
- DebugManager$1.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
1309
+ DebugManager.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
1310
1310
  throw new NativeDocumentError(
1311
1311
  `Store.createResettable('${name}') : a store with this name already exists.`
1312
1312
  );
@@ -1342,7 +1342,7 @@ var NativeDocument = (function (exports) {
1342
1342
  */
1343
1343
  createComposed(name, computation, dependencies) {
1344
1344
  if ($stores.has(name)) {
1345
- DebugManager$1.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
1345
+ DebugManager.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
1346
1346
  throw new NativeDocumentError(
1347
1347
  `Store.createComposed('${name}') : a store with this name already exists.`
1348
1348
  );
@@ -1365,7 +1365,7 @@ var NativeDocument = (function (exports) {
1365
1365
  }
1366
1366
  const depItem = $stores.get(depName);
1367
1367
  if (!depItem) {
1368
- DebugManager$1.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
1368
+ DebugManager.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
1369
1369
  throw new NativeDocumentError(
1370
1370
  `Store.createComposed('${name}') : dependency store '${depName}' not found.`
1371
1371
  );
@@ -1399,13 +1399,13 @@ var NativeDocument = (function (exports) {
1399
1399
  reset(name) {
1400
1400
  const item = $getStoreOrThrow('reset', name);
1401
1401
  if (item.composed) {
1402
- DebugManager$1.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
1402
+ DebugManager.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
1403
1403
  throw new NativeDocumentError(
1404
1404
  `Store.reset('${name}') : composed stores cannot be reset.`
1405
1405
  );
1406
1406
  }
1407
1407
  if (!item.resettable) {
1408
- DebugManager$1.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
1408
+ DebugManager.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
1409
1409
  throw new NativeDocumentError(
1410
1410
  `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
1411
1411
  );
@@ -1426,7 +1426,7 @@ var NativeDocument = (function (exports) {
1426
1426
  const item = $getStoreOrThrow('use', name);
1427
1427
 
1428
1428
  if (item.composed) {
1429
- DebugManager$1.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
1429
+ DebugManager.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
1430
1430
  throw new NativeDocumentError(
1431
1431
  `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
1432
1432
  );
@@ -1493,7 +1493,7 @@ var NativeDocument = (function (exports) {
1493
1493
  get(name) {
1494
1494
  const item = $stores.get(name);
1495
1495
  if (!item) {
1496
- DebugManager$1.warn('Store', `Store.get('${name}') : store not found.`);
1496
+ DebugManager.warn('Store', `Store.get('${name}') : store not found.`);
1497
1497
  return null;
1498
1498
  }
1499
1499
  return item.observer;
@@ -1515,7 +1515,7 @@ var NativeDocument = (function (exports) {
1515
1515
  delete(name) {
1516
1516
  const item = $stores.get(name);
1517
1517
  if (!item) {
1518
- DebugManager$1.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
1518
+ DebugManager.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
1519
1519
  return;
1520
1520
  }
1521
1521
  item.subscribers.forEach(follower => follower.destroy());
@@ -1617,7 +1617,7 @@ var NativeDocument = (function (exports) {
1617
1617
  return undefined;
1618
1618
  },
1619
1619
  set(target, prop, value) {
1620
- DebugManager$1.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
1620
+ DebugManager.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
1621
1621
  throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
1622
1622
  },
1623
1623
  deleteProperty(target, prop) {
@@ -1749,7 +1749,7 @@ var NativeDocument = (function (exports) {
1749
1749
  }
1750
1750
  }
1751
1751
  {
1752
- PluginsManager$1.emit('CreateObservable', this);
1752
+ PluginsManager.emit('CreateObservable', this);
1753
1753
  }
1754
1754
  }
1755
1755
 
@@ -1853,12 +1853,12 @@ var NativeDocument = (function (exports) {
1853
1853
  this.$previousValue = this.$currentValue;
1854
1854
  this.$currentValue = newValue;
1855
1855
  {
1856
- PluginsManager$1.emit('ObservableBeforeChange', this);
1856
+ PluginsManager.emit('ObservableBeforeChange', this);
1857
1857
  }
1858
1858
  this.trigger();
1859
1859
  this.$previousValue = null;
1860
1860
  {
1861
- PluginsManager$1.emit('ObservableAfterChange', this);
1861
+ PluginsManager.emit('ObservableAfterChange', this);
1862
1862
  }
1863
1863
  };
1864
1864
 
@@ -1936,7 +1936,7 @@ var NativeDocument = (function (exports) {
1936
1936
  ObservableItem.prototype.subscribe = function(callback) {
1937
1937
  {
1938
1938
  if (this.$isCleanedUp) {
1939
- DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
1939
+ DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
1940
1940
  return;
1941
1941
  }
1942
1942
  if (typeof callback !== 'function') {
@@ -1948,7 +1948,7 @@ var NativeDocument = (function (exports) {
1948
1948
  this.$listeners.push(callback);
1949
1949
  this.assocTrigger();
1950
1950
  {
1951
- PluginsManager$1.emit('ObservableSubscribe', this);
1951
+ PluginsManager.emit('ObservableSubscribe', this);
1952
1952
  }
1953
1953
  };
1954
1954
 
@@ -2059,7 +2059,7 @@ var NativeDocument = (function (exports) {
2059
2059
  }
2060
2060
  this.assocTrigger();
2061
2061
  {
2062
- PluginsManager$1.emit('ObservableUnsubscribe', this);
2062
+ PluginsManager.emit('ObservableUnsubscribe', this);
2063
2063
  }
2064
2064
  };
2065
2065
 
@@ -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;
@@ -2535,7 +2535,7 @@ var NativeDocument = (function (exports) {
2535
2535
  Function.prototype.toNdElement = function () {
2536
2536
  const child = this;
2537
2537
  {
2538
- PluginsManager$1.emit('BeforeProcessComponent', child);
2538
+ PluginsManager.emit('BeforeProcessComponent', child);
2539
2539
  }
2540
2540
  return ElementCreator.getChild(child());
2541
2541
  };
@@ -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();
@@ -2727,21 +2728,21 @@ var NativeDocument = (function (exports) {
2727
2728
  processChildren(children, parent) {
2728
2729
  if(children === null) return;
2729
2730
  {
2730
- PluginsManager$1.emit('BeforeProcessChildren', parent);
2731
+ PluginsManager.emit('BeforeProcessChildren', parent);
2731
2732
  }
2732
2733
  let child = this.getChild(children);
2733
2734
  if(child) {
2734
2735
  parent.appendChild(child);
2735
2736
  }
2736
2737
  {
2737
- PluginsManager$1.emit('AfterProcessChildren', parent);
2738
+ PluginsManager.emit('AfterProcessChildren', parent);
2738
2739
  }
2739
2740
  },
2740
2741
  async safeRemove(element) {
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
  }
@@ -3217,22 +3218,15 @@ var NativeDocument = (function (exports) {
3217
3218
  return createHtmlElement.bind(null, name, customWrapper);
3218
3219
  }
3219
3220
 
3220
- const OPERATIONS = {
3221
- HYDRATE_TEXT: 1,
3222
- ATTACH_METHOD: 2,
3223
- HYDRATE_ATTRIBUTES: 3,
3224
- HYDRATE_FULL: 4,
3225
- };
3226
-
3227
-
3221
+ const cloneBindingsDataCache = new WeakMap();
3228
3222
 
3229
3223
  const pathProcess = (target, path, data) => {
3230
- if(path.operation === OPERATIONS.HYDRATE_TEXT) {
3224
+ if(path.HYDRATE_TEXT) {
3231
3225
  const value = path.value;
3232
3226
  ElementCreator.bindTextNode(target, path.isString ? data[0][value] : value.apply(null, data));
3233
3227
  return;
3234
3228
  }
3235
- if(path.operation === OPERATIONS.ATTACH_METHOD || path.operation === OPERATIONS.HYDRATE_FULL) {
3229
+ if(path.ATTACH_METHOD) {
3236
3230
  const bindingData = path.bindingData;
3237
3231
  for(let i = 0, length = bindingData._attachLength; i < length; i++) {
3238
3232
  const method = bindingData.attach[i];
@@ -3241,7 +3235,7 @@ var NativeDocument = (function (exports) {
3241
3235
  });
3242
3236
  }
3243
3237
  }
3244
- if(path.operation === OPERATIONS.HYDRATE_ATTRIBUTES || path.operation === OPERATIONS.HYDRATE_FULL) {
3238
+ if(path.HYDRATE_ATTRIBUTES) {
3245
3239
  path.hydrator(target, path.bindingData, data);
3246
3240
  }
3247
3241
  };
@@ -3343,7 +3337,23 @@ var NativeDocument = (function (exports) {
3343
3337
  target = $applyBindingParents[path.parentId].childNodes[path.index];
3344
3338
  $applyBindingParents[path.id] = target;
3345
3339
 
3346
- pathProcess(target, path, data);
3340
+ if(path.HYDRATE_TEXT) {
3341
+ const value = path.value;
3342
+ ElementCreator.bindTextNode(target, path.isString ? data[0][value] : value.apply(null, data));
3343
+ continue;
3344
+ }
3345
+ if(path.ATTACH_METHOD) {
3346
+ const bindingData = path.bindingData;
3347
+ for(let i = 0, length = bindingData._attachLength; i < length; i++) {
3348
+ const method = bindingData.attach[i];
3349
+ target.nd[method.methodName](function() {
3350
+ method.fn.call(this, ...data, ...arguments);
3351
+ });
3352
+ }
3353
+ }
3354
+ if(path.HYDRATE_ATTRIBUTES) {
3355
+ path.hydrator(target, path.bindingData, data);
3356
+ }
3347
3357
  }
3348
3358
 
3349
3359
  for (let i = 0; i <= pathSize; i++) {
@@ -3436,8 +3446,6 @@ var NativeDocument = (function (exports) {
3436
3446
  return hydrateStyleAttribute;
3437
3447
  };
3438
3448
 
3439
- const cloneBindingsDataCache$1 = new WeakMap();
3440
-
3441
3449
  function TemplateCloner($fn) {
3442
3450
  let $node = null;
3443
3451
  let $hasBindingData = false;
@@ -3452,7 +3460,7 @@ var NativeDocument = (function (exports) {
3452
3460
 
3453
3461
  let pathCounter = 0;
3454
3462
  const clone = (node, data, currentPath) => {
3455
- const bindDingData = cloneBindingsDataCache$1.get(node);
3463
+ const bindDingData = cloneBindingsDataCache.get(node);
3456
3464
  if(bindDingData) {
3457
3465
  optimizeBindingData(bindDingData);
3458
3466
  }
@@ -3461,7 +3469,8 @@ var NativeDocument = (function (exports) {
3461
3469
  const value = bindDingData.value;
3462
3470
  const textNode = node.cloneNode();
3463
3471
  currentPath.value = value;
3464
- currentPath.operation = OPERATIONS.HYDRATE_TEXT;
3472
+ currentPath.HYDRATE_TEXT = true;
3473
+ currentPath.operation = true;
3465
3474
  currentPath.isString = (typeof value === 'string');
3466
3475
  ElementCreator.bindTextNode(textNode, (currentPath.isString ? data[0][value] : value.apply(null, data)));
3467
3476
  return textNode;
@@ -3480,14 +3489,13 @@ var NativeDocument = (function (exports) {
3480
3489
  currentPath.bindingData = bindDingData;
3481
3490
  currentPath.hydrator = hydrator;
3482
3491
 
3483
- if(hasAttributes && hasAttachMethods) {
3484
- currentPath.operation = OPERATIONS.HYDRATE_FULL;
3485
- }
3486
- else if(hasAttributes) {
3487
- currentPath.operation = OPERATIONS.HYDRATE_ATTRIBUTES;
3492
+ if(hasAttributes) {
3493
+ currentPath.HYDRATE_ATTRIBUTES = true;
3494
+ currentPath.operation = true;
3488
3495
  }
3489
- else if(hasAttachMethods) {
3490
- currentPath.operation = OPERATIONS.ATTACH_METHOD;
3496
+ if(hasAttachMethods) {
3497
+ currentPath.ATTACH_METHOD = true;
3498
+ currentPath.operation = true;
3491
3499
  }
3492
3500
  }
3493
3501
  const childNodes = node.childNodes;
@@ -3557,11 +3565,10 @@ var NativeDocument = (function (exports) {
3557
3565
  return createBinding(fn, 'attach');
3558
3566
  };
3559
3567
  this.callback = this.attach;
3560
-
3561
3568
  }
3562
3569
 
3563
3570
 
3564
- function createTemplateCloner($binder) {
3571
+ const createTemplateCloner = ($binder) => {
3565
3572
  return new Proxy($binder, {
3566
3573
  get(target, prop) {
3567
3574
  if(prop in target) {
@@ -3571,26 +3578,26 @@ var NativeDocument = (function (exports) {
3571
3578
  return target.value(prop);
3572
3579
  }
3573
3580
  });
3574
- }
3581
+ };
3575
3582
 
3576
3583
  function useCache(fn) {
3577
3584
  let $cache = null;
3578
3585
 
3579
- let wrapper = function(args) {
3586
+ let wrapper = (args) => {
3580
3587
  $cache = new TemplateCloner(fn);
3581
3588
 
3582
- wrapper = function(args) {
3589
+ wrapper = (args) => {
3583
3590
  return $cache.clone(args);
3584
3591
  };
3585
3592
  return $cache.clone(args);
3586
3593
  };
3587
3594
 
3588
3595
  if(fn.length < 2) {
3589
- return function(...args) {
3596
+ return (...args) => {
3590
3597
  return wrapper(args);
3591
3598
  };
3592
3599
  }
3593
- return function(_, __, ...args) {
3600
+ return (_, __, ...args) => {
3594
3601
  return wrapper([_, __, ...args]);
3595
3602
  };
3596
3603
  }
@@ -4172,7 +4179,7 @@ var NativeDocument = (function (exports) {
4172
4179
 
4173
4180
  ObservableItem.call(this, target, configs);
4174
4181
  {
4175
- PluginsManager$1.emit('CreateObservableArray', this);
4182
+ PluginsManager.emit('CreateObservableArray', this);
4176
4183
  }
4177
4184
  };
4178
4185
 
@@ -4804,7 +4811,7 @@ var NativeDocument = (function (exports) {
4804
4811
  const observable = new ObservableItem(initialValue);
4805
4812
  const updatedValue = nextTick(() => observable.set(callback()));
4806
4813
  {
4807
- PluginsManager$1.emit('CreateObservableComputed', observable, dependencies);
4814
+ PluginsManager.emit('CreateObservableComputed', observable, dependencies);
4808
4815
  }
4809
4816
 
4810
4817
  if(Validator.isFunction(dependencies)) {
@@ -4903,7 +4910,7 @@ var NativeDocument = (function (exports) {
4903
4910
  }
4904
4911
  cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
4905
4912
  } catch (e) {
4906
- DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
4913
+ DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
4907
4914
  throw e;
4908
4915
  }
4909
4916
  return keyId;
@@ -5110,7 +5117,7 @@ var NativeDocument = (function (exports) {
5110
5117
  }
5111
5118
  };
5112
5119
 
5113
- const removeByItem = function(item, fragment) {
5120
+ const removeByItem = (item, fragment) => {
5114
5121
  const cacheItem = cache.get(item);
5115
5122
  if(!cacheItem) {
5116
5123
  return null;
@@ -5293,7 +5300,7 @@ var NativeDocument = (function (exports) {
5293
5300
  */
5294
5301
  const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
5295
5302
  if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
5296
- return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
5303
+ return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
5297
5304
  }
5298
5305
  const element = Anchor('Show if : '+(comment || ''));
5299
5306
 
@@ -6712,7 +6719,7 @@ var NativeDocument = (function (exports) {
6712
6719
  window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
6713
6720
  this.handleRouteChange(route, params, query, path);
6714
6721
  } catch (e) {
6715
- DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
6722
+ DebugManager.error('HistoryRouter', 'Error in pushState', e);
6716
6723
  }
6717
6724
  };
6718
6725
  /**
@@ -6725,7 +6732,7 @@ var NativeDocument = (function (exports) {
6725
6732
  window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
6726
6733
  this.handleRouteChange(route, params, {}, path);
6727
6734
  } catch(e) {
6728
- DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
6735
+ DebugManager.error('HistoryRouter', 'Error in replaceState', e);
6729
6736
  }
6730
6737
  };
6731
6738
  this.forward = function() {
@@ -6752,7 +6759,7 @@ var NativeDocument = (function (exports) {
6752
6759
  }
6753
6760
  this.handleRouteChange(route, params, query, path);
6754
6761
  } catch(e) {
6755
- DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
6762
+ DebugManager.error('HistoryRouter', 'Error in popstate event', e);
6756
6763
  }
6757
6764
  });
6758
6765
  const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
@@ -6977,7 +6984,7 @@ var NativeDocument = (function (exports) {
6977
6984
  listener(request);
6978
6985
  next && next(request);
6979
6986
  } catch (e) {
6980
- DebugManager$1.warn('Route Listener', 'Error in listener:', e);
6987
+ DebugManager.warn('Route Listener', 'Error in listener:', e);
6981
6988
  }
6982
6989
  }
6983
6990
  };
@@ -7155,7 +7162,7 @@ var NativeDocument = (function (exports) {
7155
7162
  */
7156
7163
  Router.create = function(options, callback) {
7157
7164
  if(!Validator.isFunction(callback)) {
7158
- DebugManager$1.error('Router', 'Callback must be a function');
7165
+ DebugManager.error('Router', 'Callback must be a function');
7159
7166
  throw new RouterError('Callback must be a function');
7160
7167
  }
7161
7168
  const router = new Router(options);
@@ -7359,7 +7366,7 @@ var NativeDocument = (function (exports) {
7359
7366
  exports.HtmlElementWrapper = HtmlElementWrapper;
7360
7367
  exports.NDElement = NDElement;
7361
7368
  exports.Observable = Observable;
7362
- exports.PluginsManager = PluginsManager$1;
7369
+ exports.PluginsManager = PluginsManager;
7363
7370
  exports.SingletonView = SingletonView;
7364
7371
  exports.Store = Store;
7365
7372
  exports.StoreFactory = StoreFactory;