native-document 1.0.93 → 1.0.95

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.
Files changed (37) hide show
  1. package/dist/native-document.components.min.js +667 -62
  2. package/dist/native-document.dev.js +878 -111
  3. package/dist/native-document.dev.js.map +1 -1
  4. package/dist/native-document.devtools.min.js +1 -1
  5. package/dist/native-document.min.js +1 -1
  6. package/elements.js +1 -0
  7. package/index.def.js +1086 -0
  8. package/package.json +1 -1
  9. package/src/core/elements/anchor.js +28 -20
  10. package/src/core/elements/content-formatter.js +138 -1
  11. package/src/core/elements/control/for-each-array.js +1 -1
  12. package/src/core/elements/control/for-each.js +2 -2
  13. package/src/core/elements/control/show-if.js +3 -3
  14. package/src/core/elements/control/show-when.js +2 -2
  15. package/src/core/elements/control/switch.js +1 -1
  16. package/src/core/elements/description-list.js +14 -0
  17. package/src/core/elements/form.js +188 -4
  18. package/src/core/elements/html5-semantics.js +44 -1
  19. package/src/core/elements/img.js +22 -10
  20. package/src/core/elements/index.js +5 -0
  21. package/src/core/elements/interactive.js +19 -1
  22. package/src/core/elements/list.js +28 -1
  23. package/src/core/elements/medias.js +29 -0
  24. package/src/core/elements/meta-data.js +34 -0
  25. package/src/core/elements/table.js +59 -0
  26. package/src/core/utils/helpers.js +7 -2
  27. package/src/core/utils/memoize.js +1 -1
  28. package/src/core/wrappers/DocumentObserver.js +102 -31
  29. package/src/core/wrappers/ElementCreator.js +5 -0
  30. package/src/core/wrappers/HtmlElementWrapper.js +2 -2
  31. package/src/core/wrappers/NDElement.js +33 -2
  32. package/src/core/wrappers/TemplateCloner.js +1 -1
  33. package/src/core/wrappers/prototypes/nd-element.transition.extensions.js +83 -0
  34. package/types/elements.d.ts +1073 -113
  35. package/types/forms.d.ts +85 -48
  36. package/types/images.d.ts +16 -9
  37. package/types/nd-element.d.ts +6 -0
@@ -363,16 +363,16 @@ var NativeComponents = (function (exports) {
363
363
  // });
364
364
  };
365
365
 
366
- let DebugManager$1 = {};
366
+ let DebugManager = {};
367
367
  {
368
- DebugManager$1 = {
368
+ DebugManager = {
369
369
  log() {},
370
370
  warn() {},
371
371
  error() {},
372
372
  disable() {}
373
373
  };
374
374
  }
375
- var DebugManager = DebugManager$1;
375
+ var DebugManager$1 = DebugManager;
376
376
 
377
377
  const MemoryManager = (function() {
378
378
 
@@ -421,7 +421,7 @@ var NativeComponents = (function (exports) {
421
421
  }
422
422
  }
423
423
  if (cleanedCount > 0) {
424
- DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
424
+ DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
425
425
  }
426
426
  }
427
427
  };
@@ -617,7 +617,12 @@ var NativeComponents = (function (exports) {
617
617
  };
618
618
 
619
619
  const deepClone = (value, onObservableFound) => {
620
- // Primitives
620
+ try {
621
+ if(window.structuredClone !== undefined) {
622
+ return window.structuredClone(value);
623
+ }
624
+ } catch (e){}
625
+
621
626
  if (value === null || typeof value !== 'object') {
622
627
  return value;
623
628
  }
@@ -641,7 +646,7 @@ var NativeComponents = (function (exports) {
641
646
  // Objects
642
647
  const cloned = {};
643
648
  for (const key in value) {
644
- if (value.hasOwnProperty(key)) {
649
+ if (Object.hasOwn(value, key)) {
645
650
  cloned[key] = deepClone(value[key]);
646
651
  }
647
652
  }
@@ -1097,96 +1102,168 @@ var NativeComponents = (function (exports) {
1097
1102
 
1098
1103
  const DocumentObserver = {
1099
1104
  mounted: new WeakMap(),
1105
+ beforeUnmount: new WeakMap(),
1100
1106
  mountedSupposedSize: 0,
1101
1107
  unmounted: new WeakMap(),
1102
1108
  unmountedSupposedSize: 0,
1103
1109
  observer: null,
1110
+
1104
1111
  executeMountedCallback(node) {
1105
1112
  const data = DocumentObserver.mounted.get(node);
1106
1113
  if(!data) {
1107
1114
  return;
1108
1115
  }
1109
1116
  data.inDom = true;
1110
- data.mounted && data.mounted(node);
1117
+ if(!data.mounted) {
1118
+ return;
1119
+ }
1120
+ if(Array.isArray(data.mounted)) {
1121
+ for(const cb of data.mounted) {
1122
+ cb(node);
1123
+ }
1124
+ return;
1125
+ }
1126
+ data.mounted(node);
1111
1127
  },
1128
+
1112
1129
  executeUnmountedCallback(node) {
1113
1130
  const data = DocumentObserver.unmounted.get(node);
1114
1131
  if(!data) {
1115
1132
  return;
1116
1133
  }
1117
-
1118
1134
  data.inDom = false;
1119
- if(data.unmounted && data.unmounted(node) === true) {
1135
+ if(!data.unmounted) {
1136
+ return;
1137
+ }
1138
+
1139
+ let shouldRemove = false;
1140
+ if(Array.isArray(data.unmounted)) {
1141
+ for(const cb of data.unmounted) {
1142
+ if(cb(node) === true) {
1143
+ shouldRemove = true;
1144
+ }
1145
+ }
1146
+ } else {
1147
+ shouldRemove = data.unmounted(node) === true;
1148
+ }
1149
+
1150
+ if(shouldRemove) {
1120
1151
  data.disconnect();
1121
1152
  node.nd?.remove();
1122
1153
  }
1123
1154
  },
1155
+
1124
1156
  checkMutation: function(mutationsList) {
1125
1157
  for(const mutation of mutationsList) {
1126
- if(DocumentObserver.mountedSupposedSize > 0 ) {
1158
+ if(DocumentObserver.mountedSupposedSize > 0) {
1127
1159
  for(const node of mutation.addedNodes) {
1128
1160
  DocumentObserver.executeMountedCallback(node);
1129
1161
  if(!node.querySelectorAll) {
1130
- return;
1162
+ continue;
1131
1163
  }
1132
1164
  const children = node.querySelectorAll('[data--nd-mounted]');
1133
- if(!children.length) {
1134
- return;
1135
- }
1136
- for(const node of children) {
1137
- DocumentObserver.executeMountedCallback(node);
1165
+ for(const child of children) {
1166
+ DocumentObserver.executeMountedCallback(child);
1138
1167
  }
1139
1168
  }
1140
1169
  }
1141
1170
 
1142
- if(DocumentObserver.unmountedSupposedSize > 0 ) {
1143
- for(const node of mutation.removedNodes) {
1171
+ if (DocumentObserver.unmountedSupposedSize > 0) {
1172
+ for (const node of mutation.removedNodes) {
1144
1173
  DocumentObserver.executeUnmountedCallback(node);
1145
1174
  if(!node.querySelectorAll) {
1146
- return;
1175
+ continue;
1147
1176
  }
1148
1177
  const children = node.querySelectorAll('[data--nd-unmounted]');
1149
- if(!children.length) {
1150
- return;
1151
- }
1152
- for(const node of children) {
1153
- DocumentObserver.executeUnmountedCallback(node);
1178
+ for(const child of children) {
1179
+ DocumentObserver.executeUnmountedCallback(child);
1154
1180
  }
1155
1181
  }
1156
1182
  }
1157
1183
  }
1158
1184
  },
1185
+
1159
1186
  /**
1160
- *
1161
1187
  * @param {HTMLElement} element
1162
1188
  * @param {boolean} inDom
1163
- * @returns {{watch: (function(): Map<any, any>), disconnect: (function(): boolean), mounted: (function(*): Set<any>), unmounted: (function(*): Set<any>)}}
1189
+ * @returns {{ disconnect: Function, mounted: Function, unmounted: Function, off: Function }}
1164
1190
  */
1165
1191
  watch: function(element, inDom = false) {
1192
+ let mountedRegistered = false;
1193
+ let unmountedRegistered = false;
1194
+
1166
1195
  let data = {
1167
1196
  inDom,
1168
1197
  mounted: null,
1169
1198
  unmounted: null,
1170
1199
  disconnect: () => {
1171
- DocumentObserver.mounted.delete(element);
1172
- DocumentObserver.unmounted.delete(element);
1173
- DocumentObserver.mountedSupposedSize--;
1174
- DocumentObserver.unmountedSupposedSize--;
1200
+ if (mountedRegistered) {
1201
+ DocumentObserver.mounted.delete(element);
1202
+ DocumentObserver.mountedSupposedSize--;
1203
+ }
1204
+ if (unmountedRegistered) {
1205
+ DocumentObserver.unmounted.delete(element);
1206
+ DocumentObserver.unmountedSupposedSize--;
1207
+ }
1175
1208
  data = null;
1176
1209
  }
1177
1210
  };
1178
1211
 
1212
+ const addListener = (type, callback) => {
1213
+ if (!data[type]) {
1214
+ data[type] = callback;
1215
+ return;
1216
+ }
1217
+ if (!Array.isArray(data[type])) {
1218
+ data[type] = [data[type], callback];
1219
+ return;
1220
+ }
1221
+ data[type].push(callback);
1222
+ };
1223
+
1224
+ const removeListener = (type, callback) => {
1225
+ if(!data?.[type]) {
1226
+ return;
1227
+ }
1228
+ if(Array.isArray(data[type])) {
1229
+ const index = data[type].indexOf(callback);
1230
+ if(index > -1) {
1231
+ data[type].splice(index, 1);
1232
+ }
1233
+ if(data[type].length === 1) {
1234
+ data[type] = data[type][0];
1235
+ }
1236
+ if(data[type].length === 0) {
1237
+ data[type] = null;
1238
+ }
1239
+ return;
1240
+ }
1241
+ data[type] = null;
1242
+ };
1243
+
1179
1244
  return {
1180
- disconnect: data.disconnect,
1245
+ disconnect: () => data?.disconnect(),
1246
+
1181
1247
  mounted: (callback) => {
1182
- data.mounted = callback;
1248
+ addListener('mounted', callback);
1183
1249
  DocumentObserver.mounted.set(element, data);
1184
- DocumentObserver.mountedSupposedSize++;
1250
+ if (!mountedRegistered) {
1251
+ DocumentObserver.mountedSupposedSize++;
1252
+ mountedRegistered = true;
1253
+ }
1185
1254
  },
1255
+
1186
1256
  unmounted: (callback) => {
1187
- data.unmounted = callback;
1257
+ addListener('unmounted', callback);
1188
1258
  DocumentObserver.unmounted.set(element, data);
1189
- DocumentObserver.unmountedSupposedSize++;
1259
+ if (!unmountedRegistered) {
1260
+ DocumentObserver.unmountedSupposedSize++;
1261
+ unmountedRegistered = true;
1262
+ }
1263
+ },
1264
+
1265
+ off: (type, callback) => {
1266
+ removeListener(type, callback);
1190
1267
  }
1191
1268
  };
1192
1269
  }
@@ -1265,6 +1342,37 @@ var NativeComponents = (function (exports) {
1265
1342
  return this.lifecycle({ unmounted: callback });
1266
1343
  };
1267
1344
 
1345
+ NDElement.prototype.beforeUnmount = function(id, callback) {
1346
+ const el = this.$element;
1347
+
1348
+ if(!DocumentObserver.beforeUnmount.has(el)) {
1349
+ DocumentObserver.beforeUnmount.set(el, new Map());
1350
+ const originalRemove = el.remove.bind(el);
1351
+
1352
+ let $isUnmounting = false;
1353
+
1354
+ el.remove = async () => {
1355
+ if($isUnmounting) {
1356
+ return;
1357
+ }
1358
+ $isUnmounting = true;
1359
+
1360
+ try {
1361
+ const callbacks = DocumentObserver.beforeUnmount.get(el);
1362
+ for (const cb of callbacks.values()) {
1363
+ await cb.call(this, el);
1364
+ }
1365
+ } finally {
1366
+ originalRemove();
1367
+ $isUnmounting = false;
1368
+ }
1369
+ };
1370
+ }
1371
+
1372
+ DocumentObserver.beforeUnmount.get(el).set(id, callback);
1373
+ return this;
1374
+ };
1375
+
1268
1376
  NDElement.prototype.htmlElement = function() {
1269
1377
  return this.$element;
1270
1378
  };
@@ -1376,24 +1484,24 @@ var NativeComponents = (function (exports) {
1376
1484
  ]);
1377
1485
 
1378
1486
  for (const name in methods) {
1379
- if (!methods.hasOwnProperty(name)) {
1487
+ if (!Object.hasOwn(methods, name)) {
1380
1488
  continue;
1381
1489
  }
1382
1490
 
1383
1491
  const method = methods[name];
1384
1492
 
1385
1493
  if (typeof method !== 'function') {
1386
- DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
1494
+ DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
1387
1495
  continue;
1388
1496
  }
1389
1497
 
1390
1498
  if (protectedMethods.has(name)) {
1391
- DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
1499
+ DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
1392
1500
  throw new NativeDocumentError(`Cannot override protected method "${name}"`);
1393
1501
  }
1394
1502
 
1395
1503
  if (NDElement.prototype[name]) {
1396
- DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
1504
+ DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
1397
1505
  }
1398
1506
 
1399
1507
  NDElement.prototype[name] = method;
@@ -1546,6 +1654,7 @@ var NativeComponents = (function (exports) {
1546
1654
 
1547
1655
  anchorFragment.nativeInsertBefore = anchorFragment.insertBefore;
1548
1656
  anchorFragment.nativeAppendChild = anchorFragment.appendChild;
1657
+ anchorFragment.nativeAppend = anchorFragment.append;
1549
1658
 
1550
1659
  const isParentUniqueChild = (parent) => (isUniqueChild || (parent.firstChild === anchorStart && parent.lastChild === anchorEnd));
1551
1660
 
@@ -1575,65 +1684,72 @@ var NativeComponents = (function (exports) {
1575
1684
  anchorFragment.appendChild = function(child, before = null) {
1576
1685
  const parent = anchorEnd.parentNode;
1577
1686
  if(!parent) {
1578
- DebugManager.error('Anchor', 'Anchor : parent not found', child);
1687
+ DebugManager$1.error('Anchor', 'Anchor : parent not found', child);
1579
1688
  return;
1580
1689
  }
1581
1690
  before = before ?? anchorEnd;
1582
1691
  insertBefore(parent, child, before);
1583
1692
  };
1693
+
1584
1694
  anchorFragment.append = function(...args ) {
1585
1695
  return anchorFragment.appendChild(args);
1586
1696
  };
1587
1697
 
1588
- anchorFragment.removeChildren = function() {
1698
+ anchorFragment.removeChildren = async function() {
1589
1699
  const parent = anchorEnd.parentNode;
1590
1700
  if(parent === anchorFragment) {
1591
1701
  return;
1592
1702
  }
1593
- if(isParentUniqueChild(parent)) {
1594
- parent.replaceChildren(anchorStart, anchorEnd);
1595
- return;
1596
- }
1703
+ // if(isParentUniqueChild(parent)) {
1704
+ // parent.replaceChildren(anchorStart, anchorEnd);
1705
+ // return;
1706
+ // }
1597
1707
 
1598
1708
  let itemToRemove = anchorStart.nextSibling, tempItem;
1599
- const fragment = document.createDocumentFragment();
1709
+ const removes = [];
1600
1710
  while(itemToRemove && itemToRemove !== anchorEnd) {
1601
1711
  tempItem = itemToRemove.nextSibling;
1602
- fragment.append(itemToRemove);
1712
+ removes.push(itemToRemove.remove());
1603
1713
  itemToRemove = tempItem;
1604
1714
  }
1605
- fragment.replaceChildren();
1715
+ await Promise.all(removes);
1606
1716
  };
1607
- anchorFragment.remove = function() {
1717
+
1718
+ anchorFragment.remove = async function() {
1608
1719
  const parent = anchorEnd.parentNode;
1609
1720
  if(parent === anchorFragment) {
1610
1721
  return;
1611
1722
  }
1612
1723
  let itemToRemove = anchorStart.nextSibling, tempItem;
1724
+ const allItemToRemove = [];
1725
+ const removes = [];
1613
1726
  while(itemToRemove && itemToRemove !== anchorEnd) {
1614
1727
  tempItem = itemToRemove.nextSibling;
1615
- anchorFragment.nativeAppendChild(itemToRemove);
1728
+ allItemToRemove.push(itemToRemove);
1729
+ removes.push(itemToRemove.remove());
1616
1730
  itemToRemove = tempItem;
1617
1731
  }
1732
+ await Promise.all(removes);
1733
+ anchorFragment.nativeAppend(...allItemToRemove);
1618
1734
  };
1619
1735
 
1620
- anchorFragment.removeWithAnchors = function() {
1621
- anchorFragment.removeChildren();
1736
+ anchorFragment.removeWithAnchors = async function() {
1737
+ await anchorFragment.removeChildren();
1622
1738
  anchorStart.remove();
1623
1739
  anchorEnd.remove();
1624
1740
  };
1625
1741
 
1626
- anchorFragment.replaceContent = function(child) {
1742
+ anchorFragment.replaceContent = async function(child) {
1627
1743
  const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
1628
1744
  const parent = anchorEnd.parentNode;
1629
1745
  if(!parent) {
1630
1746
  return;
1631
1747
  }
1632
- if(isParentUniqueChild(parent)) {
1633
- parent.replaceChildren(anchorStart, childElement, anchorEnd);
1634
- return;
1635
- }
1636
- anchorFragment.removeChildren();
1748
+ // if(isParentUniqueChild(parent)) {
1749
+ // parent.replaceChildren(anchorStart, childElement, anchorEnd);
1750
+ // return;
1751
+ // }
1752
+ await anchorFragment.removeChildren();
1637
1753
  parent.insertBefore(childElement, anchorEnd);
1638
1754
  };
1639
1755
 
@@ -1953,6 +2069,88 @@ var NativeComponents = (function (exports) {
1953
2069
  return ElementCreator.getChild(child());
1954
2070
  };
1955
2071
 
2072
+ /**
2073
+ * @param {HTMLElement} el
2074
+ * @param {number} timeout
2075
+ */
2076
+ const waitForVisualEnd = (el, timeout = 1000) => {
2077
+ return new Promise((resolve) => {
2078
+ let isResolved = false;
2079
+
2080
+ const cleanupAndResolve = (e) => {
2081
+ if (e && e.target !== el) return;
2082
+ if (isResolved) return;
2083
+
2084
+ isResolved = true;
2085
+ el.removeEventListener('transitionend', cleanupAndResolve);
2086
+ el.removeEventListener('animationend', cleanupAndResolve);
2087
+ clearTimeout(timer);
2088
+ resolve();
2089
+ };
2090
+
2091
+ el.addEventListener('transitionend', cleanupAndResolve);
2092
+ el.addEventListener('animationend', cleanupAndResolve);
2093
+
2094
+ const timer = setTimeout(cleanupAndResolve, timeout);
2095
+
2096
+ const style = window.getComputedStyle(el);
2097
+ const hasTransition = style.transitionDuration !== '0s';
2098
+ const hasAnimation = style.animationDuration !== '0s';
2099
+
2100
+ if (!hasTransition && !hasAnimation) {
2101
+ cleanupAndResolve();
2102
+ }
2103
+ });
2104
+ };
2105
+
2106
+ NDElement.prototype.transitionOut = function(transitionName) {
2107
+ const exitClass = transitionName + '-exit';
2108
+ this.beforeUnmount('transition-exit', async function() {
2109
+ this.$element.classes.add(exitClass);
2110
+ await waitForVisualEnd(this.$element);
2111
+ this.$element.classes.remove(exitClass);
2112
+ });
2113
+ return this;
2114
+ };
2115
+
2116
+ NDElement.prototype.transitionIn = function(transitionName) {
2117
+ const startClass = transitionName + '-enter-from';
2118
+ const endClass = transitionName + '-enter-to';
2119
+
2120
+ this.$element.classes.add(startClass);
2121
+
2122
+ this.mounted(() => {
2123
+ requestAnimationFrame(() => {
2124
+ requestAnimationFrame(() => {
2125
+ this.$element.classes.remove(startClass);
2126
+ this.$element.classes.add(endClass);
2127
+
2128
+ waitForVisualEnd(this.$element).then(() => {
2129
+ this.$element.classes.remove(endClass);
2130
+ });
2131
+ });
2132
+ });
2133
+ });
2134
+ return this;
2135
+ };
2136
+
2137
+
2138
+ NDElement.prototype.transition = function (transitionName) {
2139
+ this.transitionIn(transitionName);
2140
+ this.transitionOut(transitionName);
2141
+ return this;
2142
+ };
2143
+
2144
+ NDElement.prototype.animate = function(animationName) {
2145
+ this.$element.classes.add(animationName);
2146
+
2147
+ waitForVisualEnd(this.$element).then(() => {
2148
+ this.$element.classes.remove(animationName);
2149
+ });
2150
+
2151
+ return this;
2152
+ };
2153
+
1956
2154
  String.prototype.handleNdAttribute = function(element, attributeName) {
1957
2155
  element.setAttribute(attributeName, this);
1958
2156
  };
@@ -2050,6 +2248,10 @@ var NativeComponents = (function (exports) {
2050
2248
  parent.appendChild(child);
2051
2249
  }
2052
2250
  },
2251
+ async safeRemove(element) {
2252
+ await element.remove();
2253
+
2254
+ },
2053
2255
  getChild(child) {
2054
2256
  if(child == null) {
2055
2257
  return null;
@@ -2390,10 +2592,10 @@ var NativeComponents = (function (exports) {
2390
2592
  /**
2391
2593
  *
2392
2594
  * @param {string} name
2393
- * @param {?Function} customWrapper
2595
+ * @param {?Function=} customWrapper
2394
2596
  * @returns {Function}
2395
2597
  */
2396
- function HtmlElementWrapper(name, customWrapper) {
2598
+ function HtmlElementWrapper(name, customWrapper = null) {
2397
2599
  return createHtmlElement.bind(null, name, customWrapper);
2398
2600
  }
2399
2601
 
@@ -3086,40 +3288,196 @@ var NativeComponents = (function (exports) {
3086
3288
  return observable;
3087
3289
  };
3088
3290
 
3291
+ /**
3292
+ * Creates a `<div>` element.
3293
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLDivElement}
3294
+ */
3089
3295
  HtmlElementWrapper('div');
3296
+
3297
+ /**
3298
+ * Creates a `<span>` element.
3299
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLSpanElement}
3300
+ */
3090
3301
  HtmlElementWrapper('span');
3302
+
3303
+ /**
3304
+ * Creates a `<label>` element.
3305
+ * @type {function(LabelAttributes=, NdChild|NdChild[]=): HTMLLabelElement}
3306
+ */
3091
3307
  HtmlElementWrapper('label');
3308
+
3309
+ /**
3310
+ * Creates a `<p>` element.
3311
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLParagraphElement}
3312
+ */
3092
3313
  HtmlElementWrapper('p');
3314
+
3315
+ /**
3316
+ * Creates a `<strong>` element.
3317
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3318
+ */
3093
3319
  HtmlElementWrapper('strong');
3320
+
3321
+ /**
3322
+ * Creates a `<h1>` element.
3323
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
3324
+ */
3094
3325
  HtmlElementWrapper('h1');
3326
+
3327
+ /**
3328
+ * Creates a `<h2>` element.
3329
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
3330
+ */
3095
3331
  HtmlElementWrapper('h2');
3332
+
3333
+ /**
3334
+ * Creates a `<h3>` element.
3335
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
3336
+ */
3096
3337
  HtmlElementWrapper('h3');
3338
+
3339
+ /**
3340
+ * Creates a `<h4>` element.
3341
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
3342
+ */
3097
3343
  HtmlElementWrapper('h4');
3344
+
3345
+ /**
3346
+ * Creates a `<h5>` element.
3347
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
3348
+ */
3098
3349
  HtmlElementWrapper('h5');
3350
+
3351
+ /**
3352
+ * Creates a `<h6>` element.
3353
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
3354
+ */
3099
3355
  HtmlElementWrapper('h6');
3100
3356
 
3357
+ /**
3358
+ * Creates a `<br>` element.
3359
+ * @type {function(GlobalAttributes=): HTMLBRElement}
3360
+ */
3101
3361
  HtmlElementWrapper('br');
3102
3362
 
3363
+ /**
3364
+ * Creates an `<a>` element.
3365
+ * @type {function(AnchorAttributes=, NdChild|NdChild[]=): HTMLAnchorElement}
3366
+ */
3103
3367
  HtmlElementWrapper('a');
3368
+
3369
+ /**
3370
+ * Creates a `<pre>` element.
3371
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLPreElement}
3372
+ */
3104
3373
  HtmlElementWrapper('pre');
3374
+
3375
+ /**
3376
+ * Creates a `<code>` element.
3377
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3378
+ */
3105
3379
  HtmlElementWrapper('code');
3380
+
3381
+ /**
3382
+ * Creates a `<blockquote>` element.
3383
+ * @type {function(GlobalAttributes & { cite?: string }=, NdChild|NdChild[]=): HTMLQuoteElement}
3384
+ */
3106
3385
  HtmlElementWrapper('blockquote');
3386
+
3387
+ /**
3388
+ * Creates an `<hr>` element.
3389
+ * @type {function(GlobalAttributes=): HTMLHRElement}
3390
+ */
3107
3391
  HtmlElementWrapper('hr');
3392
+
3393
+ /**
3394
+ * Creates an `<em>` element.
3395
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3396
+ */
3108
3397
  HtmlElementWrapper('em');
3398
+
3399
+ /**
3400
+ * Creates a `<small>` element.
3401
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3402
+ */
3109
3403
  HtmlElementWrapper('small');
3404
+
3405
+ /**
3406
+ * Creates a `<mark>` element.
3407
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3408
+ */
3110
3409
  HtmlElementWrapper('mark');
3410
+
3411
+ /**
3412
+ * Creates a `<del>` element.
3413
+ * @type {function(ModAttributes=, NdChild|NdChild[]=): HTMLModElement}
3414
+ */
3111
3415
  HtmlElementWrapper('del');
3416
+
3417
+ /**
3418
+ * Creates an `<ins>` element.
3419
+ * @type {function(ModAttributes=, NdChild|NdChild[]=): HTMLModElement}
3420
+ */
3112
3421
  HtmlElementWrapper('ins');
3422
+
3423
+ /**
3424
+ * Creates a `<sub>` element.
3425
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3426
+ */
3113
3427
  HtmlElementWrapper('sub');
3428
+
3429
+ /**
3430
+ * Creates a `<sup>` element.
3431
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3432
+ */
3114
3433
  HtmlElementWrapper('sup');
3434
+
3435
+ /**
3436
+ * Creates an `<abbr>` element.
3437
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3438
+ */
3115
3439
  HtmlElementWrapper('abbr');
3440
+
3441
+ /**
3442
+ * Creates a `<cite>` element.
3443
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3444
+ */
3116
3445
  HtmlElementWrapper('cite');
3446
+
3447
+ /**
3448
+ * Creates a `<q>` element.
3449
+ * @type {function(GlobalAttributes & { cite?: string }=, NdChild|NdChild[]=): HTMLQuoteElement}
3450
+ */
3117
3451
  HtmlElementWrapper('q');
3118
3452
 
3453
+ /**
3454
+ * Creates a `<dl>` element.
3455
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLDListElement}
3456
+ */
3119
3457
  HtmlElementWrapper('dl');
3458
+
3459
+ /**
3460
+ * Creates a `<dt>` element.
3461
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3462
+ */
3120
3463
  HtmlElementWrapper('dt');
3464
+
3465
+ /**
3466
+ * Creates a `<dd>` element.
3467
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3468
+ */
3121
3469
  HtmlElementWrapper('dd');
3122
3470
 
3471
+ /**
3472
+ * Creates a `<form>` element.
3473
+ * Extended with fluent methods: `.submit()`, `.post()`, `.get()`, `.multipartFormData()`.
3474
+ * @type {function(FormAttributes=, NdChild|NdChild[]=): HTMLFormElement & {
3475
+ * submit: (actionOrFn: string | ((e: SubmitEvent) => void)) => HTMLFormElement,
3476
+ * post: (action: string) => HTMLFormElement,
3477
+ * get: (action: string) => HTMLFormElement,
3478
+ * multipartFormData: () => HTMLFormElement,
3479
+ * }}
3480
+ */
3123
3481
  HtmlElementWrapper('form', function(el) {
3124
3482
 
3125
3483
  el.submit = function(action) {
@@ -3149,70 +3507,317 @@ var NativeComponents = (function (exports) {
3149
3507
  return el;
3150
3508
  });
3151
3509
 
3510
+ /**
3511
+ * Creates an `<input>` element.
3512
+ * @type {function(InputAttributes=): HTMLInputElement}
3513
+ */
3152
3514
  HtmlElementWrapper('input');
3153
3515
 
3516
+ /**
3517
+ * Creates a `<textarea>` element.
3518
+ * @type {function(TextAreaAttributes=, NdChild|NdChild[]=): HTMLTextAreaElement}
3519
+ */
3154
3520
  HtmlElementWrapper('textarea');
3155
3521
 
3522
+ /**
3523
+ * Creates a `<select>` element.
3524
+ * @type {function(SelectAttributes=, NdChild|NdChild[]=): HTMLSelectElement}
3525
+ */
3156
3526
  HtmlElementWrapper('select');
3157
- HtmlElementWrapper('fieldset', );
3527
+
3528
+ /**
3529
+ * Creates a `<fieldset>` element.
3530
+ * @type {function(GlobalAttributes & { disabled?: Observable<boolean>|boolean }=, NdChild|NdChild[]=): HTMLFieldSetElement}
3531
+ */
3532
+ HtmlElementWrapper('fieldset');
3533
+
3534
+ /**
3535
+ * Creates an `<option>` element.
3536
+ * @type {function(OptionAttributes=, NdChild|NdChild[]=): HTMLOptionElement}
3537
+ */
3158
3538
  HtmlElementWrapper('option');
3539
+
3540
+ /**
3541
+ * Creates a `<legend>` element.
3542
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLLegendElement}
3543
+ */
3159
3544
  HtmlElementWrapper('legend');
3545
+
3546
+ /**
3547
+ * Creates a `<datalist>` element.
3548
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLDataListElement}
3549
+ */
3160
3550
  HtmlElementWrapper('datalist');
3551
+
3552
+ /**
3553
+ * Creates an `<output>` element.
3554
+ * @type {function(OutputAttributes=, NdChild|NdChild[]=): HTMLOutputElement}
3555
+ */
3161
3556
  HtmlElementWrapper('output');
3557
+
3558
+ /**
3559
+ * Creates a `<progress>` element.
3560
+ * @type {function(ProgressAttributes=, NdChild|NdChild[]=): HTMLProgressElement}
3561
+ */
3162
3562
  HtmlElementWrapper('progress');
3163
- HtmlElementWrapper('meter');
3164
3563
 
3564
+ /**
3565
+ * Creates a `<meter>` element.
3566
+ * @type {function(MeterAttributes=, NdChild|NdChild[]=): HTMLMeterElement}
3567
+ */
3568
+ HtmlElementWrapper('meter');
3165
3569
 
3570
+ /**
3571
+ * Creates a `<button>` element.
3572
+ * @type {function(ButtonAttributes=, NdChild|NdChild[]=): HTMLButtonElement}
3573
+ */
3166
3574
  const Button$1 = HtmlElementWrapper('button');
3167
3575
 
3576
+ /**
3577
+ * Creates a `<main>` element.
3578
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3579
+ */
3168
3580
  HtmlElementWrapper('main');
3581
+
3582
+ /**
3583
+ * Creates a `<section>` element.
3584
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3585
+ */
3169
3586
  HtmlElementWrapper('section');
3587
+
3588
+ /**
3589
+ * Creates an `<article>` element.
3590
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3591
+ */
3170
3592
  HtmlElementWrapper('article');
3593
+
3594
+ /**
3595
+ * Creates an `<aside>` element.
3596
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3597
+ */
3171
3598
  HtmlElementWrapper('aside');
3599
+
3600
+ /**
3601
+ * Creates a `<nav>` element.
3602
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3603
+ */
3172
3604
  HtmlElementWrapper('nav');
3605
+
3606
+ /**
3607
+ * Creates a `<figure>` element.
3608
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3609
+ */
3173
3610
  HtmlElementWrapper('figure');
3611
+
3612
+ /**
3613
+ * Creates a `<figcaption>` element.
3614
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3615
+ */
3174
3616
  HtmlElementWrapper('figcaption');
3175
3617
 
3618
+ /**
3619
+ * Creates a `<header>` element.
3620
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3621
+ */
3176
3622
  HtmlElementWrapper('header');
3623
+
3624
+ /**
3625
+ * Creates a `<footer>` element.
3626
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3627
+ */
3177
3628
  HtmlElementWrapper('footer');
3178
3629
 
3630
+ /**
3631
+ * Creates an `<img>` element.
3632
+ * @type {function(ImgAttributes=): HTMLImageElement}
3633
+ */
3179
3634
  HtmlElementWrapper('img');
3180
3635
 
3636
+ /**
3637
+ * Creates a `<details>` element.
3638
+ * @type {function(DetailsAttributes=, NdChild|NdChild[]=): HTMLDetailsElement}
3639
+ */
3181
3640
  HtmlElementWrapper('details');
3641
+
3642
+ /**
3643
+ * Creates a `<summary>` element.
3644
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3645
+ */
3182
3646
  HtmlElementWrapper('summary');
3647
+
3648
+ /**
3649
+ * Creates a `<dialog>` element.
3650
+ * @type {function(DialogAttributes=, NdChild|NdChild[]=): HTMLDialogElement}
3651
+ */
3183
3652
  HtmlElementWrapper('dialog');
3653
+
3654
+ /**
3655
+ * Creates a `<menu>` element.
3656
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLMenuElement}
3657
+ */
3184
3658
  HtmlElementWrapper('menu');
3185
3659
 
3660
+ /**
3661
+ * Creates an `<ol>` element.
3662
+ * @type {function(OlAttributes=, NdChild|NdChild[]=): HTMLOListElement}
3663
+ */
3186
3664
  HtmlElementWrapper('ol');
3665
+
3666
+ /**
3667
+ * Creates a `<ul>` element.
3668
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLUListElement}
3669
+ */
3187
3670
  HtmlElementWrapper('ul');
3671
+
3672
+ /**
3673
+ * Creates a `<li>` element.
3674
+ * @type {function(GlobalAttributes & { value?: number }=, NdChild|NdChild[]=): HTMLLIElement}
3675
+ */
3188
3676
  HtmlElementWrapper('li');
3189
3677
 
3678
+ /**
3679
+ * Creates an `<audio>` element.
3680
+ * @type {function(AudioAttributes=, NdChild|NdChild[]=): HTMLAudioElement}
3681
+ */
3190
3682
  HtmlElementWrapper('audio');
3683
+
3684
+ /**
3685
+ * Creates a `<video>` element.
3686
+ * @type {function(VideoAttributes=, NdChild|NdChild[]=): HTMLVideoElement}
3687
+ */
3191
3688
  HtmlElementWrapper('video');
3689
+
3690
+ /**
3691
+ * Creates a `<source>` element.
3692
+ * @type {function(SourceAttributes=): HTMLSourceElement}
3693
+ */
3192
3694
  HtmlElementWrapper('source');
3695
+
3696
+ /**
3697
+ * Creates a `<track>` element.
3698
+ * @type {function(TrackAttributes=): HTMLTrackElement}
3699
+ */
3193
3700
  HtmlElementWrapper('track');
3701
+
3702
+ /**
3703
+ * Creates a `<canvas>` element.
3704
+ * @type {function(CanvasAttributes=, NdChild|NdChild[]=): HTMLCanvasElement}
3705
+ */
3194
3706
  HtmlElementWrapper('canvas');
3707
+
3708
+ /**
3709
+ * Creates an `<svg>` element.
3710
+ * @type {function(SvgAttributes=, NdChild|NdChild[]=): SVGSVGElement}
3711
+ */
3195
3712
  HtmlElementWrapper('svg');
3196
3713
 
3714
+ /**
3715
+ * Creates a `<time>` element.
3716
+ * @type {function(TimeAttributes=, NdChild|NdChild[]=): HTMLTimeElement}
3717
+ */
3197
3718
  HtmlElementWrapper('time');
3719
+
3720
+ /**
3721
+ * Creates a `<data>` element.
3722
+ * @type {function(GlobalAttributes & { value?: Observable<string>|string }=, NdChild|NdChild[]=): HTMLDataElement}
3723
+ */
3198
3724
  HtmlElementWrapper('data');
3725
+
3726
+ /**
3727
+ * Creates an `<address>` element.
3728
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3729
+ */
3199
3730
  HtmlElementWrapper('address');
3731
+
3732
+ /**
3733
+ * Creates a `<kbd>` element.
3734
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3735
+ */
3200
3736
  HtmlElementWrapper('kbd');
3737
+
3738
+ /**
3739
+ * Creates a `<samp>` element.
3740
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3741
+ */
3201
3742
  HtmlElementWrapper('samp');
3743
+
3744
+ /**
3745
+ * Creates a `<var>` element.
3746
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
3747
+ */
3202
3748
  HtmlElementWrapper('var');
3749
+
3750
+ /**
3751
+ * Creates a `<wbr>` element.
3752
+ * @type {function(GlobalAttributes=): HTMLElement}
3753
+ */
3203
3754
  HtmlElementWrapper('wbr');
3204
3755
 
3756
+ /**
3757
+ * Creates a `<caption>` element.
3758
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableCaptionElement}
3759
+ */
3205
3760
  HtmlElementWrapper('caption');
3761
+
3762
+ /**
3763
+ * Creates a `<table>` element.
3764
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableElement}
3765
+ */
3206
3766
  const Table = HtmlElementWrapper('table');
3767
+
3768
+ /**
3769
+ * Creates a `<thead>` element.
3770
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableSectionElement}
3771
+ */
3207
3772
  HtmlElementWrapper('thead');
3773
+
3774
+ /**
3775
+ * Creates a `<tfoot>` element.
3776
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableSectionElement}
3777
+ */
3208
3778
  HtmlElementWrapper('tfoot');
3779
+
3780
+ /**
3781
+ * Creates a `<tbody>` element.
3782
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableSectionElement}
3783
+ */
3209
3784
  HtmlElementWrapper('tbody');
3785
+
3786
+ /**
3787
+ * Creates a `<tr>` element.
3788
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableRowElement}
3789
+ */
3210
3790
  const Tr = HtmlElementWrapper('tr');
3791
+
3792
+ /**
3793
+ * Alias for {@link Tr}.
3794
+ * @type {typeof Tr}
3795
+ */
3211
3796
  const TRow = Tr;
3797
+
3798
+ /**
3799
+ * Creates a `<th>` element.
3800
+ * @type {function(ThAttributes=, NdChild|NdChild[]=): HTMLTableCellElement}
3801
+ */
3212
3802
  const Th = HtmlElementWrapper('th');
3803
+
3804
+ /**
3805
+ * Alias for {@link Th}.
3806
+ * @type {typeof Th}
3807
+ */
3213
3808
  const THeadCell$1 = Th;
3809
+
3810
+ /**
3811
+ * Creates a `<td>` element.
3812
+ * @type {function(TdAttributes=, NdChild|NdChild[]=): HTMLTableCellElement}
3813
+ */
3214
3814
  HtmlElementWrapper('td');
3215
3815
 
3816
+ /**
3817
+ * Creates an empty `DocumentFragment` wrapper.
3818
+ * Useful for grouping elements without adding a DOM node.
3819
+ * @type {function(GlobalAttributes=, NdChild|NdChild[]=): DocumentFragment}
3820
+ */
3216
3821
  HtmlElementWrapper('');
3217
3822
 
3218
3823
  /**