native-document 1.0.30 → 1.0.31

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.
@@ -637,6 +637,10 @@ var NativeDocument = (function (exports) {
637
637
  };
638
638
  }
639
639
 
640
+ NDElement.prototype.valueOf = function() {
641
+ return this.$element;
642
+ };
643
+
640
644
  NDElement.prototype.ref = function(target, name) {
641
645
  target[name] = this.$element;
642
646
  return this;
@@ -1260,35 +1264,6 @@ var NativeDocument = (function (exports) {
1260
1264
  }
1261
1265
  });
1262
1266
 
1263
- /**
1264
- *
1265
- * @param {string} name
1266
- * @param {?Function} customWrapper
1267
- * @returns {Function}
1268
- */
1269
- function HtmlElementWrapper(name, customWrapper) {
1270
- const $tagName = name.toLowerCase();
1271
-
1272
- return function(attributes, children = null) {
1273
- try {
1274
- if(!Validator.isJson(attributes)) {
1275
- const tempChildren = children;
1276
- children = attributes;
1277
- attributes = tempChildren;
1278
- }
1279
- const element = ElementCreator.createElement($tagName);
1280
- const finalElement = (typeof customWrapper === 'function') ? customWrapper(element) : element;
1281
-
1282
- ElementCreator.processAttributes(finalElement, attributes);
1283
- ElementCreator.processChildren(children, finalElement);
1284
-
1285
- return ElementCreator.setup(finalElement, attributes, customWrapper);
1286
- } catch (error) {
1287
- DebugManager$1.error('ElementCreation', `Error creating ${$tagName}`, error);
1288
- }
1289
- };
1290
- }
1291
-
1292
1267
  class ArgTypesError extends Error {
1293
1268
  constructor(message, errors) {
1294
1269
  super(`${message}\n\n${errors.join("\n")}\n\n`);
@@ -1392,15 +1367,40 @@ var NativeDocument = (function (exports) {
1392
1367
  };
1393
1368
  };
1394
1369
 
1395
- const normalizeComponentArgs = function(props, children) {
1396
- if(!Validator.isJson(children)) {
1397
- const temp = props;
1398
- props = children;
1399
- children = temp;
1370
+ const normalizeComponentArgs = function(props, children = null) {
1371
+ if(!Validator.isJson(props)) {
1372
+ const temp = children;
1373
+ children = props;
1374
+ props = temp;
1400
1375
  }
1401
1376
  return { props, children };
1402
1377
  };
1403
1378
 
1379
+ /**
1380
+ *
1381
+ * @param {string} name
1382
+ * @param {?Function} customWrapper
1383
+ * @returns {Function}
1384
+ */
1385
+ function HtmlElementWrapper(name, customWrapper) {
1386
+ const $tagName = name.toLowerCase();
1387
+
1388
+ return function(_attributes, _children = null) {
1389
+ try {
1390
+ const { props: attributes, children = null } = normalizeComponentArgs(_attributes, _children);
1391
+ const element = ElementCreator.createElement($tagName);
1392
+ const finalElement = (typeof customWrapper === 'function') ? customWrapper(element) : element;
1393
+
1394
+ ElementCreator.processAttributes(finalElement, attributes);
1395
+ ElementCreator.processChildren(children, finalElement);
1396
+
1397
+ return ElementCreator.setup(finalElement, attributes, customWrapper);
1398
+ } catch (error) {
1399
+ DebugManager$1.error('ElementCreation', `Error creating ${$tagName}`, error);
1400
+ }
1401
+ };
1402
+ }
1403
+
1404
1404
  Function.prototype.args = function(...args) {
1405
1405
  return withValidation(this, args);
1406
1406
  };