native-document 1.0.118 → 1.0.120
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 +197 -38
- package/dist/native-document.dev.js +277 -134
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/lifecycle-events.md +1 -1
- package/elements.js +2 -2
- package/package.json +1 -1
- package/src/core/data/ObservableArray.js +3 -1
- package/src/core/data/ObservableItem.js +3 -1
- package/src/core/elements/anchor/anchor-with-sentinel.js +41 -0
- package/src/core/elements/{anchor.js → anchor/anchor.js} +66 -19
- package/src/core/elements/anchor/one-child-anchor-overwriting.js +66 -0
- package/src/core/elements/control/for-each-array.js +53 -69
- package/src/core/elements/control/for-each.js +1 -1
- package/src/core/elements/control/show-if.js +1 -1
- package/src/core/elements/control/switch.js +1 -1
- package/src/core/wrappers/ElementCreator.js +1 -1
- package/src/core/wrappers/HtmlElementWrapper.js +5 -4
- package/src/core/wrappers/SingletonView.js +1 -1
- package/src/core/wrappers/prototypes/nd-element-extensions.js +4 -0
- package/src/core/wrappers/template-cloner/NodeCloner.js +2 -1
|
@@ -35,7 +35,7 @@ var NativeDocument = (function (exports) {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
}
|
|
38
|
-
var DebugManager = DebugManager$1;
|
|
38
|
+
var DebugManager$2 = 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
|
|
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$2.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 = PluginsManager
|
|
394
|
+
var PluginsManager$1 = PluginsManager;
|
|
395
395
|
|
|
396
396
|
function NDElement(element) {
|
|
397
397
|
this.$element = element;
|
|
398
398
|
{
|
|
399
|
-
PluginsManager.emit('NDElementCreated', element, this);
|
|
399
|
+
PluginsManager$1.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.warn('NDElement.extend', `Method "${name}" already exists and will be overwritten`);
|
|
564
|
+
DebugManager$2.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.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
615
|
+
DebugManager$2.warn('NDElement.extend', `"${name}" is not a function, skipping`);
|
|
616
616
|
continue;
|
|
617
617
|
}
|
|
618
618
|
|
|
619
619
|
if (protectedMethods.has(name)) {
|
|
620
|
-
DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
|
|
620
|
+
DebugManager$2.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.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
625
|
+
DebugManager$2.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
|
|
626
626
|
}
|
|
627
627
|
|
|
628
628
|
NDElement.prototype[name] = method;
|
|
629
629
|
}
|
|
630
630
|
{
|
|
631
|
-
PluginsManager.emit('NDElementExtended', methods);
|
|
631
|
+
PluginsManager$1.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.warn('Validator', `Reserved attributes found: ${foundReserved.join(', ')}`);
|
|
782
|
+
DebugManager$2.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.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
869
|
+
DebugManager$2.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
872
|
};
|
|
@@ -1176,7 +1176,7 @@ var NativeDocument = (function (exports) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
{
|
|
1179
|
-
PluginsManager.emit('CreateObservable', this);
|
|
1179
|
+
PluginsManager$1.emit('CreateObservable', this);
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
@@ -1272,6 +1272,8 @@ var NativeDocument = (function (exports) {
|
|
|
1272
1272
|
};
|
|
1273
1273
|
ObservableItem.prototype.trigger = noneTrigger;
|
|
1274
1274
|
|
|
1275
|
+
|
|
1276
|
+
const $setOperation = { action: 'set' };
|
|
1275
1277
|
ObservableItem.prototype.$updateWithNewValue = function(newValue) {
|
|
1276
1278
|
newValue = newValue?.__$isObservable ? newValue.val() : newValue;
|
|
1277
1279
|
if(this.$currentValue === newValue) {
|
|
@@ -1280,12 +1282,12 @@ var NativeDocument = (function (exports) {
|
|
|
1280
1282
|
this.$previousValue = this.$currentValue;
|
|
1281
1283
|
this.$currentValue = newValue;
|
|
1282
1284
|
{
|
|
1283
|
-
PluginsManager.emit('ObservableBeforeChange', this);
|
|
1285
|
+
PluginsManager$1.emit('ObservableBeforeChange', this);
|
|
1284
1286
|
}
|
|
1285
|
-
this.trigger();
|
|
1287
|
+
this.trigger($setOperation);
|
|
1286
1288
|
this.$previousValue = null;
|
|
1287
1289
|
{
|
|
1288
|
-
PluginsManager.emit('ObservableAfterChange', this);
|
|
1290
|
+
PluginsManager$1.emit('ObservableAfterChange', this);
|
|
1289
1291
|
}
|
|
1290
1292
|
};
|
|
1291
1293
|
|
|
@@ -1363,7 +1365,7 @@ var NativeDocument = (function (exports) {
|
|
|
1363
1365
|
ObservableItem.prototype.subscribe = function(callback) {
|
|
1364
1366
|
{
|
|
1365
1367
|
if (this.$isCleanedUp) {
|
|
1366
|
-
DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1368
|
+
DebugManager$2.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
|
|
1367
1369
|
return;
|
|
1368
1370
|
}
|
|
1369
1371
|
if (typeof callback !== 'function') {
|
|
@@ -1375,7 +1377,7 @@ var NativeDocument = (function (exports) {
|
|
|
1375
1377
|
this.$listeners.push(callback);
|
|
1376
1378
|
this.assocTrigger();
|
|
1377
1379
|
{
|
|
1378
|
-
PluginsManager.emit('ObservableSubscribe', this);
|
|
1380
|
+
PluginsManager$1.emit('ObservableSubscribe', this);
|
|
1379
1381
|
}
|
|
1380
1382
|
};
|
|
1381
1383
|
|
|
@@ -1486,7 +1488,7 @@ var NativeDocument = (function (exports) {
|
|
|
1486
1488
|
}
|
|
1487
1489
|
this.assocTrigger();
|
|
1488
1490
|
{
|
|
1489
|
-
PluginsManager.emit('ObservableUnsubscribe', this);
|
|
1491
|
+
PluginsManager$1.emit('ObservableUnsubscribe', this);
|
|
1490
1492
|
}
|
|
1491
1493
|
};
|
|
1492
1494
|
|
|
@@ -1922,6 +1924,10 @@ var NativeDocument = (function (exports) {
|
|
|
1922
1924
|
return ElementCreator.createStaticTextNode(null, this);
|
|
1923
1925
|
};
|
|
1924
1926
|
|
|
1927
|
+
Number.prototype.toNdElement = function () {
|
|
1928
|
+
return ElementCreator.createStaticTextNode(null, this.toString());
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1925
1931
|
Element.prototype.toNdElement = function () {
|
|
1926
1932
|
return this;
|
|
1927
1933
|
};
|
|
@@ -1961,7 +1967,7 @@ var NativeDocument = (function (exports) {
|
|
|
1961
1967
|
Function.prototype.toNdElement = function () {
|
|
1962
1968
|
const child = this;
|
|
1963
1969
|
{
|
|
1964
|
-
PluginsManager.emit('BeforeProcessComponent', child);
|
|
1970
|
+
PluginsManager$1.emit('BeforeProcessComponent', child);
|
|
1965
1971
|
}
|
|
1966
1972
|
return ElementCreator.getChild(child());
|
|
1967
1973
|
};
|
|
@@ -2148,14 +2154,14 @@ var NativeDocument = (function (exports) {
|
|
|
2148
2154
|
processChildren: (children, parent) => {
|
|
2149
2155
|
if(children === null) return;
|
|
2150
2156
|
{
|
|
2151
|
-
PluginsManager.emit('BeforeProcessChildren', parent);
|
|
2157
|
+
PluginsManager$1.emit('BeforeProcessChildren', parent);
|
|
2152
2158
|
}
|
|
2153
2159
|
let child = ElementCreator.getChild(children);
|
|
2154
2160
|
if(child) {
|
|
2155
2161
|
parent.appendChild(child);
|
|
2156
2162
|
}
|
|
2157
2163
|
{
|
|
2158
|
-
PluginsManager.emit('AfterProcessChildren', parent);
|
|
2164
|
+
PluginsManager$1.emit('AfterProcessChildren', parent);
|
|
2159
2165
|
}
|
|
2160
2166
|
},
|
|
2161
2167
|
async safeRemove(element) {
|
|
@@ -2197,8 +2203,124 @@ var NativeDocument = (function (exports) {
|
|
|
2197
2203
|
processStyleAttribute: bindStyleAttribute,
|
|
2198
2204
|
};
|
|
2199
2205
|
|
|
2206
|
+
function AnchorWithSentinel(name) {
|
|
2207
|
+
const instance = Reflect.construct(DocumentFragment, [], AnchorWithSentinel);
|
|
2208
|
+
const sentinel = document.createComment((name || '') + ' Anchor Sentinel');
|
|
2209
|
+
const events = {};
|
|
2210
|
+
|
|
2211
|
+
instance.appendChild(sentinel);
|
|
2212
|
+
|
|
2213
|
+
const observer = new MutationObserver(() => {
|
|
2214
|
+
if (sentinel.parentNode !== instance && !(sentinel.parentNode instanceof DocumentFragment)) {
|
|
2215
|
+
events.connected && events.connected(sentinel.parentNode);
|
|
2216
|
+
}
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
observer.observe(document, { childList: true, subtree: true });
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
instance.$sentinel = sentinel;
|
|
2223
|
+
instance.$observer = observer;
|
|
2224
|
+
instance.$events = events;
|
|
2225
|
+
|
|
2226
|
+
return instance;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
AnchorWithSentinel.prototype = Object.create(DocumentFragment.prototype);
|
|
2230
|
+
AnchorWithSentinel.prototype.constructor = AnchorWithSentinel;
|
|
2231
|
+
|
|
2232
|
+
AnchorWithSentinel.prototype.onConnected = function(callback) {
|
|
2233
|
+
this.$events.connected = callback;
|
|
2234
|
+
return this;
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2237
|
+
AnchorWithSentinel.prototype.onConnectedOnce = function(callback) {
|
|
2238
|
+
this.$events.connected = (parent) => {
|
|
2239
|
+
callback(parent);
|
|
2240
|
+
this.$observer.disconnect();
|
|
2241
|
+
this.$events.connectedOnce = null;
|
|
2242
|
+
};
|
|
2243
|
+
};
|
|
2244
|
+
|
|
2245
|
+
function oneChildAnchorOverwriting(anchor, parent) {
|
|
2246
|
+
|
|
2247
|
+
anchor.remove = () => {
|
|
2248
|
+
anchor.append.apply(anchor, parent.childNodes);
|
|
2249
|
+
};
|
|
2250
|
+
anchor.getParent = () => parent;
|
|
2251
|
+
|
|
2252
|
+
anchor.appendChild = (child) => {
|
|
2253
|
+
child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
|
|
2254
|
+
parent.appendChild(child);
|
|
2255
|
+
};
|
|
2256
|
+
|
|
2257
|
+
anchor.appendChildRaw = parent.appendChild.bind(parent);
|
|
2258
|
+
anchor.append = anchor.appendChild;
|
|
2259
|
+
anchor.appendRaw = anchor.appendChildRaw;
|
|
2260
|
+
|
|
2261
|
+
anchor.insertAtStart = (child) => {
|
|
2262
|
+
child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
|
|
2263
|
+
parent.firstChild ? parent.insertBefore(child, parent.firstChild) : parent.appendChild(child);
|
|
2264
|
+
};
|
|
2265
|
+
anchor.insertAtStartRaw = (child) => {
|
|
2266
|
+
parent.firstChild ? parent.insertBefore(child, parent.firstChild) : parent.appendChild(child);
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
anchor.appendElement = anchor.appendChild;
|
|
2270
|
+
|
|
2271
|
+
anchor.removeChildren = () => {
|
|
2272
|
+
parent.textContent = '';
|
|
2273
|
+
};
|
|
2274
|
+
|
|
2275
|
+
anchor.replaceContent = function(content) {
|
|
2276
|
+
const child = Validator.isElement(content) ? content : ElementCreator.getChild(content);
|
|
2277
|
+
parent.replaceChildren(child);
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
anchor.replaceContentRaw = function(child) {
|
|
2281
|
+
parent.replaceChildren(child);
|
|
2282
|
+
};
|
|
2283
|
+
anchor.setContent = anchor.replaceContent;
|
|
2284
|
+
|
|
2285
|
+
anchor.insertBefore = (child, anchor) => {
|
|
2286
|
+
child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
|
|
2287
|
+
parent.insertBefore(child, anchor);
|
|
2288
|
+
};
|
|
2289
|
+
anchor.insertBeforeRaw = (child, anchor) => {
|
|
2290
|
+
parent.insertBefore(child, anchor);
|
|
2291
|
+
};
|
|
2292
|
+
|
|
2293
|
+
anchor.appendChildBefore = anchor.insertBefore;
|
|
2294
|
+
anchor.appendChildBeforeRaw = anchor.insertBeforeRaw;
|
|
2295
|
+
|
|
2296
|
+
anchor.clear = anchor.remove;
|
|
2297
|
+
anchor.detach = anchor.remove;
|
|
2298
|
+
|
|
2299
|
+
anchor.replaceChildren = function() {
|
|
2300
|
+
parent.replaceChildren(...arguments);
|
|
2301
|
+
};
|
|
2302
|
+
|
|
2303
|
+
anchor.getByIndex = (index) => {
|
|
2304
|
+
return parent.childNodes[index];
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2200
2308
|
function Anchor(name, isUniqueChild = false) {
|
|
2201
|
-
const anchorFragment =
|
|
2309
|
+
const anchorFragment = new AnchorWithSentinel(name);
|
|
2310
|
+
|
|
2311
|
+
/**
|
|
2312
|
+
* State :
|
|
2313
|
+
* 1. Not injected in the DOM
|
|
2314
|
+
* 2. Injected in the DOM and should be the only child of parent
|
|
2315
|
+
* 3. Injected in the DOM and the parent may have other children
|
|
2316
|
+
*/
|
|
2317
|
+
|
|
2318
|
+
anchorFragment.onConnectedOnce((parent) => {
|
|
2319
|
+
if(isUniqueChild) {
|
|
2320
|
+
oneChildAnchorOverwriting(anchorFragment, parent);
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
|
|
2202
2324
|
anchorFragment.__Anchor__ = true;
|
|
2203
2325
|
|
|
2204
2326
|
const anchorStart = document.createComment('Anchor Start : '+name);
|
|
@@ -2212,30 +2334,32 @@ var NativeDocument = (function (exports) {
|
|
|
2212
2334
|
anchorFragment.nativeAppend = anchorFragment.append;
|
|
2213
2335
|
|
|
2214
2336
|
const isParentUniqueChild = isUniqueChild
|
|
2215
|
-
? () => true
|
|
2216
|
-
: (parent) => (parent.firstChild === anchorStart && parent.lastChild === anchorEnd);
|
|
2337
|
+
? () => true: (parent) => (parent.firstChild === anchorStart && parent.lastChild === anchorEnd);
|
|
2217
2338
|
|
|
2218
2339
|
const insertBefore = function(parent, child, target) {
|
|
2219
2340
|
const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
|
|
2341
|
+
insertBeforeRaw(parent, childElement, target);
|
|
2342
|
+
};
|
|
2343
|
+
|
|
2344
|
+
const insertBeforeRaw = function(parent, child, target) {
|
|
2220
2345
|
if(parent === anchorFragment) {
|
|
2221
|
-
parent.nativeInsertBefore(
|
|
2346
|
+
parent.nativeInsertBefore(child, target);
|
|
2222
2347
|
return;
|
|
2223
2348
|
}
|
|
2224
2349
|
if(isParentUniqueChild(parent) && target === anchorEnd) {
|
|
2225
|
-
parent.append(
|
|
2350
|
+
parent.append(child, target);
|
|
2226
2351
|
return;
|
|
2227
2352
|
}
|
|
2228
|
-
parent.insertBefore(
|
|
2353
|
+
parent.insertBefore(child, target);
|
|
2229
2354
|
};
|
|
2230
2355
|
|
|
2231
|
-
anchorFragment.appendElement = function(child
|
|
2356
|
+
anchorFragment.appendElement = function(child) {
|
|
2232
2357
|
const parentNode = anchorStart.parentNode;
|
|
2233
|
-
const targetBefore = before || anchorEnd;
|
|
2234
2358
|
if(parentNode === anchorFragment) {
|
|
2235
|
-
parentNode.nativeInsertBefore(child,
|
|
2359
|
+
parentNode.nativeInsertBefore(child, anchorEnd);
|
|
2236
2360
|
return;
|
|
2237
2361
|
}
|
|
2238
|
-
parentNode
|
|
2362
|
+
parentNode.insertBefore(child, anchorEnd);
|
|
2239
2363
|
};
|
|
2240
2364
|
|
|
2241
2365
|
anchorFragment.appendChild = function(child, before = null) {
|
|
@@ -2248,8 +2372,32 @@ var NativeDocument = (function (exports) {
|
|
|
2248
2372
|
insertBefore(parent, child, before);
|
|
2249
2373
|
};
|
|
2250
2374
|
|
|
2251
|
-
anchorFragment.
|
|
2252
|
-
|
|
2375
|
+
anchorFragment.appendChildRaw = function(child, before = null) {
|
|
2376
|
+
const parent = anchorEnd.parentNode;
|
|
2377
|
+
if(!parent) {
|
|
2378
|
+
DebugManager.error('Anchor', 'Anchor : parent not found', child);
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
before = before ?? anchorEnd;
|
|
2382
|
+
insertBeforeRaw(parent, child, before);
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
anchorFragment.getParent = () => anchorEnd.parentNode;
|
|
2386
|
+
anchorFragment.append = anchorFragment.appendChild;
|
|
2387
|
+
anchorFragment.appendRaw = anchorFragment.appendChildRaw;
|
|
2388
|
+
|
|
2389
|
+
anchorFragment.insertAtStart = function(child) {
|
|
2390
|
+
child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
|
|
2391
|
+
anchorFragment.insertAtStartRaw(child);
|
|
2392
|
+
};
|
|
2393
|
+
|
|
2394
|
+
anchorFragment.insertAtStartRaw = function(child) {
|
|
2395
|
+
const parentNode = anchorStart.parentNode;
|
|
2396
|
+
if(parentNode === anchorFragment) {
|
|
2397
|
+
parentNode.nativeInsertBefore(child, anchorStart);
|
|
2398
|
+
return;
|
|
2399
|
+
}
|
|
2400
|
+
parentNode.insertBefore(child, anchorStart);
|
|
2253
2401
|
};
|
|
2254
2402
|
|
|
2255
2403
|
anchorFragment.removeChildren = function() {
|
|
@@ -2276,6 +2424,7 @@ var NativeDocument = (function (exports) {
|
|
|
2276
2424
|
return;
|
|
2277
2425
|
}
|
|
2278
2426
|
if(isParentUniqueChild(parent)) {
|
|
2427
|
+
anchorFragment.append.apply(anchorFragment, parent.childNodes);
|
|
2279
2428
|
parent.replaceChildren(anchorStart, anchorEnd);
|
|
2280
2429
|
return;
|
|
2281
2430
|
}
|
|
@@ -2295,6 +2444,10 @@ var NativeDocument = (function (exports) {
|
|
|
2295
2444
|
|
|
2296
2445
|
anchorFragment.replaceContent = function(child) {
|
|
2297
2446
|
const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
|
|
2447
|
+
anchorFragment.replaceContentRaw(childElement);
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2450
|
+
anchorFragment.replaceContentRaw = function(child) {
|
|
2298
2451
|
const parent = anchorEnd.parentNode;
|
|
2299
2452
|
if(!parent) {
|
|
2300
2453
|
return;
|
|
@@ -2308,10 +2461,10 @@ var NativeDocument = (function (exports) {
|
|
|
2308
2461
|
};
|
|
2309
2462
|
|
|
2310
2463
|
anchorFragment.setContent = anchorFragment.replaceContent;
|
|
2464
|
+
anchorFragment.setContentRaw = anchorFragment.replaceContentRaw;
|
|
2311
2465
|
|
|
2312
|
-
anchorFragment.insertBefore =
|
|
2313
|
-
|
|
2314
|
-
};
|
|
2466
|
+
anchorFragment.insertBefore = anchorFragment.appendChild;
|
|
2467
|
+
anchorFragment.insertBeforeRaw = anchorFragment.appendChildRaw;
|
|
2315
2468
|
|
|
2316
2469
|
anchorFragment.endElement = function() {
|
|
2317
2470
|
return anchorEnd;
|
|
@@ -2320,9 +2473,11 @@ var NativeDocument = (function (exports) {
|
|
|
2320
2473
|
anchorFragment.startElement = function() {
|
|
2321
2474
|
return anchorStart;
|
|
2322
2475
|
};
|
|
2476
|
+
|
|
2323
2477
|
anchorFragment.restore = function() {
|
|
2324
2478
|
anchorFragment.appendChild(anchorFragment);
|
|
2325
2479
|
};
|
|
2480
|
+
|
|
2326
2481
|
anchorFragment.clear = anchorFragment.remove;
|
|
2327
2482
|
anchorFragment.detach = anchorFragment.remove;
|
|
2328
2483
|
|
|
@@ -2773,9 +2928,10 @@ var NativeDocument = (function (exports) {
|
|
|
2773
2928
|
* @returns {Text}
|
|
2774
2929
|
*/
|
|
2775
2930
|
const createTextNode = (value) => {
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2931
|
+
if(value) {
|
|
2932
|
+
return value.toNdElement();
|
|
2933
|
+
}
|
|
2934
|
+
return ElementCreator.createTextNode();
|
|
2779
2935
|
};
|
|
2780
2936
|
|
|
2781
2937
|
|
|
@@ -2869,8 +3025,9 @@ var NativeDocument = (function (exports) {
|
|
|
2869
3025
|
const methods = Object.keys(this.$ndMethods);
|
|
2870
3026
|
if(methods.length === 1) {
|
|
2871
3027
|
const methodName = methods[0];
|
|
3028
|
+
const callback = this.$ndMethods[methodName];
|
|
2872
3029
|
steps.push((clonedNode, data) => {
|
|
2873
|
-
clonedNode.nd[methodName](
|
|
3030
|
+
clonedNode.nd[methodName](callback.bind(clonedNode, ...data));
|
|
2874
3031
|
});
|
|
2875
3032
|
} else {
|
|
2876
3033
|
steps.push((clonedNode, data) => {
|
|
@@ -3689,7 +3846,7 @@ var NativeDocument = (function (exports) {
|
|
|
3689
3846
|
|
|
3690
3847
|
ObservableItem.call(this, target, configs);
|
|
3691
3848
|
{
|
|
3692
|
-
PluginsManager.emit('CreateObservableArray', this);
|
|
3849
|
+
PluginsManager$1.emit('CreateObservableArray', this);
|
|
3693
3850
|
}
|
|
3694
3851
|
};
|
|
3695
3852
|
|
|
@@ -3718,6 +3875,8 @@ var NativeDocument = (function (exports) {
|
|
|
3718
3875
|
};
|
|
3719
3876
|
});
|
|
3720
3877
|
|
|
3878
|
+
const $clearEvent = { action: 'clear' };
|
|
3879
|
+
|
|
3721
3880
|
/**
|
|
3722
3881
|
* Removes all items from the array and triggers an update.
|
|
3723
3882
|
*
|
|
@@ -3731,7 +3890,7 @@ var NativeDocument = (function (exports) {
|
|
|
3731
3890
|
return;
|
|
3732
3891
|
}
|
|
3733
3892
|
this.$currentValue.length = 0;
|
|
3734
|
-
this.trigger(
|
|
3893
|
+
this.trigger($clearEvent);
|
|
3735
3894
|
return true;
|
|
3736
3895
|
};
|
|
3737
3896
|
|
|
@@ -4321,7 +4480,7 @@ var NativeDocument = (function (exports) {
|
|
|
4321
4480
|
const observable = new ObservableItem(initialValue);
|
|
4322
4481
|
const updatedValue = nextTick(() => observable.set(callback()));
|
|
4323
4482
|
{
|
|
4324
|
-
PluginsManager.emit('CreateObservableComputed', observable, dependencies);
|
|
4483
|
+
PluginsManager$1.emit('CreateObservableComputed', observable, dependencies);
|
|
4325
4484
|
}
|
|
4326
4485
|
|
|
4327
4486
|
if(Validator.isFunction(dependencies)) {
|
|
@@ -4356,7 +4515,7 @@ var NativeDocument = (function (exports) {
|
|
|
4356
4515
|
const $getStoreOrThrow = (method, name) => {
|
|
4357
4516
|
const item = $stores.get(name);
|
|
4358
4517
|
if (!item) {
|
|
4359
|
-
DebugManager.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
4518
|
+
DebugManager$2.error('Store', `Store.${method}('${name}') : store not found. Did you call Store.create('${name}') first?`);
|
|
4360
4519
|
throw new NativeDocumentError(
|
|
4361
4520
|
`Store.${method}('${name}') : store not found.`
|
|
4362
4521
|
);
|
|
@@ -4369,7 +4528,7 @@ var NativeDocument = (function (exports) {
|
|
|
4369
4528
|
*/
|
|
4370
4529
|
const $applyReadOnly = (observer, name, context) => {
|
|
4371
4530
|
const readOnlyError = (method) => () => {
|
|
4372
|
-
DebugManager.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
4531
|
+
DebugManager$2.error('Store', `Store.${context}('${name}') is read-only. '${method}()' is not allowed.`);
|
|
4373
4532
|
throw new NativeDocumentError(
|
|
4374
4533
|
`Store.${context}('${name}') is read-only.`
|
|
4375
4534
|
);
|
|
@@ -4400,7 +4559,7 @@ var NativeDocument = (function (exports) {
|
|
|
4400
4559
|
*/
|
|
4401
4560
|
create(name, value) {
|
|
4402
4561
|
if ($stores.has(name)) {
|
|
4403
|
-
DebugManager.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
4562
|
+
DebugManager$2.warn('Store', `Store.create('${name}') : a store with this name already exists. Use Store.get('${name}') to retrieve it.`);
|
|
4404
4563
|
throw new NativeDocumentError(
|
|
4405
4564
|
`Store.create('${name}') : a store with this name already exists.`
|
|
4406
4565
|
);
|
|
@@ -4421,7 +4580,7 @@ var NativeDocument = (function (exports) {
|
|
|
4421
4580
|
*/
|
|
4422
4581
|
createResettable(name, value) {
|
|
4423
4582
|
if ($stores.has(name)) {
|
|
4424
|
-
DebugManager.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4583
|
+
DebugManager$2.warn('Store', `Store.createResettable('${name}') : a store with this name already exists.`);
|
|
4425
4584
|
throw new NativeDocumentError(
|
|
4426
4585
|
`Store.createResettable('${name}') : a store with this name already exists.`
|
|
4427
4586
|
);
|
|
@@ -4457,7 +4616,7 @@ var NativeDocument = (function (exports) {
|
|
|
4457
4616
|
*/
|
|
4458
4617
|
createComposed(name, computation, dependencies) {
|
|
4459
4618
|
if ($stores.has(name)) {
|
|
4460
|
-
DebugManager.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4619
|
+
DebugManager$2.warn('Store', `Store.createComposed('${name}') : a store with this name already exists.`);
|
|
4461
4620
|
throw new NativeDocumentError(
|
|
4462
4621
|
`Store.createComposed('${name}') : a store with this name already exists.`
|
|
4463
4622
|
);
|
|
@@ -4480,7 +4639,7 @@ var NativeDocument = (function (exports) {
|
|
|
4480
4639
|
}
|
|
4481
4640
|
const depItem = $stores.get(depName);
|
|
4482
4641
|
if (!depItem) {
|
|
4483
|
-
DebugManager.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4642
|
+
DebugManager$2.error('Store', `Store.createComposed('${name}') : dependency '${depName}' not found. Create it first.`);
|
|
4484
4643
|
throw new NativeDocumentError(
|
|
4485
4644
|
`Store.createComposed('${name}') : dependency store '${depName}' not found.`
|
|
4486
4645
|
);
|
|
@@ -4514,13 +4673,13 @@ var NativeDocument = (function (exports) {
|
|
|
4514
4673
|
reset(name) {
|
|
4515
4674
|
const item = $getStoreOrThrow('reset', name);
|
|
4516
4675
|
if (item.composed) {
|
|
4517
|
-
DebugManager.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4676
|
+
DebugManager$2.error('Store', `Store.reset('${name}') : composed stores cannot be reset. Their value is derived from dependencies.`);
|
|
4518
4677
|
throw new NativeDocumentError(
|
|
4519
4678
|
`Store.reset('${name}') : composed stores cannot be reset.`
|
|
4520
4679
|
);
|
|
4521
4680
|
}
|
|
4522
4681
|
if (!item.resettable) {
|
|
4523
|
-
DebugManager.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4682
|
+
DebugManager$2.error('Store', `Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`);
|
|
4524
4683
|
throw new NativeDocumentError(
|
|
4525
4684
|
`Store.reset('${name}') : this store is not resettable. Use Store.createResettable('${name}', value) instead of Store.create().`
|
|
4526
4685
|
);
|
|
@@ -4541,7 +4700,7 @@ var NativeDocument = (function (exports) {
|
|
|
4541
4700
|
const item = $getStoreOrThrow('use', name);
|
|
4542
4701
|
|
|
4543
4702
|
if (item.composed) {
|
|
4544
|
-
DebugManager.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4703
|
+
DebugManager$2.error('Store', `Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`);
|
|
4545
4704
|
throw new NativeDocumentError(
|
|
4546
4705
|
`Store.use('${name}') : composed stores are read-only. Use Store.follow('${name}') instead.`
|
|
4547
4706
|
);
|
|
@@ -4608,7 +4767,7 @@ var NativeDocument = (function (exports) {
|
|
|
4608
4767
|
get(name) {
|
|
4609
4768
|
const item = $stores.get(name);
|
|
4610
4769
|
if (!item) {
|
|
4611
|
-
DebugManager.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4770
|
+
DebugManager$2.warn('Store', `Store.get('${name}') : store not found.`);
|
|
4612
4771
|
return null;
|
|
4613
4772
|
}
|
|
4614
4773
|
return item.observer;
|
|
@@ -4630,7 +4789,7 @@ var NativeDocument = (function (exports) {
|
|
|
4630
4789
|
delete(name) {
|
|
4631
4790
|
const item = $stores.get(name);
|
|
4632
4791
|
if (!item) {
|
|
4633
|
-
DebugManager.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4792
|
+
DebugManager$2.warn('Store', `Store.delete('${name}') : store not found, nothing to delete.`);
|
|
4634
4793
|
return;
|
|
4635
4794
|
}
|
|
4636
4795
|
item.subscribers.forEach(follower => follower.destroy());
|
|
@@ -4732,7 +4891,7 @@ var NativeDocument = (function (exports) {
|
|
|
4732
4891
|
return undefined;
|
|
4733
4892
|
},
|
|
4734
4893
|
set(target, prop, value) {
|
|
4735
|
-
DebugManager.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4894
|
+
DebugManager$2.error('Store', `Forbidden: You cannot overwrite the store key '${String(prop)}'. Use .use('${String(prop)}').set(value) instead.`);
|
|
4736
4895
|
throw new NativeDocumentError(`Store structure is immutable. Use .set() on the observable.`);
|
|
4737
4896
|
},
|
|
4738
4897
|
deleteProperty(target, prop) {
|
|
@@ -4820,7 +4979,7 @@ var NativeDocument = (function (exports) {
|
|
|
4820
4979
|
}
|
|
4821
4980
|
cache.set(keyId, { keyId, isNew: true, child: new WeakRef(child), indexObserver});
|
|
4822
4981
|
} catch (e) {
|
|
4823
|
-
DebugManager.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4982
|
+
DebugManager$2.error('ForEach', `Error creating element for key ${keyId}` , e);
|
|
4824
4983
|
throw e;
|
|
4825
4984
|
}
|
|
4826
4985
|
return keyId;
|
|
@@ -4925,7 +5084,7 @@ var NativeDocument = (function (exports) {
|
|
|
4925
5084
|
function ForEachArray(data, callback, configs = {}) {
|
|
4926
5085
|
const element = Anchor('ForEach Array', configs.isParentUniqueChild);
|
|
4927
5086
|
const blockEnd = element.endElement();
|
|
4928
|
-
|
|
5087
|
+
element.startElement();
|
|
4929
5088
|
|
|
4930
5089
|
let cache = new Map();
|
|
4931
5090
|
let lastNumberOfItems = 0;
|
|
@@ -4933,6 +5092,9 @@ var NativeDocument = (function (exports) {
|
|
|
4933
5092
|
|
|
4934
5093
|
const clear = (items) => {
|
|
4935
5094
|
element.removeChildren();
|
|
5095
|
+
clearCacheOnly(items);
|
|
5096
|
+
};
|
|
5097
|
+
const clearCacheOnly = (items) => {
|
|
4936
5098
|
cleanCache(items);
|
|
4937
5099
|
lastNumberOfItems = 0;
|
|
4938
5100
|
};
|
|
@@ -5011,21 +5173,23 @@ var NativeDocument = (function (exports) {
|
|
|
5011
5173
|
};
|
|
5012
5174
|
|
|
5013
5175
|
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5176
|
+
let cleanCache;
|
|
5177
|
+
|
|
5178
|
+
if(!isIndexRequired) {
|
|
5179
|
+
cleanCache = cache.clear.bind(cache);
|
|
5180
|
+
}
|
|
5181
|
+
else if(configs.shouldKeepItemsInCache) {
|
|
5182
|
+
cleanCache = () => {};
|
|
5183
|
+
} else {
|
|
5184
|
+
cleanCache = (items) => {
|
|
5185
|
+
for (const [itemAsKey, _] of cache.entries()) {
|
|
5186
|
+
if(items && items.includes(itemAsKey)) {
|
|
5187
|
+
continue;
|
|
5188
|
+
}
|
|
5189
|
+
removeCacheItem(itemAsKey, false);
|
|
5025
5190
|
}
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
};
|
|
5191
|
+
};
|
|
5192
|
+
}
|
|
5029
5193
|
|
|
5030
5194
|
const removeByItem = (item, fragment) => {
|
|
5031
5195
|
const cacheItem = cache.get(item);
|
|
@@ -5045,7 +5209,7 @@ var NativeDocument = (function (exports) {
|
|
|
5045
5209
|
};
|
|
5046
5210
|
|
|
5047
5211
|
const Actions = {
|
|
5048
|
-
toFragment(items){
|
|
5212
|
+
toFragment: (items) =>{
|
|
5049
5213
|
const fragment = document.createDocumentFragment();
|
|
5050
5214
|
for(let i = 0, length = items.length; i < length; i++) {
|
|
5051
5215
|
fragment.appendChild(buildItem(items[i], lastNumberOfItems));
|
|
@@ -5053,14 +5217,19 @@ var NativeDocument = (function (exports) {
|
|
|
5053
5217
|
}
|
|
5054
5218
|
return fragment;
|
|
5055
5219
|
},
|
|
5056
|
-
add(items) {
|
|
5057
|
-
element.
|
|
5220
|
+
add: (items) => {
|
|
5221
|
+
element.appendChildRaw(Actions.toFragment(items));
|
|
5222
|
+
},
|
|
5223
|
+
replace: (items) => {
|
|
5224
|
+
clearCacheOnly(items);
|
|
5225
|
+
element.replaceContentRaw(Actions.toFragment(items));
|
|
5058
5226
|
},
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5227
|
+
set: () => {
|
|
5228
|
+
const items = data.val();
|
|
5229
|
+
clearCacheOnly(items);
|
|
5230
|
+
element.replaceContentRaw(Actions.toFragment(items));
|
|
5062
5231
|
},
|
|
5063
|
-
reOrder(items) {
|
|
5232
|
+
reOrder: (items) => {
|
|
5064
5233
|
let child = null;
|
|
5065
5234
|
const fragment = document.createDocumentFragment();
|
|
5066
5235
|
for(const item of items) {
|
|
@@ -5070,24 +5239,13 @@ var NativeDocument = (function (exports) {
|
|
|
5070
5239
|
}
|
|
5071
5240
|
}
|
|
5072
5241
|
child = null;
|
|
5073
|
-
element.
|
|
5242
|
+
element.appendElementRaw(fragment);
|
|
5074
5243
|
},
|
|
5075
|
-
removeOne(element, index) {
|
|
5244
|
+
removeOne: (element, index) => {
|
|
5076
5245
|
removeCacheItem(element, true);
|
|
5077
5246
|
},
|
|
5078
5247
|
clear,
|
|
5079
|
-
|
|
5080
|
-
Actions.add(items);
|
|
5081
|
-
},
|
|
5082
|
-
push(items) {
|
|
5083
|
-
let delay = 0;
|
|
5084
|
-
if(configs.pushDelay) {
|
|
5085
|
-
delay = configs.pushDelay(items) ?? 0;
|
|
5086
|
-
}
|
|
5087
|
-
|
|
5088
|
-
Actions.add(items, delay);
|
|
5089
|
-
},
|
|
5090
|
-
populate([target, iteration, callback]) {
|
|
5248
|
+
populate: ([target, iteration, callback]) => {
|
|
5091
5249
|
const fragment = document.createDocumentFragment();
|
|
5092
5250
|
for (let i = 0; i < iteration; i++) {
|
|
5093
5251
|
const data = callback(i);
|
|
@@ -5095,13 +5253,13 @@ var NativeDocument = (function (exports) {
|
|
|
5095
5253
|
fragment.append(buildItem(data, i));
|
|
5096
5254
|
lastNumberOfItems++;
|
|
5097
5255
|
}
|
|
5098
|
-
element.
|
|
5256
|
+
element.appendChildRaw(fragment);
|
|
5099
5257
|
fragment.replaceChildren();
|
|
5100
5258
|
},
|
|
5101
|
-
unshift(values){
|
|
5102
|
-
element.
|
|
5259
|
+
unshift: (values) => {
|
|
5260
|
+
element.insertAtStartRaw(Actions.toFragment(values));
|
|
5103
5261
|
},
|
|
5104
|
-
splice(args, deleted) {
|
|
5262
|
+
splice: (args, deleted) => {
|
|
5105
5263
|
const [start, deleteCount, ...values] = args;
|
|
5106
5264
|
let elementBeforeFirst = null;
|
|
5107
5265
|
const garbageFragment = document.createDocumentFragment();
|
|
@@ -5124,27 +5282,27 @@ var NativeDocument = (function (exports) {
|
|
|
5124
5282
|
garbageFragment.replaceChildren();
|
|
5125
5283
|
|
|
5126
5284
|
if(values && values.length && elementBeforeFirst) {
|
|
5127
|
-
element.
|
|
5285
|
+
element.insertBeforeRaw(Actions.toFragment(values), elementBeforeFirst.nextSibling);
|
|
5128
5286
|
}
|
|
5129
5287
|
|
|
5130
5288
|
},
|
|
5131
|
-
reverse(_, reversed) {
|
|
5289
|
+
reverse: (_, reversed) => {
|
|
5132
5290
|
Actions.reOrder(reversed);
|
|
5133
5291
|
},
|
|
5134
|
-
sort(_, sorted) {
|
|
5292
|
+
sort: (_, sorted) => {
|
|
5135
5293
|
Actions.reOrder(sorted);
|
|
5136
5294
|
},
|
|
5137
|
-
remove(_, deleted) {
|
|
5295
|
+
remove: (_, deleted)=> {
|
|
5138
5296
|
Actions.removeOne(deleted);
|
|
5139
5297
|
},
|
|
5140
|
-
pop(_, deleted) {
|
|
5298
|
+
pop: (_, deleted) => {
|
|
5141
5299
|
Actions.removeOne(deleted);
|
|
5142
5300
|
},
|
|
5143
|
-
shift(_, deleted) {
|
|
5301
|
+
shift: (_, deleted) => {
|
|
5144
5302
|
Actions.removeOne(deleted);
|
|
5145
5303
|
},
|
|
5146
|
-
swap(args, elements) {
|
|
5147
|
-
const parent =
|
|
5304
|
+
swap: (args, elements) => {
|
|
5305
|
+
const parent = element.getParent();
|
|
5148
5306
|
|
|
5149
5307
|
let childA = getItemChild(elements[0]);
|
|
5150
5308
|
let childB = getItemChild(elements[1]);
|
|
@@ -5159,37 +5317,22 @@ var NativeDocument = (function (exports) {
|
|
|
5159
5317
|
childB = null;
|
|
5160
5318
|
}
|
|
5161
5319
|
};
|
|
5320
|
+
Actions.merge = Actions.add;
|
|
5321
|
+
Actions.push = Actions.add;
|
|
5162
5322
|
|
|
5163
|
-
const buildContent = (items, _, operations) => {
|
|
5164
|
-
|
|
5165
|
-
if(lastNumberOfItems === 0) {
|
|
5166
|
-
return;
|
|
5167
|
-
}
|
|
5168
|
-
clear();
|
|
5169
|
-
return;
|
|
5170
|
-
}
|
|
5171
|
-
selectBuildStrategy(operations?.action);
|
|
5323
|
+
const buildContent = (items, _, operations = {}) => {
|
|
5324
|
+
selectBuildStrategy(operations.action);
|
|
5172
5325
|
|
|
5173
|
-
if(
|
|
5174
|
-
if(lastNumberOfItems === 0) {
|
|
5175
|
-
Actions.add(items);
|
|
5176
|
-
return;
|
|
5177
|
-
}
|
|
5178
|
-
Actions.replace(items);
|
|
5179
|
-
}
|
|
5180
|
-
else if(Actions[operations.action]) {
|
|
5326
|
+
if(Actions[operations.action]) {
|
|
5181
5327
|
Actions[operations.action](operations.args, operations.result);
|
|
5182
5328
|
}
|
|
5183
|
-
|
|
5184
5329
|
updateIndexObservers(items, 0);
|
|
5185
5330
|
};
|
|
5186
5331
|
|
|
5187
5332
|
if(data.val().length) {
|
|
5188
5333
|
buildContent(data.val(), null, {action: null});
|
|
5189
5334
|
}
|
|
5190
|
-
|
|
5191
|
-
data.subscribe(buildContent);
|
|
5192
|
-
}
|
|
5335
|
+
data.subscribe(buildContent);
|
|
5193
5336
|
|
|
5194
5337
|
return element;
|
|
5195
5338
|
}
|
|
@@ -5210,7 +5353,7 @@ var NativeDocument = (function (exports) {
|
|
|
5210
5353
|
*/
|
|
5211
5354
|
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
5212
5355
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
5213
|
-
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5356
|
+
return DebugManager$2.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
5214
5357
|
}
|
|
5215
5358
|
const element = Anchor('Show if : '+(comment || ''));
|
|
5216
5359
|
|
|
@@ -6629,7 +6772,7 @@ var NativeDocument = (function (exports) {
|
|
|
6629
6772
|
window.history.pushState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6630
6773
|
this.handleRouteChange(route, params, query, path);
|
|
6631
6774
|
} catch (e) {
|
|
6632
|
-
DebugManager.error('HistoryRouter', 'Error in pushState', e);
|
|
6775
|
+
DebugManager$2.error('HistoryRouter', 'Error in pushState', e);
|
|
6633
6776
|
}
|
|
6634
6777
|
};
|
|
6635
6778
|
/**
|
|
@@ -6642,7 +6785,7 @@ var NativeDocument = (function (exports) {
|
|
|
6642
6785
|
window.history.replaceState({ name: route.name(), params, path}, route.name() || path , path);
|
|
6643
6786
|
this.handleRouteChange(route, params, {}, path);
|
|
6644
6787
|
} catch(e) {
|
|
6645
|
-
DebugManager.error('HistoryRouter', 'Error in replaceState', e);
|
|
6788
|
+
DebugManager$2.error('HistoryRouter', 'Error in replaceState', e);
|
|
6646
6789
|
}
|
|
6647
6790
|
};
|
|
6648
6791
|
this.forward = function() {
|
|
@@ -6669,7 +6812,7 @@ var NativeDocument = (function (exports) {
|
|
|
6669
6812
|
}
|
|
6670
6813
|
this.handleRouteChange(route, params, query, path);
|
|
6671
6814
|
} catch(e) {
|
|
6672
|
-
DebugManager.error('HistoryRouter', 'Error in popstate event', e);
|
|
6815
|
+
DebugManager$2.error('HistoryRouter', 'Error in popstate event', e);
|
|
6673
6816
|
}
|
|
6674
6817
|
});
|
|
6675
6818
|
const { route, params, query, path } = this.resolve(defaultPath || (window.location.pathname+window.location.search));
|
|
@@ -6894,7 +7037,7 @@ var NativeDocument = (function (exports) {
|
|
|
6894
7037
|
listener(request);
|
|
6895
7038
|
next && next(request);
|
|
6896
7039
|
} catch (e) {
|
|
6897
|
-
DebugManager.warn('Route Listener', 'Error in listener:', e);
|
|
7040
|
+
DebugManager$2.warn('Route Listener', 'Error in listener:', e);
|
|
6898
7041
|
}
|
|
6899
7042
|
}
|
|
6900
7043
|
};
|
|
@@ -7072,7 +7215,7 @@ var NativeDocument = (function (exports) {
|
|
|
7072
7215
|
*/
|
|
7073
7216
|
Router.create = function(options, callback) {
|
|
7074
7217
|
if(!Validator.isFunction(callback)) {
|
|
7075
|
-
DebugManager.error('Router', 'Callback must be a function');
|
|
7218
|
+
DebugManager$2.error('Router', 'Callback must be a function');
|
|
7076
7219
|
throw new RouterError('Callback must be a function');
|
|
7077
7220
|
}
|
|
7078
7221
|
const router = new Router(options);
|
|
@@ -7276,7 +7419,7 @@ var NativeDocument = (function (exports) {
|
|
|
7276
7419
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
7277
7420
|
exports.NDElement = NDElement;
|
|
7278
7421
|
exports.Observable = Observable;
|
|
7279
|
-
exports.PluginsManager = PluginsManager;
|
|
7422
|
+
exports.PluginsManager = PluginsManager$1;
|
|
7280
7423
|
exports.SingletonView = SingletonView;
|
|
7281
7424
|
exports.Store = Store;
|
|
7282
7425
|
exports.StoreFactory = StoreFactory;
|