native-document 1.0.78 → 1.0.80
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 +32 -28
- package/dist/native-document.dev.js +33 -28
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.devtools.min.js +1 -1
- package/dist/native-document.min.js +1 -1
- package/package.json +1 -1
- package/src/components/tooltip/prototypes.js +1 -1
- package/src/core/utils/prototypes.js +2 -0
- package/src/core/wrappers/AttributesWrapper.js +20 -13
- package/src/core/wrappers/ElementCreator.js +11 -6
- package/src/core/wrappers/TemplateCloner.js +1 -2
- package/src/core/wrappers/prototypes/attributes-extensions.js +0 -8
|
@@ -1552,8 +1552,18 @@ var NativeComponents = (function (exports) {
|
|
|
1552
1552
|
function bindClassAttribute(element, data) {
|
|
1553
1553
|
for(let className in data) {
|
|
1554
1554
|
const value = data[className];
|
|
1555
|
-
if(value
|
|
1556
|
-
|
|
1555
|
+
if(Validator.isObservable(value)) {
|
|
1556
|
+
element.classes.toggle(className, value.val());
|
|
1557
|
+
value.subscribe(toggleElementClass.bind(null, element, className));
|
|
1558
|
+
continue;
|
|
1559
|
+
}
|
|
1560
|
+
if(Validator.isObservableWhenResult(value)) {
|
|
1561
|
+
element.classes.toggle(className, value.isMath());
|
|
1562
|
+
value.subscribe(toggleElementClass.bind(null, element, className));
|
|
1563
|
+
continue;
|
|
1564
|
+
}
|
|
1565
|
+
if(value.$hydrate) {
|
|
1566
|
+
value.$hydrate(element, className);
|
|
1557
1567
|
continue;
|
|
1558
1568
|
}
|
|
1559
1569
|
element.classes.toggle(className, value);
|
|
@@ -1623,12 +1633,6 @@ var NativeComponents = (function (exports) {
|
|
|
1623
1633
|
}
|
|
1624
1634
|
}
|
|
1625
1635
|
|
|
1626
|
-
const NdBindings = {
|
|
1627
|
-
class: (element, value) => bindClassAttribute(element, value),
|
|
1628
|
-
style: (element, value) => bindStyleAttribute(element, value),
|
|
1629
|
-
};
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
1636
|
/**
|
|
1633
1637
|
*
|
|
1634
1638
|
* @param {HTMLElement} element
|
|
@@ -1642,7 +1646,7 @@ var NativeComponents = (function (exports) {
|
|
|
1642
1646
|
|
|
1643
1647
|
for(let key in attributes) {
|
|
1644
1648
|
const attributeName = key.toLowerCase();
|
|
1645
|
-
let value = attributes[
|
|
1649
|
+
let value = attributes[attributeName];
|
|
1646
1650
|
if(value == null) {
|
|
1647
1651
|
continue;
|
|
1648
1652
|
}
|
|
@@ -1650,10 +1654,13 @@ var NativeComponents = (function (exports) {
|
|
|
1650
1654
|
value.handleNdAttribute(element, attributeName, value);
|
|
1651
1655
|
continue;
|
|
1652
1656
|
}
|
|
1653
|
-
if(typeof value ===
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
+
if(typeof value === 'object') {
|
|
1658
|
+
if(attributeName === 'class') {
|
|
1659
|
+
bindClassAttribute(element, value);
|
|
1660
|
+
continue;
|
|
1661
|
+
}
|
|
1662
|
+
if(attributeName === 'style') {
|
|
1663
|
+
bindStyleAttribute(element, value);
|
|
1657
1664
|
continue;
|
|
1658
1665
|
}
|
|
1659
1666
|
}
|
|
@@ -1723,14 +1730,6 @@ var NativeComponents = (function (exports) {
|
|
|
1723
1730
|
element.setAttribute(attributeName, this);
|
|
1724
1731
|
};
|
|
1725
1732
|
|
|
1726
|
-
Number.prototype.handleNdAttribute = function(element, attributeName) {
|
|
1727
|
-
element.setAttribute(attributeName, this);
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
Boolean.prototype.handleNdAttribute = function(element, attrName) {
|
|
1731
|
-
bindBooleanAttribute(element, attrName, this);
|
|
1732
|
-
};
|
|
1733
|
-
|
|
1734
1733
|
ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
|
|
1735
1734
|
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
1736
1735
|
bindBooleanAttribute(element, attributeName, this);
|
|
@@ -1822,14 +1821,19 @@ var NativeComponents = (function (exports) {
|
|
|
1822
1821
|
PluginsManager.emit('AfterProcessChildren', parent);
|
|
1823
1822
|
},
|
|
1824
1823
|
getChild(child) {
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1824
|
+
if(child == null) {
|
|
1825
|
+
return null;
|
|
1826
|
+
}
|
|
1827
|
+
if(child.toNdElement) {
|
|
1828
|
+
do {
|
|
1829
|
+
child = child.toNdElement();
|
|
1830
|
+
if(Validator.isElement(child)) {
|
|
1831
|
+
return child;
|
|
1832
|
+
}
|
|
1833
|
+
} while (child.toNdElement);
|
|
1830
1834
|
}
|
|
1831
1835
|
|
|
1832
|
-
return
|
|
1836
|
+
return ElementCreator.createStaticTextNode(null, child);
|
|
1833
1837
|
},
|
|
1834
1838
|
/**
|
|
1835
1839
|
*
|
|
@@ -2168,7 +2172,7 @@ var NativeComponents = (function (exports) {
|
|
|
2168
2172
|
return createHtmlElement.bind(null, name.toLowerCase(), customWrapper);
|
|
2169
2173
|
}
|
|
2170
2174
|
|
|
2171
|
-
|
|
2175
|
+
DocumentFragment.prototype.__IS_FRAGMENT = true;
|
|
2172
2176
|
|
|
2173
2177
|
Function.prototype.args = function(...args) {
|
|
2174
2178
|
return withValidation(this);
|
|
@@ -1368,8 +1368,18 @@ var NativeDocument = (function (exports) {
|
|
|
1368
1368
|
function bindClassAttribute(element, data) {
|
|
1369
1369
|
for(let className in data) {
|
|
1370
1370
|
const value = data[className];
|
|
1371
|
-
if(value
|
|
1372
|
-
|
|
1371
|
+
if(Validator.isObservable(value)) {
|
|
1372
|
+
element.classes.toggle(className, value.val());
|
|
1373
|
+
value.subscribe(toggleElementClass.bind(null, element, className));
|
|
1374
|
+
continue;
|
|
1375
|
+
}
|
|
1376
|
+
if(Validator.isObservableWhenResult(value)) {
|
|
1377
|
+
element.classes.toggle(className, value.isMath());
|
|
1378
|
+
value.subscribe(toggleElementClass.bind(null, element, className));
|
|
1379
|
+
continue;
|
|
1380
|
+
}
|
|
1381
|
+
if(value.$hydrate) {
|
|
1382
|
+
value.$hydrate(element, className);
|
|
1373
1383
|
continue;
|
|
1374
1384
|
}
|
|
1375
1385
|
element.classes.toggle(className, value);
|
|
@@ -1439,12 +1449,6 @@ var NativeDocument = (function (exports) {
|
|
|
1439
1449
|
}
|
|
1440
1450
|
}
|
|
1441
1451
|
|
|
1442
|
-
const NdBindings = {
|
|
1443
|
-
class: (element, value) => bindClassAttribute(element, value),
|
|
1444
|
-
style: (element, value) => bindStyleAttribute(element, value),
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
1452
|
/**
|
|
1449
1453
|
*
|
|
1450
1454
|
* @param {HTMLElement} element
|
|
@@ -1460,7 +1464,7 @@ var NativeDocument = (function (exports) {
|
|
|
1460
1464
|
|
|
1461
1465
|
for(let key in attributes) {
|
|
1462
1466
|
const attributeName = key.toLowerCase();
|
|
1463
|
-
let value = attributes[
|
|
1467
|
+
let value = attributes[attributeName];
|
|
1464
1468
|
if(value == null) {
|
|
1465
1469
|
continue;
|
|
1466
1470
|
}
|
|
@@ -1468,10 +1472,13 @@ var NativeDocument = (function (exports) {
|
|
|
1468
1472
|
value.handleNdAttribute(element, attributeName, value);
|
|
1469
1473
|
continue;
|
|
1470
1474
|
}
|
|
1471
|
-
if(typeof value ===
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
+
if(typeof value === 'object') {
|
|
1476
|
+
if(attributeName === 'class') {
|
|
1477
|
+
bindClassAttribute(element, value);
|
|
1478
|
+
continue;
|
|
1479
|
+
}
|
|
1480
|
+
if(attributeName === 'style') {
|
|
1481
|
+
bindStyleAttribute(element, value);
|
|
1475
1482
|
continue;
|
|
1476
1483
|
}
|
|
1477
1484
|
}
|
|
@@ -1541,14 +1548,6 @@ var NativeDocument = (function (exports) {
|
|
|
1541
1548
|
element.setAttribute(attributeName, this);
|
|
1542
1549
|
};
|
|
1543
1550
|
|
|
1544
|
-
Number.prototype.handleNdAttribute = function(element, attributeName) {
|
|
1545
|
-
element.setAttribute(attributeName, this);
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1548
|
-
Boolean.prototype.handleNdAttribute = function(element, attrName) {
|
|
1549
|
-
bindBooleanAttribute(element, attrName, this);
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
1551
|
ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
|
|
1553
1552
|
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
1554
1553
|
bindBooleanAttribute(element, attributeName, this);
|
|
@@ -1640,14 +1639,19 @@ var NativeDocument = (function (exports) {
|
|
|
1640
1639
|
PluginsManager.emit('AfterProcessChildren', parent);
|
|
1641
1640
|
},
|
|
1642
1641
|
getChild(child) {
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1642
|
+
if(child == null) {
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
if(child.toNdElement) {
|
|
1646
|
+
do {
|
|
1647
|
+
child = child.toNdElement();
|
|
1648
|
+
if(Validator.isElement(child)) {
|
|
1649
|
+
return child;
|
|
1650
|
+
}
|
|
1651
|
+
} while (child.toNdElement);
|
|
1648
1652
|
}
|
|
1649
1653
|
|
|
1650
|
-
return
|
|
1654
|
+
return ElementCreator.createStaticTextNode(null, child);
|
|
1651
1655
|
},
|
|
1652
1656
|
/**
|
|
1653
1657
|
*
|
|
@@ -2310,7 +2314,6 @@ var NativeDocument = (function (exports) {
|
|
|
2310
2314
|
return wrapper([_, __, ...args]);
|
|
2311
2315
|
};
|
|
2312
2316
|
}
|
|
2313
|
-
w;
|
|
2314
2317
|
|
|
2315
2318
|
function SingletonView($viewCreator) {
|
|
2316
2319
|
let $cacheNode = null;
|
|
@@ -2358,6 +2361,8 @@ var NativeDocument = (function (exports) {
|
|
|
2358
2361
|
};
|
|
2359
2362
|
}
|
|
2360
2363
|
|
|
2364
|
+
DocumentFragment.prototype.__IS_FRAGMENT = true;
|
|
2365
|
+
|
|
2361
2366
|
Function.prototype.args = function(...args) {
|
|
2362
2367
|
return exports.withValidation(this, args);
|
|
2363
2368
|
};
|