@rindo/core 2.17.4 → 2.18.0

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 (63) hide show
  1. package/cli/index.cjs +26 -16
  2. package/cli/index.js +26 -16
  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 +607 -212
  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 +337 -157
  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/package.json +1 -1
  48. package/internal/rindo-private.d.ts +2 -106
  49. package/internal/rindo-public-compiler.d.ts +42 -8
  50. package/internal/testing/package.json +1 -1
  51. package/mock-doc/index.cjs +77 -61
  52. package/mock-doc/index.d.ts +13 -12
  53. package/mock-doc/index.js +77 -61
  54. package/mock-doc/package.json +1 -1
  55. package/package.json +2 -4
  56. package/screenshot/index.js +10 -10
  57. package/screenshot/package.json +1 -1
  58. package/sys/node/index.js +1 -1
  59. package/sys/node/package.json +1 -1
  60. package/sys/node/worker.js +1 -1
  61. package/testing/index.js +780 -794
  62. package/testing/package.json +1 -1
  63. 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.0 | 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
  }
@@ -1287,7 +1287,7 @@ function getParser(ownerDocument) {
1287
1287
  // @ts-ignore
1288
1288
  const treeAdapter = {
1289
1289
  createDocument() {
1290
- const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
1290
+ const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
1291
1291
  doc['x-mode'] = 'no-quirks';
1292
1292
  return doc;
1293
1293
  },
@@ -1329,7 +1329,7 @@ function getParser(ownerDocument) {
1329
1329
  return templateElement.content;
1330
1330
  },
1331
1331
  setDocumentType(doc, name, publicId, systemId) {
1332
- let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
1332
+ let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
1333
1333
  if (doctypeNode == null) {
1334
1334
  doctypeNode = ownerDocument.createDocumentTypeNode();
1335
1335
  doc.insertBefore(doctypeNode, doc.firstChild);
@@ -1350,7 +1350,7 @@ function getParser(ownerDocument) {
1350
1350
  },
1351
1351
  insertText(parentNode, text) {
1352
1352
  const lastChild = parentNode.lastChild;
1353
- if (lastChild != null && lastChild.nodeType === 3 /* TEXT_NODE */) {
1353
+ if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
1354
1354
  lastChild.nodeValue += text;
1355
1355
  }
1356
1356
  else {
@@ -1359,7 +1359,7 @@ function getParser(ownerDocument) {
1359
1359
  },
1360
1360
  insertTextBefore(parentNode, text, referenceNode) {
1361
1361
  const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
1362
- if (prevNode != null && prevNode.nodeType === 3 /* TEXT_NODE */) {
1362
+ if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
1363
1363
  prevNode.nodeValue += text;
1364
1364
  }
1365
1365
  else {
@@ -1421,16 +1421,16 @@ function getParser(ownerDocument) {
1421
1421
  return doctypeNode['x-systemId'];
1422
1422
  },
1423
1423
  isTextNode(node) {
1424
- return node.nodeType === 3 /* TEXT_NODE */;
1424
+ return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
1425
1425
  },
1426
1426
  isCommentNode(node) {
1427
- return node.nodeType === 8 /* COMMENT_NODE */;
1427
+ return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
1428
1428
  },
1429
1429
  isDocumentTypeNode(node) {
1430
- return node.nodeType === 10 /* DOCUMENT_TYPE_NODE */;
1430
+ return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
1431
1431
  },
1432
1432
  isElementNode(node) {
1433
- return node.nodeType === 1 /* ELEMENT_NODE */;
1433
+ return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
1434
1434
  },
1435
1435
  };
1436
1436
  parseOptions = {
@@ -1450,7 +1450,7 @@ class MockNode {
1450
1450
  this.childNodes = [];
1451
1451
  }
1452
1452
  appendChild(newNode) {
1453
- if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
1453
+ if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
1454
1454
  const nodes = newNode.childNodes.slice();
1455
1455
  for (const child of nodes) {
1456
1456
  this.appendChild(child);
@@ -1474,7 +1474,9 @@ class MockNode {
1474
1474
  const firstChild = this.firstChild;
1475
1475
  items.forEach((item) => {
1476
1476
  const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
1477
- this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
1477
+ if (firstChild) {
1478
+ this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
1479
+ }
1478
1480
  });
1479
1481
  }
1480
1482
  cloneNode(deep) {
@@ -1489,7 +1491,7 @@ class MockNode {
1489
1491
  return this.childNodes[0] || null;
1490
1492
  }
1491
1493
  insertBefore(newNode, referenceNode) {
1492
- if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
1494
+ if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
1493
1495
  for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
1494
1496
  insertBefore(this, newNode.childNodes[i], referenceNode);
1495
1497
  }
@@ -1502,11 +1504,11 @@ class MockNode {
1502
1504
  get isConnected() {
1503
1505
  let node = this;
1504
1506
  while (node != null) {
1505
- if (node.nodeType === 9 /* DOCUMENT_NODE */) {
1507
+ if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
1506
1508
  return true;
1507
1509
  }
1508
1510
  node = node.parentNode;
1509
- if (node != null && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
1511
+ if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
1510
1512
  node = node.host;
1511
1513
  }
1512
1514
  }
@@ -1526,7 +1528,8 @@ class MockNode {
1526
1528
  return null;
1527
1529
  }
1528
1530
  get nodeValue() {
1529
- return this._nodeValue;
1531
+ var _a;
1532
+ return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
1530
1533
  }
1531
1534
  set nodeValue(value) {
1532
1535
  this._nodeValue = value;
@@ -1558,7 +1561,7 @@ class MockNode {
1558
1561
  const index = this.childNodes.indexOf(childNode);
1559
1562
  if (index > -1) {
1560
1563
  this.childNodes.splice(index, 1);
1561
- if (this.nodeType === 1 /* ELEMENT_NODE */) {
1564
+ if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
1562
1565
  const wasConnected = this.isConnected;
1563
1566
  childNode.parentNode = null;
1564
1567
  if (wasConnected === true) {
@@ -1588,7 +1591,8 @@ class MockNode {
1588
1591
  return null;
1589
1592
  }
1590
1593
  get textContent() {
1591
- return this._nodeValue;
1594
+ var _a;
1595
+ return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
1592
1596
  }
1593
1597
  set textContent(value) {
1594
1598
  this._nodeValue = String(value);
@@ -1610,8 +1614,10 @@ class MockNodeList {
1610
1614
  }
1611
1615
  class MockElement extends MockNode {
1612
1616
  constructor(ownerDocument, nodeName) {
1613
- super(ownerDocument, 1 /* ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
1617
+ super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
1614
1618
  this.namespaceURI = null;
1619
+ this.__shadowRoot = null;
1620
+ this.__attributeMap = null;
1615
1621
  }
1616
1622
  addEventListener(type, handler) {
1617
1623
  addEventListener(this, type, handler);
@@ -1638,7 +1644,9 @@ class MockElement extends MockNode {
1638
1644
  }
1639
1645
  get attributes() {
1640
1646
  if (this.__attributeMap == null) {
1641
- this.__attributeMap = createAttributeProxy(false);
1647
+ const attrMap = createAttributeProxy(false);
1648
+ this.__attributeMap = attrMap;
1649
+ return attrMap;
1642
1650
  }
1643
1651
  return this.__attributeMap;
1644
1652
  }
@@ -1646,10 +1654,10 @@ class MockElement extends MockNode {
1646
1654
  this.__attributeMap = attrs;
1647
1655
  }
1648
1656
  get children() {
1649
- return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */);
1657
+ return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
1650
1658
  }
1651
1659
  get childElementCount() {
1652
- return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */).length;
1660
+ return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
1653
1661
  }
1654
1662
  get className() {
1655
1663
  return this.getAttributeNS(null, 'class') || '';
@@ -1665,6 +1673,7 @@ class MockElement extends MockNode {
1665
1673
  }
1666
1674
  cloneNode(_deep) {
1667
1675
  // implemented on MockElement.prototype from within element.ts
1676
+ // @ts-ignore - implemented on MockElement.prototype from within element.ts
1668
1677
  return null;
1669
1678
  }
1670
1679
  closest(selector) {
@@ -1754,7 +1763,8 @@ class MockElement extends MockNode {
1754
1763
  });
1755
1764
  }
1756
1765
  set innerHTML(html) {
1757
- if (NON_ESCAPABLE_CONTENT.has(this.nodeName) === true) {
1766
+ var _a;
1767
+ if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
1758
1768
  setTextContent(this, html);
1759
1769
  }
1760
1770
  else {
@@ -1866,9 +1876,9 @@ class MockElement extends MockNode {
1866
1876
  get nextElementSibling() {
1867
1877
  const parentElement = this.parentElement;
1868
1878
  if (parentElement != null &&
1869
- (parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
1870
- parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
1871
- parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
1879
+ (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
1880
+ parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
1881
+ parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
1872
1882
  const children = parentElement.children;
1873
1883
  const index = children.indexOf(this) + 1;
1874
1884
  return parentElement.children[index] || null;
@@ -1885,9 +1895,9 @@ class MockElement extends MockNode {
1885
1895
  get previousElementSibling() {
1886
1896
  const parentElement = this.parentElement;
1887
1897
  if (parentElement != null &&
1888
- (parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
1889
- parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
1890
- parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
1898
+ (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
1899
+ parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
1900
+ parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
1891
1901
  const children = parentElement.children;
1892
1902
  const index = children.indexOf(this) - 1;
1893
1903
  return parentElement.children[index] || null;
@@ -2020,7 +2030,8 @@ class MockElement extends MockNode {
2020
2030
  this.setAttributeNS(null, 'tabindex', value);
2021
2031
  }
2022
2032
  get tagName() {
2023
- return this.nodeName;
2033
+ var _a;
2034
+ return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
2024
2035
  }
2025
2036
  set tagName(value) {
2026
2037
  this.nodeName = value;
@@ -2335,10 +2346,11 @@ function getElementsByClassName(elm, classNames, foundElms) {
2335
2346
  }
2336
2347
  }
2337
2348
  function getElementsByTagName(elm, tagName, foundElms) {
2349
+ var _a;
2338
2350
  const children = elm.children;
2339
2351
  for (let i = 0, ii = children.length; i < ii; i++) {
2340
2352
  const childElm = children[i];
2341
- if (tagName === '*' || childElm.nodeName.toLowerCase() === tagName) {
2353
+ if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
2342
2354
  foundElms.push(childElm);
2343
2355
  }
2344
2356
  getElementsByTagName(childElm, tagName, foundElms);
@@ -2377,14 +2389,17 @@ class MockHTMLElement extends MockElement {
2377
2389
  this.namespaceURI = 'http://www.w3.org/1999/xhtml';
2378
2390
  }
2379
2391
  get tagName() {
2380
- return this.nodeName;
2392
+ var _a;
2393
+ return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
2381
2394
  }
2382
2395
  set tagName(value) {
2383
2396
  this.nodeName = value;
2384
2397
  }
2385
2398
  get attributes() {
2386
2399
  if (this.__attributeMap == null) {
2387
- this.__attributeMap = createAttributeProxy(true);
2400
+ const attrMap = createAttributeProxy(true);
2401
+ this.__attributeMap = attrMap;
2402
+ return attrMap;
2388
2403
  }
2389
2404
  return this.__attributeMap;
2390
2405
  }
@@ -2394,7 +2409,7 @@ class MockHTMLElement extends MockElement {
2394
2409
  }
2395
2410
  class MockTextNode extends MockNode {
2396
2411
  constructor(ownerDocument, text) {
2397
- super(ownerDocument, 3 /* TEXT_NODE */, "#text" /* TEXT_NODE */, text);
2412
+ super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
2398
2413
  }
2399
2414
  cloneNode(_deep) {
2400
2415
  return new MockTextNode(null, this.nodeValue);
@@ -2416,7 +2431,7 @@ class MockTextNode extends MockNode {
2416
2431
  const text = [];
2417
2432
  for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
2418
2433
  const childNode = this.parentNode.childNodes[i];
2419
- if (childNode.nodeType === 3 /* TEXT_NODE */) {
2434
+ if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
2420
2435
  text.push(childNode.nodeValue);
2421
2436
  }
2422
2437
  }
@@ -2428,10 +2443,10 @@ class MockTextNode extends MockNode {
2428
2443
  function getTextContent(childNodes, text) {
2429
2444
  for (let i = 0, ii = childNodes.length; i < ii; i++) {
2430
2445
  const childNode = childNodes[i];
2431
- if (childNode.nodeType === 3 /* TEXT_NODE */) {
2446
+ if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
2432
2447
  text.push(childNode.nodeValue);
2433
2448
  }
2434
- else if (childNode.nodeType === 1 /* ELEMENT_NODE */) {
2449
+ else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
2435
2450
  getTextContent(childNode.childNodes, text);
2436
2451
  }
2437
2452
  }
@@ -2446,7 +2461,7 @@ function setTextContent(elm, text) {
2446
2461
 
2447
2462
  class MockComment extends MockNode {
2448
2463
  constructor(ownerDocument, data) {
2449
- super(ownerDocument, 8 /* COMMENT_NODE */, "#comment" /* COMMENT_NODE */, data);
2464
+ super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
2450
2465
  }
2451
2466
  cloneNode(_deep) {
2452
2467
  return new MockComment(null, this.nodeValue);
@@ -2462,8 +2477,8 @@ class MockComment extends MockNode {
2462
2477
  class MockDocumentFragment extends MockHTMLElement {
2463
2478
  constructor(ownerDocument) {
2464
2479
  super(ownerDocument, null);
2465
- this.nodeName = "#document-fragment" /* DOCUMENT_FRAGMENT_NODE */;
2466
- this.nodeType = 11 /* DOCUMENT_FRAGMENT_NODE */;
2480
+ this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
2481
+ this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
2467
2482
  }
2468
2483
  getElementById(id) {
2469
2484
  return getElementById(this, id);
@@ -2473,9 +2488,9 @@ class MockDocumentFragment extends MockHTMLElement {
2473
2488
  if (deep) {
2474
2489
  for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
2475
2490
  const childNode = this.childNodes[i];
2476
- if (childNode.nodeType === 1 /* ELEMENT_NODE */ ||
2477
- childNode.nodeType === 3 /* TEXT_NODE */ ||
2478
- childNode.nodeType === 8 /* COMMENT_NODE */) {
2491
+ if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
2492
+ childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
2493
+ childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
2479
2494
  const clonedChildNode = this.childNodes[i].cloneNode(true);
2480
2495
  cloned.appendChild(clonedChildNode);
2481
2496
  }
@@ -2488,7 +2503,7 @@ class MockDocumentFragment extends MockHTMLElement {
2488
2503
  class MockDocumentTypeNode extends MockHTMLElement {
2489
2504
  constructor(ownerDocument) {
2490
2505
  super(ownerDocument, '!DOCTYPE');
2491
- this.nodeType = 10 /* DOCUMENT_TYPE_NODE */;
2506
+ this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
2492
2507
  this.setAttribute('html', '');
2493
2508
  }
2494
2509
  }
@@ -3633,6 +3648,7 @@ class MockNavigator {
3633
3648
  class MockPerformance {
3634
3649
  constructor() {
3635
3650
  this.timeOrigin = Date.now();
3651
+ this.eventCounts = new Map();
3636
3652
  }
3637
3653
  addEventListener() {
3638
3654
  //
@@ -4522,8 +4538,8 @@ function resetWindowDimensions(win) {
4522
4538
  class MockDocument extends MockHTMLElement {
4523
4539
  constructor(html = null, win = null) {
4524
4540
  super(null, null);
4525
- this.nodeName = "#document" /* DOCUMENT_NODE */;
4526
- this.nodeType = 9 /* DOCUMENT_NODE */;
4541
+ this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
4542
+ this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
4527
4543
  this.defaultView = win;
4528
4544
  this.cookie = '';
4529
4545
  this.referrer = '';
@@ -4597,7 +4613,7 @@ class MockDocument extends MockHTMLElement {
4597
4613
  }
4598
4614
  set documentElement(documentElement) {
4599
4615
  for (let i = this.childNodes.length - 1; i >= 0; i--) {
4600
- if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
4616
+ if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
4601
4617
  this.childNodes[i].remove();
4602
4618
  }
4603
4619
  }
@@ -4668,7 +4684,7 @@ class MockDocument extends MockHTMLElement {
4668
4684
  return new MockAttr(attrName, '', namespaceURI);
4669
4685
  }
4670
4686
  createElement(tagName) {
4671
- if (tagName === "#document" /* DOCUMENT_NODE */) {
4687
+ if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
4672
4688
  const doc = new MockDocument(false);
4673
4689
  doc.nodeName = tagName;
4674
4690
  doc.parentNode = null;
@@ -4737,11 +4753,11 @@ function resetDocument(doc) {
4737
4753
  }
4738
4754
  }
4739
4755
  try {
4740
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
4756
+ doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
4741
4757
  }
4742
4758
  catch (e) { }
4743
4759
  try {
4744
- doc.nodeType = 9 /* DOCUMENT_NODE */;
4760
+ doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
4745
4761
  }
4746
4762
  catch (e) { }
4747
4763
  try {
@@ -4791,7 +4807,7 @@ function getElementsByName(elm, elmName, foundElms = []) {
4791
4807
  function setOwnerDocument(elm, ownerDocument) {
4792
4808
  for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
4793
4809
  elm.childNodes[i].ownerDocument = ownerDocument;
4794
- if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
4810
+ if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
4795
4811
  setOwnerDocument(elm.childNodes[i], ownerDocument);
4796
4812
  }
4797
4813
  }
@@ -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;