native-document 1.0.99 → 1.0.100
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 -23
- package/dist/native-document.dev.js +49 -50
- 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/data/ObservableItem.js +1 -1
- package/src/core/data/Store.js +1 -1
- package/src/core/utils/formatters.js +0 -1
|
@@ -363,16 +363,16 @@ var NativeComponents = (function (exports) {
|
|
|
363
363
|
// });
|
|
364
364
|
};
|
|
365
365
|
|
|
366
|
-
let DebugManager
|
|
366
|
+
let DebugManager = {};
|
|
367
367
|
{
|
|
368
|
-
DebugManager
|
|
368
|
+
DebugManager = {
|
|
369
369
|
log() {},
|
|
370
370
|
warn() {},
|
|
371
371
|
error() {},
|
|
372
372
|
disable() {}
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
var DebugManager = DebugManager
|
|
375
|
+
var DebugManager$1 = DebugManager;
|
|
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.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
860
|
+
DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
861
861
|
continue;
|
|
862
862
|
}
|
|
863
863
|
|
|
864
864
|
if (protectedMethods.has(name)) {
|
|
865
|
-
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
865
|
+
DebugManager$1.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.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
870
|
+
DebugManager$1.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.error('Anchor', 'Anchor : parent not found', child);
|
|
1053
|
+
DebugManager$1.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.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1237
|
+
DebugManager$1.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.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
1444
|
+
DebugManager$1.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.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
1457
|
+
DebugManager$1.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.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
1488
|
+
DebugManager$1.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.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
1509
|
+
DebugManager$1.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.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
1545
|
+
DebugManager$1.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.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
1568
|
+
DebugManager$1.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.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
1602
|
+
DebugManager$1.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.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
1608
|
+
DebugManager$1.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.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
1629
|
+
DebugManager$1.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.warn('Store', `Store.get('${name}') : store not found.`);
|
|
1696
|
+
DebugManager$1.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.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
1718
|
+
DebugManager$1.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.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
1820
|
+
DebugManager$1.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) {
|
|
@@ -1828,7 +1828,7 @@ var NativeComponents = (function (exports) {
|
|
|
1828
1828
|
|
|
1829
1829
|
const Store = StoreFactory();
|
|
1830
1830
|
|
|
1831
|
-
Store.create('locale', '
|
|
1831
|
+
Store.create('locale', navigator.language.split('-')[0] || 'en');
|
|
1832
1832
|
|
|
1833
1833
|
const $parseDateParts = (value, locale) => {
|
|
1834
1834
|
const d = new Date(value);
|
|
@@ -1864,7 +1864,6 @@ var NativeComponents = (function (exports) {
|
|
|
1864
1864
|
};
|
|
1865
1865
|
|
|
1866
1866
|
const Formatters = {
|
|
1867
|
-
|
|
1868
1867
|
currency: (value, locale, { currency = 'XOF', notation, minimumFractionDigits, maximumFractionDigits } = {}) =>
|
|
1869
1868
|
new Intl.NumberFormat(locale, {
|
|
1870
1869
|
style: 'currency',
|
|
@@ -2434,7 +2433,7 @@ var NativeComponents = (function (exports) {
|
|
|
2434
2433
|
}
|
|
2435
2434
|
|
|
2436
2435
|
const formatter = Formatters[type];
|
|
2437
|
-
const localeObservable =
|
|
2436
|
+
const localeObservable = Formatters.locale;
|
|
2438
2437
|
|
|
2439
2438
|
return Observable.computed(() => formatter(self.val(), localeObservable.val(), options),
|
|
2440
2439
|
[self, localeObservable]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var NativeDocument = (function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
let DebugManager
|
|
4
|
+
let DebugManager = {};
|
|
5
5
|
|
|
6
6
|
{
|
|
7
|
-
DebugManager
|
|
7
|
+
DebugManager = {
|
|
8
8
|
enabled: false,
|
|
9
9
|
|
|
10
10
|
enable() {
|
|
@@ -35,7 +35,7 @@ var NativeDocument = (function (exports) {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
}
|
|
38
|
-
var DebugManager = DebugManager
|
|
38
|
+
var DebugManager$1 = DebugManager;
|
|
39
39
|
|
|
40
40
|
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
|
|
316
|
+
let PluginsManager = null;
|
|
317
317
|
|
|
318
318
|
{
|
|
319
|
-
PluginsManager
|
|
319
|
+
PluginsManager = (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.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
|
|
385
|
+
DebugManager$1.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 = PluginsManager
|
|
394
|
+
var PluginsManager$1 = PluginsManager;
|
|
395
395
|
|
|
396
396
|
function NDElement(element) {
|
|
397
397
|
this.$element = element;
|
|
398
398
|
this.$observer = null;
|
|
399
399
|
{
|
|
400
|
-
PluginsManager.emit('NDElementCreated', element, this);
|
|
400
|
+
PluginsManager$1.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.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
575
|
+
DebugManager$1.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.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
626
|
+
DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
627
627
|
continue;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
630
|
if (protectedMethods.has(name)) {
|
|
631
|
-
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
631
|
+
DebugManager$1.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.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
636
|
+
DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
637
637
|
}
|
|
638
638
|
|
|
639
639
|
NDElement.prototype[name] = method;
|
|
640
640
|
}
|
|
641
641
|
{
|
|
642
|
-
PluginsManager.emit('NDElementExtended', methods);
|
|
642
|
+
PluginsManager$1.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.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
789
|
+
DebugManager$1.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.error('Anchor', 'Anchor : parent not found', child);
|
|
838
|
+
DebugManager$1.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.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
1036
|
+
DebugManager$1.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.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
1238
|
+
DebugManager$1.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.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
1251
|
+
DebugManager$1.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.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
1282
|
+
DebugManager$1.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.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
1303
|
+
DebugManager$1.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.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
1339
|
+
DebugManager$1.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.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
1362
|
+
DebugManager$1.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.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
1396
|
+
DebugManager$1.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.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
1402
|
+
DebugManager$1.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.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
1423
|
+
DebugManager$1.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.warn('Store', `Store.get('${name}') : store not found.`);
|
|
1490
|
+
DebugManager$1.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.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
1512
|
+
DebugManager$1.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.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
1614
|
+
DebugManager$1.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) {
|
|
@@ -1622,7 +1622,7 @@ var NativeDocument = (function (exports) {
|
|
|
1622
1622
|
|
|
1623
1623
|
const Store = StoreFactory();
|
|
1624
1624
|
|
|
1625
|
-
Store.create('locale', '
|
|
1625
|
+
Store.create('locale', navigator.language.split('-')[0] || 'en');
|
|
1626
1626
|
|
|
1627
1627
|
const $parseDateParts = (value, locale) => {
|
|
1628
1628
|
const d = new Date(value);
|
|
@@ -1658,7 +1658,6 @@ var NativeDocument = (function (exports) {
|
|
|
1658
1658
|
};
|
|
1659
1659
|
|
|
1660
1660
|
const Formatters = {
|
|
1661
|
-
|
|
1662
1661
|
currency: (value, locale, { currency = 'XOF', notation, minimumFractionDigits, maximumFractionDigits } = {}) =>
|
|
1663
1662
|
new Intl.NumberFormat(locale, {
|
|
1664
1663
|
style: 'currency',
|
|
@@ -1744,7 +1743,7 @@ var NativeDocument = (function (exports) {
|
|
|
1744
1743
|
}
|
|
1745
1744
|
}
|
|
1746
1745
|
{
|
|
1747
|
-
PluginsManager.emit('CreateObservable', this);
|
|
1746
|
+
PluginsManager$1.emit('CreateObservable', this);
|
|
1748
1747
|
}
|
|
1749
1748
|
}
|
|
1750
1749
|
|
|
@@ -1848,12 +1847,12 @@ var NativeDocument = (function (exports) {
|
|
|
1848
1847
|
this.$previousValue = this.$currentValue;
|
|
1849
1848
|
this.$currentValue = newValue;
|
|
1850
1849
|
{
|
|
1851
|
-
PluginsManager.emit('ObservableBeforeChange', this);
|
|
1850
|
+
PluginsManager$1.emit('ObservableBeforeChange', this);
|
|
1852
1851
|
}
|
|
1853
1852
|
this.trigger();
|
|
1854
1853
|
this.$previousValue = null;
|
|
1855
1854
|
{
|
|
1856
|
-
PluginsManager.emit('ObservableAfterChange', this);
|
|
1855
|
+
PluginsManager$1.emit('ObservableAfterChange', this);
|
|
1857
1856
|
}
|
|
1858
1857
|
};
|
|
1859
1858
|
|
|
@@ -1940,7 +1939,7 @@ var NativeDocument = (function (exports) {
|
|
|
1940
1939
|
ObservableItem.prototype.subscribe = function(callback) {
|
|
1941
1940
|
{
|
|
1942
1941
|
if (this.$isCleanedUp) {
|
|
1943
|
-
DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1942
|
+
DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1944
1943
|
return;
|
|
1945
1944
|
}
|
|
1946
1945
|
if (typeof callback !== 'function') {
|
|
@@ -1952,7 +1951,7 @@ var NativeDocument = (function (exports) {
|
|
|
1952
1951
|
this.$listeners.push(callback);
|
|
1953
1952
|
this.assocTrigger();
|
|
1954
1953
|
{
|
|
1955
|
-
PluginsManager.emit('ObservableSubscribe', this);
|
|
1954
|
+
PluginsManager$1.emit('ObservableSubscribe', this);
|
|
1956
1955
|
}
|
|
1957
1956
|
};
|
|
1958
1957
|
|
|
@@ -2063,7 +2062,7 @@ var NativeDocument = (function (exports) {
|
|
|
2063
2062
|
}
|
|
2064
2063
|
this.assocTrigger();
|
|
2065
2064
|
{
|
|
2066
|
-
PluginsManager.emit('ObservableUnsubscribe', this);
|
|
2065
|
+
PluginsManager$1.emit('ObservableUnsubscribe', this);
|
|
2067
2066
|
}
|
|
2068
2067
|
};
|
|
2069
2068
|
|
|
@@ -2266,7 +2265,7 @@ var NativeDocument = (function (exports) {
|
|
|
2266
2265
|
}
|
|
2267
2266
|
|
|
2268
2267
|
const formatter = Formatters[type];
|
|
2269
|
-
const localeObservable =
|
|
2268
|
+
const localeObservable = Formatters.locale;
|
|
2270
2269
|
|
|
2271
2270
|
return Observable.computed(() => formatter(self.val(), localeObservable.val(), options),
|
|
2272
2271
|
[self, localeObservable]
|
|
@@ -2541,7 +2540,7 @@ var NativeDocument = (function (exports) {
|
|
|
2541
2540
|
Function.prototype.toNdElement = function () {
|
|
2542
2541
|
const child = this;
|
|
2543
2542
|
{
|
|
2544
|
-
PluginsManager.emit('BeforeProcessComponent', child);
|
|
2543
|
+
PluginsManager$1.emit('BeforeProcessComponent', child);
|
|
2545
2544
|
}
|
|
2546
2545
|
return ElementCreator.getChild(child());
|
|
2547
2546
|
};
|
|
@@ -2729,14 +2728,14 @@ var NativeDocument = (function (exports) {
|
|
|
2729
2728
|
processChildren(children, parent) {
|
|
2730
2729
|
if(children === null) return;
|
|
2731
2730
|
{
|
|
2732
|
-
PluginsManager.emit('BeforeProcessChildren', parent);
|
|
2731
|
+
PluginsManager$1.emit('BeforeProcessChildren', parent);
|
|
2733
2732
|
}
|
|
2734
2733
|
let child = this.getChild(children);
|
|
2735
2734
|
if(child) {
|
|
2736
2735
|
parent.appendChild(child);
|
|
2737
2736
|
}
|
|
2738
2737
|
{
|
|
2739
|
-
PluginsManager.emit('AfterProcessChildren', parent);
|
|
2738
|
+
PluginsManager$1.emit('AfterProcessChildren', parent);
|
|
2740
2739
|
}
|
|
2741
2740
|
},
|
|
2742
2741
|
async safeRemove(element) {
|
|
@@ -3992,7 +3991,7 @@ var NativeDocument = (function (exports) {
|
|
|
3992
3991
|
|
|
3993
3992
|
ObservableItem.call(this, target, configs);
|
|
3994
3993
|
{
|
|
3995
|
-
PluginsManager.emit('CreateObservableArray', this);
|
|
3994
|
+
PluginsManager$1.emit('CreateObservableArray', this);
|
|
3996
3995
|
}
|
|
3997
3996
|
};
|
|
3998
3997
|
|
|
@@ -4624,7 +4623,7 @@ var NativeDocument = (function (exports) {
|
|
|
4624
4623
|
const observable = new ObservableItem(initialValue);
|
|
4625
4624
|
const updatedValue = nextTick(() => observable.set(callback()));
|
|
4626
4625
|
{
|
|
4627
|
-
PluginsManager.emit('CreateObservableComputed', observable, dependencies);
|
|
4626
|
+
PluginsManager$1.emit('CreateObservableComputed', observable, dependencies);
|
|
4628
4627
|
}
|
|
4629
4628
|
|
|
4630
4629
|
if(Validator.isFunction(dependencies)) {
|
|
@@ -4723,7 +4722,7 @@ var NativeDocument = (function (exports) {
|
|
|
4723
4722
|
}
|
|
4724
4723
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
4725
4724
|
} catch (e) {
|
|
4726
|
-
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4725
|
+
DebugManager$1.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4727
4726
|
throw e;
|
|
4728
4727
|
}
|
|
4729
4728
|
return keyId;
|
|
@@ -5093,7 +5092,7 @@ var NativeDocument = (function (exports) {
|
|
|
5093
5092
|
*/
|
|
5094
5093
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
5095
5094
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
5096
|
-
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5095
|
+
return DebugManager$1.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5097
5096
|
}
|
|
5098
5097
|
const element = Anchor('Show if : '+(comment || ''));
|
|
5099
5098
|
|
|
@@ -6512,7 +6511,7 @@ var NativeDocument = (function (exports) {
|
|
|
6512
6511
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6513
6512
|
this.handleRouteChange(route, params, query, path);
|
|
6514
6513
|
} catch (e) {
|
|
6515
|
-
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
6514
|
+
DebugManager$1.error('HistoryRouter', 'Error in pushState', e);
|
|
6516
6515
|
}
|
|
6517
6516
|
};
|
|
6518
6517
|
/**
|
|
@@ -6525,7 +6524,7 @@ var NativeDocument = (function (exports) {
|
|
|
6525
6524
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6526
6525
|
this.handleRouteChange(route, params, {}, path);
|
|
6527
6526
|
} catch(e) {
|
|
6528
|
-
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
6527
|
+
DebugManager$1.error('HistoryRouter', 'Error in replaceState', e);
|
|
6529
6528
|
}
|
|
6530
6529
|
};
|
|
6531
6530
|
this.forward = function() {
|
|
@@ -6552,7 +6551,7 @@ var NativeDocument = (function (exports) {
|
|
|
6552
6551
|
}
|
|
6553
6552
|
this.handleRouteChange(route, params, query, path);
|
|
6554
6553
|
} catch(e) {
|
|
6555
|
-
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
6554
|
+
DebugManager$1.error('HistoryRouter', 'Error in popstate event', e);
|
|
6556
6555
|
}
|
|
6557
6556
|
});
|
|
6558
6557
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -6777,7 +6776,7 @@ var NativeDocument = (function (exports) {
|
|
|
6777
6776
|
listener(request);
|
|
6778
6777
|
next && next(request);
|
|
6779
6778
|
} catch (e) {
|
|
6780
|
-
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
6779
|
+
DebugManager$1.warn('Route Listener', 'Error in listener:', e);
|
|
6781
6780
|
}
|
|
6782
6781
|
}
|
|
6783
6782
|
};
|
|
@@ -6955,7 +6954,7 @@ var NativeDocument = (function (exports) {
|
|
|
6955
6954
|
*/
|
|
6956
6955
|
Router.create = function(options, callback) {
|
|
6957
6956
|
if(!Validator.isFunction(callback)) {
|
|
6958
|
-
DebugManager.error('Router', 'Callback must be a function');
|
|
6957
|
+
DebugManager$1.error('Router', 'Callback must be a function');
|
|
6959
6958
|
throw new RouterError('Callback must be a function');
|
|
6960
6959
|
}
|
|
6961
6960
|
const router = new Router(options);
|
|
@@ -7148,7 +7147,7 @@ var NativeDocument = (function (exports) {
|
|
|
7148
7147
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
7149
7148
|
exports.NDElement = NDElement;
|
|
7150
7149
|
exports.Observable = Observable;
|
|
7151
|
-
exports.PluginsManager = PluginsManager;
|
|
7150
|
+
exports.PluginsManager = PluginsManager$1;
|
|
7152
7151
|
exports.SingletonView = SingletonView;
|
|
7153
7152
|
exports.Store = Store;
|
|
7154
7153
|
exports.StoreFactory = StoreFactory;
|