native-document 1.0.48 → 1.0.49
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 = {};
|
|
5
5
|
|
|
6
6
|
{
|
|
7
|
-
DebugManager
|
|
7
|
+
DebugManager = {
|
|
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 = DebugManager
|
|
38
|
+
var DebugManager$1 = DebugManager;
|
|
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.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
87
|
+
DebugManager$1.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.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
210
|
+
DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -395,7 +395,7 @@ var NativeDocument = (function (exports) {
|
|
|
395
395
|
ObservableItem.prototype.subscribe = function(callback, target = null) {
|
|
396
396
|
this.$listeners = this.$listeners ?? [];
|
|
397
397
|
if (this.$isCleanedUp) {
|
|
398
|
-
DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
398
|
+
DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
399
399
|
return () => {};
|
|
400
400
|
}
|
|
401
401
|
if (typeof callback !== 'function') {
|
|
@@ -1017,7 +1017,7 @@ var NativeDocument = (function (exports) {
|
|
|
1017
1017
|
const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
|
|
1018
1018
|
|
|
1019
1019
|
if (foundReserved.length > 0) {
|
|
1020
|
-
DebugManager.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
1020
|
+
DebugManager$1.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
1023
|
return attributes;
|
|
@@ -1065,7 +1065,7 @@ var NativeDocument = (function (exports) {
|
|
|
1065
1065
|
element.appendChild = function(child, before = null) {
|
|
1066
1066
|
const parent = anchorEnd.parentNode;
|
|
1067
1067
|
if(!parent) {
|
|
1068
|
-
DebugManager.error('Anchor', 'Anchor : parent not found', child);
|
|
1068
|
+
DebugManager$1.error('Anchor', 'Anchor : parent not found', child);
|
|
1069
1069
|
return;
|
|
1070
1070
|
}
|
|
1071
1071
|
before = before ?? anchorEnd;
|
|
@@ -2145,10 +2145,11 @@ var NativeDocument = (function (exports) {
|
|
|
2145
2145
|
throw new NativeDocumentError('Observable.array : target must be an array');
|
|
2146
2146
|
}
|
|
2147
2147
|
|
|
2148
|
-
ObservableItem.
|
|
2148
|
+
ObservableItem.call(this, target);
|
|
2149
2149
|
PluginsManager.emit('CreateObservableArray', this);
|
|
2150
2150
|
};
|
|
2151
2151
|
|
|
2152
|
+
ObservableArray.prototype = Object.create(ObservableItem.prototype);
|
|
2152
2153
|
ObservableArray.prototype.__$isObservableArray = true;
|
|
2153
2154
|
|
|
2154
2155
|
mutationMethods.forEach((method) => {
|
|
@@ -2638,7 +2639,7 @@ var NativeDocument = (function (exports) {
|
|
|
2638
2639
|
}
|
|
2639
2640
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
2640
2641
|
} catch (e) {
|
|
2641
|
-
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
2642
|
+
DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
2642
2643
|
throw e;
|
|
2643
2644
|
}
|
|
2644
2645
|
return keyId;
|
|
@@ -3010,7 +3011,7 @@ var NativeDocument = (function (exports) {
|
|
|
3010
3011
|
*/
|
|
3011
3012
|
const ShowIf$1 = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
3012
3013
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
3013
|
-
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
3014
|
+
return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
3014
3015
|
}
|
|
3015
3016
|
const element = new Anchor('Show if : '+(comment || ''));
|
|
3016
3017
|
|
|
@@ -3786,7 +3787,7 @@ var NativeDocument = (function (exports) {
|
|
|
3786
3787
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
3787
3788
|
this.handleRouteChange(route, params, query, path);
|
|
3788
3789
|
} catch (e) {
|
|
3789
|
-
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
3790
|
+
DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
|
|
3790
3791
|
}
|
|
3791
3792
|
};
|
|
3792
3793
|
/**
|
|
@@ -3799,7 +3800,7 @@ var NativeDocument = (function (exports) {
|
|
|
3799
3800
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
3800
3801
|
this.handleRouteChange(route, params, {}, path);
|
|
3801
3802
|
} catch(e) {
|
|
3802
|
-
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
3803
|
+
DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
|
|
3803
3804
|
}
|
|
3804
3805
|
};
|
|
3805
3806
|
this.forward = function() {
|
|
@@ -3826,7 +3827,7 @@ var NativeDocument = (function (exports) {
|
|
|
3826
3827
|
}
|
|
3827
3828
|
this.handleRouteChange(route, params, query, path);
|
|
3828
3829
|
} catch(e) {
|
|
3829
|
-
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
3830
|
+
DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
|
|
3830
3831
|
}
|
|
3831
3832
|
});
|
|
3832
3833
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -3980,7 +3981,7 @@ var NativeDocument = (function (exports) {
|
|
|
3980
3981
|
listener(request);
|
|
3981
3982
|
next && next(request);
|
|
3982
3983
|
} catch (e) {
|
|
3983
|
-
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
3984
|
+
DebugManager$1.warn('Route Listener', 'Error in listener:', e);
|
|
3984
3985
|
}
|
|
3985
3986
|
}
|
|
3986
3987
|
};
|
|
@@ -4139,7 +4140,7 @@ var NativeDocument = (function (exports) {
|
|
|
4139
4140
|
*/
|
|
4140
4141
|
Router.create = function(options, callback) {
|
|
4141
4142
|
if(!Validator.isFunction(callback)) {
|
|
4142
|
-
DebugManager.error('Router', 'Callback must be a function', e);
|
|
4143
|
+
DebugManager$1.error('Router', 'Callback must be a function', e);
|
|
4143
4144
|
throw new RouterError('Callback must be a function');
|
|
4144
4145
|
}
|
|
4145
4146
|
const router = new Router(options);
|