native-document 1.0.125 → 1.0.126
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.
- package/dist/native-document.components.min.js +22 -29
- package/dist/native-document.dev.js +52 -57
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/package.json +1 -1
- package/src/core/elements/anchor/anchor.js +3 -10
- package/src/router/RouterComponent.js +3 -1
|
@@ -363,16 +363,16 @@ var NativeComponents = (function (exports) {
|
|
|
363
363
|
// });
|
|
364
364
|
};
|
|
365
365
|
|
|
366
|
-
let DebugManager$
|
|
366
|
+
let DebugManager$1 = {};
|
|
367
367
|
{
|
|
368
|
-
DebugManager$
|
|
368
|
+
DebugManager$1 = {
|
|
369
369
|
log() {},
|
|
370
370
|
warn() {},
|
|
371
371
|
error() {},
|
|
372
372
|
disable() {}
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
var DebugManager$
|
|
375
|
+
var DebugManager$2 = DebugManager$1;
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
378
|
*
|
|
@@ -854,17 +854,17 @@ var NativeComponents = (function (exports) {
|
|
|
854
854
|
const method = methods[name];
|
|
855
855
|
|
|
856
856
|
if (typeof method !== 'function') {
|
|
857
|
-
DebugManager$
|
|
857
|
+
DebugManager$2.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
858
858
|
continue;
|
|
859
859
|
}
|
|
860
860
|
|
|
861
861
|
if (protectedMethods.has(name)) {
|
|
862
|
-
DebugManager$
|
|
862
|
+
DebugManager$2.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
863
863
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
if (NDElement.prototype[name]) {
|
|
867
|
-
DebugManager$
|
|
867
|
+
DebugManager$2.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
868
868
|
}
|
|
869
869
|
|
|
870
870
|
NDElement.prototype[name] = method;
|
|
@@ -1089,7 +1089,7 @@ var NativeComponents = (function (exports) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
1091
|
if (cleanedCount > 0) {
|
|
1092
|
-
DebugManager$
|
|
1092
|
+
DebugManager$2.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
};
|
|
@@ -2467,13 +2467,6 @@ var NativeComponents = (function (exports) {
|
|
|
2467
2467
|
function Anchor(name, isUniqueChild = false) {
|
|
2468
2468
|
const anchorFragment = new AnchorWithSentinel(name);
|
|
2469
2469
|
|
|
2470
|
-
/**
|
|
2471
|
-
* State :
|
|
2472
|
-
* 1. Not injected in the DOM
|
|
2473
|
-
* 2. Injected in the DOM and should be the only child of parent
|
|
2474
|
-
* 3. Injected in the DOM and the parent may have other children
|
|
2475
|
-
*/
|
|
2476
|
-
|
|
2477
2470
|
anchorFragment.onConnectedOnce((parent) => {
|
|
2478
2471
|
if(isUniqueChild) {
|
|
2479
2472
|
oneChildAnchorOverwriting(anchorFragment, parent);
|
|
@@ -2580,7 +2573,7 @@ var NativeComponents = (function (exports) {
|
|
|
2580
2573
|
return;
|
|
2581
2574
|
}
|
|
2582
2575
|
if(isParentUniqueChild(parent)) {
|
|
2583
|
-
anchorFragment.
|
|
2576
|
+
anchorFragment.nativeAppend.apply(anchorFragment, parent.childNodes);
|
|
2584
2577
|
parent.replaceChildren(anchorStart, anchorEnd);
|
|
2585
2578
|
return;
|
|
2586
2579
|
}
|
|
@@ -2609,11 +2602,11 @@ var NativeComponents = (function (exports) {
|
|
|
2609
2602
|
return;
|
|
2610
2603
|
}
|
|
2611
2604
|
if(isParentUniqueChild(parent)) {
|
|
2612
|
-
parent.replaceChildren(anchorStart,
|
|
2605
|
+
parent.replaceChildren(anchorStart, child, anchorEnd);
|
|
2613
2606
|
return;
|
|
2614
2607
|
}
|
|
2615
2608
|
anchorFragment.removeChildren();
|
|
2616
|
-
parent.insertBefore(
|
|
2609
|
+
parent.insertBefore(child, anchorEnd);
|
|
2617
2610
|
};
|
|
2618
2611
|
|
|
2619
2612
|
anchorFragment.setContent = anchorFragment.replaceContent;
|
|
@@ -3952,7 +3945,7 @@ var NativeComponents = (function (exports) {
|
|
|
3952
3945
|
const $getStoreOrThrow = (method, name) => {
|
|
3953
3946
|
const item = $stores.get(name);
|
|
3954
3947
|
if (!item) {
|
|
3955
|
-
DebugManager$
|
|
3948
|
+
DebugManager$2.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
3956
3949
|
throw new NativeDocumentError(
|
|
3957
3950
|
`Store.${method}('${name}') : store not found.`
|
|
3958
3951
|
);
|
|
@@ -3965,7 +3958,7 @@ var NativeComponents = (function (exports) {
|
|
|
3965
3958
|
*/
|
|
3966
3959
|
const $applyReadOnly = (observer, name, context) => {
|
|
3967
3960
|
const readOnlyError = (method) => () => {
|
|
3968
|
-
DebugManager$
|
|
3961
|
+
DebugManager$2.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
3969
3962
|
throw new NativeDocumentError(
|
|
3970
3963
|
`Store.${context}('${name}') is read-only.`
|
|
3971
3964
|
);
|
|
@@ -3996,7 +3989,7 @@ var NativeComponents = (function (exports) {
|
|
|
3996
3989
|
*/
|
|
3997
3990
|
create(name, value) {
|
|
3998
3991
|
if ($stores.has(name)) {
|
|
3999
|
-
DebugManager$
|
|
3992
|
+
DebugManager$2.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
4000
3993
|
throw new NativeDocumentError(
|
|
4001
3994
|
`Store.create('${name}') : a store with this name already exists.`
|
|
4002
3995
|
);
|
|
@@ -4017,7 +4010,7 @@ var NativeComponents = (function (exports) {
|
|
|
4017
4010
|
*/
|
|
4018
4011
|
createResettable(name, value) {
|
|
4019
4012
|
if ($stores.has(name)) {
|
|
4020
|
-
DebugManager$
|
|
4013
|
+
DebugManager$2.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4021
4014
|
throw new NativeDocumentError(
|
|
4022
4015
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
4023
4016
|
);
|
|
@@ -4053,7 +4046,7 @@ var NativeComponents = (function (exports) {
|
|
|
4053
4046
|
*/
|
|
4054
4047
|
createComposed(name, computation, dependencies) {
|
|
4055
4048
|
if ($stores.has(name)) {
|
|
4056
|
-
DebugManager$
|
|
4049
|
+
DebugManager$2.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4057
4050
|
throw new NativeDocumentError(
|
|
4058
4051
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
4059
4052
|
);
|
|
@@ -4076,7 +4069,7 @@ var NativeComponents = (function (exports) {
|
|
|
4076
4069
|
}
|
|
4077
4070
|
const depItem = $stores.get(depName);
|
|
4078
4071
|
if (!depItem) {
|
|
4079
|
-
DebugManager$
|
|
4072
|
+
DebugManager$2.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4080
4073
|
throw new NativeDocumentError(
|
|
4081
4074
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
4082
4075
|
);
|
|
@@ -4110,13 +4103,13 @@ var NativeComponents = (function (exports) {
|
|
|
4110
4103
|
reset(name) {
|
|
4111
4104
|
const item = $getStoreOrThrow('reset', name);
|
|
4112
4105
|
if (item.composed) {
|
|
4113
|
-
DebugManager$
|
|
4106
|
+
DebugManager$2.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4114
4107
|
throw new NativeDocumentError(
|
|
4115
4108
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
4116
4109
|
);
|
|
4117
4110
|
}
|
|
4118
4111
|
if (!item.resettable) {
|
|
4119
|
-
DebugManager$
|
|
4112
|
+
DebugManager$2.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4120
4113
|
throw new NativeDocumentError(
|
|
4121
4114
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
4122
4115
|
);
|
|
@@ -4137,7 +4130,7 @@ var NativeComponents = (function (exports) {
|
|
|
4137
4130
|
const item = $getStoreOrThrow('use', name);
|
|
4138
4131
|
|
|
4139
4132
|
if (item.composed) {
|
|
4140
|
-
DebugManager$
|
|
4133
|
+
DebugManager$2.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4141
4134
|
throw new NativeDocumentError(
|
|
4142
4135
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
4143
4136
|
);
|
|
@@ -4204,7 +4197,7 @@ var NativeComponents = (function (exports) {
|
|
|
4204
4197
|
get(name) {
|
|
4205
4198
|
const item = $stores.get(name);
|
|
4206
4199
|
if (!item) {
|
|
4207
|
-
DebugManager$
|
|
4200
|
+
DebugManager$2.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4208
4201
|
return null;
|
|
4209
4202
|
}
|
|
4210
4203
|
return item.observer;
|
|
@@ -4226,7 +4219,7 @@ var NativeComponents = (function (exports) {
|
|
|
4226
4219
|
delete(name) {
|
|
4227
4220
|
const item = $stores.get(name);
|
|
4228
4221
|
if (!item) {
|
|
4229
|
-
DebugManager$
|
|
4222
|
+
DebugManager$2.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4230
4223
|
return;
|
|
4231
4224
|
}
|
|
4232
4225
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -4328,7 +4321,7 @@ var NativeComponents = (function (exports) {
|
|
|
4328
4321
|
return undefined;
|
|
4329
4322
|
},
|
|
4330
4323
|
set(target, prop, value) {
|
|
4331
|
-
DebugManager$
|
|
4324
|
+
DebugManager$2.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4332
4325
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
4333
4326
|
},
|
|
4334
4327
|
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$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$2 = DebugManager$1;
|
|
39
39
|
|
|
40
40
|
class NativeDocumentError extends Error {
|
|
41
41
|
constructor(message, context = {}) {
|
|
@@ -321,10 +321,10 @@ var NativeDocument = (function (exports) {
|
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
|
|
324
|
-
let PluginsManager
|
|
324
|
+
let PluginsManager = null;
|
|
325
325
|
|
|
326
326
|
{
|
|
327
|
-
PluginsManager
|
|
327
|
+
PluginsManager = (function() {
|
|
328
328
|
|
|
329
329
|
const $plugins = new Map();
|
|
330
330
|
const $pluginByEvents = new Map();
|
|
@@ -390,7 +390,7 @@ var NativeDocument = (function (exports) {
|
|
|
390
390
|
try{
|
|
391
391
|
callback.call(plugin, ...data);
|
|
392
392
|
} catch (error) {
|
|
393
|
-
DebugManager$
|
|
393
|
+
DebugManager$2.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
}
|
|
@@ -399,12 +399,12 @@ var NativeDocument = (function (exports) {
|
|
|
399
399
|
}());
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
var PluginsManager = PluginsManager
|
|
402
|
+
var PluginsManager$1 = PluginsManager;
|
|
403
403
|
|
|
404
404
|
function NDElement(element) {
|
|
405
405
|
this.$element = element;
|
|
406
406
|
{
|
|
407
|
-
PluginsManager.emit('NDElementCreated', element, this);
|
|
407
|
+
PluginsManager$1.emit('NDElementCreated', element, this);
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
|
|
@@ -569,7 +569,7 @@ var NativeDocument = (function (exports) {
|
|
|
569
569
|
}
|
|
570
570
|
{
|
|
571
571
|
if (this[name] && !this.$localExtensions.has(name)) {
|
|
572
|
-
DebugManager$
|
|
572
|
+
DebugManager$2.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
573
573
|
}
|
|
574
574
|
this.$localExtensions.set(name, method);
|
|
575
575
|
}
|
|
@@ -620,23 +620,23 @@ var NativeDocument = (function (exports) {
|
|
|
620
620
|
const method = methods[name];
|
|
621
621
|
|
|
622
622
|
if (typeof method !== 'function') {
|
|
623
|
-
DebugManager$
|
|
623
|
+
DebugManager$2.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
624
624
|
continue;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
627
|
if (protectedMethods.has(name)) {
|
|
628
|
-
DebugManager$
|
|
628
|
+
DebugManager$2.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
629
629
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
630
630
|
}
|
|
631
631
|
|
|
632
632
|
if (NDElement.prototype[name]) {
|
|
633
|
-
DebugManager$
|
|
633
|
+
DebugManager$2.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
NDElement.prototype[name] = method;
|
|
637
637
|
}
|
|
638
638
|
{
|
|
639
|
-
PluginsManager.emit('NDElementExtended', methods);
|
|
639
|
+
PluginsManager$1.emit('NDElementExtended', methods);
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
return NDElement;
|
|
@@ -787,7 +787,7 @@ var NativeDocument = (function (exports) {
|
|
|
787
787
|
const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
|
|
788
788
|
|
|
789
789
|
if (foundReserved.length > 0) {
|
|
790
|
-
DebugManager$
|
|
790
|
+
DebugManager$2.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
791
791
|
}
|
|
792
792
|
|
|
793
793
|
return attributes;
|
|
@@ -874,7 +874,7 @@ var NativeDocument = (function (exports) {
|
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
876
|
if (cleanedCount > 0) {
|
|
877
|
-
DebugManager$
|
|
877
|
+
DebugManager$2.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
};
|
|
@@ -1185,7 +1185,7 @@ var NativeDocument = (function (exports) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
1187
|
{
|
|
1188
|
-
PluginsManager.emit('CreateObservable', this);
|
|
1188
|
+
PluginsManager$1.emit('CreateObservable', this);
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
1191
|
|
|
@@ -1292,12 +1292,12 @@ var NativeDocument = (function (exports) {
|
|
|
1292
1292
|
this.$previousValue = this.$currentValue;
|
|
1293
1293
|
this.$currentValue = newValue;
|
|
1294
1294
|
{
|
|
1295
|
-
PluginsManager.emit('ObservableBeforeChange', this);
|
|
1295
|
+
PluginsManager$1.emit('ObservableBeforeChange', this);
|
|
1296
1296
|
}
|
|
1297
1297
|
this.trigger($setOperation);
|
|
1298
1298
|
this.$previousValue = null;
|
|
1299
1299
|
{
|
|
1300
|
-
PluginsManager.emit('ObservableAfterChange', this);
|
|
1300
|
+
PluginsManager$1.emit('ObservableAfterChange', this);
|
|
1301
1301
|
}
|
|
1302
1302
|
};
|
|
1303
1303
|
|
|
@@ -1375,7 +1375,7 @@ var NativeDocument = (function (exports) {
|
|
|
1375
1375
|
ObservableItem.prototype.subscribe = function(callback) {
|
|
1376
1376
|
{
|
|
1377
1377
|
if (this.$isCleanedUp) {
|
|
1378
|
-
DebugManager$
|
|
1378
|
+
DebugManager$2.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1379
1379
|
return;
|
|
1380
1380
|
}
|
|
1381
1381
|
if (typeof callback !== 'function') {
|
|
@@ -1387,7 +1387,7 @@ var NativeDocument = (function (exports) {
|
|
|
1387
1387
|
this.$listeners.push(callback);
|
|
1388
1388
|
this.assocTrigger();
|
|
1389
1389
|
{
|
|
1390
|
-
PluginsManager.emit('ObservableSubscribe', this);
|
|
1390
|
+
PluginsManager$1.emit('ObservableSubscribe', this);
|
|
1391
1391
|
}
|
|
1392
1392
|
};
|
|
1393
1393
|
|
|
@@ -1498,7 +1498,7 @@ var NativeDocument = (function (exports) {
|
|
|
1498
1498
|
}
|
|
1499
1499
|
this.assocTrigger();
|
|
1500
1500
|
{
|
|
1501
|
-
PluginsManager.emit('ObservableUnsubscribe', this);
|
|
1501
|
+
PluginsManager$1.emit('ObservableUnsubscribe', this);
|
|
1502
1502
|
}
|
|
1503
1503
|
};
|
|
1504
1504
|
|
|
@@ -1972,7 +1972,7 @@ var NativeDocument = (function (exports) {
|
|
|
1972
1972
|
Function.prototype.toNdElement = function () {
|
|
1973
1973
|
const child = this;
|
|
1974
1974
|
{
|
|
1975
|
-
PluginsManager.emit('BeforeProcessComponent', child);
|
|
1975
|
+
PluginsManager$1.emit('BeforeProcessComponent', child);
|
|
1976
1976
|
}
|
|
1977
1977
|
return ElementCreator.getChild(child());
|
|
1978
1978
|
};
|
|
@@ -2155,14 +2155,14 @@ var NativeDocument = (function (exports) {
|
|
|
2155
2155
|
processChildren: (children, parent) => {
|
|
2156
2156
|
if(children === null) return;
|
|
2157
2157
|
{
|
|
2158
|
-
PluginsManager.emit('BeforeProcessChildren', parent);
|
|
2158
|
+
PluginsManager$1.emit('BeforeProcessChildren', parent);
|
|
2159
2159
|
}
|
|
2160
2160
|
let child = ElementCreator.getChild(children);
|
|
2161
2161
|
if(child) {
|
|
2162
2162
|
parent.appendChild(child);
|
|
2163
2163
|
}
|
|
2164
2164
|
{
|
|
2165
|
-
PluginsManager.emit('AfterProcessChildren', parent);
|
|
2165
|
+
PluginsManager$1.emit('AfterProcessChildren', parent);
|
|
2166
2166
|
}
|
|
2167
2167
|
},
|
|
2168
2168
|
async safeRemove(element) {
|
|
@@ -2313,13 +2313,6 @@ var NativeDocument = (function (exports) {
|
|
|
2313
2313
|
function Anchor(name, isUniqueChild = false) {
|
|
2314
2314
|
const anchorFragment = new AnchorWithSentinel(name);
|
|
2315
2315
|
|
|
2316
|
-
/**
|
|
2317
|
-
* State :
|
|
2318
|
-
* 1. Not injected in the DOM
|
|
2319
|
-
* 2. Injected in the DOM and should be the only child of parent
|
|
2320
|
-
* 3. Injected in the DOM and the parent may have other children
|
|
2321
|
-
*/
|
|
2322
|
-
|
|
2323
2316
|
anchorFragment.onConnectedOnce((parent) => {
|
|
2324
2317
|
if(isUniqueChild) {
|
|
2325
2318
|
oneChildAnchorOverwriting(anchorFragment, parent);
|
|
@@ -2426,7 +2419,7 @@ var NativeDocument = (function (exports) {
|
|
|
2426
2419
|
return;
|
|
2427
2420
|
}
|
|
2428
2421
|
if(isParentUniqueChild(parent)) {
|
|
2429
|
-
anchorFragment.
|
|
2422
|
+
anchorFragment.nativeAppend.apply(anchorFragment, parent.childNodes);
|
|
2430
2423
|
parent.replaceChildren(anchorStart, anchorEnd);
|
|
2431
2424
|
return;
|
|
2432
2425
|
}
|
|
@@ -2455,11 +2448,11 @@ var NativeDocument = (function (exports) {
|
|
|
2455
2448
|
return;
|
|
2456
2449
|
}
|
|
2457
2450
|
if(isParentUniqueChild(parent)) {
|
|
2458
|
-
parent.replaceChildren(anchorStart,
|
|
2451
|
+
parent.replaceChildren(anchorStart, child, anchorEnd);
|
|
2459
2452
|
return;
|
|
2460
2453
|
}
|
|
2461
2454
|
anchorFragment.removeChildren();
|
|
2462
|
-
parent.insertBefore(
|
|
2455
|
+
parent.insertBefore(child, anchorEnd);
|
|
2463
2456
|
};
|
|
2464
2457
|
|
|
2465
2458
|
anchorFragment.setContent = anchorFragment.replaceContent;
|
|
@@ -3852,7 +3845,7 @@ var NativeDocument = (function (exports) {
|
|
|
3852
3845
|
|
|
3853
3846
|
ObservableItem.call(this, target, configs);
|
|
3854
3847
|
{
|
|
3855
|
-
PluginsManager.emit('CreateObservableArray', this);
|
|
3848
|
+
PluginsManager$1.emit('CreateObservableArray', this);
|
|
3856
3849
|
}
|
|
3857
3850
|
};
|
|
3858
3851
|
|
|
@@ -4486,7 +4479,7 @@ var NativeDocument = (function (exports) {
|
|
|
4486
4479
|
const observable = new ObservableItem(initialValue);
|
|
4487
4480
|
const updatedValue = nextTick(() => observable.set(callback()));
|
|
4488
4481
|
{
|
|
4489
|
-
PluginsManager.emit('CreateObservableComputed', observable, dependencies);
|
|
4482
|
+
PluginsManager$1.emit('CreateObservableComputed', observable, dependencies);
|
|
4490
4483
|
}
|
|
4491
4484
|
|
|
4492
4485
|
if(Validator.isFunction(dependencies)) {
|
|
@@ -4521,7 +4514,7 @@ var NativeDocument = (function (exports) {
|
|
|
4521
4514
|
const $getStoreOrThrow = (method, name) => {
|
|
4522
4515
|
const item = $stores.get(name);
|
|
4523
4516
|
if (!item) {
|
|
4524
|
-
DebugManager$
|
|
4517
|
+
DebugManager$2.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
4525
4518
|
throw new NativeDocumentError(
|
|
4526
4519
|
`Store.${method}('${name}') : store not found.`
|
|
4527
4520
|
);
|
|
@@ -4534,7 +4527,7 @@ var NativeDocument = (function (exports) {
|
|
|
4534
4527
|
*/
|
|
4535
4528
|
const $applyReadOnly = (observer, name, context) => {
|
|
4536
4529
|
const readOnlyError = (method) => () => {
|
|
4537
|
-
DebugManager$
|
|
4530
|
+
DebugManager$2.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
4538
4531
|
throw new NativeDocumentError(
|
|
4539
4532
|
`Store.${context}('${name}') is read-only.`
|
|
4540
4533
|
);
|
|
@@ -4565,7 +4558,7 @@ var NativeDocument = (function (exports) {
|
|
|
4565
4558
|
*/
|
|
4566
4559
|
create(name, value) {
|
|
4567
4560
|
if ($stores.has(name)) {
|
|
4568
|
-
DebugManager$
|
|
4561
|
+
DebugManager$2.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
4569
4562
|
throw new NativeDocumentError(
|
|
4570
4563
|
`Store.create('${name}') : a store with this name already exists.`
|
|
4571
4564
|
);
|
|
@@ -4586,7 +4579,7 @@ var NativeDocument = (function (exports) {
|
|
|
4586
4579
|
*/
|
|
4587
4580
|
createResettable(name, value) {
|
|
4588
4581
|
if ($stores.has(name)) {
|
|
4589
|
-
DebugManager$
|
|
4582
|
+
DebugManager$2.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4590
4583
|
throw new NativeDocumentError(
|
|
4591
4584
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
4592
4585
|
);
|
|
@@ -4622,7 +4615,7 @@ var NativeDocument = (function (exports) {
|
|
|
4622
4615
|
*/
|
|
4623
4616
|
createComposed(name, computation, dependencies) {
|
|
4624
4617
|
if ($stores.has(name)) {
|
|
4625
|
-
DebugManager$
|
|
4618
|
+
DebugManager$2.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4626
4619
|
throw new NativeDocumentError(
|
|
4627
4620
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
4628
4621
|
);
|
|
@@ -4645,7 +4638,7 @@ var NativeDocument = (function (exports) {
|
|
|
4645
4638
|
}
|
|
4646
4639
|
const depItem = $stores.get(depName);
|
|
4647
4640
|
if (!depItem) {
|
|
4648
|
-
DebugManager$
|
|
4641
|
+
DebugManager$2.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4649
4642
|
throw new NativeDocumentError(
|
|
4650
4643
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
4651
4644
|
);
|
|
@@ -4679,13 +4672,13 @@ var NativeDocument = (function (exports) {
|
|
|
4679
4672
|
reset(name) {
|
|
4680
4673
|
const item = $getStoreOrThrow('reset', name);
|
|
4681
4674
|
if (item.composed) {
|
|
4682
|
-
DebugManager$
|
|
4675
|
+
DebugManager$2.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4683
4676
|
throw new NativeDocumentError(
|
|
4684
4677
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
4685
4678
|
);
|
|
4686
4679
|
}
|
|
4687
4680
|
if (!item.resettable) {
|
|
4688
|
-
DebugManager$
|
|
4681
|
+
DebugManager$2.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4689
4682
|
throw new NativeDocumentError(
|
|
4690
4683
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
4691
4684
|
);
|
|
@@ -4706,7 +4699,7 @@ var NativeDocument = (function (exports) {
|
|
|
4706
4699
|
const item = $getStoreOrThrow('use', name);
|
|
4707
4700
|
|
|
4708
4701
|
if (item.composed) {
|
|
4709
|
-
DebugManager$
|
|
4702
|
+
DebugManager$2.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4710
4703
|
throw new NativeDocumentError(
|
|
4711
4704
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
4712
4705
|
);
|
|
@@ -4773,7 +4766,7 @@ var NativeDocument = (function (exports) {
|
|
|
4773
4766
|
get(name) {
|
|
4774
4767
|
const item = $stores.get(name);
|
|
4775
4768
|
if (!item) {
|
|
4776
|
-
DebugManager$
|
|
4769
|
+
DebugManager$2.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4777
4770
|
return null;
|
|
4778
4771
|
}
|
|
4779
4772
|
return item.observer;
|
|
@@ -4795,7 +4788,7 @@ var NativeDocument = (function (exports) {
|
|
|
4795
4788
|
delete(name) {
|
|
4796
4789
|
const item = $stores.get(name);
|
|
4797
4790
|
if (!item) {
|
|
4798
|
-
DebugManager$
|
|
4791
|
+
DebugManager$2.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4799
4792
|
return;
|
|
4800
4793
|
}
|
|
4801
4794
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -4897,7 +4890,7 @@ var NativeDocument = (function (exports) {
|
|
|
4897
4890
|
return undefined;
|
|
4898
4891
|
},
|
|
4899
4892
|
set(target, prop, value) {
|
|
4900
|
-
DebugManager$
|
|
4893
|
+
DebugManager$2.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4901
4894
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
4902
4895
|
},
|
|
4903
4896
|
deleteProperty(target, prop) {
|
|
@@ -4985,7 +4978,7 @@ var NativeDocument = (function (exports) {
|
|
|
4985
4978
|
}
|
|
4986
4979
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
4987
4980
|
} catch (e) {
|
|
4988
|
-
DebugManager$
|
|
4981
|
+
DebugManager$2.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4989
4982
|
throw e;
|
|
4990
4983
|
}
|
|
4991
4984
|
return keyId;
|
|
@@ -5355,7 +5348,7 @@ var NativeDocument = (function (exports) {
|
|
|
5355
5348
|
*/
|
|
5356
5349
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
5357
5350
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
5358
|
-
return DebugManager$
|
|
5351
|
+
return DebugManager$2.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5359
5352
|
}
|
|
5360
5353
|
const element = Anchor('Show if : '+(comment || ''));
|
|
5361
5354
|
|
|
@@ -6774,7 +6767,7 @@ var NativeDocument = (function (exports) {
|
|
|
6774
6767
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6775
6768
|
this.handleRouteChange(route, params, query, path);
|
|
6776
6769
|
} catch (e) {
|
|
6777
|
-
DebugManager$
|
|
6770
|
+
DebugManager$2.error('HistoryRouter', 'Error in pushState', e);
|
|
6778
6771
|
}
|
|
6779
6772
|
};
|
|
6780
6773
|
/**
|
|
@@ -6787,7 +6780,7 @@ var NativeDocument = (function (exports) {
|
|
|
6787
6780
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6788
6781
|
this.handleRouteChange(route, params, {}, path);
|
|
6789
6782
|
} catch(e) {
|
|
6790
|
-
DebugManager$
|
|
6783
|
+
DebugManager$2.error('HistoryRouter', 'Error in replaceState', e);
|
|
6791
6784
|
}
|
|
6792
6785
|
};
|
|
6793
6786
|
this.forward = function() {
|
|
@@ -6814,7 +6807,7 @@ var NativeDocument = (function (exports) {
|
|
|
6814
6807
|
}
|
|
6815
6808
|
this.handleRouteChange(route, params, query, path);
|
|
6816
6809
|
} catch(e) {
|
|
6817
|
-
DebugManager$
|
|
6810
|
+
DebugManager$2.error('HistoryRouter', 'Error in popstate event', e);
|
|
6818
6811
|
}
|
|
6819
6812
|
});
|
|
6820
6813
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -6919,7 +6912,6 @@ var NativeDocument = (function (exports) {
|
|
|
6919
6912
|
anchor = Anchor(path);
|
|
6920
6913
|
anchor.appendChild(node);
|
|
6921
6914
|
}
|
|
6922
|
-
console.log(anchor);
|
|
6923
6915
|
$routeInstanceAnchors.set(node, anchor);
|
|
6924
6916
|
return anchor;
|
|
6925
6917
|
};
|
|
@@ -6955,10 +6947,12 @@ var NativeDocument = (function (exports) {
|
|
|
6955
6947
|
if(cachedLayout === $currentLayout) {
|
|
6956
6948
|
const layoutAnchor = getNodeAnchorForLayout(nodeToInsert, path);
|
|
6957
6949
|
removeLastNodeInserted();
|
|
6950
|
+
$lastNodeInserted = nodeToInsert;
|
|
6958
6951
|
layoutAnchor.replaceContent(nodeToInsert);
|
|
6959
6952
|
return;
|
|
6960
6953
|
}
|
|
6961
6954
|
cleanContainer();
|
|
6955
|
+
$lastNodeInserted = nodeToInsert;
|
|
6962
6956
|
$currentLayout = cachedLayout;
|
|
6963
6957
|
const layoutAnchor = getNodeAnchorForLayout(nodeToInsert, path);
|
|
6964
6958
|
layoutAnchor.replaceContent(nodeToInsert);
|
|
@@ -6966,6 +6960,7 @@ var NativeDocument = (function (exports) {
|
|
|
6966
6960
|
return;
|
|
6967
6961
|
}
|
|
6968
6962
|
cleanContainer();
|
|
6963
|
+
$lastNodeInserted = nodeToInsert;
|
|
6969
6964
|
const anchor = getNodeAnchorForLayout(nodeToInsert, path);
|
|
6970
6965
|
|
|
6971
6966
|
$currentLayout = ElementCreator.getChild(layout(anchor));
|
|
@@ -7041,7 +7036,7 @@ var NativeDocument = (function (exports) {
|
|
|
7041
7036
|
listener(request);
|
|
7042
7037
|
next && next(request);
|
|
7043
7038
|
} catch (e) {
|
|
7044
|
-
DebugManager$
|
|
7039
|
+
DebugManager$2.warn('Route Listener', 'Error in listener:', e);
|
|
7045
7040
|
}
|
|
7046
7041
|
}
|
|
7047
7042
|
};
|
|
@@ -7219,7 +7214,7 @@ var NativeDocument = (function (exports) {
|
|
|
7219
7214
|
*/
|
|
7220
7215
|
Router.create = function(options, callback) {
|
|
7221
7216
|
if(!Validator.isFunction(callback)) {
|
|
7222
|
-
DebugManager$
|
|
7217
|
+
DebugManager$2.error('Router', 'Callback must be a function');
|
|
7223
7218
|
throw new RouterError('Callback must be a function');
|
|
7224
7219
|
}
|
|
7225
7220
|
const router = new Router(options);
|
|
@@ -7423,7 +7418,7 @@ var NativeDocument = (function (exports) {
|
|
|
7423
7418
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
7424
7419
|
exports.NDElement = NDElement;
|
|
7425
7420
|
exports.Observable = Observable;
|
|
7426
|
-
exports.PluginsManager = PluginsManager;
|
|
7421
|
+
exports.PluginsManager = PluginsManager$1;
|
|
7427
7422
|
exports.SingletonView = SingletonView;
|
|
7428
7423
|
exports.Store = Store;
|
|
7429
7424
|
exports.StoreFactory = StoreFactory;
|