native-document 1.0.159 โ†’ 1.0.161

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,14 +1,14 @@
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: true,
9
9
 
10
10
  enable() {
11
- DebugManager$2.log('๐Ÿ” NativeDocument Debug Mode enabled');
11
+ DebugManager$1.log('๐Ÿ” NativeDocument Debug Mode enabled');
12
12
  },
13
13
 
14
14
  disable() {
@@ -32,7 +32,7 @@ var NativeDocument = (function (exports) {
32
32
  };
33
33
 
34
34
  }
35
- var DebugManager$1 = DebugManager$2;
35
+ var DebugManager$2 = DebugManager$1;
36
36
 
37
37
  class NativeDocumentError extends Error {
38
38
  constructor(message, context = {}) {
@@ -188,7 +188,7 @@ var NativeDocument = (function (exports) {
188
188
  const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
189
189
 
190
190
  if (foundReserved.length > 0) {
191
- DebugManager$1.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
191
+ DebugManager$2.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
192
192
  }
193
193
 
194
194
  return attributes;
@@ -275,16 +275,16 @@ var NativeDocument = (function (exports) {
275
275
  }
276
276
  }
277
277
  if (cleanedCount > 0) {
278
- DebugManager$1.log('Memory Auto Clean', `๐Ÿงน Cleaned ${cleanedCount} orphaned observables`);
278
+ DebugManager$2.log('Memory Auto Clean', `๐Ÿงน Cleaned ${cleanedCount} orphaned observables`);
279
279
  }
280
280
  }
281
281
  };
282
282
  }());
283
283
 
284
- let PluginsManager$1 = null;
284
+ let PluginsManager = null;
285
285
 
286
286
  {
287
- PluginsManager$1 = (function() {
287
+ PluginsManager = (function() {
288
288
 
289
289
  const $plugins = new Map();
290
290
  const $pluginByEvents = new Map();
@@ -350,7 +350,7 @@ var NativeDocument = (function (exports) {
350
350
  try{
351
351
  callback.call(plugin, ...data);
352
352
  } catch (error) {
353
- DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
353
+ DebugManager$2.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
354
354
  }
355
355
  }
356
356
  }
@@ -359,7 +359,38 @@ var NativeDocument = (function (exports) {
359
359
  }());
360
360
  }
361
361
 
362
- var PluginsManager = PluginsManager$1;
362
+ var PluginsManager$1 = PluginsManager;
363
+
364
+ const invoke = function(fn, args, context) {
365
+ if(context) {
366
+ fn.apply(context, args);
367
+ } else {
368
+ fn(...args);
369
+ }
370
+ };
371
+ /**
372
+ *
373
+ * @param {Function} fn
374
+ * @param {number} delay
375
+ * @param {{leading?:Boolean, trailing?:Boolean, debounce?:Boolean, check: Function}}options
376
+ * @returns {(function(...[*]): void)|*}
377
+ */
378
+ const debounce = function(fn, delay, options = {}) {
379
+ let timer = null;
380
+ let lastArgs = null;
381
+
382
+ return function(...args) {
383
+ const context = options.context === true ? this : null;
384
+ if(options.check) {
385
+ options.check(...args);
386
+ }
387
+ lastArgs = args;
388
+
389
+ // debounce mode: reset the timer for each call
390
+ clearTimeout(timer);
391
+ timer = setTimeout(() => invoke(fn, lastArgs, context), delay);
392
+ }
393
+ };
363
394
 
364
395
  const nextTick = function(fn) {
365
396
  let pending = false;
@@ -521,7 +552,7 @@ var NativeDocument = (function (exports) {
521
552
  }
522
553
  }
523
554
  {
524
- PluginsManager.emit('CreateObservable', this);
555
+ PluginsManager$1.emit('CreateObservable', this);
525
556
  }
526
557
  }
527
558
 
@@ -636,12 +667,12 @@ var NativeDocument = (function (exports) {
636
667
  this.$previousValue = this.$currentValue;
637
668
  this.$currentValue = newValue;
638
669
  {
639
- PluginsManager.emit('ObservableBeforeChange', this);
670
+ PluginsManager$1.emit('ObservableBeforeChange', this);
640
671
  }
641
672
  this.trigger($setOperation);
642
673
  this.$previousValue = null;
643
674
  {
644
- PluginsManager.emit('ObservableAfterChange', this);
675
+ PluginsManager$1.emit('ObservableAfterChange', this);
645
676
  }
646
677
  };
647
678
 
@@ -720,7 +751,7 @@ var NativeDocument = (function (exports) {
720
751
  ObservableItem.prototype.subscribe = function(callback) {
721
752
  {
722
753
  if (this.$isCleanedUp) {
723
- DebugManager$1.warn('Observable subscription', 'โš ๏ธ Attempted to subscribe to a cleaned up observable.');
754
+ DebugManager$2.warn('Observable subscription', 'โš ๏ธ Attempted to subscribe to a cleaned up observable.');
724
755
  return;
725
756
  }
726
757
  if (typeof callback !== 'function') {
@@ -732,7 +763,7 @@ var NativeDocument = (function (exports) {
732
763
  this.$listeners.push(callback);
733
764
  this.assocTrigger();
734
765
  {
735
- PluginsManager.emit('ObservableSubscribe', this);
766
+ PluginsManager$1.emit('ObservableSubscribe', this);
736
767
  }
737
768
  };
738
769
 
@@ -843,7 +874,7 @@ var NativeDocument = (function (exports) {
843
874
  }
844
875
  this.assocTrigger();
845
876
  {
846
- PluginsManager.emit('ObservableUnsubscribe', this);
877
+ PluginsManager$1.emit('ObservableUnsubscribe', this);
847
878
  }
848
879
  };
849
880
 
@@ -1089,7 +1120,7 @@ var NativeDocument = (function (exports) {
1089
1120
  const regex = new RegExp(pattern, flags);
1090
1121
  return regex.test(String(value));
1091
1122
  } catch (error){
1092
- DebugManager$1.warn('Invalid regex pattern:', pattern, error);
1123
+ DebugManager$2.warn('Invalid regex pattern:', pattern, error);
1093
1124
  return false;
1094
1125
  }
1095
1126
  }
@@ -1348,7 +1379,7 @@ var NativeDocument = (function (exports) {
1348
1379
 
1349
1380
  ObservableItem.call(this, target, configs);
1350
1381
  {
1351
- PluginsManager.emit('CreateObservableArray', this);
1382
+ PluginsManager$1.emit('CreateObservableArray', this);
1352
1383
  }
1353
1384
  };
1354
1385
 
@@ -2204,7 +2235,7 @@ var NativeDocument = (function (exports) {
2204
2235
 
2205
2236
  ObservableItem.call(this);
2206
2237
  {
2207
- PluginsManager.emit('CreateObservableChecker', this);
2238
+ PluginsManager$1.emit('CreateObservableChecker', this);
2208
2239
  }
2209
2240
 
2210
2241
  this.$mutation = $checker;
@@ -2435,6 +2466,186 @@ var NativeDocument = (function (exports) {
2435
2466
  );
2436
2467
  };
2437
2468
 
2469
+ const STATE = {
2470
+ UNRESOLVED: 'unresolved',
2471
+ PENDING: 'pending',
2472
+ READY: 'ready',
2473
+ REFRESHING: 'refreshing',
2474
+ ERRORED: 'errored',
2475
+ };
2476
+
2477
+ function ObservableResource(fn, deps, config) {
2478
+ this.$fn = (config.debounce > 0) ? debounce(fn, config.debounce) : fn;
2479
+ this.$dependencies = deps;
2480
+ this.$config = config;
2481
+ this.$controller = null;
2482
+ this.$subscriptions = [];
2483
+
2484
+ this.data = config.initial ?? new ObservableItem(null);
2485
+ this.error = new ObservableItem(null);
2486
+ this.state = new ObservableItem(STATE.UNRESOLVED);
2487
+
2488
+ this.loading = ObservableItem.computed(
2489
+ (state) => state === STATE.PENDING || state === STATE.REFRESHING,
2490
+ [this.state]
2491
+ );
2492
+
2493
+ if (config.auto) {
2494
+ if (deps.length > 0) {
2495
+ this.$watchDependencies();
2496
+ return;
2497
+ }
2498
+ this.fetch();
2499
+ }
2500
+ }
2501
+
2502
+ ObservableResource.prototype.$abort = function() {
2503
+ if (this.$controller) {
2504
+ this.$controller.abort();
2505
+ this.$controller = null;
2506
+ }
2507
+ };
2508
+
2509
+ ObservableResource.prototype.$runWithAbortController = function(isRefetch = false) {
2510
+ this.$abort();
2511
+
2512
+ this.$controller = new AbortController();
2513
+ const signal = this.$controller.signal;
2514
+
2515
+ const hasData = this.data.val() !== null;
2516
+ const nextState = isRefetch && hasData ? STATE.REFRESHING : STATE.PENDING;
2517
+
2518
+ this.error.set(null);
2519
+ this.state.set(nextState);
2520
+
2521
+ const depValues = this.$dependencies.map(dep => dep.val());
2522
+ const args = [...depValues, signal];
2523
+
2524
+ Promise.resolve(this.$fn(...args))
2525
+ .then(result => {
2526
+ if (signal.aborted) {
2527
+ return;
2528
+ }
2529
+ this.data.set(result);
2530
+ this.error.set(null);
2531
+ this.state.set(STATE.READY);
2532
+ this.$controller = null;
2533
+ })
2534
+ .catch(err => {
2535
+ if (signal.aborted) {
2536
+ return;
2537
+ }
2538
+ this.error.set(err);
2539
+ this.state.set(STATE.ERRORED);
2540
+ this.$controller = null;
2541
+ });
2542
+ };
2543
+ ObservableResource.prototype.$runWithoutAbortController = function(isRefetch = false) {
2544
+ const hasData = this.data.val() !== null;
2545
+ const nextState = isRefetch && hasData ? STATE.REFRESHING : STATE.PENDING;
2546
+
2547
+ this.error.set(null);
2548
+ this.state.set(nextState);
2549
+
2550
+ const args = this.$dependencies.map(dep => dep.val());
2551
+
2552
+ Promise.resolve(this.$fn(...args))
2553
+ .then(result => {
2554
+ this.data.set(result);
2555
+ this.error.set(null);
2556
+ this.state.set(STATE.READY);
2557
+ })
2558
+ .catch(err => {
2559
+ this.error.set(err);
2560
+ this.state.set(STATE.ERRORED);
2561
+ });
2562
+ };
2563
+
2564
+ ObservableResource.prototype.$run = function(isRefetch = false) {
2565
+ const needsSignal = this.$fn.length > this.$dependencies.length;
2566
+ if(needsSignal) {
2567
+ this.$run = this.$runWithAbortController;
2568
+ return this.$runWithAbortController(isRefetch);
2569
+ }
2570
+ this.$run = this.$runWithoutAbortController;
2571
+
2572
+ return this.$run(isRefetch);
2573
+ };
2574
+
2575
+ ObservableResource.prototype.$watchDependencies = function() {
2576
+ this.$subscriptions.forEach(unsub => unsub());
2577
+ this.$subscriptions = [];
2578
+
2579
+ this.$dependencies.forEach(dep => {
2580
+ const callback = () => this.$run(true);
2581
+ dep.subscribe(callback);
2582
+ this.$subscriptions.push(() => dep.unsubscribe(callback));
2583
+ });
2584
+ if (!this.$config.lazy) {
2585
+ this.$run(false);
2586
+ }
2587
+ };
2588
+
2589
+ ObservableResource.prototype.fetch = function() {
2590
+ this.$run(false);
2591
+ return this;
2592
+ };
2593
+
2594
+ ObservableResource.prototype.refetch = function() {
2595
+ this.$run(true);
2596
+ return this;
2597
+ };
2598
+
2599
+ ObservableResource.prototype.mutate = function(value) {
2600
+ this.data.set(value);
2601
+ this.state.set(STATE.READY);
2602
+ return this;
2603
+ };
2604
+
2605
+ ObservableResource.prototype.destroy = function() {
2606
+ this.$abort();
2607
+ this.$subscriptions.forEach(unsub => unsub());
2608
+ this.$subscriptions = [];
2609
+ };
2610
+
2611
+ ObservableResource.prototype.isReady = function() {
2612
+ return this.state.isEqualTo(STATE.READY);
2613
+ };
2614
+
2615
+ ObservableResource.prototype.isPending = function() {
2616
+ return this.state.isEqualTo(STATE.PENDING);
2617
+ };
2618
+
2619
+ ObservableResource.prototype.isRefreshing = function() {
2620
+ return this.state.isEqualTo(STATE.REFRESHING);
2621
+ };
2622
+
2623
+ ObservableResource.prototype.isErrored = function() {
2624
+ return this.state.isEqualTo(STATE.ERRORED);
2625
+ };
2626
+
2627
+ ObservableResource.prototype.isUnresolved = function() {
2628
+ return this.state.isEqualTo(STATE.UNRESOLVED);
2629
+ };
2630
+
2631
+ ObservableResource.prototype.onSuccess = function(callback) {
2632
+ this.data.subscribe((value) => {
2633
+ if (this.state.val() === STATE.READY) {
2634
+ callback(value);
2635
+ }
2636
+ });
2637
+ return this;
2638
+ };
2639
+
2640
+ ObservableResource.prototype.onError = function(callback) {
2641
+ this.error.subscribe((err) => {
2642
+ if (err !== null) {
2643
+ callback(err);
2644
+ }
2645
+ });
2646
+ return this;
2647
+ };
2648
+
2438
2649
  /**
2439
2650
  *
2440
2651
  * @param {*} value
@@ -2566,12 +2777,12 @@ var NativeDocument = (function (exports) {
2566
2777
  * const computed = Observable.computed(() => { ... }, batch);
2567
2778
  */
2568
2779
  Observable.computed = function(callback, dependencies = []) {
2569
- const initialValue = callback();
2570
- const observable = new ObservableItem(initialValue);
2571
2780
  const getValues = () => dependencies.map((item) => item.val());
2781
+ const initialValue = callback(...getValues());
2782
+ const observable = new ObservableItem(initialValue);
2572
2783
  const updatedValue = nextTick(() => observable.set(callback(...getValues())));
2573
2784
  {
2574
- PluginsManager.emit('CreateObservableComputed', observable, dependencies);
2785
+ PluginsManager$1.emit('CreateObservableComputed', observable, dependencies);
2575
2786
  }
2576
2787
 
2577
2788
  if(Validator.isFunction(dependencies)) {
@@ -2640,6 +2851,15 @@ var NativeDocument = (function (exports) {
2640
2851
  Observable.object = Observable.init;
2641
2852
  Observable.json = Observable.init;
2642
2853
 
2854
+
2855
+ Observable.resource = function(fn, deps = [], options = false) {
2856
+ const config = (typeof options === 'boolean')
2857
+ ? { auto: options, debounce: 0, lazy: false }
2858
+ : { auto: false, debounce: 0, lazy: false, ...options };
2859
+
2860
+ return new ObservableResource(fn, deps, config);
2861
+ };
2862
+
2643
2863
  /**
2644
2864
  *
2645
2865
  * @param {HTMLElement} element
@@ -2877,14 +3097,14 @@ var NativeDocument = (function (exports) {
2877
3097
  processChildren: (children, parent) => {
2878
3098
  if(children === null) return;
2879
3099
  {
2880
- PluginsManager.emit('BeforeProcessChildren', parent);
3100
+ PluginsManager$1.emit('BeforeProcessChildren', parent);
2881
3101
  }
2882
3102
  let child = ElementCreator.getChild(children);
2883
3103
  if(child) {
2884
3104
  parent.appendChild(child);
2885
3105
  }
2886
3106
  {
2887
- PluginsManager.emit('AfterProcessChildren', parent);
3107
+ PluginsManager$1.emit('AfterProcessChildren', parent);
2888
3108
  }
2889
3109
  },
2890
3110
  async safeRemove(element) {
@@ -3534,7 +3754,7 @@ var NativeDocument = (function (exports) {
3534
3754
  this.$element = element;
3535
3755
  this.$attachements = null;
3536
3756
  {
3537
- PluginsManager.emit('NDElementCreated', element, this);
3757
+ PluginsManager$1.emit('NDElementCreated', element, this);
3538
3758
  }
3539
3759
  }
3540
3760
 
@@ -3706,12 +3926,12 @@ var NativeDocument = (function (exports) {
3706
3926
  const method = methods[name];
3707
3927
 
3708
3928
  if (typeof method !== 'function') {
3709
- DebugManager$1.warn(`โš ๏ธ extends(): "${name}" is not a function, skipping`);
3929
+ DebugManager$2.warn(`โš ๏ธ extends(): "${name}" is not a function, skipping`);
3710
3930
  continue;
3711
3931
  }
3712
3932
  {
3713
3933
  if (this[name] && !this.$localExtensions.has(name)) {
3714
- DebugManager$1.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
3934
+ DebugManager$2.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
3715
3935
  }
3716
3936
  this.$localExtensions.set(name, method);
3717
3937
  }
@@ -3722,6 +3942,31 @@ var NativeDocument = (function (exports) {
3722
3942
  return this;
3723
3943
  };
3724
3944
 
3945
+
3946
+ NDElement.prototype.attr = function(name, value) {
3947
+ if(value?.__$Observable) {
3948
+ bindAttributeWithObservable(this.$element, name, value);
3949
+ return this;
3950
+ }
3951
+ this.$element.setAttribute(name, value);
3952
+ };
3953
+
3954
+ NDElement.prototype.attrs = function(attrs) {
3955
+ AttributesWrapper(this.$element, attrs);
3956
+ return this;
3957
+ };
3958
+
3959
+ NDElement.prototype.class = function(classes) {
3960
+ bindClassAttribute(this.$element, classes);
3961
+ return this;
3962
+ };
3963
+
3964
+ NDElement.prototype.style = function(style) {
3965
+ bindStyleAttribute(this.$element, style);
3966
+ return this;
3967
+ };
3968
+
3969
+
3725
3970
  /**
3726
3971
  * Extends the NDElement prototype with new methods available to all NDElement instances.
3727
3972
  * Use this to add global methods to all NDElements.
@@ -3762,23 +4007,23 @@ var NativeDocument = (function (exports) {
3762
4007
  const method = methods[name];
3763
4008
 
3764
4009
  if (typeof method !== 'function') {
3765
- DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
4010
+ DebugManager$2.warn('NDElement.extend', `"${name}" is not a function, skipping`);
3766
4011
  continue;
3767
4012
  }
3768
4013
 
3769
4014
  if (protectedMethods.has(name)) {
3770
- DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
4015
+ DebugManager$2.error('NDElement.extend', `Cannot override protected method "${name}"`);
3771
4016
  throw new NativeDocumentError(`Cannot override protected method "${name}"`);
3772
4017
  }
3773
4018
 
3774
4019
  if (NDElement.prototype[name]) {
3775
- DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
4020
+ DebugManager$2.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
3776
4021
  }
3777
4022
 
3778
4023
  NDElement.prototype[name] = method;
3779
4024
  }
3780
4025
  {
3781
- PluginsManager.emit('NDElementExtended', methods);
4026
+ PluginsManager$1.emit('NDElementExtended', methods);
3782
4027
  }
3783
4028
 
3784
4029
  return NDElement;
@@ -4154,7 +4399,7 @@ var NativeDocument = (function (exports) {
4154
4399
  Function.prototype.toNdElement = function () {
4155
4400
  const child = this;
4156
4401
  {
4157
- PluginsManager.emit('BeforeProcessComponent', child);
4402
+ PluginsManager$1.emit('BeforeProcessComponent', child);
4158
4403
  }
4159
4404
  return ElementCreator.getChild(child());
4160
4405
  };
@@ -4804,7 +5049,7 @@ var NativeDocument = (function (exports) {
4804
5049
  const $getStoreOrThrow = (method, name) => {
4805
5050
  const item = $stores.get(name);
4806
5051
  if (!item) {
4807
- DebugManager$1.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
5052
+ DebugManager$2.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
4808
5053
  throw new NativeDocumentError(
4809
5054
  `Store.${method}('${name}') : store not found.`
4810
5055
  );
@@ -4817,7 +5062,7 @@ var NativeDocument = (function (exports) {
4817
5062
  */
4818
5063
  const $applyReadOnly = (observer, name, context) => {
4819
5064
  const readOnlyError = (method) => () => {
4820
- DebugManager$1.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
5065
+ DebugManager$2.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
4821
5066
  throw new NativeDocumentError(
4822
5067
  `Store.${context}('${name}') is read-only.`
4823
5068
  );
@@ -4848,7 +5093,7 @@ var NativeDocument = (function (exports) {
4848
5093
  */
4849
5094
  create(name, value) {
4850
5095
  if ($stores.has(name)) {
4851
- DebugManager$1.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
5096
+ DebugManager$2.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
4852
5097
  throw new NativeDocumentError(
4853
5098
  `Store.create('${name}') : a store with this name already exists.`
4854
5099
  );
@@ -4869,7 +5114,7 @@ var NativeDocument = (function (exports) {
4869
5114
  */
4870
5115
  createResettable(name, value) {
4871
5116
  if ($stores.has(name)) {
4872
- DebugManager$1.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
5117
+ DebugManager$2.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
4873
5118
  throw new NativeDocumentError(
4874
5119
  `Store.createResettable('${name}') : a store with this name already exists.`
4875
5120
  );
@@ -4905,7 +5150,7 @@ var NativeDocument = (function (exports) {
4905
5150
  */
4906
5151
  createComposed(name, computation, dependencies) {
4907
5152
  if ($stores.has(name)) {
4908
- DebugManager$1.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
5153
+ DebugManager$2.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
4909
5154
  throw new NativeDocumentError(
4910
5155
  `Store.createComposed('${name}') : a store with this name already exists.`
4911
5156
  );
@@ -4928,7 +5173,7 @@ var NativeDocument = (function (exports) {
4928
5173
  }
4929
5174
  const depItem = $stores.get(depName);
4930
5175
  if (!depItem) {
4931
- DebugManager$1.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
5176
+ DebugManager$2.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
4932
5177
  throw new NativeDocumentError(
4933
5178
  `Store.createComposed('${name}') : dependency store '${depName}' not found.`
4934
5179
  );
@@ -4962,13 +5207,13 @@ var NativeDocument = (function (exports) {
4962
5207
  reset(name) {
4963
5208
  const item = $getStoreOrThrow('reset', name);
4964
5209
  if (item.composed) {
4965
- DebugManager$1.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
5210
+ DebugManager$2.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
4966
5211
  throw new NativeDocumentError(
4967
5212
  `Store.reset('${name}') : composed stores cannot be reset.`
4968
5213
  );
4969
5214
  }
4970
5215
  if (!item.resettable) {
4971
- DebugManager$1.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
5216
+ DebugManager$2.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
4972
5217
  throw new NativeDocumentError(
4973
5218
  `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
4974
5219
  );
@@ -4989,7 +5234,7 @@ var NativeDocument = (function (exports) {
4989
5234
  const item = $getStoreOrThrow('use', name);
4990
5235
 
4991
5236
  if (item.composed) {
4992
- DebugManager$1.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
5237
+ DebugManager$2.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
4993
5238
  throw new NativeDocumentError(
4994
5239
  `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
4995
5240
  );
@@ -5056,7 +5301,7 @@ var NativeDocument = (function (exports) {
5056
5301
  get(name) {
5057
5302
  const item = $stores.get(name);
5058
5303
  if (!item) {
5059
- DebugManager$1.warn('Store', `Store.get('${name}') : store not found.`);
5304
+ DebugManager$2.warn('Store', `Store.get('${name}') : store not found.`);
5060
5305
  return null;
5061
5306
  }
5062
5307
  return item.observer;
@@ -5078,7 +5323,7 @@ var NativeDocument = (function (exports) {
5078
5323
  delete(name) {
5079
5324
  const item = $stores.get(name);
5080
5325
  if (!item) {
5081
- DebugManager$1.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
5326
+ DebugManager$2.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
5082
5327
  return;
5083
5328
  }
5084
5329
  item.subscribers.forEach(follower => follower.destroy());
@@ -5180,7 +5425,7 @@ var NativeDocument = (function (exports) {
5180
5425
  return undefined;
5181
5426
  },
5182
5427
  set(target, prop, value) {
5183
- DebugManager$1.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
5428
+ DebugManager$2.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
5184
5429
  throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
5185
5430
  },
5186
5431
  deleteProperty(target, prop) {
@@ -5271,7 +5516,7 @@ var NativeDocument = (function (exports) {
5271
5516
  }
5272
5517
  cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
5273
5518
  } catch (e) {
5274
- DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
5519
+ DebugManager$2.error('ForEach', `Error creating element for key ${keyId}` , e);
5275
5520
  throw e;
5276
5521
  }
5277
5522
  return keyId;
@@ -5661,7 +5906,7 @@ var NativeDocument = (function (exports) {
5661
5906
  return condition ? ElementCreator.getChild(child) : null;
5662
5907
  }
5663
5908
 
5664
- return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable or boolean / "+comment, condition);
5909
+ return DebugManager$2.warn('ShowIf', "ShowIf : condition must be an Observable or boolean / "+comment, condition);
5665
5910
  }
5666
5911
  const element = Anchor('Show if : '+(comment || ''));
5667
5912
 
@@ -7215,7 +7460,7 @@ var NativeDocument = (function (exports) {
7215
7460
  window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
7216
7461
  this.handleRouteChange(route, params, query, path);
7217
7462
  } catch (e) {
7218
- DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
7463
+ DebugManager$2.error('HistoryRouter', 'Error in pushState', e);
7219
7464
  }
7220
7465
  };
7221
7466
  /**
@@ -7228,7 +7473,7 @@ var NativeDocument = (function (exports) {
7228
7473
  window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
7229
7474
  this.handleRouteChange(route, params, {}, path);
7230
7475
  } catch(e) {
7231
- DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
7476
+ DebugManager$2.error('HistoryRouter', 'Error in replaceState', e);
7232
7477
  }
7233
7478
  };
7234
7479
  this.forward = function() {
@@ -7255,7 +7500,7 @@ var NativeDocument = (function (exports) {
7255
7500
  }
7256
7501
  this.handleRouteChange(route, params, query, path);
7257
7502
  } catch(e) {
7258
- DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
7503
+ DebugManager$2.error('HistoryRouter', 'Error in popstate event', e);
7259
7504
  }
7260
7505
  });
7261
7506
  const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
@@ -7484,7 +7729,7 @@ var NativeDocument = (function (exports) {
7484
7729
  listener(request);
7485
7730
  next && next(request);
7486
7731
  } catch (e) {
7487
- DebugManager$1.warn('Route Listener', 'Error in listener:', e);
7732
+ DebugManager$2.warn('Route Listener', 'Error in listener:', e);
7488
7733
  }
7489
7734
  }
7490
7735
  };
@@ -7673,7 +7918,7 @@ var NativeDocument = (function (exports) {
7673
7918
  */
7674
7919
  Router.create = function(options, callback) {
7675
7920
  if(!Validator.isFunction(callback)) {
7676
- DebugManager$1.error('Router', 'Callback must be a function');
7921
+ DebugManager$2.error('Router', 'Callback must be a function');
7677
7922
  throw new RouterError('Callback must be a function');
7678
7923
  }
7679
7924
  const router = new Router(options);
@@ -7878,7 +8123,7 @@ var NativeDocument = (function (exports) {
7878
8123
  exports.HtmlElementWrapper = HtmlElementWrapper;
7879
8124
  exports.NDElement = NDElement;
7880
8125
  exports.Observable = Observable;
7881
- exports.PluginsManager = PluginsManager;
8126
+ exports.PluginsManager = PluginsManager$1;
7882
8127
  exports.SingletonView = SingletonView;
7883
8128
  exports.Store = Store;
7884
8129
  exports.StoreFactory = StoreFactory;