native-document 1.0.116 → 1.0.117
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 +5 -12
- package/dist/native-document.dev.js +59 -68
- 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/wrappers/prototypes/bind-class-extensions.js +1 -2
- package/src/core/wrappers/template-cloner/NodeCloner.js +5 -12
- package/src/core/wrappers/template-cloner/TemplateCloner.js +4 -6
|
@@ -3324,9 +3324,10 @@ var NativeComponents = (function (exports) {
|
|
|
3324
3324
|
}
|
|
3325
3325
|
|
|
3326
3326
|
const stepsCount = steps.length;
|
|
3327
|
+
const $element = this.$element;
|
|
3327
3328
|
|
|
3328
|
-
this.cloneNode =
|
|
3329
|
-
const clonedNode =
|
|
3329
|
+
this.cloneNode = (data) => {
|
|
3330
|
+
const clonedNode = $element.cloneNode(false);
|
|
3330
3331
|
for(let i = 0; i < stepsCount; i++) {
|
|
3331
3332
|
steps[i](clonedNode, data);
|
|
3332
3333
|
}
|
|
@@ -3338,14 +3339,6 @@ var NativeComponents = (function (exports) {
|
|
|
3338
3339
|
return this.$element.cloneNode(false);
|
|
3339
3340
|
};
|
|
3340
3341
|
|
|
3341
|
-
NodeCloner.prototype.cloneTextNodeByProperty = function(data) {
|
|
3342
|
-
return createTextNode(data[0][this.$content]);
|
|
3343
|
-
};
|
|
3344
|
-
|
|
3345
|
-
NodeCloner.prototype.cloneTextNodeByCallback = function(data) {
|
|
3346
|
-
return createTextNode(this.$content.apply(null, data));
|
|
3347
|
-
};
|
|
3348
|
-
|
|
3349
3342
|
NodeCloner.prototype.attach = function(methodName, callback) {
|
|
3350
3343
|
this.$ndMethods = this.$ndMethods || {};
|
|
3351
3344
|
this.$ndMethods[methodName] = callback;
|
|
@@ -3355,10 +3348,10 @@ var NativeComponents = (function (exports) {
|
|
|
3355
3348
|
NodeCloner.prototype.text = function(value) {
|
|
3356
3349
|
this.$content = value;
|
|
3357
3350
|
if(typeof value === 'function') {
|
|
3358
|
-
this.cloneNode =
|
|
3351
|
+
this.cloneNode = (data) => createTextNode(value.apply(null, data));
|
|
3359
3352
|
return this;
|
|
3360
3353
|
}
|
|
3361
|
-
this.cloneNode =
|
|
3354
|
+
this.cloneNode = (data) => createTextNode(data[0][value]);
|
|
3362
3355
|
return this;
|
|
3363
3356
|
};
|
|
3364
3357
|
|
|
@@ -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,12 +391,12 @@ 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
|
{
|
|
399
|
-
PluginsManager
|
|
399
|
+
PluginsManager.emit('NDElementCreated', element, this);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
@@ -561,7 +561,7 @@ var NativeDocument = (function (exports) {
|
|
|
561
561
|
}
|
|
562
562
|
{
|
|
563
563
|
if (this[name] && !this.$localExtensions.has(name)) {
|
|
564
|
-
DebugManager
|
|
564
|
+
DebugManager.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
565
565
|
}
|
|
566
566
|
this.$localExtensions.set(name, method);
|
|
567
567
|
}
|
|
@@ -612,23 +612,23 @@ var NativeDocument = (function (exports) {
|
|
|
612
612
|
const method = methods[name];
|
|
613
613
|
|
|
614
614
|
if (typeof method !== 'function') {
|
|
615
|
-
DebugManager
|
|
615
|
+
DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
616
616
|
continue;
|
|
617
617
|
}
|
|
618
618
|
|
|
619
619
|
if (protectedMethods.has(name)) {
|
|
620
|
-
DebugManager
|
|
620
|
+
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
621
621
|
throw new NativeDocumentError(`Cannot override protected method "${name}"`);
|
|
622
622
|
}
|
|
623
623
|
|
|
624
624
|
if (NDElement.prototype[name]) {
|
|
625
|
-
DebugManager
|
|
625
|
+
DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
626
626
|
}
|
|
627
627
|
|
|
628
628
|
NDElement.prototype[name] = method;
|
|
629
629
|
}
|
|
630
630
|
{
|
|
631
|
-
PluginsManager
|
|
631
|
+
PluginsManager.emit('NDElementExtended', methods);
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
return NDElement;
|
|
@@ -779,7 +779,7 @@ var NativeDocument = (function (exports) {
|
|
|
779
779
|
const foundReserved = Object.keys(attributes).filter(key => reserved.includes(key));
|
|
780
780
|
|
|
781
781
|
if (foundReserved.length > 0) {
|
|
782
|
-
DebugManager
|
|
782
|
+
DebugManager.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
783
783
|
}
|
|
784
784
|
|
|
785
785
|
return attributes;
|
|
@@ -866,7 +866,7 @@ var NativeDocument = (function (exports) {
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
if (cleanedCount > 0) {
|
|
869
|
-
DebugManager
|
|
869
|
+
DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
872
|
};
|
|
@@ -1068,7 +1068,7 @@ var NativeDocument = (function (exports) {
|
|
|
1068
1068
|
const $getStoreOrThrow = (method, name) => {
|
|
1069
1069
|
const item = $stores.get(name);
|
|
1070
1070
|
if (!item) {
|
|
1071
|
-
DebugManager
|
|
1071
|
+
DebugManager.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
1072
1072
|
throw new NativeDocumentError(
|
|
1073
1073
|
`Store.${method}('${name}') : store not found.`
|
|
1074
1074
|
);
|
|
@@ -1081,7 +1081,7 @@ var NativeDocument = (function (exports) {
|
|
|
1081
1081
|
*/
|
|
1082
1082
|
const $applyReadOnly = (observer, name, context) => {
|
|
1083
1083
|
const readOnlyError = (method) => () => {
|
|
1084
|
-
DebugManager
|
|
1084
|
+
DebugManager.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
1085
1085
|
throw new NativeDocumentError(
|
|
1086
1086
|
`Store.${context}('${name}') is read-only.`
|
|
1087
1087
|
);
|
|
@@ -1112,7 +1112,7 @@ var NativeDocument = (function (exports) {
|
|
|
1112
1112
|
*/
|
|
1113
1113
|
create(name, value) {
|
|
1114
1114
|
if ($stores.has(name)) {
|
|
1115
|
-
DebugManager
|
|
1115
|
+
DebugManager.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
1116
1116
|
throw new NativeDocumentError(
|
|
1117
1117
|
`Store.create('${name}') : a store with this name already exists.`
|
|
1118
1118
|
);
|
|
@@ -1133,7 +1133,7 @@ var NativeDocument = (function (exports) {
|
|
|
1133
1133
|
*/
|
|
1134
1134
|
createResettable(name, value) {
|
|
1135
1135
|
if ($stores.has(name)) {
|
|
1136
|
-
DebugManager
|
|
1136
|
+
DebugManager.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
1137
1137
|
throw new NativeDocumentError(
|
|
1138
1138
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
1139
1139
|
);
|
|
@@ -1169,7 +1169,7 @@ var NativeDocument = (function (exports) {
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
createComposed(name, computation, dependencies) {
|
|
1171
1171
|
if ($stores.has(name)) {
|
|
1172
|
-
DebugManager
|
|
1172
|
+
DebugManager.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
1173
1173
|
throw new NativeDocumentError(
|
|
1174
1174
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
1175
1175
|
);
|
|
@@ -1192,7 +1192,7 @@ var NativeDocument = (function (exports) {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
const depItem = $stores.get(depName);
|
|
1194
1194
|
if (!depItem) {
|
|
1195
|
-
DebugManager
|
|
1195
|
+
DebugManager.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
1196
1196
|
throw new NativeDocumentError(
|
|
1197
1197
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
1198
1198
|
);
|
|
@@ -1226,13 +1226,13 @@ var NativeDocument = (function (exports) {
|
|
|
1226
1226
|
reset(name) {
|
|
1227
1227
|
const item = $getStoreOrThrow('reset', name);
|
|
1228
1228
|
if (item.composed) {
|
|
1229
|
-
DebugManager
|
|
1229
|
+
DebugManager.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
1230
1230
|
throw new NativeDocumentError(
|
|
1231
1231
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
1232
1232
|
);
|
|
1233
1233
|
}
|
|
1234
1234
|
if (!item.resettable) {
|
|
1235
|
-
DebugManager
|
|
1235
|
+
DebugManager.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
1236
1236
|
throw new NativeDocumentError(
|
|
1237
1237
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
1238
1238
|
);
|
|
@@ -1253,7 +1253,7 @@ var NativeDocument = (function (exports) {
|
|
|
1253
1253
|
const item = $getStoreOrThrow('use', name);
|
|
1254
1254
|
|
|
1255
1255
|
if (item.composed) {
|
|
1256
|
-
DebugManager
|
|
1256
|
+
DebugManager.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
1257
1257
|
throw new NativeDocumentError(
|
|
1258
1258
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
1259
1259
|
);
|
|
@@ -1320,7 +1320,7 @@ var NativeDocument = (function (exports) {
|
|
|
1320
1320
|
get(name) {
|
|
1321
1321
|
const item = $stores.get(name);
|
|
1322
1322
|
if (!item) {
|
|
1323
|
-
DebugManager
|
|
1323
|
+
DebugManager.warn('Store', `Store.get('${name}') : store not found.`);
|
|
1324
1324
|
return null;
|
|
1325
1325
|
}
|
|
1326
1326
|
return item.observer;
|
|
@@ -1342,7 +1342,7 @@ var NativeDocument = (function (exports) {
|
|
|
1342
1342
|
delete(name) {
|
|
1343
1343
|
const item = $stores.get(name);
|
|
1344
1344
|
if (!item) {
|
|
1345
|
-
DebugManager
|
|
1345
|
+
DebugManager.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
1346
1346
|
return;
|
|
1347
1347
|
}
|
|
1348
1348
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -1444,7 +1444,7 @@ var NativeDocument = (function (exports) {
|
|
|
1444
1444
|
return undefined;
|
|
1445
1445
|
},
|
|
1446
1446
|
set(target, prop, value) {
|
|
1447
|
-
DebugManager
|
|
1447
|
+
DebugManager.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
1448
1448
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
1449
1449
|
},
|
|
1450
1450
|
deleteProperty(target, prop) {
|
|
@@ -1576,7 +1576,7 @@ var NativeDocument = (function (exports) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
{
|
|
1579
|
-
PluginsManager
|
|
1579
|
+
PluginsManager.emit('CreateObservable', this);
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
1582
|
|
|
@@ -1680,12 +1680,12 @@ var NativeDocument = (function (exports) {
|
|
|
1680
1680
|
this.$previousValue = this.$currentValue;
|
|
1681
1681
|
this.$currentValue = newValue;
|
|
1682
1682
|
{
|
|
1683
|
-
PluginsManager
|
|
1683
|
+
PluginsManager.emit('ObservableBeforeChange', this);
|
|
1684
1684
|
}
|
|
1685
1685
|
this.trigger();
|
|
1686
1686
|
this.$previousValue = null;
|
|
1687
1687
|
{
|
|
1688
|
-
PluginsManager
|
|
1688
|
+
PluginsManager.emit('ObservableAfterChange', this);
|
|
1689
1689
|
}
|
|
1690
1690
|
};
|
|
1691
1691
|
|
|
@@ -1763,7 +1763,7 @@ var NativeDocument = (function (exports) {
|
|
|
1763
1763
|
ObservableItem.prototype.subscribe = function(callback) {
|
|
1764
1764
|
{
|
|
1765
1765
|
if (this.$isCleanedUp) {
|
|
1766
|
-
DebugManager
|
|
1766
|
+
DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1767
1767
|
return;
|
|
1768
1768
|
}
|
|
1769
1769
|
if (typeof callback !== 'function') {
|
|
@@ -1775,7 +1775,7 @@ var NativeDocument = (function (exports) {
|
|
|
1775
1775
|
this.$listeners.push(callback);
|
|
1776
1776
|
this.assocTrigger();
|
|
1777
1777
|
{
|
|
1778
|
-
PluginsManager
|
|
1778
|
+
PluginsManager.emit('ObservableSubscribe', this);
|
|
1779
1779
|
}
|
|
1780
1780
|
};
|
|
1781
1781
|
|
|
@@ -1886,7 +1886,7 @@ var NativeDocument = (function (exports) {
|
|
|
1886
1886
|
}
|
|
1887
1887
|
this.assocTrigger();
|
|
1888
1888
|
{
|
|
1889
|
-
PluginsManager
|
|
1889
|
+
PluginsManager.emit('ObservableUnsubscribe', this);
|
|
1890
1890
|
}
|
|
1891
1891
|
};
|
|
1892
1892
|
|
|
@@ -2362,7 +2362,7 @@ var NativeDocument = (function (exports) {
|
|
|
2362
2362
|
Function.prototype.toNdElement = function () {
|
|
2363
2363
|
const child = this;
|
|
2364
2364
|
{
|
|
2365
|
-
PluginsManager
|
|
2365
|
+
PluginsManager.emit('BeforeProcessComponent', child);
|
|
2366
2366
|
}
|
|
2367
2367
|
return ElementCreator.getChild(child());
|
|
2368
2368
|
};
|
|
@@ -2549,14 +2549,14 @@ var NativeDocument = (function (exports) {
|
|
|
2549
2549
|
processChildren: (children, parent) => {
|
|
2550
2550
|
if(children === null) return;
|
|
2551
2551
|
{
|
|
2552
|
-
PluginsManager
|
|
2552
|
+
PluginsManager.emit('BeforeProcessChildren', parent);
|
|
2553
2553
|
}
|
|
2554
2554
|
let child = ElementCreator.getChild(children);
|
|
2555
2555
|
if(child) {
|
|
2556
2556
|
parent.appendChild(child);
|
|
2557
2557
|
}
|
|
2558
2558
|
{
|
|
2559
|
-
PluginsManager
|
|
2559
|
+
PluginsManager.emit('AfterProcessChildren', parent);
|
|
2560
2560
|
}
|
|
2561
2561
|
},
|
|
2562
2562
|
async safeRemove(element) {
|
|
@@ -2642,7 +2642,7 @@ var NativeDocument = (function (exports) {
|
|
|
2642
2642
|
anchorFragment.appendChild = function(child, before = null) {
|
|
2643
2643
|
const parent = anchorEnd.parentNode;
|
|
2644
2644
|
if(!parent) {
|
|
2645
|
-
DebugManager
|
|
2645
|
+
DebugManager.error('Anchor', 'Anchor : parent not found', child);
|
|
2646
2646
|
return;
|
|
2647
2647
|
}
|
|
2648
2648
|
before = before ?? anchorEnd;
|
|
@@ -2905,16 +2905,16 @@ var NativeDocument = (function (exports) {
|
|
|
2905
2905
|
"ContextMenu"
|
|
2906
2906
|
];
|
|
2907
2907
|
|
|
2908
|
-
const property
|
|
2908
|
+
const property = {
|
|
2909
2909
|
configurable: true,
|
|
2910
2910
|
get() {
|
|
2911
2911
|
return new NDElement(this);
|
|
2912
2912
|
}
|
|
2913
2913
|
};
|
|
2914
2914
|
|
|
2915
|
-
Object.defineProperty(HTMLElement.prototype, 'nd', property
|
|
2915
|
+
Object.defineProperty(HTMLElement.prototype, 'nd', property);
|
|
2916
2916
|
|
|
2917
|
-
Object.defineProperty(DocumentFragment.prototype, 'nd', property
|
|
2917
|
+
Object.defineProperty(DocumentFragment.prototype, 'nd', property);
|
|
2918
2918
|
|
|
2919
2919
|
Object.defineProperty(NDElement.prototype, 'nd', {
|
|
2920
2920
|
configurable: true,
|
|
@@ -3293,9 +3293,10 @@ var NativeDocument = (function (exports) {
|
|
|
3293
3293
|
}
|
|
3294
3294
|
|
|
3295
3295
|
const stepsCount = steps.length;
|
|
3296
|
+
const $element = this.$element;
|
|
3296
3297
|
|
|
3297
|
-
this.cloneNode =
|
|
3298
|
-
const clonedNode =
|
|
3298
|
+
this.cloneNode = (data) => {
|
|
3299
|
+
const clonedNode = $element.cloneNode(false);
|
|
3299
3300
|
for(let i = 0; i < stepsCount; i++) {
|
|
3300
3301
|
steps[i](clonedNode, data);
|
|
3301
3302
|
}
|
|
@@ -3307,14 +3308,6 @@ var NativeDocument = (function (exports) {
|
|
|
3307
3308
|
return this.$element.cloneNode(false);
|
|
3308
3309
|
};
|
|
3309
3310
|
|
|
3310
|
-
NodeCloner.prototype.cloneTextNodeByProperty = function(data) {
|
|
3311
|
-
return createTextNode(data[0][this.$content]);
|
|
3312
|
-
};
|
|
3313
|
-
|
|
3314
|
-
NodeCloner.prototype.cloneTextNodeByCallback = function(data) {
|
|
3315
|
-
return createTextNode(this.$content.apply(null, data));
|
|
3316
|
-
};
|
|
3317
|
-
|
|
3318
3311
|
NodeCloner.prototype.attach = function(methodName, callback) {
|
|
3319
3312
|
this.$ndMethods = this.$ndMethods || {};
|
|
3320
3313
|
this.$ndMethods[methodName] = callback;
|
|
@@ -3324,10 +3317,10 @@ var NativeDocument = (function (exports) {
|
|
|
3324
3317
|
NodeCloner.prototype.text = function(value) {
|
|
3325
3318
|
this.$content = value;
|
|
3326
3319
|
if(typeof value === 'function') {
|
|
3327
|
-
this.cloneNode =
|
|
3320
|
+
this.cloneNode = (data) => createTextNode(value.apply(null, data));
|
|
3328
3321
|
return this;
|
|
3329
3322
|
}
|
|
3330
|
-
this.cloneNode =
|
|
3323
|
+
this.cloneNode = (data) => createTextNode(data[0][value]);
|
|
3331
3324
|
return this;
|
|
3332
3325
|
};
|
|
3333
3326
|
|
|
@@ -3410,11 +3403,10 @@ var NativeDocument = (function (exports) {
|
|
|
3410
3403
|
const binder = createTemplateCloner(this);
|
|
3411
3404
|
$node = $fn(binder);
|
|
3412
3405
|
if(!$node.nodeCloner) {
|
|
3413
|
-
console.log('nodeCloner not found on :');
|
|
3414
3406
|
$node.nodeCloner = new NodeCloner($node);
|
|
3415
3407
|
}
|
|
3416
3408
|
assignClonerToNode($node);
|
|
3417
|
-
this.clone =
|
|
3409
|
+
this.clone = $node.dynamicCloneNode;
|
|
3418
3410
|
return $node.dynamicCloneNode(data);
|
|
3419
3411
|
};
|
|
3420
3412
|
|
|
@@ -3466,10 +3458,9 @@ var NativeDocument = (function (exports) {
|
|
|
3466
3458
|
let wrapper = (args) => {
|
|
3467
3459
|
$cache = new TemplateCloner(fn);
|
|
3468
3460
|
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
return $cache.clone(args);
|
|
3461
|
+
const node = $cache.clone(args);
|
|
3462
|
+
wrapper = $cache.clone;
|
|
3463
|
+
return node;
|
|
3473
3464
|
};
|
|
3474
3465
|
|
|
3475
3466
|
if(fn.length < 2) {
|
|
@@ -4059,7 +4050,7 @@ var NativeDocument = (function (exports) {
|
|
|
4059
4050
|
|
|
4060
4051
|
ObservableItem.call(this, target, configs);
|
|
4061
4052
|
{
|
|
4062
|
-
PluginsManager
|
|
4053
|
+
PluginsManager.emit('CreateObservableArray', this);
|
|
4063
4054
|
}
|
|
4064
4055
|
};
|
|
4065
4056
|
|
|
@@ -4691,7 +4682,7 @@ var NativeDocument = (function (exports) {
|
|
|
4691
4682
|
const observable = new ObservableItem(initialValue);
|
|
4692
4683
|
const updatedValue = nextTick(() => observable.set(callback()));
|
|
4693
4684
|
{
|
|
4694
|
-
PluginsManager
|
|
4685
|
+
PluginsManager.emit('CreateObservableComputed', observable, dependencies);
|
|
4695
4686
|
}
|
|
4696
4687
|
|
|
4697
4688
|
if(Validator.isFunction(dependencies)) {
|
|
@@ -4790,7 +4781,7 @@ var NativeDocument = (function (exports) {
|
|
|
4790
4781
|
}
|
|
4791
4782
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
4792
4783
|
} catch (e) {
|
|
4793
|
-
DebugManager
|
|
4784
|
+
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4794
4785
|
throw e;
|
|
4795
4786
|
}
|
|
4796
4787
|
return keyId;
|
|
@@ -5180,7 +5171,7 @@ var NativeDocument = (function (exports) {
|
|
|
5180
5171
|
*/
|
|
5181
5172
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
5182
5173
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
5183
|
-
return DebugManager
|
|
5174
|
+
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5184
5175
|
}
|
|
5185
5176
|
const element = Anchor('Show if : '+(comment || ''));
|
|
5186
5177
|
|
|
@@ -6599,7 +6590,7 @@ var NativeDocument = (function (exports) {
|
|
|
6599
6590
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6600
6591
|
this.handleRouteChange(route, params, query, path);
|
|
6601
6592
|
} catch (e) {
|
|
6602
|
-
DebugManager
|
|
6593
|
+
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
6603
6594
|
}
|
|
6604
6595
|
};
|
|
6605
6596
|
/**
|
|
@@ -6612,7 +6603,7 @@ var NativeDocument = (function (exports) {
|
|
|
6612
6603
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6613
6604
|
this.handleRouteChange(route, params, {}, path);
|
|
6614
6605
|
} catch(e) {
|
|
6615
|
-
DebugManager
|
|
6606
|
+
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
6616
6607
|
}
|
|
6617
6608
|
};
|
|
6618
6609
|
this.forward = function() {
|
|
@@ -6639,7 +6630,7 @@ var NativeDocument = (function (exports) {
|
|
|
6639
6630
|
}
|
|
6640
6631
|
this.handleRouteChange(route, params, query, path);
|
|
6641
6632
|
} catch(e) {
|
|
6642
|
-
DebugManager
|
|
6633
|
+
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
6643
6634
|
}
|
|
6644
6635
|
});
|
|
6645
6636
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -6864,7 +6855,7 @@ var NativeDocument = (function (exports) {
|
|
|
6864
6855
|
listener(request);
|
|
6865
6856
|
next && next(request);
|
|
6866
6857
|
} catch (e) {
|
|
6867
|
-
DebugManager
|
|
6858
|
+
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
6868
6859
|
}
|
|
6869
6860
|
}
|
|
6870
6861
|
};
|
|
@@ -7042,7 +7033,7 @@ var NativeDocument = (function (exports) {
|
|
|
7042
7033
|
*/
|
|
7043
7034
|
Router.create = function(options, callback) {
|
|
7044
7035
|
if(!Validator.isFunction(callback)) {
|
|
7045
|
-
DebugManager
|
|
7036
|
+
DebugManager.error('Router', 'Callback must be a function');
|
|
7046
7037
|
throw new RouterError('Callback must be a function');
|
|
7047
7038
|
}
|
|
7048
7039
|
const router = new Router(options);
|
|
@@ -7246,7 +7237,7 @@ var NativeDocument = (function (exports) {
|
|
|
7246
7237
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
7247
7238
|
exports.NDElement = NDElement;
|
|
7248
7239
|
exports.Observable = Observable;
|
|
7249
|
-
exports.PluginsManager = PluginsManager
|
|
7240
|
+
exports.PluginsManager = PluginsManager;
|
|
7250
7241
|
exports.SingletonView = SingletonView;
|
|
7251
7242
|
exports.Store = Store;
|
|
7252
7243
|
exports.StoreFactory = StoreFactory;
|