native-document 1.0.124 → 1.0.126

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$2 = {};
4
+ let DebugManager$1 = {};
5
5
 
6
6
  {
7
- DebugManager$2 = {
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$2;
38
+ var DebugManager$2 = DebugManager$1;
39
39
 
40
40
  class NativeDocumentError extends Error {
41
41
  constructor(message, context = {}) {
@@ -146,6 +146,16 @@ var NativeDocument = (function (exports) {
146
146
  unmounted: new WeakMap(),
147
147
  unmountedSupposedSize: 0,
148
148
  observer: null,
149
+ initObserver: () => {
150
+ if(DocumentObserver.observer) {
151
+ return;
152
+ }
153
+ DocumentObserver.observer = new MutationObserver(DocumentObserver.checkMutation);
154
+ DocumentObserver.observer.observe(document.body, {
155
+ childList: true,
156
+ subtree: true,
157
+ });
158
+ },
149
159
 
150
160
  executeMountedCallback(node) {
151
161
  const data = DocumentObserver.mounted.get(node);
@@ -193,6 +203,7 @@ var NativeDocument = (function (exports) {
193
203
  },
194
204
 
195
205
  checkMutation: function(mutationsList) {
206
+ console.log('mutationsList', mutationsList);
196
207
  for(const mutation of mutationsList) {
197
208
  if(DocumentObserver.mountedSupposedSize > 0) {
198
209
  for(const node of mutation.addedNodes) {
@@ -231,6 +242,8 @@ var NativeDocument = (function (exports) {
231
242
  let mountedRegistered = false;
232
243
  let unmountedRegistered = false;
233
244
 
245
+ DocumentObserver.initObserver();
246
+
234
247
  let data = {
235
248
  inDom,
236
249
  mounted: null,
@@ -308,16 +321,10 @@ var NativeDocument = (function (exports) {
308
321
  }
309
322
  };
310
323
 
311
- DocumentObserver.observer = new MutationObserver(DocumentObserver.checkMutation);
312
- DocumentObserver.observer.observe(document.body, {
313
- childList: true,
314
- subtree: true,
315
- });
316
-
317
- let PluginsManager$1 = null;
324
+ let PluginsManager = null;
318
325
 
319
326
  {
320
- PluginsManager$1 = (function() {
327
+ PluginsManager = (function() {
321
328
 
322
329
  const $plugins = new Map();
323
330
  const $pluginByEvents = new Map();
@@ -383,7 +390,7 @@ var NativeDocument = (function (exports) {
383
390
  try{
384
391
  callback.call(plugin, ...data);
385
392
  } catch (error) {
386
- DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
393
+ DebugManager$2.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
387
394
  }
388
395
  }
389
396
  }
@@ -392,12 +399,12 @@ var NativeDocument = (function (exports) {
392
399
  }());
393
400
  }
394
401
 
395
- var PluginsManager = PluginsManager$1;
402
+ var PluginsManager$1 = PluginsManager;
396
403
 
397
404
  function NDElement(element) {
398
405
  this.$element = element;
399
406
  {
400
- PluginsManager.emit('NDElementCreated', element, this);
407
+ PluginsManager$1.emit('NDElementCreated', element, this);
401
408
  }
402
409
  }
403
410
 
@@ -562,7 +569,7 @@ var NativeDocument = (function (exports) {
562
569
  }
563
570
  {
564
571
  if (this[name] && !this.$localExtensions.has(name)) {
565
- DebugManager$1.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
572
+ DebugManager$2.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
566
573
  }
567
574
  this.$localExtensions.set(name, method);
568
575
  }
@@ -613,23 +620,23 @@ var NativeDocument = (function (exports) {
613
620
  const method = methods[name];
614
621
 
615
622
  if (typeof method !== 'function') {
616
- DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
623
+ DebugManager$2.warn('NDElement.extend', `"${name}" is not a function, skipping`);
617
624
  continue;
618
625
  }
619
626
 
620
627
  if (protectedMethods.has(name)) {
621
- DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
628
+ DebugManager$2.error('NDElement.extend', `Cannot override protected method "${name}"`);
622
629
  throw new NativeDocumentError(`Cannot override protected method "${name}"`);
623
630
  }
624
631
 
625
632
  if (NDElement.prototype[name]) {
626
- DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
633
+ DebugManager$2.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
627
634
  }
628
635
 
629
636
  NDElement.prototype[name] = method;
630
637
  }
631
638
  {
632
- PluginsManager.emit('NDElementExtended', methods);
639
+ PluginsManager$1.emit('NDElementExtended', methods);
633
640
  }
634
641
 
635
642
  return NDElement;
@@ -780,7 +787,7 @@ var NativeDocument = (function (exports) {
780
787
  const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
781
788
 
782
789
  if (foundReserved.length > 0) {
783
- DebugManager$1.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
790
+ DebugManager$2.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
784
791
  }
785
792
 
786
793
  return attributes;
@@ -867,7 +874,7 @@ var NativeDocument = (function (exports) {
867
874
  }
868
875
  }
869
876
  if (cleanedCount > 0) {
870
- DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
877
+ DebugManager$2.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
871
878
  }
872
879
  }
873
880
  };
@@ -1178,7 +1185,7 @@ var NativeDocument = (function (exports) {
1178
1185
  }
1179
1186
  }
1180
1187
  {
1181
- PluginsManager.emit('CreateObservable', this);
1188
+ PluginsManager$1.emit('CreateObservable', this);
1182
1189
  }
1183
1190
  }
1184
1191
 
@@ -1285,12 +1292,12 @@ var NativeDocument = (function (exports) {
1285
1292
  this.$previousValue = this.$currentValue;
1286
1293
  this.$currentValue = newValue;
1287
1294
  {
1288
- PluginsManager.emit('ObservableBeforeChange', this);
1295
+ PluginsManager$1.emit('ObservableBeforeChange', this);
1289
1296
  }
1290
1297
  this.trigger($setOperation);
1291
1298
  this.$previousValue = null;
1292
1299
  {
1293
- PluginsManager.emit('ObservableAfterChange', this);
1300
+ PluginsManager$1.emit('ObservableAfterChange', this);
1294
1301
  }
1295
1302
  };
1296
1303
 
@@ -1368,7 +1375,7 @@ var NativeDocument = (function (exports) {
1368
1375
  ObservableItem.prototype.subscribe = function(callback) {
1369
1376
  {
1370
1377
  if (this.$isCleanedUp) {
1371
- DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
1378
+ DebugManager$2.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
1372
1379
  return;
1373
1380
  }
1374
1381
  if (typeof callback !== 'function') {
@@ -1380,7 +1387,7 @@ var NativeDocument = (function (exports) {
1380
1387
  this.$listeners.push(callback);
1381
1388
  this.assocTrigger();
1382
1389
  {
1383
- PluginsManager.emit('ObservableSubscribe', this);
1390
+ PluginsManager$1.emit('ObservableSubscribe', this);
1384
1391
  }
1385
1392
  };
1386
1393
 
@@ -1491,7 +1498,7 @@ var NativeDocument = (function (exports) {
1491
1498
  }
1492
1499
  this.assocTrigger();
1493
1500
  {
1494
- PluginsManager.emit('ObservableUnsubscribe', this);
1501
+ PluginsManager$1.emit('ObservableUnsubscribe', this);
1495
1502
  }
1496
1503
  };
1497
1504
 
@@ -1965,7 +1972,7 @@ var NativeDocument = (function (exports) {
1965
1972
  Function.prototype.toNdElement = function () {
1966
1973
  const child = this;
1967
1974
  {
1968
- PluginsManager.emit('BeforeProcessComponent', child);
1975
+ PluginsManager$1.emit('BeforeProcessComponent', child);
1969
1976
  }
1970
1977
  return ElementCreator.getChild(child());
1971
1978
  };
@@ -2148,14 +2155,14 @@ var NativeDocument = (function (exports) {
2148
2155
  processChildren: (children, parent) => {
2149
2156
  if(children === null) return;
2150
2157
  {
2151
- PluginsManager.emit('BeforeProcessChildren', parent);
2158
+ PluginsManager$1.emit('BeforeProcessChildren', parent);
2152
2159
  }
2153
2160
  let child = ElementCreator.getChild(children);
2154
2161
  if(child) {
2155
2162
  parent.appendChild(child);
2156
2163
  }
2157
2164
  {
2158
- PluginsManager.emit('AfterProcessChildren', parent);
2165
+ PluginsManager$1.emit('AfterProcessChildren', parent);
2159
2166
  }
2160
2167
  },
2161
2168
  async safeRemove(element) {
@@ -2200,9 +2207,11 @@ var NativeDocument = (function (exports) {
2200
2207
  function AnchorWithSentinel(name) {
2201
2208
  const instance = Reflect.construct(DocumentFragment, [], AnchorWithSentinel);
2202
2209
  const sentinel = document.createComment((name || '') + ' Anchor Sentinel');
2210
+ const anchorStart = document.createComment('Anchor Start : '+name);
2211
+ const anchorEnd = document.createComment('/ Anchor End '+name);
2203
2212
  const events = {};
2204
2213
 
2205
- instance.appendChild(sentinel);
2214
+ instance.append(anchorStart, sentinel, anchorEnd);
2206
2215
 
2207
2216
  const observer = new MutationObserver(() => {
2208
2217
  if (sentinel.parentNode !== instance && !(sentinel.parentNode instanceof DocumentFragment)) {
@@ -2214,6 +2223,8 @@ var NativeDocument = (function (exports) {
2214
2223
 
2215
2224
 
2216
2225
  instance.$sentinel = sentinel;
2226
+ instance.$start = anchorStart;
2227
+ instance.$end = anchorEnd;
2217
2228
  instance.$observer = observer;
2218
2229
  instance.$events = events;
2219
2230
 
@@ -2302,13 +2313,6 @@ var NativeDocument = (function (exports) {
2302
2313
  function Anchor(name, isUniqueChild = false) {
2303
2314
  const anchorFragment = new AnchorWithSentinel(name);
2304
2315
 
2305
- /**
2306
- * State :
2307
- * 1. Not injected in the DOM
2308
- * 2. Injected in the DOM and should be the only child of parent
2309
- * 3. Injected in the DOM and the parent may have other children
2310
- */
2311
-
2312
2316
  anchorFragment.onConnectedOnce((parent) => {
2313
2317
  if(isUniqueChild) {
2314
2318
  oneChildAnchorOverwriting(anchorFragment, parent);
@@ -2317,11 +2321,8 @@ var NativeDocument = (function (exports) {
2317
2321
 
2318
2322
  anchorFragment.__Anchor__ = true;
2319
2323
 
2320
- const anchorStart = document.createComment('Anchor Start : '+name);
2321
- const anchorEnd = document.createComment('/ Anchor End '+name);
2322
-
2323
- anchorFragment.appendChild(anchorStart);
2324
- anchorFragment.appendChild(anchorEnd);
2324
+ const anchorStart = anchorFragment.$start;
2325
+ const anchorEnd = anchorFragment.$end;
2325
2326
 
2326
2327
  anchorFragment.nativeInsertBefore = anchorFragment.insertBefore;
2327
2328
  anchorFragment.nativeAppendChild = anchorFragment.appendChild;
@@ -2418,7 +2419,7 @@ var NativeDocument = (function (exports) {
2418
2419
  return;
2419
2420
  }
2420
2421
  if(isParentUniqueChild(parent)) {
2421
- anchorFragment.append.apply(anchorFragment, parent.childNodes);
2422
+ anchorFragment.nativeAppend.apply(anchorFragment, parent.childNodes);
2422
2423
  parent.replaceChildren(anchorStart, anchorEnd);
2423
2424
  return;
2424
2425
  }
@@ -2447,11 +2448,11 @@ var NativeDocument = (function (exports) {
2447
2448
  return;
2448
2449
  }
2449
2450
  if(isParentUniqueChild(parent)) {
2450
- parent.replaceChildren(anchorStart, childElement, anchorEnd);
2451
+ parent.replaceChildren(anchorStart, child, anchorEnd);
2451
2452
  return;
2452
2453
  }
2453
2454
  anchorFragment.removeChildren();
2454
- parent.insertBefore(childElement, anchorEnd);
2455
+ parent.insertBefore(child, anchorEnd);
2455
2456
  };
2456
2457
 
2457
2458
  anchorFragment.setContent = anchorFragment.replaceContent;
@@ -2968,7 +2969,11 @@ var NativeDocument = (function (exports) {
2968
2969
 
2969
2970
  return (attr, children) => createElement(attr, children)
2970
2971
  }
2971
- return () => Anchor('');
2972
+ return (children, name = '') => {
2973
+ const anchor = Anchor(name);
2974
+ anchor.append(children);
2975
+ return anchor;
2976
+ };
2972
2977
  }
2973
2978
 
2974
2979
  function NodeCloner($element) {
@@ -3840,7 +3845,7 @@ var NativeDocument = (function (exports) {
3840
3845
 
3841
3846
  ObservableItem.call(this, target, configs);
3842
3847
  {
3843
- PluginsManager.emit('CreateObservableArray', this);
3848
+ PluginsManager$1.emit('CreateObservableArray', this);
3844
3849
  }
3845
3850
  };
3846
3851
 
@@ -4474,7 +4479,7 @@ var NativeDocument = (function (exports) {
4474
4479
  const observable = new ObservableItem(initialValue);
4475
4480
  const updatedValue = nextTick(() => observable.set(callback()));
4476
4481
  {
4477
- PluginsManager.emit('CreateObservableComputed', observable, dependencies);
4482
+ PluginsManager$1.emit('CreateObservableComputed', observable, dependencies);
4478
4483
  }
4479
4484
 
4480
4485
  if(Validator.isFunction(dependencies)) {
@@ -4509,7 +4514,7 @@ var NativeDocument = (function (exports) {
4509
4514
  const $getStoreOrThrow = (method, name) => {
4510
4515
  const item = $stores.get(name);
4511
4516
  if (!item) {
4512
- DebugManager$1.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
4517
+ DebugManager$2.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
4513
4518
  throw new NativeDocumentError(
4514
4519
  `Store.${method}('${name}') : store not found.`
4515
4520
  );
@@ -4522,7 +4527,7 @@ var NativeDocument = (function (exports) {
4522
4527
  */
4523
4528
  const $applyReadOnly = (observer, name, context) => {
4524
4529
  const readOnlyError = (method) => () => {
4525
- DebugManager$1.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
4530
+ DebugManager$2.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
4526
4531
  throw new NativeDocumentError(
4527
4532
  `Store.${context}('${name}') is read-only.`
4528
4533
  );
@@ -4553,7 +4558,7 @@ var NativeDocument = (function (exports) {
4553
4558
  */
4554
4559
  create(name, value) {
4555
4560
  if ($stores.has(name)) {
4556
- DebugManager$1.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
4561
+ DebugManager$2.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
4557
4562
  throw new NativeDocumentError(
4558
4563
  `Store.create('${name}') : a store with this name already exists.`
4559
4564
  );
@@ -4574,7 +4579,7 @@ var NativeDocument = (function (exports) {
4574
4579
  */
4575
4580
  createResettable(name, value) {
4576
4581
  if ($stores.has(name)) {
4577
- DebugManager$1.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
4582
+ DebugManager$2.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
4578
4583
  throw new NativeDocumentError(
4579
4584
  `Store.createResettable('${name}') : a store with this name already exists.`
4580
4585
  );
@@ -4610,7 +4615,7 @@ var NativeDocument = (function (exports) {
4610
4615
  */
4611
4616
  createComposed(name, computation, dependencies) {
4612
4617
  if ($stores.has(name)) {
4613
- DebugManager$1.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
4618
+ DebugManager$2.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
4614
4619
  throw new NativeDocumentError(
4615
4620
  `Store.createComposed('${name}') : a store with this name already exists.`
4616
4621
  );
@@ -4633,7 +4638,7 @@ var NativeDocument = (function (exports) {
4633
4638
  }
4634
4639
  const depItem = $stores.get(depName);
4635
4640
  if (!depItem) {
4636
- DebugManager$1.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
4641
+ DebugManager$2.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
4637
4642
  throw new NativeDocumentError(
4638
4643
  `Store.createComposed('${name}') : dependency store '${depName}' not found.`
4639
4644
  );
@@ -4667,13 +4672,13 @@ var NativeDocument = (function (exports) {
4667
4672
  reset(name) {
4668
4673
  const item = $getStoreOrThrow('reset', name);
4669
4674
  if (item.composed) {
4670
- DebugManager$1.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
4675
+ DebugManager$2.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
4671
4676
  throw new NativeDocumentError(
4672
4677
  `Store.reset('${name}') : composed stores cannot be reset.`
4673
4678
  );
4674
4679
  }
4675
4680
  if (!item.resettable) {
4676
- DebugManager$1.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
4681
+ DebugManager$2.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
4677
4682
  throw new NativeDocumentError(
4678
4683
  `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
4679
4684
  );
@@ -4694,7 +4699,7 @@ var NativeDocument = (function (exports) {
4694
4699
  const item = $getStoreOrThrow('use', name);
4695
4700
 
4696
4701
  if (item.composed) {
4697
- DebugManager$1.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
4702
+ DebugManager$2.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
4698
4703
  throw new NativeDocumentError(
4699
4704
  `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
4700
4705
  );
@@ -4761,7 +4766,7 @@ var NativeDocument = (function (exports) {
4761
4766
  get(name) {
4762
4767
  const item = $stores.get(name);
4763
4768
  if (!item) {
4764
- DebugManager$1.warn('Store', `Store.get('${name}') : store not found.`);
4769
+ DebugManager$2.warn('Store', `Store.get('${name}') : store not found.`);
4765
4770
  return null;
4766
4771
  }
4767
4772
  return item.observer;
@@ -4783,7 +4788,7 @@ var NativeDocument = (function (exports) {
4783
4788
  delete(name) {
4784
4789
  const item = $stores.get(name);
4785
4790
  if (!item) {
4786
- DebugManager$1.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
4791
+ DebugManager$2.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
4787
4792
  return;
4788
4793
  }
4789
4794
  item.subscribers.forEach(follower => follower.destroy());
@@ -4885,7 +4890,7 @@ var NativeDocument = (function (exports) {
4885
4890
  return undefined;
4886
4891
  },
4887
4892
  set(target, prop, value) {
4888
- DebugManager$1.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
4893
+ DebugManager$2.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
4889
4894
  throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
4890
4895
  },
4891
4896
  deleteProperty(target, prop) {
@@ -4973,7 +4978,7 @@ var NativeDocument = (function (exports) {
4973
4978
  }
4974
4979
  cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
4975
4980
  } catch (e) {
4976
- DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
4981
+ DebugManager$2.error('ForEach', `Error creating element for key ${keyId}` , e);
4977
4982
  throw e;
4978
4983
  }
4979
4984
  return keyId;
@@ -5085,9 +5090,6 @@ var NativeDocument = (function (exports) {
5085
5090
 
5086
5091
  const clear = (items) => {
5087
5092
  element.removeChildren();
5088
- clearCacheOnly(items);
5089
- };
5090
- const clearCacheOnly = (items) => {
5091
5093
  cleanCache(items);
5092
5094
  lastNumberOfItems = 0;
5093
5095
  };
@@ -5125,7 +5127,7 @@ var NativeDocument = (function (exports) {
5125
5127
  };
5126
5128
 
5127
5129
  const createAndCache = (item) => {
5128
- const child = callback(item, null);
5130
+ const child = ElementCreator.getChild(callback(item, null));
5129
5131
  {
5130
5132
  if(!child) {
5131
5133
  throw new NativeDocumentError("ForEachArray child can't be null or undefined!");
@@ -5137,7 +5139,7 @@ var NativeDocument = (function (exports) {
5137
5139
 
5138
5140
  const createWithIndexAndCache = (item, indexKey) => {
5139
5141
  const indexObserver = Observable(indexKey);
5140
- const child = callback(item, indexObserver);
5142
+ const child = ElementCreator.getChild(callback(item, indexObserver));
5141
5143
  {
5142
5144
  if(!child) {
5143
5145
  throw new NativeDocumentError("ForEachArray child can't be null or undefined!");
@@ -5214,13 +5216,13 @@ var NativeDocument = (function (exports) {
5214
5216
  element.appendChildRaw(Actions.toFragment(items));
5215
5217
  },
5216
5218
  replace: (items) => {
5217
- clearCacheOnly(items);
5218
- element.replaceContentRaw(Actions.toFragment(items));
5219
+ clear(items);
5220
+ element.appendChildRaw(Actions.toFragment(items));
5219
5221
  },
5220
5222
  set: () => {
5221
5223
  const items = data.val();
5222
- clearCacheOnly(items);
5223
- element.replaceContentRaw(Actions.toFragment(items));
5224
+ clear(items);
5225
+ element.appendChildRaw(Actions.toFragment(items));
5224
5226
  },
5225
5227
  reOrder: (items) => {
5226
5228
  let child = null;
@@ -5346,7 +5348,7 @@ var NativeDocument = (function (exports) {
5346
5348
  */
5347
5349
  const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
5348
5350
  if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
5349
- return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
5351
+ return DebugManager$2.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
5350
5352
  }
5351
5353
  const element = Anchor('Show if : '+(comment || ''));
5352
5354
 
@@ -6765,7 +6767,7 @@ var NativeDocument = (function (exports) {
6765
6767
  window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
6766
6768
  this.handleRouteChange(route, params, query, path);
6767
6769
  } catch (e) {
6768
- DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
6770
+ DebugManager$2.error('HistoryRouter', 'Error in pushState', e);
6769
6771
  }
6770
6772
  };
6771
6773
  /**
@@ -6778,7 +6780,7 @@ var NativeDocument = (function (exports) {
6778
6780
  window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
6779
6781
  this.handleRouteChange(route, params, {}, path);
6780
6782
  } catch(e) {
6781
- DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
6783
+ DebugManager$2.error('HistoryRouter', 'Error in replaceState', e);
6782
6784
  }
6783
6785
  };
6784
6786
  this.forward = function() {
@@ -6805,7 +6807,7 @@ var NativeDocument = (function (exports) {
6805
6807
  }
6806
6808
  this.handleRouteChange(route, params, query, path);
6807
6809
  } catch(e) {
6808
- DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
6810
+ DebugManager$2.error('HistoryRouter', 'Error in popstate event', e);
6809
6811
  }
6810
6812
  });
6811
6813
  const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
@@ -6919,6 +6921,7 @@ var NativeDocument = (function (exports) {
6919
6921
  $lastNodeInserted.remove();
6920
6922
  }
6921
6923
  };
6924
+
6922
6925
  const cleanContainer = () => {
6923
6926
  container.nodeValue = '';
6924
6927
  removeLastNodeInserted();
@@ -6944,10 +6947,12 @@ var NativeDocument = (function (exports) {
6944
6947
  if(cachedLayout === $currentLayout) {
6945
6948
  const layoutAnchor = getNodeAnchorForLayout(nodeToInsert, path);
6946
6949
  removeLastNodeInserted();
6950
+ $lastNodeInserted = nodeToInsert;
6947
6951
  layoutAnchor.replaceContent(nodeToInsert);
6948
6952
  return;
6949
6953
  }
6950
6954
  cleanContainer();
6955
+ $lastNodeInserted = nodeToInsert;
6951
6956
  $currentLayout = cachedLayout;
6952
6957
  const layoutAnchor = getNodeAnchorForLayout(nodeToInsert, path);
6953
6958
  layoutAnchor.replaceContent(nodeToInsert);
@@ -6955,6 +6960,7 @@ var NativeDocument = (function (exports) {
6955
6960
  return;
6956
6961
  }
6957
6962
  cleanContainer();
6963
+ $lastNodeInserted = nodeToInsert;
6958
6964
  const anchor = getNodeAnchorForLayout(nodeToInsert, path);
6959
6965
 
6960
6966
  $currentLayout = ElementCreator.getChild(layout(anchor));
@@ -7030,7 +7036,7 @@ var NativeDocument = (function (exports) {
7030
7036
  listener(request);
7031
7037
  next && next(request);
7032
7038
  } catch (e) {
7033
- DebugManager$1.warn('Route Listener', 'Error in listener:', e);
7039
+ DebugManager$2.warn('Route Listener', 'Error in listener:', e);
7034
7040
  }
7035
7041
  }
7036
7042
  };
@@ -7208,7 +7214,7 @@ var NativeDocument = (function (exports) {
7208
7214
  */
7209
7215
  Router.create = function(options, callback) {
7210
7216
  if(!Validator.isFunction(callback)) {
7211
- DebugManager$1.error('Router', 'Callback must be a function');
7217
+ DebugManager$2.error('Router', 'Callback must be a function');
7212
7218
  throw new RouterError('Callback must be a function');
7213
7219
  }
7214
7220
  const router = new Router(options);
@@ -7412,7 +7418,7 @@ var NativeDocument = (function (exports) {
7412
7418
  exports.HtmlElementWrapper = HtmlElementWrapper;
7413
7419
  exports.NDElement = NDElement;
7414
7420
  exports.Observable = Observable;
7415
- exports.PluginsManager = PluginsManager;
7421
+ exports.PluginsManager = PluginsManager$1;
7416
7422
  exports.SingletonView = SingletonView;
7417
7423
  exports.Store = Store;
7418
7424
  exports.StoreFactory = StoreFactory;