native-document 1.0.67 → 1.0.68
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$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
|
|
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
|
|
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
|
|
210
|
+
DebugManager.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -459,7 +459,7 @@ var NativeDocument = (function (exports) {
|
|
|
459
459
|
ObservableItem.prototype.subscribe = function(callback, target = null) {
|
|
460
460
|
this.$listeners = this.$listeners ?? [];
|
|
461
461
|
if (this.$isCleanedUp) {
|
|
462
|
-
DebugManager
|
|
462
|
+
DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
463
463
|
return () => {};
|
|
464
464
|
}
|
|
465
465
|
if (typeof callback !== 'function') {
|
|
@@ -597,7 +597,6 @@ var NativeDocument = (function (exports) {
|
|
|
597
597
|
},
|
|
598
598
|
checkMutation: function(mutationsList) {
|
|
599
599
|
for(const mutation of mutationsList) {
|
|
600
|
-
console.log({ mutation });
|
|
601
600
|
if(DocumentObserver.mountedSupposedSize > 0 ) {
|
|
602
601
|
for(const node of mutation.addedNodes) {
|
|
603
602
|
DocumentObserver.executeMountedCallback(node);
|
|
@@ -1001,7 +1000,7 @@ var NativeDocument = (function (exports) {
|
|
|
1001
1000
|
}
|
|
1002
1001
|
{
|
|
1003
1002
|
if (this[name] && !this.$localExtensions.has(name)) {
|
|
1004
|
-
DebugManager
|
|
1003
|
+
DebugManager.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
1005
1004
|
}
|
|
1006
1005
|
this.$localExtensions.set(name, method);
|
|
1007
1006
|
}
|
|
@@ -1035,17 +1034,17 @@ var NativeDocument = (function (exports) {
|
|
|
1035
1034
|
const method = methods[name];
|
|
1036
1035
|
|
|
1037
1036
|
if (typeof method !== 'function') {
|
|
1038
|
-
DebugManager
|
|
1037
|
+
DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
1039
1038
|
continue;
|
|
1040
1039
|
}
|
|
1041
1040
|
|
|
1042
1041
|
if (protectedMethods.has(name)) {
|
|
1043
|
-
DebugManager
|
|
1042
|
+
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
1044
1043
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
1045
1044
|
}
|
|
1046
1045
|
|
|
1047
1046
|
if (NDElement.prototype[name]) {
|
|
1048
|
-
DebugManager
|
|
1047
|
+
DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
1049
1048
|
}
|
|
1050
1049
|
|
|
1051
1050
|
NDElement.prototype[name] = method;
|
|
@@ -1191,7 +1190,7 @@ var NativeDocument = (function (exports) {
|
|
|
1191
1190
|
const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
|
|
1192
1191
|
|
|
1193
1192
|
if (foundReserved.length > 0) {
|
|
1194
|
-
DebugManager
|
|
1193
|
+
DebugManager.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
1195
1194
|
}
|
|
1196
1195
|
|
|
1197
1196
|
return attributes;
|
|
@@ -1239,7 +1238,7 @@ var NativeDocument = (function (exports) {
|
|
|
1239
1238
|
element.appendChild = function(child, before = null) {
|
|
1240
1239
|
const parent = anchorEnd.parentNode;
|
|
1241
1240
|
if(!parent) {
|
|
1242
|
-
DebugManager
|
|
1241
|
+
DebugManager.error('Anchor', 'Anchor : parent not found', child);
|
|
1243
1242
|
return;
|
|
1244
1243
|
}
|
|
1245
1244
|
before = before ?? anchorEnd;
|
|
@@ -2823,7 +2822,7 @@ var NativeDocument = (function (exports) {
|
|
|
2823
2822
|
}
|
|
2824
2823
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
2825
2824
|
} catch (e) {
|
|
2826
|
-
DebugManager
|
|
2825
|
+
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
2827
2826
|
throw e;
|
|
2828
2827
|
}
|
|
2829
2828
|
return keyId;
|
|
@@ -3195,7 +3194,7 @@ var NativeDocument = (function (exports) {
|
|
|
3195
3194
|
*/
|
|
3196
3195
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
3197
3196
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
3198
|
-
return DebugManager
|
|
3197
|
+
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
3199
3198
|
}
|
|
3200
3199
|
const element = Anchor('Show if : '+(comment || ''));
|
|
3201
3200
|
|
|
@@ -3982,7 +3981,7 @@ var NativeDocument = (function (exports) {
|
|
|
3982
3981
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
3983
3982
|
this.handleRouteChange(route, params, query, path);
|
|
3984
3983
|
} catch (e) {
|
|
3985
|
-
DebugManager
|
|
3984
|
+
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
3986
3985
|
}
|
|
3987
3986
|
};
|
|
3988
3987
|
/**
|
|
@@ -3995,7 +3994,7 @@ var NativeDocument = (function (exports) {
|
|
|
3995
3994
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
3996
3995
|
this.handleRouteChange(route, params, {}, path);
|
|
3997
3996
|
} catch(e) {
|
|
3998
|
-
DebugManager
|
|
3997
|
+
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
3999
3998
|
}
|
|
4000
3999
|
};
|
|
4001
4000
|
this.forward = function() {
|
|
@@ -4022,7 +4021,7 @@ var NativeDocument = (function (exports) {
|
|
|
4022
4021
|
}
|
|
4023
4022
|
this.handleRouteChange(route, params, query, path);
|
|
4024
4023
|
} catch(e) {
|
|
4025
|
-
DebugManager
|
|
4024
|
+
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
4026
4025
|
}
|
|
4027
4026
|
});
|
|
4028
4027
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -4176,7 +4175,7 @@ var NativeDocument = (function (exports) {
|
|
|
4176
4175
|
listener(request);
|
|
4177
4176
|
next && next(request);
|
|
4178
4177
|
} catch (e) {
|
|
4179
|
-
DebugManager
|
|
4178
|
+
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
4180
4179
|
}
|
|
4181
4180
|
}
|
|
4182
4181
|
};
|
|
@@ -4335,7 +4334,7 @@ var NativeDocument = (function (exports) {
|
|
|
4335
4334
|
*/
|
|
4336
4335
|
Router.create = function(options, callback) {
|
|
4337
4336
|
if(!Validator.isFunction(callback)) {
|
|
4338
|
-
DebugManager
|
|
4337
|
+
DebugManager.error('Router', 'Callback must be a function', e);
|
|
4339
4338
|
throw new RouterError('Callback must be a function');
|
|
4340
4339
|
}
|
|
4341
4340
|
const router = new Router(options);
|