native-document 1.0.100 → 1.0.102
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 +20 -20
- package/dist/native-document.dev.js +50 -49
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/index.d.ts +2 -3
- package/index.js +1 -0
- package/package.json +2 -2
- package/router.d.ts +7 -0
- package/src/router/Route.js +2 -2
- package/types/localStorage.ts +102 -0
- package/types/service.d.ts +1 -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 = DebugManager$1;
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
378
|
*
|
|
@@ -857,17 +857,17 @@ var NativeComponents = (function (exports) {
|
|
|
857
857
|
const method = methods[name];
|
|
858
858
|
|
|
859
859
|
if (typeof method !== 'function') {
|
|
860
|
-
DebugManager
|
|
860
|
+
DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
861
861
|
continue;
|
|
862
862
|
}
|
|
863
863
|
|
|
864
864
|
if (protectedMethods.has(name)) {
|
|
865
|
-
DebugManager
|
|
865
|
+
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
866
866
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
867
867
|
}
|
|
868
868
|
|
|
869
869
|
if (NDElement.prototype[name]) {
|
|
870
|
-
DebugManager
|
|
870
|
+
DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
871
871
|
}
|
|
872
872
|
|
|
873
873
|
NDElement.prototype[name] = method;
|
|
@@ -1050,7 +1050,7 @@ var NativeComponents = (function (exports) {
|
|
|
1050
1050
|
anchorFragment.appendChild = function(child, before = null) {
|
|
1051
1051
|
const parent = anchorEnd.parentNode;
|
|
1052
1052
|
if(!parent) {
|
|
1053
|
-
DebugManager
|
|
1053
|
+
DebugManager.error('Anchor', 'Anchor : parent not found', child);
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
1056
|
before = before ?? anchorEnd;
|
|
@@ -1234,7 +1234,7 @@ var NativeComponents = (function (exports) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
1236
|
if (cleanedCount > 0) {
|
|
1237
|
-
DebugManager
|
|
1237
|
+
DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1238
1238
|
}
|
|
1239
1239
|
}
|
|
1240
1240
|
};
|
|
@@ -1441,7 +1441,7 @@ var NativeComponents = (function (exports) {
|
|
|
1441
1441
|
const $getStoreOrThrow = (method, name) => {
|
|
1442
1442
|
const item = $stores.get(name);
|
|
1443
1443
|
if (!item) {
|
|
1444
|
-
DebugManager
|
|
1444
|
+
DebugManager.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
1445
1445
|
throw new NativeDocumentError(
|
|
1446
1446
|
`Store.${method}('${name}') : store not found.`
|
|
1447
1447
|
);
|
|
@@ -1454,7 +1454,7 @@ var NativeComponents = (function (exports) {
|
|
|
1454
1454
|
*/
|
|
1455
1455
|
const $applyReadOnly = (observer, name, context) => {
|
|
1456
1456
|
const readOnlyError = (method) => () => {
|
|
1457
|
-
DebugManager
|
|
1457
|
+
DebugManager.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
1458
1458
|
throw new NativeDocumentError(
|
|
1459
1459
|
`Store.${context}('${name}') is read-only.`
|
|
1460
1460
|
);
|
|
@@ -1485,7 +1485,7 @@ var NativeComponents = (function (exports) {
|
|
|
1485
1485
|
*/
|
|
1486
1486
|
create(name, value) {
|
|
1487
1487
|
if ($stores.has(name)) {
|
|
1488
|
-
DebugManager
|
|
1488
|
+
DebugManager.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
1489
1489
|
throw new NativeDocumentError(
|
|
1490
1490
|
`Store.create('${name}') : a store with this name already exists.`
|
|
1491
1491
|
);
|
|
@@ -1506,7 +1506,7 @@ var NativeComponents = (function (exports) {
|
|
|
1506
1506
|
*/
|
|
1507
1507
|
createResettable(name, value) {
|
|
1508
1508
|
if ($stores.has(name)) {
|
|
1509
|
-
DebugManager
|
|
1509
|
+
DebugManager.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
1510
1510
|
throw new NativeDocumentError(
|
|
1511
1511
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
1512
1512
|
);
|
|
@@ -1542,7 +1542,7 @@ var NativeComponents = (function (exports) {
|
|
|
1542
1542
|
*/
|
|
1543
1543
|
createComposed(name, computation, dependencies) {
|
|
1544
1544
|
if ($stores.has(name)) {
|
|
1545
|
-
DebugManager
|
|
1545
|
+
DebugManager.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
1546
1546
|
throw new NativeDocumentError(
|
|
1547
1547
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
1548
1548
|
);
|
|
@@ -1565,7 +1565,7 @@ var NativeComponents = (function (exports) {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
const depItem = $stores.get(depName);
|
|
1567
1567
|
if (!depItem) {
|
|
1568
|
-
DebugManager
|
|
1568
|
+
DebugManager.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
1569
1569
|
throw new NativeDocumentError(
|
|
1570
1570
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
1571
1571
|
);
|
|
@@ -1599,13 +1599,13 @@ var NativeComponents = (function (exports) {
|
|
|
1599
1599
|
reset(name) {
|
|
1600
1600
|
const item = $getStoreOrThrow('reset', name);
|
|
1601
1601
|
if (item.composed) {
|
|
1602
|
-
DebugManager
|
|
1602
|
+
DebugManager.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
1603
1603
|
throw new NativeDocumentError(
|
|
1604
1604
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
1605
1605
|
);
|
|
1606
1606
|
}
|
|
1607
1607
|
if (!item.resettable) {
|
|
1608
|
-
DebugManager
|
|
1608
|
+
DebugManager.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
1609
1609
|
throw new NativeDocumentError(
|
|
1610
1610
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
1611
1611
|
);
|
|
@@ -1626,7 +1626,7 @@ var NativeComponents = (function (exports) {
|
|
|
1626
1626
|
const item = $getStoreOrThrow('use', name);
|
|
1627
1627
|
|
|
1628
1628
|
if (item.composed) {
|
|
1629
|
-
DebugManager
|
|
1629
|
+
DebugManager.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
1630
1630
|
throw new NativeDocumentError(
|
|
1631
1631
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
1632
1632
|
);
|
|
@@ -1693,7 +1693,7 @@ var NativeComponents = (function (exports) {
|
|
|
1693
1693
|
get(name) {
|
|
1694
1694
|
const item = $stores.get(name);
|
|
1695
1695
|
if (!item) {
|
|
1696
|
-
DebugManager
|
|
1696
|
+
DebugManager.warn('Store', `Store.get('${name}') : store not found.`);
|
|
1697
1697
|
return null;
|
|
1698
1698
|
}
|
|
1699
1699
|
return item.observer;
|
|
@@ -1715,7 +1715,7 @@ var NativeComponents = (function (exports) {
|
|
|
1715
1715
|
delete(name) {
|
|
1716
1716
|
const item = $stores.get(name);
|
|
1717
1717
|
if (!item) {
|
|
1718
|
-
DebugManager
|
|
1718
|
+
DebugManager.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
1719
1719
|
return;
|
|
1720
1720
|
}
|
|
1721
1721
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -1817,7 +1817,7 @@ var NativeComponents = (function (exports) {
|
|
|
1817
1817
|
return undefined;
|
|
1818
1818
|
},
|
|
1819
1819
|
set(target, prop, value) {
|
|
1820
|
-
DebugManager
|
|
1820
|
+
DebugManager.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
1821
1821
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
1822
1822
|
},
|
|
1823
1823
|
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 = DebugManager$1;
|
|
39
39
|
|
|
40
40
|
class NativeDocumentError extends Error {
|
|
41
41
|
constructor(message, context = {}) {
|
|
@@ -313,10 +313,10 @@ var NativeDocument = (function (exports) {
|
|
|
313
313
|
subtree: true,
|
|
314
314
|
});
|
|
315
315
|
|
|
316
|
-
let PluginsManager = null;
|
|
316
|
+
let PluginsManager$1 = null;
|
|
317
317
|
|
|
318
318
|
{
|
|
319
|
-
PluginsManager = (function() {
|
|
319
|
+
PluginsManager$1 = (function() {
|
|
320
320
|
|
|
321
321
|
const $plugins = new Map();
|
|
322
322
|
const $pluginByEvents = new Map();
|
|
@@ -382,7 +382,7 @@ var NativeDocument = (function (exports) {
|
|
|
382
382
|
try{
|
|
383
383
|
callback.call(plugin, ...data);
|
|
384
384
|
} catch (error) {
|
|
385
|
-
DebugManager
|
|
385
|
+
DebugManager.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
@@ -391,13 +391,13 @@ var NativeDocument = (function (exports) {
|
|
|
391
391
|
}());
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
var PluginsManager
|
|
394
|
+
var PluginsManager = PluginsManager$1;
|
|
395
395
|
|
|
396
396
|
function NDElement(element) {
|
|
397
397
|
this.$element = element;
|
|
398
398
|
this.$observer = null;
|
|
399
399
|
{
|
|
400
|
-
PluginsManager
|
|
400
|
+
PluginsManager.emit('NDElementCreated', element, this);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
|
|
@@ -572,7 +572,7 @@ var NativeDocument = (function (exports) {
|
|
|
572
572
|
}
|
|
573
573
|
{
|
|
574
574
|
if (this[name] && !this.$localExtensions.has(name)) {
|
|
575
|
-
DebugManager
|
|
575
|
+
DebugManager.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
576
576
|
}
|
|
577
577
|
this.$localExtensions.set(name, method);
|
|
578
578
|
}
|
|
@@ -623,23 +623,23 @@ var NativeDocument = (function (exports) {
|
|
|
623
623
|
const method = methods[name];
|
|
624
624
|
|
|
625
625
|
if (typeof method !== 'function') {
|
|
626
|
-
DebugManager
|
|
626
|
+
DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
627
627
|
continue;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
630
|
if (protectedMethods.has(name)) {
|
|
631
|
-
DebugManager
|
|
631
|
+
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
632
632
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
if (NDElement.prototype[name]) {
|
|
636
|
-
DebugManager
|
|
636
|
+
DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
637
637
|
}
|
|
638
638
|
|
|
639
639
|
NDElement.prototype[name] = method;
|
|
640
640
|
}
|
|
641
641
|
{
|
|
642
|
-
PluginsManager
|
|
642
|
+
PluginsManager.emit('NDElementExtended', methods);
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
return NDElement;
|
|
@@ -786,7 +786,7 @@ var NativeDocument = (function (exports) {
|
|
|
786
786
|
const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
|
|
787
787
|
|
|
788
788
|
if (foundReserved.length > 0) {
|
|
789
|
-
DebugManager
|
|
789
|
+
DebugManager.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
return attributes;
|
|
@@ -835,7 +835,7 @@ var NativeDocument = (function (exports) {
|
|
|
835
835
|
anchorFragment.appendChild = function(child, before = null) {
|
|
836
836
|
const parent = anchorEnd.parentNode;
|
|
837
837
|
if(!parent) {
|
|
838
|
-
DebugManager
|
|
838
|
+
DebugManager.error('Anchor', 'Anchor : parent not found', child);
|
|
839
839
|
return;
|
|
840
840
|
}
|
|
841
841
|
before = before ?? anchorEnd;
|
|
@@ -1033,7 +1033,7 @@ var NativeDocument = (function (exports) {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
1035
1035
|
if (cleanedCount > 0) {
|
|
1036
|
-
DebugManager
|
|
1036
|
+
DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
};
|
|
@@ -1235,7 +1235,7 @@ var NativeDocument = (function (exports) {
|
|
|
1235
1235
|
const $getStoreOrThrow = (method, name) => {
|
|
1236
1236
|
const item = $stores.get(name);
|
|
1237
1237
|
if (!item) {
|
|
1238
|
-
DebugManager
|
|
1238
|
+
DebugManager.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
1239
1239
|
throw new NativeDocumentError(
|
|
1240
1240
|
`Store.${method}('${name}') : store not found.`
|
|
1241
1241
|
);
|
|
@@ -1248,7 +1248,7 @@ var NativeDocument = (function (exports) {
|
|
|
1248
1248
|
*/
|
|
1249
1249
|
const $applyReadOnly = (observer, name, context) => {
|
|
1250
1250
|
const readOnlyError = (method) => () => {
|
|
1251
|
-
DebugManager
|
|
1251
|
+
DebugManager.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
1252
1252
|
throw new NativeDocumentError(
|
|
1253
1253
|
`Store.${context}('${name}') is read-only.`
|
|
1254
1254
|
);
|
|
@@ -1279,7 +1279,7 @@ var NativeDocument = (function (exports) {
|
|
|
1279
1279
|
*/
|
|
1280
1280
|
create(name, value) {
|
|
1281
1281
|
if ($stores.has(name)) {
|
|
1282
|
-
DebugManager
|
|
1282
|
+
DebugManager.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
1283
1283
|
throw new NativeDocumentError(
|
|
1284
1284
|
`Store.create('${name}') : a store with this name already exists.`
|
|
1285
1285
|
);
|
|
@@ -1300,7 +1300,7 @@ var NativeDocument = (function (exports) {
|
|
|
1300
1300
|
*/
|
|
1301
1301
|
createResettable(name, value) {
|
|
1302
1302
|
if ($stores.has(name)) {
|
|
1303
|
-
DebugManager
|
|
1303
|
+
DebugManager.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
1304
1304
|
throw new NativeDocumentError(
|
|
1305
1305
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
1306
1306
|
);
|
|
@@ -1336,7 +1336,7 @@ var NativeDocument = (function (exports) {
|
|
|
1336
1336
|
*/
|
|
1337
1337
|
createComposed(name, computation, dependencies) {
|
|
1338
1338
|
if ($stores.has(name)) {
|
|
1339
|
-
DebugManager
|
|
1339
|
+
DebugManager.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
1340
1340
|
throw new NativeDocumentError(
|
|
1341
1341
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
1342
1342
|
);
|
|
@@ -1359,7 +1359,7 @@ var NativeDocument = (function (exports) {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
const depItem = $stores.get(depName);
|
|
1361
1361
|
if (!depItem) {
|
|
1362
|
-
DebugManager
|
|
1362
|
+
DebugManager.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
1363
1363
|
throw new NativeDocumentError(
|
|
1364
1364
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
1365
1365
|
);
|
|
@@ -1393,13 +1393,13 @@ var NativeDocument = (function (exports) {
|
|
|
1393
1393
|
reset(name) {
|
|
1394
1394
|
const item = $getStoreOrThrow('reset', name);
|
|
1395
1395
|
if (item.composed) {
|
|
1396
|
-
DebugManager
|
|
1396
|
+
DebugManager.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
1397
1397
|
throw new NativeDocumentError(
|
|
1398
1398
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
1399
1399
|
);
|
|
1400
1400
|
}
|
|
1401
1401
|
if (!item.resettable) {
|
|
1402
|
-
DebugManager
|
|
1402
|
+
DebugManager.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
1403
1403
|
throw new NativeDocumentError(
|
|
1404
1404
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
1405
1405
|
);
|
|
@@ -1420,7 +1420,7 @@ var NativeDocument = (function (exports) {
|
|
|
1420
1420
|
const item = $getStoreOrThrow('use', name);
|
|
1421
1421
|
|
|
1422
1422
|
if (item.composed) {
|
|
1423
|
-
DebugManager
|
|
1423
|
+
DebugManager.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
1424
1424
|
throw new NativeDocumentError(
|
|
1425
1425
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
1426
1426
|
);
|
|
@@ -1487,7 +1487,7 @@ var NativeDocument = (function (exports) {
|
|
|
1487
1487
|
get(name) {
|
|
1488
1488
|
const item = $stores.get(name);
|
|
1489
1489
|
if (!item) {
|
|
1490
|
-
DebugManager
|
|
1490
|
+
DebugManager.warn('Store', `Store.get('${name}') : store not found.`);
|
|
1491
1491
|
return null;
|
|
1492
1492
|
}
|
|
1493
1493
|
return item.observer;
|
|
@@ -1509,7 +1509,7 @@ var NativeDocument = (function (exports) {
|
|
|
1509
1509
|
delete(name) {
|
|
1510
1510
|
const item = $stores.get(name);
|
|
1511
1511
|
if (!item) {
|
|
1512
|
-
DebugManager
|
|
1512
|
+
DebugManager.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
1513
1513
|
return;
|
|
1514
1514
|
}
|
|
1515
1515
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -1611,7 +1611,7 @@ var NativeDocument = (function (exports) {
|
|
|
1611
1611
|
return undefined;
|
|
1612
1612
|
},
|
|
1613
1613
|
set(target, prop, value) {
|
|
1614
|
-
DebugManager
|
|
1614
|
+
DebugManager.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
1615
1615
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
1616
1616
|
},
|
|
1617
1617
|
deleteProperty(target, prop) {
|
|
@@ -1743,7 +1743,7 @@ var NativeDocument = (function (exports) {
|
|
|
1743
1743
|
}
|
|
1744
1744
|
}
|
|
1745
1745
|
{
|
|
1746
|
-
PluginsManager
|
|
1746
|
+
PluginsManager.emit('CreateObservable', this);
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
1749
|
|
|
@@ -1847,12 +1847,12 @@ var NativeDocument = (function (exports) {
|
|
|
1847
1847
|
this.$previousValue = this.$currentValue;
|
|
1848
1848
|
this.$currentValue = newValue;
|
|
1849
1849
|
{
|
|
1850
|
-
PluginsManager
|
|
1850
|
+
PluginsManager.emit('ObservableBeforeChange', this);
|
|
1851
1851
|
}
|
|
1852
1852
|
this.trigger();
|
|
1853
1853
|
this.$previousValue = null;
|
|
1854
1854
|
{
|
|
1855
|
-
PluginsManager
|
|
1855
|
+
PluginsManager.emit('ObservableAfterChange', this);
|
|
1856
1856
|
}
|
|
1857
1857
|
};
|
|
1858
1858
|
|
|
@@ -1939,7 +1939,7 @@ var NativeDocument = (function (exports) {
|
|
|
1939
1939
|
ObservableItem.prototype.subscribe = function(callback) {
|
|
1940
1940
|
{
|
|
1941
1941
|
if (this.$isCleanedUp) {
|
|
1942
|
-
DebugManager
|
|
1942
|
+
DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1943
1943
|
return;
|
|
1944
1944
|
}
|
|
1945
1945
|
if (typeof callback !== 'function') {
|
|
@@ -1951,7 +1951,7 @@ var NativeDocument = (function (exports) {
|
|
|
1951
1951
|
this.$listeners.push(callback);
|
|
1952
1952
|
this.assocTrigger();
|
|
1953
1953
|
{
|
|
1954
|
-
PluginsManager
|
|
1954
|
+
PluginsManager.emit('ObservableSubscribe', this);
|
|
1955
1955
|
}
|
|
1956
1956
|
};
|
|
1957
1957
|
|
|
@@ -2062,7 +2062,7 @@ var NativeDocument = (function (exports) {
|
|
|
2062
2062
|
}
|
|
2063
2063
|
this.assocTrigger();
|
|
2064
2064
|
{
|
|
2065
|
-
PluginsManager
|
|
2065
|
+
PluginsManager.emit('ObservableUnsubscribe', this);
|
|
2066
2066
|
}
|
|
2067
2067
|
};
|
|
2068
2068
|
|
|
@@ -2540,7 +2540,7 @@ var NativeDocument = (function (exports) {
|
|
|
2540
2540
|
Function.prototype.toNdElement = function () {
|
|
2541
2541
|
const child = this;
|
|
2542
2542
|
{
|
|
2543
|
-
PluginsManager
|
|
2543
|
+
PluginsManager.emit('BeforeProcessComponent', child);
|
|
2544
2544
|
}
|
|
2545
2545
|
return ElementCreator.getChild(child());
|
|
2546
2546
|
};
|
|
@@ -2728,14 +2728,14 @@ var NativeDocument = (function (exports) {
|
|
|
2728
2728
|
processChildren(children, parent) {
|
|
2729
2729
|
if(children === null) return;
|
|
2730
2730
|
{
|
|
2731
|
-
PluginsManager
|
|
2731
|
+
PluginsManager.emit('BeforeProcessChildren', parent);
|
|
2732
2732
|
}
|
|
2733
2733
|
let child = this.getChild(children);
|
|
2734
2734
|
if(child) {
|
|
2735
2735
|
parent.appendChild(child);
|
|
2736
2736
|
}
|
|
2737
2737
|
{
|
|
2738
|
-
PluginsManager
|
|
2738
|
+
PluginsManager.emit('AfterProcessChildren', parent);
|
|
2739
2739
|
}
|
|
2740
2740
|
},
|
|
2741
2741
|
async safeRemove(element) {
|
|
@@ -3991,7 +3991,7 @@ var NativeDocument = (function (exports) {
|
|
|
3991
3991
|
|
|
3992
3992
|
ObservableItem.call(this, target, configs);
|
|
3993
3993
|
{
|
|
3994
|
-
PluginsManager
|
|
3994
|
+
PluginsManager.emit('CreateObservableArray', this);
|
|
3995
3995
|
}
|
|
3996
3996
|
};
|
|
3997
3997
|
|
|
@@ -4623,7 +4623,7 @@ var NativeDocument = (function (exports) {
|
|
|
4623
4623
|
const observable = new ObservableItem(initialValue);
|
|
4624
4624
|
const updatedValue = nextTick(() => observable.set(callback()));
|
|
4625
4625
|
{
|
|
4626
|
-
PluginsManager
|
|
4626
|
+
PluginsManager.emit('CreateObservableComputed', observable, dependencies);
|
|
4627
4627
|
}
|
|
4628
4628
|
|
|
4629
4629
|
if(Validator.isFunction(dependencies)) {
|
|
@@ -4722,7 +4722,7 @@ var NativeDocument = (function (exports) {
|
|
|
4722
4722
|
}
|
|
4723
4723
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
4724
4724
|
} catch (e) {
|
|
4725
|
-
DebugManager
|
|
4725
|
+
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4726
4726
|
throw e;
|
|
4727
4727
|
}
|
|
4728
4728
|
return keyId;
|
|
@@ -5092,7 +5092,7 @@ var NativeDocument = (function (exports) {
|
|
|
5092
5092
|
*/
|
|
5093
5093
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
5094
5094
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
5095
|
-
return DebugManager
|
|
5095
|
+
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5096
5096
|
}
|
|
5097
5097
|
const element = Anchor('Show if : '+(comment || ''));
|
|
5098
5098
|
|
|
@@ -6317,13 +6317,13 @@ var NativeDocument = (function (exports) {
|
|
|
6317
6317
|
*
|
|
6318
6318
|
* @param {string} path
|
|
6319
6319
|
*/
|
|
6320
|
-
this.match = function(path)
|
|
6320
|
+
this.match = function(path) {
|
|
6321
6321
|
path = '/'+trim(path, '/');
|
|
6322
6322
|
const match = getPattern().exec(path);
|
|
6323
6323
|
if(!match) return false;
|
|
6324
6324
|
const params = {};
|
|
6325
6325
|
|
|
6326
|
-
|
|
6326
|
+
match.forEach((value, index) => {
|
|
6327
6327
|
if(index < 1) return;
|
|
6328
6328
|
const name = $paramsNames[index - 1];
|
|
6329
6329
|
params[name] = value;
|
|
@@ -6511,7 +6511,7 @@ var NativeDocument = (function (exports) {
|
|
|
6511
6511
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6512
6512
|
this.handleRouteChange(route, params, query, path);
|
|
6513
6513
|
} catch (e) {
|
|
6514
|
-
DebugManager
|
|
6514
|
+
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
6515
6515
|
}
|
|
6516
6516
|
};
|
|
6517
6517
|
/**
|
|
@@ -6524,7 +6524,7 @@ var NativeDocument = (function (exports) {
|
|
|
6524
6524
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6525
6525
|
this.handleRouteChange(route, params, {}, path);
|
|
6526
6526
|
} catch(e) {
|
|
6527
|
-
DebugManager
|
|
6527
|
+
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
6528
6528
|
}
|
|
6529
6529
|
};
|
|
6530
6530
|
this.forward = function() {
|
|
@@ -6551,7 +6551,7 @@ var NativeDocument = (function (exports) {
|
|
|
6551
6551
|
}
|
|
6552
6552
|
this.handleRouteChange(route, params, query, path);
|
|
6553
6553
|
} catch(e) {
|
|
6554
|
-
DebugManager
|
|
6554
|
+
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
6555
6555
|
}
|
|
6556
6556
|
});
|
|
6557
6557
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -6776,7 +6776,7 @@ var NativeDocument = (function (exports) {
|
|
|
6776
6776
|
listener(request);
|
|
6777
6777
|
next && next(request);
|
|
6778
6778
|
} catch (e) {
|
|
6779
|
-
DebugManager
|
|
6779
|
+
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
6780
6780
|
}
|
|
6781
6781
|
}
|
|
6782
6782
|
};
|
|
@@ -6954,7 +6954,7 @@ var NativeDocument = (function (exports) {
|
|
|
6954
6954
|
*/
|
|
6955
6955
|
Router.create = function(options, callback) {
|
|
6956
6956
|
if(!Validator.isFunction(callback)) {
|
|
6957
|
-
DebugManager
|
|
6957
|
+
DebugManager.error('Router', 'Callback must be a function');
|
|
6958
6958
|
throw new RouterError('Callback must be a function');
|
|
6959
6959
|
}
|
|
6960
6960
|
const router = new Router(options);
|
|
@@ -7145,9 +7145,10 @@ var NativeDocument = (function (exports) {
|
|
|
7145
7145
|
exports.$ = $;
|
|
7146
7146
|
exports.ElementCreator = ElementCreator;
|
|
7147
7147
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
7148
|
+
exports.LocalStorage = LocalStorage;
|
|
7148
7149
|
exports.NDElement = NDElement;
|
|
7149
7150
|
exports.Observable = Observable;
|
|
7150
|
-
exports.PluginsManager = PluginsManager
|
|
7151
|
+
exports.PluginsManager = PluginsManager;
|
|
7151
7152
|
exports.SingletonView = SingletonView;
|
|
7152
7153
|
exports.Store = Store;
|
|
7153
7154
|
exports.StoreFactory = StoreFactory;
|