@rindo/core 2.17.4 → 2.18.1

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 (69) hide show
  1. package/cli/index.cjs +98 -35
  2. package/cli/index.js +98 -35
  3. package/cli/package.json +1 -1
  4. package/compiler/lib.dom.d.ts +620 -89
  5. package/compiler/lib.dom.iterable.d.ts +27 -3
  6. package/compiler/lib.es2015.core.d.ts +3 -3
  7. package/compiler/lib.es2015.iterable.d.ts +2 -1
  8. package/compiler/lib.es2015.reflect.d.ts +1 -1
  9. package/compiler/lib.es2020.bigint.d.ts +7 -5
  10. package/compiler/lib.es2020.d.ts +2 -0
  11. package/compiler/lib.es2020.date.d.ts +44 -0
  12. package/compiler/lib.es2020.intl.d.ts +51 -11
  13. package/compiler/lib.es2020.number.d.ts +30 -0
  14. package/compiler/lib.es2021.intl.d.ts +106 -4
  15. package/compiler/lib.es2022.array.d.ts +123 -0
  16. package/compiler/lib.es2022.d.ts +26 -0
  17. package/compiler/lib.es2022.error.d.ts +75 -0
  18. package/compiler/lib.es2022.full.d.ts +25 -0
  19. package/compiler/lib.es2022.intl.d.ts +111 -0
  20. package/compiler/lib.es2022.object.d.ts +28 -0
  21. package/compiler/lib.es2022.string.d.ts +27 -0
  22. package/compiler/lib.es5.d.ts +25 -19
  23. package/compiler/lib.esnext.d.ts +1 -1
  24. package/compiler/lib.esnext.intl.d.ts +4 -1
  25. package/compiler/lib.webworker.d.ts +236 -40
  26. package/compiler/lib.webworker.iterable.d.ts +10 -3
  27. package/compiler/package.json +1 -1
  28. package/compiler/rindo.js +805 -931
  29. package/compiler/rindo.min.js +2 -2
  30. package/compiler/sys/in-memory-fs.d.ts +218 -0
  31. package/dependencies.json +10 -1
  32. package/dev-server/client/index.js +1 -1
  33. package/dev-server/client/package.json +1 -1
  34. package/dev-server/connector.html +2 -2
  35. package/dev-server/index.js +1 -1
  36. package/dev-server/package.json +1 -1
  37. package/dev-server/server-process.js +12 -12
  38. package/internal/app-data/package.json +1 -1
  39. package/internal/client/css-shim.js +1 -1
  40. package/internal/client/dom.js +1 -1
  41. package/internal/client/index.js +338 -158
  42. package/internal/client/package.json +1 -1
  43. package/internal/client/patch-browser.js +1 -1
  44. package/internal/client/patch-esm.js +1 -1
  45. package/internal/client/shadow-css.js +1 -1
  46. package/internal/hydrate/package.json +1 -1
  47. package/internal/hydrate/runner.d.ts +1 -1
  48. package/internal/package.json +1 -1
  49. package/internal/rindo-private.d.ts +2 -106
  50. package/internal/rindo-public-compiler.d.ts +44 -10
  51. package/internal/testing/package.json +1 -1
  52. package/mock-doc/index.cjs +77 -62
  53. package/mock-doc/index.d.ts +13 -12
  54. package/mock-doc/index.js +77 -62
  55. package/mock-doc/package.json +1 -1
  56. package/package.json +10 -12
  57. package/readme.md +44 -31
  58. package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
  59. package/screenshot/index.js +10 -10
  60. package/screenshot/package.json +1 -1
  61. package/sys/node/autoprefixer.js +5 -5
  62. package/sys/node/glob.js +1 -1
  63. package/sys/node/graceful-fs.js +1 -1
  64. package/sys/node/index.js +2 -2
  65. package/sys/node/package.json +1 -1
  66. package/sys/node/worker.js +1 -1
  67. package/testing/index.js +130 -295
  68. package/testing/package.json +1 -1
  69. package/testing/testing-utils.d.ts +5 -4
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Mock Doc (CommonJS) v2.17.4 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Mock Doc (CommonJS) v2.18.1 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  var mockDoc = (function(exports) {
5
5
  'use strict';
@@ -282,7 +282,7 @@ const proxyElements = new WeakMap();
282
282
  const upgradedElements = new WeakSet();
283
283
  function connectNode(ownerDocument, node) {
284
284
  node.ownerDocument = ownerDocument;
285
- if (node.nodeType === 1 /* ELEMENT_NODE */) {
285
+ if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
286
286
  if (ownerDocument != null && node.nodeName.includes('-')) {
287
287
  const win = ownerDocument.defaultView;
288
288
  if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
@@ -318,7 +318,7 @@ function fireConnectedCallback(node) {
318
318
  }
319
319
  }
320
320
  function disconnectNode(node) {
321
- if (node.nodeType === 1 /* ELEMENT_NODE */) {
321
+ if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
322
322
  if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
323
323
  if (tempDisableCallbacks.has(node.ownerDocument) === false) {
324
324
  try {
@@ -634,7 +634,7 @@ class MockEvent {
634
634
  let currentElement = this.target;
635
635
  while (currentElement) {
636
636
  composedPath.push(currentElement);
637
- if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
637
+ if (!currentElement.parentElement && currentElement.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
638
638
  // the current element doesn't have a parent, but we've detected it's our root document node. push the window
639
639
  // object associated with the document onto the path
640
640
  composedPath.push(currentElement.defaultView);
@@ -756,7 +756,7 @@ function triggerEventListener(elm, ev) {
756
756
  if (ev.bubbles === false) {
757
757
  return;
758
758
  }
759
- if (elm.nodeName === "#document" /* DOCUMENT_NODE */) {
759
+ if (elm.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
760
760
  triggerEventListener(elm.defaultView, ev);
761
761
  }
762
762
  else {
@@ -829,7 +829,7 @@ function serializeNodeToHtml(elm, opts = {}) {
829
829
  return output.text.join('');
830
830
  }
831
831
  function serializeToHtml(node, opts, output, isShadowRoot) {
832
- if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
832
+ if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ || isShadowRoot) {
833
833
  const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
834
834
  if (tagName === 'body') {
835
835
  output.isWithinBody = true;
@@ -946,7 +946,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
946
946
  if (opts.newLines &&
947
947
  (node.childNodes.length === 0 ||
948
948
  (node.childNodes.length === 1 &&
949
- node.childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
949
+ node.childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
950
950
  node.childNodes[0].nodeValue.trim() === ''))) {
951
951
  output.text.push('\n');
952
952
  output.currentLineWidth = 0;
@@ -961,7 +961,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
961
961
  const childNodeLength = childNodes.length;
962
962
  if (childNodeLength > 0) {
963
963
  if (childNodeLength === 1 &&
964
- childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
964
+ childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
965
965
  (typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
966
966
  else {
967
967
  const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
@@ -1000,7 +1000,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
1000
1000
  output.isWithinBody = false;
1001
1001
  }
1002
1002
  }
1003
- else if (node.nodeType === 3 /* TEXT_NODE */) {
1003
+ else if (node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
1004
1004
  let textContent = node.nodeValue;
1005
1005
  if (typeof textContent === 'string') {
1006
1006
  const trimmedTextContent = textContent.trim();
@@ -1047,7 +1047,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
1047
1047
  let textContentLength = textContent.length;
1048
1048
  if (textContentLength > 0) {
1049
1049
  // this text node has text content
1050
- const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */
1050
+ const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */
1051
1051
  ? node.parentNode.nodeName
1052
1052
  : null;
1053
1053
  if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
@@ -1102,7 +1102,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
1102
1102
  }
1103
1103
  }
1104
1104
  }
1105
- else if (node.nodeType === 8 /* COMMENT_NODE */) {
1105
+ else if (node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
1106
1106
  const nodeValue = node.nodeValue;
1107
1107
  if (opts.removeHtmlComments) {
1108
1108
  const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
@@ -1127,7 +1127,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
1127
1127
  output.text.push('<!--' + nodeValue + '-->');
1128
1128
  output.currentLineWidth += nodeValue.length + 7;
1129
1129
  }
1130
- else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
1130
+ else if (node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
1131
1131
  output.text.push('<!doctype html>');
1132
1132
  }
1133
1133
  }
@@ -1284,10 +1284,9 @@ function getParser(ownerDocument) {
1284
1284
  if (parseOptions != null) {
1285
1285
  return parseOptions;
1286
1286
  }
1287
- // @ts-ignore
1288
1287
  const treeAdapter = {
1289
1288
  createDocument() {
1290
- const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
1289
+ const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
1291
1290
  doc['x-mode'] = 'no-quirks';
1292
1291
  return doc;
1293
1292
  },
@@ -1329,7 +1328,7 @@ function getParser(ownerDocument) {
1329
1328
  return templateElement.content;
1330
1329
  },
1331
1330
  setDocumentType(doc, name, publicId, systemId) {
1332
- let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
1331
+ let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
1333
1332
  if (doctypeNode == null) {
1334
1333
  doctypeNode = ownerDocument.createDocumentTypeNode();
1335
1334
  doc.insertBefore(doctypeNode, doc.firstChild);
@@ -1350,7 +1349,7 @@ function getParser(ownerDocument) {
1350
1349
  },
1351
1350
  insertText(parentNode, text) {
1352
1351
  const lastChild = parentNode.lastChild;
1353
- if (lastChild != null && lastChild.nodeType === 3 /* TEXT_NODE */) {
1352
+ if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
1354
1353
  lastChild.nodeValue += text;
1355
1354
  }
1356
1355
  else {
@@ -1359,7 +1358,7 @@ function getParser(ownerDocument) {
1359
1358
  },
1360
1359
  insertTextBefore(parentNode, text, referenceNode) {
1361
1360
  const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
1362
- if (prevNode != null && prevNode.nodeType === 3 /* TEXT_NODE */) {
1361
+ if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
1363
1362
  prevNode.nodeValue += text;
1364
1363
  }
1365
1364
  else {
@@ -1421,16 +1420,16 @@ function getParser(ownerDocument) {
1421
1420
  return doctypeNode['x-systemId'];
1422
1421
  },
1423
1422
  isTextNode(node) {
1424
- return node.nodeType === 3 /* TEXT_NODE */;
1423
+ return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
1425
1424
  },
1426
1425
  isCommentNode(node) {
1427
- return node.nodeType === 8 /* COMMENT_NODE */;
1426
+ return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
1428
1427
  },
1429
1428
  isDocumentTypeNode(node) {
1430
- return node.nodeType === 10 /* DOCUMENT_TYPE_NODE */;
1429
+ return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
1431
1430
  },
1432
1431
  isElementNode(node) {
1433
- return node.nodeType === 1 /* ELEMENT_NODE */;
1432
+ return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
1434
1433
  },
1435
1434
  };
1436
1435
  parseOptions = {
@@ -1450,7 +1449,7 @@ class MockNode {
1450
1449
  this.childNodes = [];
1451
1450
  }
1452
1451
  appendChild(newNode) {
1453
- if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
1452
+ if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
1454
1453
  const nodes = newNode.childNodes.slice();
1455
1454
  for (const child of nodes) {
1456
1455
  this.appendChild(child);
@@ -1474,7 +1473,9 @@ class MockNode {
1474
1473
  const firstChild = this.firstChild;
1475
1474
  items.forEach((item) => {
1476
1475
  const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
1477
- this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
1476
+ if (firstChild) {
1477
+ this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
1478
+ }
1478
1479
  });
1479
1480
  }
1480
1481
  cloneNode(deep) {
@@ -1489,7 +1490,7 @@ class MockNode {
1489
1490
  return this.childNodes[0] || null;
1490
1491
  }
1491
1492
  insertBefore(newNode, referenceNode) {
1492
- if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
1493
+ if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
1493
1494
  for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
1494
1495
  insertBefore(this, newNode.childNodes[i], referenceNode);
1495
1496
  }
@@ -1502,11 +1503,11 @@ class MockNode {
1502
1503
  get isConnected() {
1503
1504
  let node = this;
1504
1505
  while (node != null) {
1505
- if (node.nodeType === 9 /* DOCUMENT_NODE */) {
1506
+ if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
1506
1507
  return true;
1507
1508
  }
1508
1509
  node = node.parentNode;
1509
- if (node != null && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
1510
+ if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
1510
1511
  node = node.host;
1511
1512
  }
1512
1513
  }
@@ -1526,7 +1527,8 @@ class MockNode {
1526
1527
  return null;
1527
1528
  }
1528
1529
  get nodeValue() {
1529
- return this._nodeValue;
1530
+ var _a;
1531
+ return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
1530
1532
  }
1531
1533
  set nodeValue(value) {
1532
1534
  this._nodeValue = value;
@@ -1558,7 +1560,7 @@ class MockNode {
1558
1560
  const index = this.childNodes.indexOf(childNode);
1559
1561
  if (index > -1) {
1560
1562
  this.childNodes.splice(index, 1);
1561
- if (this.nodeType === 1 /* ELEMENT_NODE */) {
1563
+ if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
1562
1564
  const wasConnected = this.isConnected;
1563
1565
  childNode.parentNode = null;
1564
1566
  if (wasConnected === true) {
@@ -1588,7 +1590,8 @@ class MockNode {
1588
1590
  return null;
1589
1591
  }
1590
1592
  get textContent() {
1591
- return this._nodeValue;
1593
+ var _a;
1594
+ return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
1592
1595
  }
1593
1596
  set textContent(value) {
1594
1597
  this._nodeValue = String(value);
@@ -1610,8 +1613,10 @@ class MockNodeList {
1610
1613
  }
1611
1614
  class MockElement extends MockNode {
1612
1615
  constructor(ownerDocument, nodeName) {
1613
- super(ownerDocument, 1 /* ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
1616
+ super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
1614
1617
  this.namespaceURI = null;
1618
+ this.__shadowRoot = null;
1619
+ this.__attributeMap = null;
1615
1620
  }
1616
1621
  addEventListener(type, handler) {
1617
1622
  addEventListener(this, type, handler);
@@ -1638,7 +1643,9 @@ class MockElement extends MockNode {
1638
1643
  }
1639
1644
  get attributes() {
1640
1645
  if (this.__attributeMap == null) {
1641
- this.__attributeMap = createAttributeProxy(false);
1646
+ const attrMap = createAttributeProxy(false);
1647
+ this.__attributeMap = attrMap;
1648
+ return attrMap;
1642
1649
  }
1643
1650
  return this.__attributeMap;
1644
1651
  }
@@ -1646,10 +1653,10 @@ class MockElement extends MockNode {
1646
1653
  this.__attributeMap = attrs;
1647
1654
  }
1648
1655
  get children() {
1649
- return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */);
1656
+ return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
1650
1657
  }
1651
1658
  get childElementCount() {
1652
- return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */).length;
1659
+ return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
1653
1660
  }
1654
1661
  get className() {
1655
1662
  return this.getAttributeNS(null, 'class') || '';
@@ -1665,6 +1672,7 @@ class MockElement extends MockNode {
1665
1672
  }
1666
1673
  cloneNode(_deep) {
1667
1674
  // implemented on MockElement.prototype from within element.ts
1675
+ // @ts-ignore - implemented on MockElement.prototype from within element.ts
1668
1676
  return null;
1669
1677
  }
1670
1678
  closest(selector) {
@@ -1754,7 +1762,8 @@ class MockElement extends MockNode {
1754
1762
  });
1755
1763
  }
1756
1764
  set innerHTML(html) {
1757
- if (NON_ESCAPABLE_CONTENT.has(this.nodeName) === true) {
1765
+ var _a;
1766
+ if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
1758
1767
  setTextContent(this, html);
1759
1768
  }
1760
1769
  else {
@@ -1866,9 +1875,9 @@ class MockElement extends MockNode {
1866
1875
  get nextElementSibling() {
1867
1876
  const parentElement = this.parentElement;
1868
1877
  if (parentElement != null &&
1869
- (parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
1870
- parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
1871
- parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
1878
+ (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
1879
+ parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
1880
+ parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
1872
1881
  const children = parentElement.children;
1873
1882
  const index = children.indexOf(this) + 1;
1874
1883
  return parentElement.children[index] || null;
@@ -1885,9 +1894,9 @@ class MockElement extends MockNode {
1885
1894
  get previousElementSibling() {
1886
1895
  const parentElement = this.parentElement;
1887
1896
  if (parentElement != null &&
1888
- (parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
1889
- parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
1890
- parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
1897
+ (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
1898
+ parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
1899
+ parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
1891
1900
  const children = parentElement.children;
1892
1901
  const index = children.indexOf(this) - 1;
1893
1902
  return parentElement.children[index] || null;
@@ -2020,7 +2029,8 @@ class MockElement extends MockNode {
2020
2029
  this.setAttributeNS(null, 'tabindex', value);
2021
2030
  }
2022
2031
  get tagName() {
2023
- return this.nodeName;
2032
+ var _a;
2033
+ return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
2024
2034
  }
2025
2035
  set tagName(value) {
2026
2036
  this.nodeName = value;
@@ -2335,10 +2345,11 @@ function getElementsByClassName(elm, classNames, foundElms) {
2335
2345
  }
2336
2346
  }
2337
2347
  function getElementsByTagName(elm, tagName, foundElms) {
2348
+ var _a;
2338
2349
  const children = elm.children;
2339
2350
  for (let i = 0, ii = children.length; i < ii; i++) {
2340
2351
  const childElm = children[i];
2341
- if (tagName === '*' || childElm.nodeName.toLowerCase() === tagName) {
2352
+ if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
2342
2353
  foundElms.push(childElm);
2343
2354
  }
2344
2355
  getElementsByTagName(childElm, tagName, foundElms);
@@ -2377,14 +2388,17 @@ class MockHTMLElement extends MockElement {
2377
2388
  this.namespaceURI = 'http://www.w3.org/1999/xhtml';
2378
2389
  }
2379
2390
  get tagName() {
2380
- return this.nodeName;
2391
+ var _a;
2392
+ return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
2381
2393
  }
2382
2394
  set tagName(value) {
2383
2395
  this.nodeName = value;
2384
2396
  }
2385
2397
  get attributes() {
2386
2398
  if (this.__attributeMap == null) {
2387
- this.__attributeMap = createAttributeProxy(true);
2399
+ const attrMap = createAttributeProxy(true);
2400
+ this.__attributeMap = attrMap;
2401
+ return attrMap;
2388
2402
  }
2389
2403
  return this.__attributeMap;
2390
2404
  }
@@ -2394,7 +2408,7 @@ class MockHTMLElement extends MockElement {
2394
2408
  }
2395
2409
  class MockTextNode extends MockNode {
2396
2410
  constructor(ownerDocument, text) {
2397
- super(ownerDocument, 3 /* TEXT_NODE */, "#text" /* TEXT_NODE */, text);
2411
+ super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
2398
2412
  }
2399
2413
  cloneNode(_deep) {
2400
2414
  return new MockTextNode(null, this.nodeValue);
@@ -2416,7 +2430,7 @@ class MockTextNode extends MockNode {
2416
2430
  const text = [];
2417
2431
  for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
2418
2432
  const childNode = this.parentNode.childNodes[i];
2419
- if (childNode.nodeType === 3 /* TEXT_NODE */) {
2433
+ if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
2420
2434
  text.push(childNode.nodeValue);
2421
2435
  }
2422
2436
  }
@@ -2428,10 +2442,10 @@ class MockTextNode extends MockNode {
2428
2442
  function getTextContent(childNodes, text) {
2429
2443
  for (let i = 0, ii = childNodes.length; i < ii; i++) {
2430
2444
  const childNode = childNodes[i];
2431
- if (childNode.nodeType === 3 /* TEXT_NODE */) {
2445
+ if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
2432
2446
  text.push(childNode.nodeValue);
2433
2447
  }
2434
- else if (childNode.nodeType === 1 /* ELEMENT_NODE */) {
2448
+ else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
2435
2449
  getTextContent(childNode.childNodes, text);
2436
2450
  }
2437
2451
  }
@@ -2446,7 +2460,7 @@ function setTextContent(elm, text) {
2446
2460
 
2447
2461
  class MockComment extends MockNode {
2448
2462
  constructor(ownerDocument, data) {
2449
- super(ownerDocument, 8 /* COMMENT_NODE */, "#comment" /* COMMENT_NODE */, data);
2463
+ super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
2450
2464
  }
2451
2465
  cloneNode(_deep) {
2452
2466
  return new MockComment(null, this.nodeValue);
@@ -2462,8 +2476,8 @@ class MockComment extends MockNode {
2462
2476
  class MockDocumentFragment extends MockHTMLElement {
2463
2477
  constructor(ownerDocument) {
2464
2478
  super(ownerDocument, null);
2465
- this.nodeName = "#document-fragment" /* DOCUMENT_FRAGMENT_NODE */;
2466
- this.nodeType = 11 /* DOCUMENT_FRAGMENT_NODE */;
2479
+ this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
2480
+ this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
2467
2481
  }
2468
2482
  getElementById(id) {
2469
2483
  return getElementById(this, id);
@@ -2473,9 +2487,9 @@ class MockDocumentFragment extends MockHTMLElement {
2473
2487
  if (deep) {
2474
2488
  for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
2475
2489
  const childNode = this.childNodes[i];
2476
- if (childNode.nodeType === 1 /* ELEMENT_NODE */ ||
2477
- childNode.nodeType === 3 /* TEXT_NODE */ ||
2478
- childNode.nodeType === 8 /* COMMENT_NODE */) {
2490
+ if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
2491
+ childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
2492
+ childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
2479
2493
  const clonedChildNode = this.childNodes[i].cloneNode(true);
2480
2494
  cloned.appendChild(clonedChildNode);
2481
2495
  }
@@ -2488,7 +2502,7 @@ class MockDocumentFragment extends MockHTMLElement {
2488
2502
  class MockDocumentTypeNode extends MockHTMLElement {
2489
2503
  constructor(ownerDocument) {
2490
2504
  super(ownerDocument, '!DOCTYPE');
2491
- this.nodeType = 10 /* DOCUMENT_TYPE_NODE */;
2505
+ this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
2492
2506
  this.setAttribute('html', '');
2493
2507
  }
2494
2508
  }
@@ -3633,6 +3647,7 @@ class MockNavigator {
3633
3647
  class MockPerformance {
3634
3648
  constructor() {
3635
3649
  this.timeOrigin = Date.now();
3650
+ this.eventCounts = new Map();
3636
3651
  }
3637
3652
  addEventListener() {
3638
3653
  //
@@ -4522,8 +4537,8 @@ function resetWindowDimensions(win) {
4522
4537
  class MockDocument extends MockHTMLElement {
4523
4538
  constructor(html = null, win = null) {
4524
4539
  super(null, null);
4525
- this.nodeName = "#document" /* DOCUMENT_NODE */;
4526
- this.nodeType = 9 /* DOCUMENT_NODE */;
4540
+ this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
4541
+ this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
4527
4542
  this.defaultView = win;
4528
4543
  this.cookie = '';
4529
4544
  this.referrer = '';
@@ -4597,7 +4612,7 @@ class MockDocument extends MockHTMLElement {
4597
4612
  }
4598
4613
  set documentElement(documentElement) {
4599
4614
  for (let i = this.childNodes.length - 1; i >= 0; i--) {
4600
- if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
4615
+ if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
4601
4616
  this.childNodes[i].remove();
4602
4617
  }
4603
4618
  }
@@ -4668,7 +4683,7 @@ class MockDocument extends MockHTMLElement {
4668
4683
  return new MockAttr(attrName, '', namespaceURI);
4669
4684
  }
4670
4685
  createElement(tagName) {
4671
- if (tagName === "#document" /* DOCUMENT_NODE */) {
4686
+ if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
4672
4687
  const doc = new MockDocument(false);
4673
4688
  doc.nodeName = tagName;
4674
4689
  doc.parentNode = null;
@@ -4737,11 +4752,11 @@ function resetDocument(doc) {
4737
4752
  }
4738
4753
  }
4739
4754
  try {
4740
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
4755
+ doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
4741
4756
  }
4742
4757
  catch (e) { }
4743
4758
  try {
4744
- doc.nodeType = 9 /* DOCUMENT_NODE */;
4759
+ doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
4745
4760
  }
4746
4761
  catch (e) { }
4747
4762
  try {
@@ -4791,7 +4806,7 @@ function getElementsByName(elm, elmName, foundElms = []) {
4791
4806
  function setOwnerDocument(elm, ownerDocument) {
4792
4807
  for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
4793
4808
  elm.childNodes[i].ownerDocument = ownerDocument;
4794
- if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
4809
+ if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
4795
4810
  setOwnerDocument(elm.childNodes[i], ownerDocument);
4796
4811
  }
4797
4812
  }
@@ -7,7 +7,7 @@ declare class MockAttributeMap {
7
7
  setNamedItem(attr: MockAttr): void;
8
8
  setNamedItemNS(attr: MockAttr): void;
9
9
  getNamedItem(attrName: string): MockAttr;
10
- getNamedItemNS(namespaceURI: string, attrName: string): MockAttr;
10
+ getNamedItemNS(namespaceURI: string | null, attrName: string): MockAttr;
11
11
  removeNamedItem(attr: MockAttr): void;
12
12
  removeNamedItemNS(attr: MockAttr): void;
13
13
  [Symbol.iterator](): {
@@ -20,7 +20,7 @@ declare class MockAttributeMap {
20
20
  }
21
21
  declare function cloneAttributes(srcAttrs: MockAttributeMap, sortByName?: boolean): MockAttributeMap;
22
22
  declare class MockAttr {
23
- constructor(attrName: string, attrValue: string, namespaceURI?: string);
23
+ constructor(attrName: string, attrValue: string, namespaceURI?: string | null);
24
24
  get name(): string;
25
25
  set name(value: string);
26
26
  get value(): string;
@@ -108,7 +108,7 @@ declare class MockCustomElementRegistry implements CustomElementRegistry {
108
108
  declare function createCustomElement(customElements: MockCustomElementRegistry, ownerDocument: any, tagName: string): any;
109
109
  declare function connectNode(ownerDocument: any, node: MockNode): void;
110
110
  declare function disconnectNode(node: MockNode): void;
111
- declare function attributeChanged(node: MockNode, attrName: string, oldValue: string, newValue: string): void;
111
+ declare function attributeChanged(node: MockNode, attrName: string, oldValue: string | null, newValue: string | null): void;
112
112
  declare function checkAttributeChanged(node: MockNode): boolean;
113
113
  declare function dataset(elm: MockElement): any;
114
114
  declare class MockDocumentFragment extends MockHTMLElement {
@@ -471,12 +471,12 @@ declare class MockNavigator {
471
471
  userAgent: string;
472
472
  }
473
473
  declare class MockNode {
474
- nodeName: string;
474
+ nodeName: string | null;
475
475
  nodeType: number;
476
476
  ownerDocument: any;
477
- parentNode: MockNode;
477
+ parentNode: MockNode | null;
478
478
  childNodes: MockNode[];
479
- constructor(ownerDocument: any, nodeType: number, nodeName: string, nodeValue: string);
479
+ constructor(ownerDocument: any, nodeType: number, nodeName: string | null, nodeValue: string | null);
480
480
  appendChild(newNode: MockNode): MockNode;
481
481
  append(...items: (MockNode | string)[]): void;
482
482
  prepend(...items: (MockNode | string)[]): void;
@@ -514,8 +514,8 @@ declare class MockNodeList {
514
514
  constructor(ownerDocument: any, childNodes: MockNode[], length: number);
515
515
  }
516
516
  declare class MockElement extends MockNode {
517
- namespaceURI: string;
518
- constructor(ownerDocument: any, nodeName: string);
517
+ namespaceURI: string | null;
518
+ constructor(ownerDocument: any, nodeName: string | null);
519
519
  addEventListener(type: string, handler: (ev?: any) => void): void;
520
520
  attachShadow(_opts: ShadowRootInit): any;
521
521
  blur(): void;
@@ -540,7 +540,7 @@ declare class MockElement extends MockNode {
540
540
  preventScroll?: boolean;
541
541
  }): void;
542
542
  getAttribute(attrName: string): any;
543
- getAttributeNS(namespaceURI: string, attrName: string): string;
543
+ getAttributeNS(namespaceURI: string | null, attrName: string): string;
544
544
  getBoundingClientRect(): {
545
545
  bottom: number;
546
546
  height: number;
@@ -568,7 +568,7 @@ declare class MockElement extends MockNode {
568
568
  insertAdjacentHTML(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', html: string): void;
569
569
  insertAdjacentText(position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend', text: string): void;
570
570
  hasAttribute(attrName: string): boolean;
571
- hasAttributeNS(namespaceURI: string, name: string): boolean;
571
+ hasAttributeNS(namespaceURI: string | null, name: string): boolean;
572
572
  get hidden(): boolean;
573
573
  set hidden(isHidden: boolean);
574
574
  get lang(): string;
@@ -583,10 +583,10 @@ declare class MockElement extends MockNode {
583
583
  querySelector(selector: string): Element;
584
584
  querySelectorAll(selector: string): Element[];
585
585
  removeAttribute(attrName: string): void;
586
- removeAttributeNS(namespaceURI: string, attrName: string): void;
586
+ removeAttributeNS(namespaceURI: string | null, attrName: string): void;
587
587
  removeEventListener(type: string, handler: any): void;
588
588
  setAttribute(attrName: string, value: any): void;
589
- setAttributeNS(namespaceURI: string, attrName: string, value: any): void;
589
+ setAttributeNS(namespaceURI: string | null, attrName: string, value: any): void;
590
590
  get style(): any;
591
591
  set style(val: any);
592
592
  get tabIndex(): number;
@@ -723,6 +723,7 @@ declare class MockDOMParser {
723
723
  */
724
724
  declare class MockPerformance implements Performance {
725
725
  timeOrigin: number;
726
+ eventCounts: EventCounts;
726
727
  constructor();
727
728
  addEventListener(): void;
728
729
  clearMarks(): void;