native-document 1.0.72 → 1.0.75

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.
@@ -814,8 +814,8 @@ var NativeComponents = (function (exports) {
814
814
  return this.shadow('closed', style);
815
815
  };
816
816
 
817
- NDElement.prototype.attach = function(bindingHydrator) {
818
- bindingHydrator.$hydrate(this.$element);
817
+ NDElement.prototype.attach = function(methodName, bindingHydrator) {
818
+ bindingHydrator.$hydrate(this.$element, methodName);
819
819
  return this.$element;
820
820
  };
821
821
 
@@ -1171,7 +1171,7 @@ var NativeComponents = (function (exports) {
1171
1171
  return new ObservableItem(value, configs);
1172
1172
  }
1173
1173
 
1174
- const $$1 = Observable;
1174
+ const $ = Observable;
1175
1175
 
1176
1176
  /**
1177
1177
  *
@@ -1232,9 +1232,11 @@ var NativeComponents = (function (exports) {
1232
1232
  function toggleElementClass(element, className, shouldAdd) {
1233
1233
  element.classes.toggle(className, shouldAdd);
1234
1234
  }
1235
+
1235
1236
  function toggleElementStyle(element, styleName, newValue) {
1236
1237
  element.style[styleName] = newValue;
1237
1238
  }
1239
+
1238
1240
  function updateInputFromObserver(element, attributeName, newValue) {
1239
1241
  if(Validator.isBoolean(newValue)) {
1240
1242
  element[attributeName] = newValue;
@@ -1242,6 +1244,7 @@ var NativeComponents = (function (exports) {
1242
1244
  }
1243
1245
  element[attributeName] = newValue === element.value;
1244
1246
  }
1247
+
1245
1248
  function updateObserverFromInput(element, attributeName, defaultValue, value) {
1246
1249
  if(Validator.isBoolean(defaultValue)) {
1247
1250
  value.set(element[attributeName]);
@@ -1249,6 +1252,7 @@ var NativeComponents = (function (exports) {
1249
1252
  }
1250
1253
  value.set(element.value);
1251
1254
  }
1255
+
1252
1256
  /**
1253
1257
  *
1254
1258
  * @param {HTMLElement} element
@@ -1355,37 +1359,19 @@ var NativeComponents = (function (exports) {
1355
1359
  if(value === null || value === undefined) {
1356
1360
  continue;
1357
1361
  }
1358
- if(Validator.isString(value)) {
1359
- value = value.resolveObservableTemplate ? value.resolveObservableTemplate() : value;
1360
- if(Validator.isString(value)) {
1361
- element.setAttribute(attributeName, value);
1362
- continue;
1363
- }
1364
- const observables = value.filter(item => Validator.isObservable(item));
1365
- value = Observable.computed(() => {
1366
- return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
1367
- }, observables);
1368
- }
1369
- if(attributeName === 'class' && Validator.isObject(value)) {
1370
- bindClassAttribute(element, value);
1371
- continue;
1372
- }
1373
- if(attributeName === 'style' && Validator.isObject(value)) {
1374
- bindStyleAttribute(element, value);
1362
+ if(value.handleNdAttribute) {
1363
+ value.handleNdAttribute(element, attributeName, value);
1375
1364
  continue;
1376
1365
  }
1377
1366
  if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1378
1367
  bindBooleanAttribute(element, attributeName, value);
1379
- continue;
1368
+ return;
1380
1369
  }
1381
1370
  if(Validator.isObservable(value)) {
1382
1371
  bindAttributeWithObservable(element, attributeName, value);
1383
1372
  continue;
1384
1373
  }
1385
- if(value.$hydrate) {
1386
- value.$hydrate(element, attributeName);
1387
- continue;
1388
- }
1374
+
1389
1375
  element.setAttribute(attributeName, value);
1390
1376
 
1391
1377
  }
@@ -1427,7 +1413,9 @@ var NativeComponents = (function (exports) {
1427
1413
  Array.prototype.toNdElement = function () {
1428
1414
  const fragment = document.createDocumentFragment();
1429
1415
  for(let i = 0, length = this.length; i < length; i++) {
1430
- fragment.appendChild(ElementCreator.getChild(this[i]));
1416
+ const child = ElementCreator.getChild(this[i]);
1417
+ if(child === null) continue;
1418
+ fragment.appendChild(child);
1431
1419
  }
1432
1420
  return fragment;
1433
1421
  };
@@ -1442,6 +1430,44 @@ var NativeComponents = (function (exports) {
1442
1430
  return ElementCreator.createHydratableNode(null, this);
1443
1431
  };
1444
1432
 
1433
+ Object.prototype.handleNdAttribute = function(element, attributeName) {
1434
+ if(attributeName === 'class') {
1435
+ bindClassAttribute(element, this);
1436
+ return;
1437
+ }
1438
+ if(attributeName === 'style') {
1439
+ bindStyleAttribute(element, this);
1440
+
1441
+ }
1442
+ };
1443
+
1444
+ String.prototype.handleNdAttribute = function(element, attributeName) {
1445
+ let value = this.resolveObservableTemplate ? this.resolveObservableTemplate() : this;
1446
+ if(Validator.isString(value)) {
1447
+ element.setAttribute(attributeName, value);
1448
+ return;
1449
+ }
1450
+ const observables = value.filter(item => Validator.isObservable(item));
1451
+ value = Observable.computed(() => {
1452
+ return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
1453
+ }, observables);
1454
+
1455
+ if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1456
+ bindBooleanAttribute(element, attributeName, value);
1457
+ return;
1458
+ }
1459
+
1460
+ bindAttributeWithObservable(element, attributeName, value);
1461
+ };
1462
+
1463
+ ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
1464
+ bindAttributeWithObservable(element, attributeName, this);
1465
+ };
1466
+
1467
+ TemplateBinding.prototype.handleNdAttribute = function(element, attributeName) {
1468
+ this.$hydrate(element, attributeName);
1469
+ };
1470
+
1445
1471
  const $nodeCache = new Map();
1446
1472
  let $textNodeCache = null;
1447
1473
 
@@ -1513,20 +1539,10 @@ var NativeComponents = (function (exports) {
1513
1539
  processChildren(children, parent) {
1514
1540
  if(children === null) return;
1515
1541
  PluginsManager.emit('BeforeProcessChildren', parent);
1516
- if(!Array.isArray(children)) {
1517
- let child = this.getChild(children);
1518
- if(child) {
1519
- parent.appendChild(child);
1520
- }
1542
+ let child = this.getChild(children);
1543
+ if(child) {
1544
+ parent.appendChild(child);
1521
1545
  }
1522
- else {
1523
- for(let i = 0, length = children.length; i < length; i++) {
1524
- let child = this.getChild(children[i]);
1525
- if (child === null) continue;
1526
- parent.appendChild(child);
1527
- }
1528
- }
1529
-
1530
1546
  PluginsManager.emit('AfterProcessChildren', parent);
1531
1547
  },
1532
1548
  getChild(child) {
@@ -2476,7 +2492,7 @@ var NativeComponents = (function (exports) {
2476
2492
  HtmlElementWrapper('meter');
2477
2493
 
2478
2494
 
2479
- const Button$1 = HtmlElementWrapper('button');
2495
+ const Button = HtmlElementWrapper('button');
2480
2496
 
2481
2497
  HtmlElementWrapper('main');
2482
2498
  HtmlElementWrapper('section');
@@ -3085,7 +3101,7 @@ var NativeComponents = (function (exports) {
3085
3101
 
3086
3102
  const ErrorDisplayer = (errors) => {
3087
3103
 
3088
- const shouldDisplayError = $$1.computed(() => {
3104
+ const shouldDisplayError = $.computed(() => {
3089
3105
  const val = errors.val();
3090
3106
  return (val && val.length > 0);
3091
3107
  }, [errors]);
@@ -3116,15 +3132,15 @@ var NativeComponents = (function (exports) {
3116
3132
  };
3117
3133
 
3118
3134
  if(description.showErrors) {
3119
- description.errors = description.errors || $$1(null);
3135
+ description.errors = description.errors || $(null);
3120
3136
  field.errors(description.errors);
3121
3137
  }
3122
3138
 
3123
- const hasErrors = description.showErrors ? $$1.computed(() => {
3139
+ const hasErrors = description.showErrors ? $.computed(() => {
3124
3140
  const errs = description.errors?.val();
3125
3141
  return errs && errs.length > 0;
3126
3142
  }, [description.errors]) : null;
3127
- const hasFocus = $$1(false);
3143
+ const hasFocus = $(false);
3128
3144
 
3129
3145
  const wrapperClasses = {
3130
3146
  [suffix+'-wrapper']: true,
@@ -3627,7 +3643,7 @@ var NativeComponents = (function (exports) {
3627
3643
  function DefaultLayout({ fields, form }) {
3628
3644
  return Form([
3629
3645
  Object.values(fields),
3630
- Button$1({ type: 'submit', disabled: form.submitting }, 'Submit')
3646
+ Button({ type: 'submit', disabled: form.submitting }, 'Submit')
3631
3647
  ]);
3632
3648
  }
3633
3649
 
@@ -4749,7 +4765,7 @@ var NativeComponents = (function (exports) {
4749
4765
 
4750
4766
  return Div({ class: 'field-collection-layout'}, [
4751
4767
  Div({ class: 'field-collection-layout-header'}, [
4752
- Button$1({ class: 'field-collection-layout-add-btn', type: 'button' }, ['Add +'])
4768
+ Button({ class: 'field-collection-layout-add-btn', type: 'button' }, ['Add +'])
4753
4769
  .nd.onClick(() => collection.add())
4754
4770
  ]),
4755
4771
  ForEachArray(data, Template)
@@ -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
  const MemoryManager = (function() {
41
41
 
@@ -84,7 +84,7 @@ var NativeDocument = (function (exports) {
84
84
  }
85
85
  }
86
86
  if (cleanedCount > 0) {
87
- DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
87
+ DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
88
88
  }
89
89
  }
90
90
  };
@@ -207,7 +207,7 @@ var NativeDocument = (function (exports) {
207
207
  try{
208
208
  callback.call(plugin, ...data);
209
209
  } catch (error) {
210
- DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
210
+ DebugManager.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
211
211
  }
212
212
  }
213
213
  }
@@ -503,7 +503,7 @@ var NativeDocument = (function (exports) {
503
503
  ObservableItem.prototype.subscribe = function(callback, target = null) {
504
504
  this.$listeners = this.$listeners ?? [];
505
505
  if (this.$isCleanedUp) {
506
- DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
506
+ DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
507
507
  return () => {};
508
508
  }
509
509
  if (typeof callback !== 'function') {
@@ -831,8 +831,8 @@ var NativeDocument = (function (exports) {
831
831
  return this.shadow('closed', style);
832
832
  };
833
833
 
834
- NDElement.prototype.attach = function(bindingHydrator) {
835
- bindingHydrator.$hydrate(this.$element);
834
+ NDElement.prototype.attach = function(methodName, bindingHydrator) {
835
+ bindingHydrator.$hydrate(this.$element, methodName);
836
836
  return this.$element;
837
837
  };
838
838
 
@@ -856,7 +856,7 @@ var NativeDocument = (function (exports) {
856
856
  }
857
857
  {
858
858
  if (this[name] && !this.$localExtensions.has(name)) {
859
- DebugManager$1.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
859
+ DebugManager.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
860
860
  }
861
861
  this.$localExtensions.set(name, method);
862
862
  }
@@ -890,17 +890,17 @@ var NativeDocument = (function (exports) {
890
890
  const method = methods[name];
891
891
 
892
892
  if (typeof method !== 'function') {
893
- DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
893
+ DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
894
894
  continue;
895
895
  }
896
896
 
897
897
  if (protectedMethods.has(name)) {
898
- DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
898
+ DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
899
899
  throw new NativeDocumentError(`Cannot override protected method "${name}"`);
900
900
  }
901
901
 
902
902
  if (NDElement.prototype[name]) {
903
- DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
903
+ DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
904
904
  }
905
905
 
906
906
  NDElement.prototype[name] = method;
@@ -1058,7 +1058,7 @@ var NativeDocument = (function (exports) {
1058
1058
  const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
1059
1059
 
1060
1060
  if (foundReserved.length > 0) {
1061
- DebugManager$1.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
1061
+ DebugManager.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
1062
1062
  }
1063
1063
 
1064
1064
  return attributes;
@@ -1106,7 +1106,7 @@ var NativeDocument = (function (exports) {
1106
1106
  anchorFragment.appendChild = function(child, before = null) {
1107
1107
  const parent = anchorEnd.parentNode;
1108
1108
  if(!parent) {
1109
- DebugManager$1.error('Anchor', 'Anchor : parent not found', child);
1109
+ DebugManager.error('Anchor', 'Anchor : parent not found', child);
1110
1110
  return;
1111
1111
  }
1112
1112
  before = before ?? anchorEnd;
@@ -1290,9 +1290,11 @@ var NativeDocument = (function (exports) {
1290
1290
  function toggleElementClass(element, className, shouldAdd) {
1291
1291
  element.classes.toggle(className, shouldAdd);
1292
1292
  }
1293
+
1293
1294
  function toggleElementStyle(element, styleName, newValue) {
1294
1295
  element.style[styleName] = newValue;
1295
1296
  }
1297
+
1296
1298
  function updateInputFromObserver(element, attributeName, newValue) {
1297
1299
  if(Validator.isBoolean(newValue)) {
1298
1300
  element[attributeName] = newValue;
@@ -1300,6 +1302,7 @@ var NativeDocument = (function (exports) {
1300
1302
  }
1301
1303
  element[attributeName] = newValue === element.value;
1302
1304
  }
1305
+
1303
1306
  function updateObserverFromInput(element, attributeName, defaultValue, value) {
1304
1307
  if(Validator.isBoolean(defaultValue)) {
1305
1308
  value.set(element[attributeName]);
@@ -1307,6 +1310,7 @@ var NativeDocument = (function (exports) {
1307
1310
  }
1308
1311
  value.set(element.value);
1309
1312
  }
1313
+
1310
1314
  /**
1311
1315
  *
1312
1316
  * @param {HTMLElement} element
@@ -1415,37 +1419,19 @@ var NativeDocument = (function (exports) {
1415
1419
  if(value === null || value === undefined) {
1416
1420
  continue;
1417
1421
  }
1418
- if(Validator.isString(value)) {
1419
- value = value.resolveObservableTemplate ? value.resolveObservableTemplate() : value;
1420
- if(Validator.isString(value)) {
1421
- element.setAttribute(attributeName, value);
1422
- continue;
1423
- }
1424
- const observables = value.filter(item => Validator.isObservable(item));
1425
- value = Observable.computed(() => {
1426
- return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
1427
- }, observables);
1428
- }
1429
- if(attributeName === 'class' && Validator.isObject(value)) {
1430
- bindClassAttribute(element, value);
1431
- continue;
1432
- }
1433
- if(attributeName === 'style' && Validator.isObject(value)) {
1434
- bindStyleAttribute(element, value);
1422
+ if(value.handleNdAttribute) {
1423
+ value.handleNdAttribute(element, attributeName, value);
1435
1424
  continue;
1436
1425
  }
1437
1426
  if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1438
1427
  bindBooleanAttribute(element, attributeName, value);
1439
- continue;
1428
+ return;
1440
1429
  }
1441
1430
  if(Validator.isObservable(value)) {
1442
1431
  bindAttributeWithObservable(element, attributeName, value);
1443
1432
  continue;
1444
1433
  }
1445
- if(value.$hydrate) {
1446
- value.$hydrate(element, attributeName);
1447
- continue;
1448
- }
1434
+
1449
1435
  element.setAttribute(attributeName, value);
1450
1436
 
1451
1437
  }
@@ -1487,7 +1473,9 @@ var NativeDocument = (function (exports) {
1487
1473
  Array.prototype.toNdElement = function () {
1488
1474
  const fragment = document.createDocumentFragment();
1489
1475
  for(let i = 0, length = this.length; i < length; i++) {
1490
- fragment.appendChild(ElementCreator.getChild(this[i]));
1476
+ const child = ElementCreator.getChild(this[i]);
1477
+ if(child === null) continue;
1478
+ fragment.appendChild(child);
1491
1479
  }
1492
1480
  return fragment;
1493
1481
  };
@@ -1502,6 +1490,44 @@ var NativeDocument = (function (exports) {
1502
1490
  return ElementCreator.createHydratableNode(null, this);
1503
1491
  };
1504
1492
 
1493
+ Object.prototype.handleNdAttribute = function(element, attributeName) {
1494
+ if(attributeName === 'class') {
1495
+ bindClassAttribute(element, this);
1496
+ return;
1497
+ }
1498
+ if(attributeName === 'style') {
1499
+ bindStyleAttribute(element, this);
1500
+
1501
+ }
1502
+ };
1503
+
1504
+ String.prototype.handleNdAttribute = function(element, attributeName) {
1505
+ let value = this.resolveObservableTemplate ? this.resolveObservableTemplate() : this;
1506
+ if(Validator.isString(value)) {
1507
+ element.setAttribute(attributeName, value);
1508
+ return;
1509
+ }
1510
+ const observables = value.filter(item => Validator.isObservable(item));
1511
+ value = Observable.computed(() => {
1512
+ return value.map(item => Validator.isObservable(item) ? item.val() : item).join(' ') || ' ';
1513
+ }, observables);
1514
+
1515
+ if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1516
+ bindBooleanAttribute(element, attributeName, value);
1517
+ return;
1518
+ }
1519
+
1520
+ bindAttributeWithObservable(element, attributeName, value);
1521
+ };
1522
+
1523
+ ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
1524
+ bindAttributeWithObservable(element, attributeName, this);
1525
+ };
1526
+
1527
+ TemplateBinding.prototype.handleNdAttribute = function(element, attributeName) {
1528
+ this.$hydrate(element, attributeName);
1529
+ };
1530
+
1505
1531
  const $nodeCache = new Map();
1506
1532
  let $textNodeCache = null;
1507
1533
 
@@ -1573,20 +1599,10 @@ var NativeDocument = (function (exports) {
1573
1599
  processChildren(children, parent) {
1574
1600
  if(children === null) return;
1575
1601
  PluginsManager.emit('BeforeProcessChildren', parent);
1576
- if(!Array.isArray(children)) {
1577
- let child = this.getChild(children);
1578
- if(child) {
1579
- parent.appendChild(child);
1580
- }
1581
- }
1582
- else {
1583
- for(let i = 0, length = children.length; i < length; i++) {
1584
- let child = this.getChild(children[i]);
1585
- if (child === null) continue;
1586
- parent.appendChild(child);
1587
- }
1602
+ let child = this.getChild(children);
1603
+ if(child) {
1604
+ parent.appendChild(child);
1588
1605
  }
1589
-
1590
1606
  PluginsManager.emit('AfterProcessChildren', parent);
1591
1607
  },
1592
1608
  getChild(child) {
@@ -2017,7 +2033,7 @@ var NativeDocument = (function (exports) {
2017
2033
  const bindAttributes = (node, bindDingData, data) => {
2018
2034
  let attributes = null;
2019
2035
  if(bindDingData.attributes) {
2020
- attributes = attributes || {};
2036
+ attributes = {};
2021
2037
  for (const attr in bindDingData.attributes) {
2022
2038
  attributes[attr] = bindDingData.attributes[attr](...data);
2023
2039
  }
@@ -2047,29 +2063,29 @@ var NativeDocument = (function (exports) {
2047
2063
  return null;
2048
2064
  };
2049
2065
 
2050
- const $hydrateFn = function(hydrateFunction, target, element, property) {
2066
+ const $hydrateFn = function(hydrateFunction, targetType, element, property) {
2051
2067
  if(!cloneBindingsDataCache.has(element)) {
2052
2068
  // { classes, styles, attributes, value, attach }
2053
2069
  cloneBindingsDataCache.set(element, {});
2054
2070
  }
2055
2071
  const hydrationState = cloneBindingsDataCache.get(element);
2056
- if(target === 'value') {
2072
+ if(targetType === 'value') {
2057
2073
  hydrationState.value = hydrateFunction;
2058
2074
  return;
2059
2075
  }
2060
- if(target === 'attach') {
2061
- hydrationState.attach = hydrateFunction;
2062
- return;
2063
- }
2064
- hydrationState[target] = hydrationState[target] || {};
2065
- hydrationState[target][property] = hydrateFunction;
2076
+ hydrationState[targetType] = hydrationState[targetType] || {};
2077
+ hydrationState[targetType][property] = hydrateFunction;
2066
2078
  };
2067
2079
 
2068
2080
  const bindAttachMethods = function(node, bindDingData, data) {
2069
2081
  if(!bindDingData.attach) {
2070
2082
  return null;
2071
2083
  }
2072
- bindDingData.attach(node, ...data);
2084
+ for(const methodName in bindDingData.attach) {
2085
+ node.nd[methodName](function(...args) {
2086
+ bindDingData.attach[methodName].call(this, ...[...args, ...data]);
2087
+ });
2088
+ }
2073
2089
  };
2074
2090
 
2075
2091
  function TemplateCloner($fn) {
@@ -2117,10 +2133,10 @@ var NativeDocument = (function (exports) {
2117
2133
  };
2118
2134
 
2119
2135
 
2120
- const createBinding = (hydrateFunction, target) => {
2136
+ const createBinding = (hydrateFunction, targetType) => {
2121
2137
  return new TemplateBinding((element, property) => {
2122
2138
  $hasBindingData = true;
2123
- $hydrateFn(hydrateFunction, target, element, property);
2139
+ $hydrateFn(hydrateFunction, targetType, element, property);
2124
2140
  });
2125
2141
  };
2126
2142
 
@@ -3290,7 +3306,7 @@ var NativeDocument = (function (exports) {
3290
3306
  }
3291
3307
  cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
3292
3308
  } catch (e) {
3293
- DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
3309
+ DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
3294
3310
  throw e;
3295
3311
  }
3296
3312
  return keyId;
@@ -3512,9 +3528,7 @@ var NativeDocument = (function (exports) {
3512
3528
  },
3513
3529
  add(items, delay = 2) {
3514
3530
  const fragment = Actions.toFragment(items);
3515
- Promise.resolve().then(() => {
3516
- element.appendElement(fragment);
3517
- });
3531
+ element.appendElement(fragment);
3518
3532
  },
3519
3533
  replace(items) {
3520
3534
  clear();
@@ -3664,7 +3678,7 @@ var NativeDocument = (function (exports) {
3664
3678
  */
3665
3679
  const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
3666
3680
  if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
3667
- return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
3681
+ return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
3668
3682
  }
3669
3683
  const element = Anchor('Show if : '+(comment || ''));
3670
3684
 
@@ -4451,7 +4465,7 @@ var NativeDocument = (function (exports) {
4451
4465
  window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
4452
4466
  this.handleRouteChange(route, params, query, path);
4453
4467
  } catch (e) {
4454
- DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
4468
+ DebugManager.error('HistoryRouter', 'Error in pushState', e);
4455
4469
  }
4456
4470
  };
4457
4471
  /**
@@ -4464,7 +4478,7 @@ var NativeDocument = (function (exports) {
4464
4478
  window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
4465
4479
  this.handleRouteChange(route, params, {}, path);
4466
4480
  } catch(e) {
4467
- DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
4481
+ DebugManager.error('HistoryRouter', 'Error in replaceState', e);
4468
4482
  }
4469
4483
  };
4470
4484
  this.forward = function() {
@@ -4491,7 +4505,7 @@ var NativeDocument = (function (exports) {
4491
4505
  }
4492
4506
  this.handleRouteChange(route, params, query, path);
4493
4507
  } catch(e) {
4494
- DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
4508
+ DebugManager.error('HistoryRouter', 'Error in popstate event', e);
4495
4509
  }
4496
4510
  });
4497
4511
  const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
@@ -4654,7 +4668,7 @@ var NativeDocument = (function (exports) {
4654
4668
  listener(request);
4655
4669
  next && next(request);
4656
4670
  } catch (e) {
4657
- DebugManager$1.warn('Route Listener', 'Error in listener:', e);
4671
+ DebugManager.warn('Route Listener', 'Error in listener:', e);
4658
4672
  }
4659
4673
  }
4660
4674
  };
@@ -4813,7 +4827,7 @@ var NativeDocument = (function (exports) {
4813
4827
  */
4814
4828
  Router.create = function(options, callback) {
4815
4829
  if(!Validator.isFunction(callback)) {
4816
- DebugManager$1.error('Router', 'Callback must be a function', e);
4830
+ DebugManager.error('Router', 'Callback must be a function', e);
4817
4831
  throw new RouterError('Callback must be a function');
4818
4832
  }
4819
4833
  const router = new Router(options);