native-document 1.0.29 → 1.0.30
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.dev.js +54 -0
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/index.d.ts +3 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/src/utils/args-types.js +10 -1
- package/src/utils/property-accumulator.js +6 -6
- package/types/args-types.d.ts +58 -0
- package/types/property-accumulator.d.ts +33 -0
- package/types/validator.ts +55 -0
|
@@ -1392,6 +1392,15 @@ var NativeDocument = (function (exports) {
|
|
|
1392
1392
|
};
|
|
1393
1393
|
};
|
|
1394
1394
|
|
|
1395
|
+
const normalizeComponentArgs = function(props, children) {
|
|
1396
|
+
if(!Validator.isJson(children)) {
|
|
1397
|
+
const temp = props;
|
|
1398
|
+
props = children;
|
|
1399
|
+
children = temp;
|
|
1400
|
+
}
|
|
1401
|
+
return { props, children };
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1395
1404
|
Function.prototype.args = function(...args) {
|
|
1396
1405
|
return withValidation(this, args);
|
|
1397
1406
|
};
|
|
@@ -1433,6 +1442,48 @@ var NativeDocument = (function (exports) {
|
|
|
1433
1442
|
});
|
|
1434
1443
|
};
|
|
1435
1444
|
|
|
1445
|
+
const cssPropertyAccumulator = function(initialValue = {}) {
|
|
1446
|
+
let data = Validator.isString(initialValue) ? initialValue.split(';').filter(Boolean) : initialValue;
|
|
1447
|
+
const isArray = Validator.isArray(data);
|
|
1448
|
+
|
|
1449
|
+
return {
|
|
1450
|
+
add(key, value) {
|
|
1451
|
+
if(isArray) {
|
|
1452
|
+
data.push(key+' : '+value);
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
data[key] = value;
|
|
1456
|
+
},
|
|
1457
|
+
value() {
|
|
1458
|
+
if(isArray) {
|
|
1459
|
+
return data.join(';').concat(';');
|
|
1460
|
+
}
|
|
1461
|
+
return { ...data };
|
|
1462
|
+
},
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
const classPropertyAccumulator = function(initialValue = []) {
|
|
1467
|
+
let data = Validator.isString(initialValue) ? initialValue.split(" ").filter(Boolean) : initialValue;
|
|
1468
|
+
const isArray = Validator.isArray(data);
|
|
1469
|
+
|
|
1470
|
+
return {
|
|
1471
|
+
add(key, value = true) {
|
|
1472
|
+
if(isArray) {
|
|
1473
|
+
data.push(key);
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
data[key] = value;
|
|
1477
|
+
},
|
|
1478
|
+
value() {
|
|
1479
|
+
if(isArray) {
|
|
1480
|
+
return data.join(' ');
|
|
1481
|
+
}
|
|
1482
|
+
return { ...data };
|
|
1483
|
+
},
|
|
1484
|
+
};
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1436
1487
|
const methods = ['push', 'pop', 'shift', 'unshift', 'reverse', 'sort', 'splice'];
|
|
1437
1488
|
|
|
1438
1489
|
/**
|
|
@@ -3331,7 +3382,10 @@ var NativeDocument = (function (exports) {
|
|
|
3331
3382
|
exports.NDElement = NDElement;
|
|
3332
3383
|
exports.Observable = Observable;
|
|
3333
3384
|
exports.Store = Store;
|
|
3385
|
+
exports.classPropertyAccumulator = classPropertyAccumulator;
|
|
3386
|
+
exports.cssPropertyAccumulator = cssPropertyAccumulator;
|
|
3334
3387
|
exports.elements = elements;
|
|
3388
|
+
exports.normalizeComponentArgs = normalizeComponentArgs;
|
|
3335
3389
|
exports.router = router;
|
|
3336
3390
|
exports.withValidation = withValidation;
|
|
3337
3391
|
|