native-document 1.0.51 → 1.0.52
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;
|
|
@@ -2134,11 +2134,6 @@ var NativeDocument = (function (exports) {
|
|
|
2134
2134
|
});
|
|
2135
2135
|
};
|
|
2136
2136
|
|
|
2137
|
-
const Service = {
|
|
2138
|
-
once: fn => autoOnce(fn),
|
|
2139
|
-
memoize: fn => autoMemoize(fn)
|
|
2140
|
-
};
|
|
2141
|
-
|
|
2142
2137
|
const mutationMethods = ['push', 'pop', 'shift', 'unshift', 'reverse', 'sort', 'splice'];
|
|
2143
2138
|
const noMutationMethods = ['map', 'forEach', 'filter', 'reduce', 'some', 'every', 'find', 'findIndex', 'concat', 'includes', 'indexOf'];
|
|
2144
2139
|
|
|
@@ -2642,7 +2637,7 @@ var NativeDocument = (function (exports) {
|
|
|
2642
2637
|
}
|
|
2643
2638
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
2644
2639
|
} catch (e) {
|
|
2645
|
-
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
2640
|
+
DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
2646
2641
|
throw e;
|
|
2647
2642
|
}
|
|
2648
2643
|
return keyId;
|
|
@@ -3014,7 +3009,7 @@ var NativeDocument = (function (exports) {
|
|
|
3014
3009
|
*/
|
|
3015
3010
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
3016
3011
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
3017
|
-
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
3012
|
+
return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
3018
3013
|
}
|
|
3019
3014
|
const element = new Anchor('Show if : '+(comment || ''));
|
|
3020
3015
|
|
|
@@ -3790,7 +3785,7 @@ var NativeDocument = (function (exports) {
|
|
|
3790
3785
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
3791
3786
|
this.handleRouteChange(route, params, query, path);
|
|
3792
3787
|
} catch (e) {
|
|
3793
|
-
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
3788
|
+
DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
|
|
3794
3789
|
}
|
|
3795
3790
|
};
|
|
3796
3791
|
/**
|
|
@@ -3803,7 +3798,7 @@ var NativeDocument = (function (exports) {
|
|
|
3803
3798
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
3804
3799
|
this.handleRouteChange(route, params, {}, path);
|
|
3805
3800
|
} catch(e) {
|
|
3806
|
-
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
3801
|
+
DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
|
|
3807
3802
|
}
|
|
3808
3803
|
};
|
|
3809
3804
|
this.forward = function() {
|
|
@@ -3830,7 +3825,7 @@ var NativeDocument = (function (exports) {
|
|
|
3830
3825
|
}
|
|
3831
3826
|
this.handleRouteChange(route, params, query, path);
|
|
3832
3827
|
} catch(e) {
|
|
3833
|
-
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
3828
|
+
DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
|
|
3834
3829
|
}
|
|
3835
3830
|
});
|
|
3836
3831
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -3984,7 +3979,7 @@ var NativeDocument = (function (exports) {
|
|
|
3984
3979
|
listener(request);
|
|
3985
3980
|
next && next(request);
|
|
3986
3981
|
} catch (e) {
|
|
3987
|
-
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
3982
|
+
DebugManager$1.warn('Route Listener', 'Error in listener:', e);
|
|
3988
3983
|
}
|
|
3989
3984
|
}
|
|
3990
3985
|
};
|
|
@@ -4143,7 +4138,7 @@ var NativeDocument = (function (exports) {
|
|
|
4143
4138
|
*/
|
|
4144
4139
|
Router.create = function(options, callback) {
|
|
4145
4140
|
if(!Validator.isFunction(callback)) {
|
|
4146
|
-
DebugManager.error('Router', 'Callback must be a function', e);
|
|
4141
|
+
DebugManager$1.error('Router', 'Callback must be a function', e);
|
|
4147
4142
|
throw new RouterError('Callback must be a function');
|
|
4148
4143
|
}
|
|
4149
4144
|
const router = new Router(options);
|
|
@@ -4229,7 +4224,6 @@ var NativeDocument = (function (exports) {
|
|
|
4229
4224
|
exports.NDElement = NDElement;
|
|
4230
4225
|
exports.Observable = Observable;
|
|
4231
4226
|
exports.PluginsManager = PluginsManager;
|
|
4232
|
-
exports.Service = Service;
|
|
4233
4227
|
exports.SingletonView = SingletonView;
|
|
4234
4228
|
exports.Store = Store;
|
|
4235
4229
|
exports.TemplateCloner = TemplateCloner;
|