native-document 1.0.123 → 1.0.124
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.
|
@@ -363,16 +363,16 @@ var NativeComponents = (function (exports) {
|
|
|
363
363
|
// });
|
|
364
364
|
};
|
|
365
365
|
|
|
366
|
-
let DebugManager$
|
|
366
|
+
let DebugManager$2 = {};
|
|
367
367
|
{
|
|
368
|
-
DebugManager$
|
|
368
|
+
DebugManager$2 = {
|
|
369
369
|
log() {},
|
|
370
370
|
warn() {},
|
|
371
371
|
error() {},
|
|
372
372
|
disable() {}
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
var DebugManager$
|
|
375
|
+
var DebugManager$1 = DebugManager$2;
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
378
|
*
|
|
@@ -847,17 +847,17 @@ var NativeComponents = (function (exports) {
|
|
|
847
847
|
const method = methods[name];
|
|
848
848
|
|
|
849
849
|
if (typeof method !== 'function') {
|
|
850
|
-
DebugManager$
|
|
850
|
+
DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
851
851
|
continue;
|
|
852
852
|
}
|
|
853
853
|
|
|
854
854
|
if (protectedMethods.has(name)) {
|
|
855
|
-
DebugManager$
|
|
855
|
+
DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
856
856
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
if (NDElement.prototype[name]) {
|
|
860
|
-
DebugManager$
|
|
860
|
+
DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
861
861
|
}
|
|
862
862
|
|
|
863
863
|
NDElement.prototype[name] = method;
|
|
@@ -1082,7 +1082,7 @@ var NativeComponents = (function (exports) {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
1084
|
if (cleanedCount > 0) {
|
|
1085
|
-
DebugManager$
|
|
1085
|
+
DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
1088
|
};
|
|
@@ -2052,35 +2052,6 @@ var NativeComponents = (function (exports) {
|
|
|
2052
2052
|
element.setAttribute(attributeName, value.val());
|
|
2053
2053
|
};
|
|
2054
2054
|
|
|
2055
|
-
|
|
2056
|
-
const AttributeHandlers = {
|
|
2057
|
-
string: (element, attributeName, value) => element.setAttribute(attributeName, value),
|
|
2058
|
-
number: (element, attributeName, value) => element.setAttribute(attributeName, value),
|
|
2059
|
-
boolean: (element, attributeName, value) => bindBooleanAttribute(element, attributeName, value),
|
|
2060
|
-
object: (element, attributeName, value) => {
|
|
2061
|
-
if(value == null) {
|
|
2062
|
-
return;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
if(value.handleNdAttribute) {
|
|
2066
|
-
value.handleNdAttribute(element, attributeName);
|
|
2067
|
-
return;
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
if(attributeName === 'class') {
|
|
2071
|
-
bindClassAttribute(element, value);
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
if(attributeName === 'style') {
|
|
2075
|
-
bindStyleAttribute(element, value);
|
|
2076
|
-
return;
|
|
2077
|
-
}
|
|
2078
|
-
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
2079
|
-
bindBooleanAttribute(element, attributeName, value);
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
};
|
|
2083
|
-
|
|
2084
2055
|
/**
|
|
2085
2056
|
*
|
|
2086
2057
|
* @param {HTMLElement} element
|
|
@@ -2091,8 +2062,29 @@ var NativeComponents = (function (exports) {
|
|
|
2091
2062
|
for(const originalAttributeName in attributes) {
|
|
2092
2063
|
const attributeName = originalAttributeName.toLowerCase();
|
|
2093
2064
|
let value = attributes[originalAttributeName];
|
|
2094
|
-
|
|
2095
|
-
|
|
2065
|
+
if(value == null) {
|
|
2066
|
+
continue;
|
|
2067
|
+
}
|
|
2068
|
+
if(value.handleNdAttribute) {
|
|
2069
|
+
value.handleNdAttribute(element, attributeName, value);
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
2072
|
+
if(typeof value === 'object') {
|
|
2073
|
+
if(attributeName === 'class') {
|
|
2074
|
+
bindClassAttribute(element, value);
|
|
2075
|
+
continue;
|
|
2076
|
+
}
|
|
2077
|
+
if(attributeName === 'style') {
|
|
2078
|
+
bindStyleAttribute(element, value);
|
|
2079
|
+
continue;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
2083
|
+
bindBooleanAttribute(element, attributeName, value);
|
|
2084
|
+
continue;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
element.setAttribute(attributeName, value);
|
|
2096
2088
|
}
|
|
2097
2089
|
return element;
|
|
2098
2090
|
};
|
|
@@ -3948,7 +3940,7 @@ var NativeComponents = (function (exports) {
|
|
|
3948
3940
|
const $getStoreOrThrow = (method, name) => {
|
|
3949
3941
|
const item = $stores.get(name);
|
|
3950
3942
|
if (!item) {
|
|
3951
|
-
DebugManager$
|
|
3943
|
+
DebugManager$1.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
3952
3944
|
throw new NativeDocumentError(
|
|
3953
3945
|
`Store.${method}('${name}') : store not found.`
|
|
3954
3946
|
);
|
|
@@ -3961,7 +3953,7 @@ var NativeComponents = (function (exports) {
|
|
|
3961
3953
|
*/
|
|
3962
3954
|
const $applyReadOnly = (observer, name, context) => {
|
|
3963
3955
|
const readOnlyError = (method) => () => {
|
|
3964
|
-
DebugManager$
|
|
3956
|
+
DebugManager$1.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
3965
3957
|
throw new NativeDocumentError(
|
|
3966
3958
|
`Store.${context}('${name}') is read-only.`
|
|
3967
3959
|
);
|
|
@@ -3992,7 +3984,7 @@ var NativeComponents = (function (exports) {
|
|
|
3992
3984
|
*/
|
|
3993
3985
|
create(name, value) {
|
|
3994
3986
|
if ($stores.has(name)) {
|
|
3995
|
-
DebugManager$
|
|
3987
|
+
DebugManager$1.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
3996
3988
|
throw new NativeDocumentError(
|
|
3997
3989
|
`Store.create('${name}') : a store with this name already exists.`
|
|
3998
3990
|
);
|
|
@@ -4013,7 +4005,7 @@ var NativeComponents = (function (exports) {
|
|
|
4013
4005
|
*/
|
|
4014
4006
|
createResettable(name, value) {
|
|
4015
4007
|
if ($stores.has(name)) {
|
|
4016
|
-
DebugManager$
|
|
4008
|
+
DebugManager$1.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4017
4009
|
throw new NativeDocumentError(
|
|
4018
4010
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
4019
4011
|
);
|
|
@@ -4049,7 +4041,7 @@ var NativeComponents = (function (exports) {
|
|
|
4049
4041
|
*/
|
|
4050
4042
|
createComposed(name, computation, dependencies) {
|
|
4051
4043
|
if ($stores.has(name)) {
|
|
4052
|
-
DebugManager$
|
|
4044
|
+
DebugManager$1.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4053
4045
|
throw new NativeDocumentError(
|
|
4054
4046
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
4055
4047
|
);
|
|
@@ -4072,7 +4064,7 @@ var NativeComponents = (function (exports) {
|
|
|
4072
4064
|
}
|
|
4073
4065
|
const depItem = $stores.get(depName);
|
|
4074
4066
|
if (!depItem) {
|
|
4075
|
-
DebugManager$
|
|
4067
|
+
DebugManager$1.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4076
4068
|
throw new NativeDocumentError(
|
|
4077
4069
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
4078
4070
|
);
|
|
@@ -4106,13 +4098,13 @@ var NativeComponents = (function (exports) {
|
|
|
4106
4098
|
reset(name) {
|
|
4107
4099
|
const item = $getStoreOrThrow('reset', name);
|
|
4108
4100
|
if (item.composed) {
|
|
4109
|
-
DebugManager$
|
|
4101
|
+
DebugManager$1.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4110
4102
|
throw new NativeDocumentError(
|
|
4111
4103
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
4112
4104
|
);
|
|
4113
4105
|
}
|
|
4114
4106
|
if (!item.resettable) {
|
|
4115
|
-
DebugManager$
|
|
4107
|
+
DebugManager$1.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4116
4108
|
throw new NativeDocumentError(
|
|
4117
4109
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
4118
4110
|
);
|
|
@@ -4133,7 +4125,7 @@ var NativeComponents = (function (exports) {
|
|
|
4133
4125
|
const item = $getStoreOrThrow('use', name);
|
|
4134
4126
|
|
|
4135
4127
|
if (item.composed) {
|
|
4136
|
-
DebugManager$
|
|
4128
|
+
DebugManager$1.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4137
4129
|
throw new NativeDocumentError(
|
|
4138
4130
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
4139
4131
|
);
|
|
@@ -4200,7 +4192,7 @@ var NativeComponents = (function (exports) {
|
|
|
4200
4192
|
get(name) {
|
|
4201
4193
|
const item = $stores.get(name);
|
|
4202
4194
|
if (!item) {
|
|
4203
|
-
DebugManager$
|
|
4195
|
+
DebugManager$1.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4204
4196
|
return null;
|
|
4205
4197
|
}
|
|
4206
4198
|
return item.observer;
|
|
@@ -4222,7 +4214,7 @@ var NativeComponents = (function (exports) {
|
|
|
4222
4214
|
delete(name) {
|
|
4223
4215
|
const item = $stores.get(name);
|
|
4224
4216
|
if (!item) {
|
|
4225
|
-
DebugManager$
|
|
4217
|
+
DebugManager$1.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4226
4218
|
return;
|
|
4227
4219
|
}
|
|
4228
4220
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -4324,7 +4316,7 @@ var NativeComponents = (function (exports) {
|
|
|
4324
4316
|
return undefined;
|
|
4325
4317
|
},
|
|
4326
4318
|
set(target, prop, value) {
|
|
4327
|
-
DebugManager$
|
|
4319
|
+
DebugManager$1.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4328
4320
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
4329
4321
|
},
|
|
4330
4322
|
deleteProperty(target, prop) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var NativeDocument = (function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
let DebugManager$
|
|
4
|
+
let DebugManager$2 = {};
|
|
5
5
|
|
|
6
6
|
{
|
|
7
|
-
DebugManager$
|
|
7
|
+
DebugManager$2 = {
|
|
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$1 = DebugManager$2;
|
|
39
39
|
|
|
40
40
|
class NativeDocumentError extends Error {
|
|
41
41
|
constructor(message, context = {}) {
|
|
@@ -314,10 +314,10 @@ var NativeDocument = (function (exports) {
|
|
|
314
314
|
subtree: true,
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
let PluginsManager = null;
|
|
317
|
+
let PluginsManager$1 = null;
|
|
318
318
|
|
|
319
319
|
{
|
|
320
|
-
PluginsManager = (function() {
|
|
320
|
+
PluginsManager$1 = (function() {
|
|
321
321
|
|
|
322
322
|
const $plugins = new Map();
|
|
323
323
|
const $pluginByEvents = new Map();
|
|
@@ -383,7 +383,7 @@ var NativeDocument = (function (exports) {
|
|
|
383
383
|
try{
|
|
384
384
|
callback.call(plugin, ...data);
|
|
385
385
|
} catch (error) {
|
|
386
|
-
DebugManager$
|
|
386
|
+
DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
}
|
|
@@ -392,12 +392,12 @@ var NativeDocument = (function (exports) {
|
|
|
392
392
|
}());
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
-
var PluginsManager
|
|
395
|
+
var PluginsManager = PluginsManager$1;
|
|
396
396
|
|
|
397
397
|
function NDElement(element) {
|
|
398
398
|
this.$element = element;
|
|
399
399
|
{
|
|
400
|
-
PluginsManager
|
|
400
|
+
PluginsManager.emit('NDElementCreated', element, this);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
|
|
@@ -562,7 +562,7 @@ var NativeDocument = (function (exports) {
|
|
|
562
562
|
}
|
|
563
563
|
{
|
|
564
564
|
if (this[name] && !this.$localExtensions.has(name)) {
|
|
565
|
-
DebugManager$
|
|
565
|
+
DebugManager$1.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
566
566
|
}
|
|
567
567
|
this.$localExtensions.set(name, method);
|
|
568
568
|
}
|
|
@@ -613,23 +613,23 @@ var NativeDocument = (function (exports) {
|
|
|
613
613
|
const method = methods[name];
|
|
614
614
|
|
|
615
615
|
if (typeof method !== 'function') {
|
|
616
|
-
DebugManager$
|
|
616
|
+
DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
617
617
|
continue;
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
if (protectedMethods.has(name)) {
|
|
621
|
-
DebugManager$
|
|
621
|
+
DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
622
622
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
623
623
|
}
|
|
624
624
|
|
|
625
625
|
if (NDElement.prototype[name]) {
|
|
626
|
-
DebugManager$
|
|
626
|
+
DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
NDElement.prototype[name] = method;
|
|
630
630
|
}
|
|
631
631
|
{
|
|
632
|
-
PluginsManager
|
|
632
|
+
PluginsManager.emit('NDElementExtended', methods);
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
return NDElement;
|
|
@@ -780,7 +780,7 @@ var NativeDocument = (function (exports) {
|
|
|
780
780
|
const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
|
|
781
781
|
|
|
782
782
|
if (foundReserved.length > 0) {
|
|
783
|
-
DebugManager$
|
|
783
|
+
DebugManager$1.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
784
784
|
}
|
|
785
785
|
|
|
786
786
|
return attributes;
|
|
@@ -867,7 +867,7 @@ var NativeDocument = (function (exports) {
|
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
869
|
if (cleanedCount > 0) {
|
|
870
|
-
DebugManager$
|
|
870
|
+
DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
};
|
|
@@ -1178,7 +1178,7 @@ var NativeDocument = (function (exports) {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
1180
|
{
|
|
1181
|
-
PluginsManager
|
|
1181
|
+
PluginsManager.emit('CreateObservable', this);
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
@@ -1285,12 +1285,12 @@ var NativeDocument = (function (exports) {
|
|
|
1285
1285
|
this.$previousValue = this.$currentValue;
|
|
1286
1286
|
this.$currentValue = newValue;
|
|
1287
1287
|
{
|
|
1288
|
-
PluginsManager
|
|
1288
|
+
PluginsManager.emit('ObservableBeforeChange', this);
|
|
1289
1289
|
}
|
|
1290
1290
|
this.trigger($setOperation);
|
|
1291
1291
|
this.$previousValue = null;
|
|
1292
1292
|
{
|
|
1293
|
-
PluginsManager
|
|
1293
|
+
PluginsManager.emit('ObservableAfterChange', this);
|
|
1294
1294
|
}
|
|
1295
1295
|
};
|
|
1296
1296
|
|
|
@@ -1368,7 +1368,7 @@ var NativeDocument = (function (exports) {
|
|
|
1368
1368
|
ObservableItem.prototype.subscribe = function(callback) {
|
|
1369
1369
|
{
|
|
1370
1370
|
if (this.$isCleanedUp) {
|
|
1371
|
-
DebugManager$
|
|
1371
|
+
DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1372
1372
|
return;
|
|
1373
1373
|
}
|
|
1374
1374
|
if (typeof callback !== 'function') {
|
|
@@ -1380,7 +1380,7 @@ var NativeDocument = (function (exports) {
|
|
|
1380
1380
|
this.$listeners.push(callback);
|
|
1381
1381
|
this.assocTrigger();
|
|
1382
1382
|
{
|
|
1383
|
-
PluginsManager
|
|
1383
|
+
PluginsManager.emit('ObservableSubscribe', this);
|
|
1384
1384
|
}
|
|
1385
1385
|
};
|
|
1386
1386
|
|
|
@@ -1491,7 +1491,7 @@ var NativeDocument = (function (exports) {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
this.assocTrigger();
|
|
1493
1493
|
{
|
|
1494
|
-
PluginsManager
|
|
1494
|
+
PluginsManager.emit('ObservableUnsubscribe', this);
|
|
1495
1495
|
}
|
|
1496
1496
|
};
|
|
1497
1497
|
|
|
@@ -1871,35 +1871,6 @@ var NativeDocument = (function (exports) {
|
|
|
1871
1871
|
element.setAttribute(attributeName, value.val());
|
|
1872
1872
|
};
|
|
1873
1873
|
|
|
1874
|
-
|
|
1875
|
-
const AttributeHandlers = {
|
|
1876
|
-
string: (element, attributeName, value) => element.setAttribute(attributeName, value),
|
|
1877
|
-
number: (element, attributeName, value) => element.setAttribute(attributeName, value),
|
|
1878
|
-
boolean: (element, attributeName, value) => bindBooleanAttribute(element, attributeName, value),
|
|
1879
|
-
object: (element, attributeName, value) => {
|
|
1880
|
-
if(value == null) {
|
|
1881
|
-
return;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
if(value.handleNdAttribute) {
|
|
1885
|
-
value.handleNdAttribute(element, attributeName);
|
|
1886
|
-
return;
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
if(attributeName === 'class') {
|
|
1890
|
-
bindClassAttribute(element, value);
|
|
1891
|
-
return;
|
|
1892
|
-
}
|
|
1893
|
-
if(attributeName === 'style') {
|
|
1894
|
-
bindStyleAttribute(element, value);
|
|
1895
|
-
return;
|
|
1896
|
-
}
|
|
1897
|
-
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
1898
|
-
bindBooleanAttribute(element, attributeName, value);
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
};
|
|
1902
|
-
|
|
1903
1874
|
/**
|
|
1904
1875
|
*
|
|
1905
1876
|
* @param {HTMLElement} element
|
|
@@ -1914,8 +1885,29 @@ var NativeDocument = (function (exports) {
|
|
|
1914
1885
|
for(const originalAttributeName in attributes) {
|
|
1915
1886
|
const attributeName = originalAttributeName.toLowerCase();
|
|
1916
1887
|
let value = attributes[originalAttributeName];
|
|
1917
|
-
|
|
1918
|
-
|
|
1888
|
+
if(value == null) {
|
|
1889
|
+
continue;
|
|
1890
|
+
}
|
|
1891
|
+
if(value.handleNdAttribute) {
|
|
1892
|
+
value.handleNdAttribute(element, attributeName, value);
|
|
1893
|
+
continue;
|
|
1894
|
+
}
|
|
1895
|
+
if(typeof value === 'object') {
|
|
1896
|
+
if(attributeName === 'class') {
|
|
1897
|
+
bindClassAttribute(element, value);
|
|
1898
|
+
continue;
|
|
1899
|
+
}
|
|
1900
|
+
if(attributeName === 'style') {
|
|
1901
|
+
bindStyleAttribute(element, value);
|
|
1902
|
+
continue;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
1906
|
+
bindBooleanAttribute(element, attributeName, value);
|
|
1907
|
+
continue;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
element.setAttribute(attributeName, value);
|
|
1919
1911
|
}
|
|
1920
1912
|
return element;
|
|
1921
1913
|
};
|
|
@@ -1973,7 +1965,7 @@ var NativeDocument = (function (exports) {
|
|
|
1973
1965
|
Function.prototype.toNdElement = function () {
|
|
1974
1966
|
const child = this;
|
|
1975
1967
|
{
|
|
1976
|
-
PluginsManager
|
|
1968
|
+
PluginsManager.emit('BeforeProcessComponent', child);
|
|
1977
1969
|
}
|
|
1978
1970
|
return ElementCreator.getChild(child());
|
|
1979
1971
|
};
|
|
@@ -2156,14 +2148,14 @@ var NativeDocument = (function (exports) {
|
|
|
2156
2148
|
processChildren: (children, parent) => {
|
|
2157
2149
|
if(children === null) return;
|
|
2158
2150
|
{
|
|
2159
|
-
PluginsManager
|
|
2151
|
+
PluginsManager.emit('BeforeProcessChildren', parent);
|
|
2160
2152
|
}
|
|
2161
2153
|
let child = ElementCreator.getChild(children);
|
|
2162
2154
|
if(child) {
|
|
2163
2155
|
parent.appendChild(child);
|
|
2164
2156
|
}
|
|
2165
2157
|
{
|
|
2166
|
-
PluginsManager
|
|
2158
|
+
PluginsManager.emit('AfterProcessChildren', parent);
|
|
2167
2159
|
}
|
|
2168
2160
|
},
|
|
2169
2161
|
async safeRemove(element) {
|
|
@@ -3848,7 +3840,7 @@ var NativeDocument = (function (exports) {
|
|
|
3848
3840
|
|
|
3849
3841
|
ObservableItem.call(this, target, configs);
|
|
3850
3842
|
{
|
|
3851
|
-
PluginsManager
|
|
3843
|
+
PluginsManager.emit('CreateObservableArray', this);
|
|
3852
3844
|
}
|
|
3853
3845
|
};
|
|
3854
3846
|
|
|
@@ -4482,7 +4474,7 @@ var NativeDocument = (function (exports) {
|
|
|
4482
4474
|
const observable = new ObservableItem(initialValue);
|
|
4483
4475
|
const updatedValue = nextTick(() => observable.set(callback()));
|
|
4484
4476
|
{
|
|
4485
|
-
PluginsManager
|
|
4477
|
+
PluginsManager.emit('CreateObservableComputed', observable, dependencies);
|
|
4486
4478
|
}
|
|
4487
4479
|
|
|
4488
4480
|
if(Validator.isFunction(dependencies)) {
|
|
@@ -4517,7 +4509,7 @@ var NativeDocument = (function (exports) {
|
|
|
4517
4509
|
const $getStoreOrThrow = (method, name) => {
|
|
4518
4510
|
const item = $stores.get(name);
|
|
4519
4511
|
if (!item) {
|
|
4520
|
-
DebugManager$
|
|
4512
|
+
DebugManager$1.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
4521
4513
|
throw new NativeDocumentError(
|
|
4522
4514
|
`Store.${method}('${name}') : store not found.`
|
|
4523
4515
|
);
|
|
@@ -4530,7 +4522,7 @@ var NativeDocument = (function (exports) {
|
|
|
4530
4522
|
*/
|
|
4531
4523
|
const $applyReadOnly = (observer, name, context) => {
|
|
4532
4524
|
const readOnlyError = (method) => () => {
|
|
4533
|
-
DebugManager$
|
|
4525
|
+
DebugManager$1.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
4534
4526
|
throw new NativeDocumentError(
|
|
4535
4527
|
`Store.${context}('${name}') is read-only.`
|
|
4536
4528
|
);
|
|
@@ -4561,7 +4553,7 @@ var NativeDocument = (function (exports) {
|
|
|
4561
4553
|
*/
|
|
4562
4554
|
create(name, value) {
|
|
4563
4555
|
if ($stores.has(name)) {
|
|
4564
|
-
DebugManager$
|
|
4556
|
+
DebugManager$1.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
4565
4557
|
throw new NativeDocumentError(
|
|
4566
4558
|
`Store.create('${name}') : a store with this name already exists.`
|
|
4567
4559
|
);
|
|
@@ -4582,7 +4574,7 @@ var NativeDocument = (function (exports) {
|
|
|
4582
4574
|
*/
|
|
4583
4575
|
createResettable(name, value) {
|
|
4584
4576
|
if ($stores.has(name)) {
|
|
4585
|
-
DebugManager$
|
|
4577
|
+
DebugManager$1.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4586
4578
|
throw new NativeDocumentError(
|
|
4587
4579
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
4588
4580
|
);
|
|
@@ -4618,7 +4610,7 @@ var NativeDocument = (function (exports) {
|
|
|
4618
4610
|
*/
|
|
4619
4611
|
createComposed(name, computation, dependencies) {
|
|
4620
4612
|
if ($stores.has(name)) {
|
|
4621
|
-
DebugManager$
|
|
4613
|
+
DebugManager$1.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4622
4614
|
throw new NativeDocumentError(
|
|
4623
4615
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
4624
4616
|
);
|
|
@@ -4641,7 +4633,7 @@ var NativeDocument = (function (exports) {
|
|
|
4641
4633
|
}
|
|
4642
4634
|
const depItem = $stores.get(depName);
|
|
4643
4635
|
if (!depItem) {
|
|
4644
|
-
DebugManager$
|
|
4636
|
+
DebugManager$1.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4645
4637
|
throw new NativeDocumentError(
|
|
4646
4638
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
4647
4639
|
);
|
|
@@ -4675,13 +4667,13 @@ var NativeDocument = (function (exports) {
|
|
|
4675
4667
|
reset(name) {
|
|
4676
4668
|
const item = $getStoreOrThrow('reset', name);
|
|
4677
4669
|
if (item.composed) {
|
|
4678
|
-
DebugManager$
|
|
4670
|
+
DebugManager$1.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4679
4671
|
throw new NativeDocumentError(
|
|
4680
4672
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
4681
4673
|
);
|
|
4682
4674
|
}
|
|
4683
4675
|
if (!item.resettable) {
|
|
4684
|
-
DebugManager$
|
|
4676
|
+
DebugManager$1.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4685
4677
|
throw new NativeDocumentError(
|
|
4686
4678
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
4687
4679
|
);
|
|
@@ -4702,7 +4694,7 @@ var NativeDocument = (function (exports) {
|
|
|
4702
4694
|
const item = $getStoreOrThrow('use', name);
|
|
4703
4695
|
|
|
4704
4696
|
if (item.composed) {
|
|
4705
|
-
DebugManager$
|
|
4697
|
+
DebugManager$1.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4706
4698
|
throw new NativeDocumentError(
|
|
4707
4699
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
4708
4700
|
);
|
|
@@ -4769,7 +4761,7 @@ var NativeDocument = (function (exports) {
|
|
|
4769
4761
|
get(name) {
|
|
4770
4762
|
const item = $stores.get(name);
|
|
4771
4763
|
if (!item) {
|
|
4772
|
-
DebugManager$
|
|
4764
|
+
DebugManager$1.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4773
4765
|
return null;
|
|
4774
4766
|
}
|
|
4775
4767
|
return item.observer;
|
|
@@ -4791,7 +4783,7 @@ var NativeDocument = (function (exports) {
|
|
|
4791
4783
|
delete(name) {
|
|
4792
4784
|
const item = $stores.get(name);
|
|
4793
4785
|
if (!item) {
|
|
4794
|
-
DebugManager$
|
|
4786
|
+
DebugManager$1.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4795
4787
|
return;
|
|
4796
4788
|
}
|
|
4797
4789
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -4893,7 +4885,7 @@ var NativeDocument = (function (exports) {
|
|
|
4893
4885
|
return undefined;
|
|
4894
4886
|
},
|
|
4895
4887
|
set(target, prop, value) {
|
|
4896
|
-
DebugManager$
|
|
4888
|
+
DebugManager$1.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4897
4889
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
4898
4890
|
},
|
|
4899
4891
|
deleteProperty(target, prop) {
|
|
@@ -4981,7 +4973,7 @@ var NativeDocument = (function (exports) {
|
|
|
4981
4973
|
}
|
|
4982
4974
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
4983
4975
|
} catch (e) {
|
|
4984
|
-
DebugManager$
|
|
4976
|
+
DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4985
4977
|
throw e;
|
|
4986
4978
|
}
|
|
4987
4979
|
return keyId;
|
|
@@ -5354,7 +5346,7 @@ var NativeDocument = (function (exports) {
|
|
|
5354
5346
|
*/
|
|
5355
5347
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
5356
5348
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
5357
|
-
return DebugManager$
|
|
5349
|
+
return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5358
5350
|
}
|
|
5359
5351
|
const element = Anchor('Show if : '+(comment || ''));
|
|
5360
5352
|
|
|
@@ -6773,7 +6765,7 @@ var NativeDocument = (function (exports) {
|
|
|
6773
6765
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6774
6766
|
this.handleRouteChange(route, params, query, path);
|
|
6775
6767
|
} catch (e) {
|
|
6776
|
-
DebugManager$
|
|
6768
|
+
DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
|
|
6777
6769
|
}
|
|
6778
6770
|
};
|
|
6779
6771
|
/**
|
|
@@ -6786,7 +6778,7 @@ var NativeDocument = (function (exports) {
|
|
|
6786
6778
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6787
6779
|
this.handleRouteChange(route, params, {}, path);
|
|
6788
6780
|
} catch(e) {
|
|
6789
|
-
DebugManager$
|
|
6781
|
+
DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
|
|
6790
6782
|
}
|
|
6791
6783
|
};
|
|
6792
6784
|
this.forward = function() {
|
|
@@ -6813,7 +6805,7 @@ var NativeDocument = (function (exports) {
|
|
|
6813
6805
|
}
|
|
6814
6806
|
this.handleRouteChange(route, params, query, path);
|
|
6815
6807
|
} catch(e) {
|
|
6816
|
-
DebugManager$
|
|
6808
|
+
DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
|
|
6817
6809
|
}
|
|
6818
6810
|
});
|
|
6819
6811
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -7038,7 +7030,7 @@ var NativeDocument = (function (exports) {
|
|
|
7038
7030
|
listener(request);
|
|
7039
7031
|
next && next(request);
|
|
7040
7032
|
} catch (e) {
|
|
7041
|
-
DebugManager$
|
|
7033
|
+
DebugManager$1.warn('Route Listener', 'Error in listener:', e);
|
|
7042
7034
|
}
|
|
7043
7035
|
}
|
|
7044
7036
|
};
|
|
@@ -7216,7 +7208,7 @@ var NativeDocument = (function (exports) {
|
|
|
7216
7208
|
*/
|
|
7217
7209
|
Router.create = function(options, callback) {
|
|
7218
7210
|
if(!Validator.isFunction(callback)) {
|
|
7219
|
-
DebugManager$
|
|
7211
|
+
DebugManager$1.error('Router', 'Callback must be a function');
|
|
7220
7212
|
throw new RouterError('Callback must be a function');
|
|
7221
7213
|
}
|
|
7222
7214
|
const router = new Router(options);
|
|
@@ -7420,7 +7412,7 @@ var NativeDocument = (function (exports) {
|
|
|
7420
7412
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
7421
7413
|
exports.NDElement = NDElement;
|
|
7422
7414
|
exports.Observable = Observable;
|
|
7423
|
-
exports.PluginsManager = PluginsManager
|
|
7415
|
+
exports.PluginsManager = PluginsManager;
|
|
7424
7416
|
exports.SingletonView = SingletonView;
|
|
7425
7417
|
exports.Store = Store;
|
|
7426
7418
|
exports.StoreFactory = StoreFactory;
|