@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.
- package/cli/index.cjs +98 -35
- package/cli/index.js +98 -35
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +620 -89
- package/compiler/lib.dom.iterable.d.ts +27 -3
- package/compiler/lib.es2015.core.d.ts +3 -3
- package/compiler/lib.es2015.iterable.d.ts +2 -1
- package/compiler/lib.es2015.reflect.d.ts +1 -1
- package/compiler/lib.es2020.bigint.d.ts +7 -5
- package/compiler/lib.es2020.d.ts +2 -0
- package/compiler/lib.es2020.date.d.ts +44 -0
- package/compiler/lib.es2020.intl.d.ts +51 -11
- package/compiler/lib.es2020.number.d.ts +30 -0
- package/compiler/lib.es2021.intl.d.ts +106 -4
- package/compiler/lib.es2022.array.d.ts +123 -0
- package/compiler/lib.es2022.d.ts +26 -0
- package/compiler/lib.es2022.error.d.ts +75 -0
- package/compiler/lib.es2022.full.d.ts +25 -0
- package/compiler/lib.es2022.intl.d.ts +111 -0
- package/compiler/lib.es2022.object.d.ts +28 -0
- package/compiler/lib.es2022.string.d.ts +27 -0
- package/compiler/lib.es5.d.ts +25 -19
- package/compiler/lib.esnext.d.ts +1 -1
- package/compiler/lib.esnext.intl.d.ts +4 -1
- package/compiler/lib.webworker.d.ts +236 -40
- package/compiler/lib.webworker.iterable.d.ts +10 -3
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +805 -931
- package/compiler/rindo.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +218 -0
- package/dependencies.json +10 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +12 -12
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +338 -158
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2 -106
- package/internal/rindo-public-compiler.d.ts +44 -10
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +77 -62
- package/mock-doc/index.d.ts +13 -12
- package/mock-doc/index.js +77 -62
- package/mock-doc/package.json +1 -1
- package/package.json +10 -12
- package/readme.md +44 -31
- package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
- package/screenshot/index.js +10 -10
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +5 -5
- package/sys/node/glob.js +1 -1
- package/sys/node/graceful-fs.js +1 -1
- package/sys/node/index.js +2 -2
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +130 -295
- package/testing/package.json +1 -1
- package/testing/testing-utils.d.ts +5 -4
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Rindo Mock Doc v2.
|
|
2
|
+
Rindo Mock Doc v2.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
const CONTENT_REF_ID = 'r';
|
|
5
5
|
const ORG_LOCATION_ID = 'o';
|
|
@@ -279,7 +279,7 @@ const proxyElements = new WeakMap();
|
|
|
279
279
|
const upgradedElements = new WeakSet();
|
|
280
280
|
function connectNode(ownerDocument, node) {
|
|
281
281
|
node.ownerDocument = ownerDocument;
|
|
282
|
-
if (node.nodeType === 1 /* ELEMENT_NODE */) {
|
|
282
|
+
if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
283
283
|
if (ownerDocument != null && node.nodeName.includes('-')) {
|
|
284
284
|
const win = ownerDocument.defaultView;
|
|
285
285
|
if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
|
|
@@ -315,7 +315,7 @@ function fireConnectedCallback(node) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
function disconnectNode(node) {
|
|
318
|
-
if (node.nodeType === 1 /* ELEMENT_NODE */) {
|
|
318
|
+
if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
319
319
|
if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
|
|
320
320
|
if (tempDisableCallbacks.has(node.ownerDocument) === false) {
|
|
321
321
|
try {
|
|
@@ -631,7 +631,7 @@ class MockEvent {
|
|
|
631
631
|
let currentElement = this.target;
|
|
632
632
|
while (currentElement) {
|
|
633
633
|
composedPath.push(currentElement);
|
|
634
|
-
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
634
|
+
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
|
|
635
635
|
// the current element doesn't have a parent, but we've detected it's our root document node. push the window
|
|
636
636
|
// object associated with the document onto the path
|
|
637
637
|
composedPath.push(currentElement.defaultView);
|
|
@@ -753,7 +753,7 @@ function triggerEventListener(elm, ev) {
|
|
|
753
753
|
if (ev.bubbles === false) {
|
|
754
754
|
return;
|
|
755
755
|
}
|
|
756
|
-
if (elm.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
756
|
+
if (elm.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
|
|
757
757
|
triggerEventListener(elm.defaultView, ev);
|
|
758
758
|
}
|
|
759
759
|
else {
|
|
@@ -826,7 +826,7 @@ function serializeNodeToHtml(elm, opts = {}) {
|
|
|
826
826
|
return output.text.join('');
|
|
827
827
|
}
|
|
828
828
|
function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
829
|
-
if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
|
|
829
|
+
if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ || isShadowRoot) {
|
|
830
830
|
const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
|
|
831
831
|
if (tagName === 'body') {
|
|
832
832
|
output.isWithinBody = true;
|
|
@@ -943,7 +943,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
943
943
|
if (opts.newLines &&
|
|
944
944
|
(node.childNodes.length === 0 ||
|
|
945
945
|
(node.childNodes.length === 1 &&
|
|
946
|
-
node.childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
|
|
946
|
+
node.childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
|
|
947
947
|
node.childNodes[0].nodeValue.trim() === ''))) {
|
|
948
948
|
output.text.push('\n');
|
|
949
949
|
output.currentLineWidth = 0;
|
|
@@ -958,7 +958,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
958
958
|
const childNodeLength = childNodes.length;
|
|
959
959
|
if (childNodeLength > 0) {
|
|
960
960
|
if (childNodeLength === 1 &&
|
|
961
|
-
childNodes[0].nodeType === 3 /* TEXT_NODE */ &&
|
|
961
|
+
childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
|
|
962
962
|
(typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
|
|
963
963
|
else {
|
|
964
964
|
const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
@@ -997,7 +997,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
997
997
|
output.isWithinBody = false;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
else if (node.nodeType === 3 /* TEXT_NODE */) {
|
|
1000
|
+
else if (node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
1001
1001
|
let textContent = node.nodeValue;
|
|
1002
1002
|
if (typeof textContent === 'string') {
|
|
1003
1003
|
const trimmedTextContent = textContent.trim();
|
|
@@ -1044,7 +1044,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
1044
1044
|
let textContentLength = textContent.length;
|
|
1045
1045
|
if (textContentLength > 0) {
|
|
1046
1046
|
// this text node has text content
|
|
1047
|
-
const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */
|
|
1047
|
+
const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */
|
|
1048
1048
|
? node.parentNode.nodeName
|
|
1049
1049
|
: null;
|
|
1050
1050
|
if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
|
|
@@ -1099,7 +1099,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
else if (node.nodeType === 8 /* COMMENT_NODE */) {
|
|
1102
|
+
else if (node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
|
|
1103
1103
|
const nodeValue = node.nodeValue;
|
|
1104
1104
|
if (opts.removeHtmlComments) {
|
|
1105
1105
|
const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
|
|
@@ -1124,7 +1124,7 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
|
|
|
1124
1124
|
output.text.push('<!--' + nodeValue + '-->');
|
|
1125
1125
|
output.currentLineWidth += nodeValue.length + 7;
|
|
1126
1126
|
}
|
|
1127
|
-
else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
|
|
1127
|
+
else if (node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
|
|
1128
1128
|
output.text.push('<!doctype html>');
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
@@ -1281,10 +1281,9 @@ function getParser(ownerDocument) {
|
|
|
1281
1281
|
if (parseOptions != null) {
|
|
1282
1282
|
return parseOptions;
|
|
1283
1283
|
}
|
|
1284
|
-
// @ts-ignore
|
|
1285
1284
|
const treeAdapter = {
|
|
1286
1285
|
createDocument() {
|
|
1287
|
-
const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
|
|
1286
|
+
const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
|
|
1288
1287
|
doc['x-mode'] = 'no-quirks';
|
|
1289
1288
|
return doc;
|
|
1290
1289
|
},
|
|
@@ -1326,7 +1325,7 @@ function getParser(ownerDocument) {
|
|
|
1326
1325
|
return templateElement.content;
|
|
1327
1326
|
},
|
|
1328
1327
|
setDocumentType(doc, name, publicId, systemId) {
|
|
1329
|
-
let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
|
|
1328
|
+
let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
|
|
1330
1329
|
if (doctypeNode == null) {
|
|
1331
1330
|
doctypeNode = ownerDocument.createDocumentTypeNode();
|
|
1332
1331
|
doc.insertBefore(doctypeNode, doc.firstChild);
|
|
@@ -1347,7 +1346,7 @@ function getParser(ownerDocument) {
|
|
|
1347
1346
|
},
|
|
1348
1347
|
insertText(parentNode, text) {
|
|
1349
1348
|
const lastChild = parentNode.lastChild;
|
|
1350
|
-
if (lastChild != null && lastChild.nodeType === 3 /* TEXT_NODE */) {
|
|
1349
|
+
if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
1351
1350
|
lastChild.nodeValue += text;
|
|
1352
1351
|
}
|
|
1353
1352
|
else {
|
|
@@ -1356,7 +1355,7 @@ function getParser(ownerDocument) {
|
|
|
1356
1355
|
},
|
|
1357
1356
|
insertTextBefore(parentNode, text, referenceNode) {
|
|
1358
1357
|
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
|
1359
|
-
if (prevNode != null && prevNode.nodeType === 3 /* TEXT_NODE */) {
|
|
1358
|
+
if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
1360
1359
|
prevNode.nodeValue += text;
|
|
1361
1360
|
}
|
|
1362
1361
|
else {
|
|
@@ -1418,16 +1417,16 @@ function getParser(ownerDocument) {
|
|
|
1418
1417
|
return doctypeNode['x-systemId'];
|
|
1419
1418
|
},
|
|
1420
1419
|
isTextNode(node) {
|
|
1421
|
-
return node.nodeType === 3 /* TEXT_NODE */;
|
|
1420
|
+
return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
|
|
1422
1421
|
},
|
|
1423
1422
|
isCommentNode(node) {
|
|
1424
|
-
return node.nodeType === 8 /* COMMENT_NODE */;
|
|
1423
|
+
return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
|
|
1425
1424
|
},
|
|
1426
1425
|
isDocumentTypeNode(node) {
|
|
1427
|
-
return node.nodeType === 10 /* DOCUMENT_TYPE_NODE */;
|
|
1426
|
+
return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
|
|
1428
1427
|
},
|
|
1429
1428
|
isElementNode(node) {
|
|
1430
|
-
return node.nodeType === 1 /* ELEMENT_NODE */;
|
|
1429
|
+
return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
|
|
1431
1430
|
},
|
|
1432
1431
|
};
|
|
1433
1432
|
parseOptions = {
|
|
@@ -1447,7 +1446,7 @@ class MockNode {
|
|
|
1447
1446
|
this.childNodes = [];
|
|
1448
1447
|
}
|
|
1449
1448
|
appendChild(newNode) {
|
|
1450
|
-
if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1449
|
+
if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
|
|
1451
1450
|
const nodes = newNode.childNodes.slice();
|
|
1452
1451
|
for (const child of nodes) {
|
|
1453
1452
|
this.appendChild(child);
|
|
@@ -1471,7 +1470,9 @@ class MockNode {
|
|
|
1471
1470
|
const firstChild = this.firstChild;
|
|
1472
1471
|
items.forEach((item) => {
|
|
1473
1472
|
const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
|
|
1474
|
-
|
|
1473
|
+
if (firstChild) {
|
|
1474
|
+
this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
|
|
1475
|
+
}
|
|
1475
1476
|
});
|
|
1476
1477
|
}
|
|
1477
1478
|
cloneNode(deep) {
|
|
@@ -1486,7 +1487,7 @@ class MockNode {
|
|
|
1486
1487
|
return this.childNodes[0] || null;
|
|
1487
1488
|
}
|
|
1488
1489
|
insertBefore(newNode, referenceNode) {
|
|
1489
|
-
if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1490
|
+
if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
|
|
1490
1491
|
for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
|
|
1491
1492
|
insertBefore(this, newNode.childNodes[i], referenceNode);
|
|
1492
1493
|
}
|
|
@@ -1499,11 +1500,11 @@ class MockNode {
|
|
|
1499
1500
|
get isConnected() {
|
|
1500
1501
|
let node = this;
|
|
1501
1502
|
while (node != null) {
|
|
1502
|
-
if (node.nodeType === 9 /* DOCUMENT_NODE */) {
|
|
1503
|
+
if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
|
|
1503
1504
|
return true;
|
|
1504
1505
|
}
|
|
1505
1506
|
node = node.parentNode;
|
|
1506
|
-
if (node != null && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
1507
|
+
if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
|
|
1507
1508
|
node = node.host;
|
|
1508
1509
|
}
|
|
1509
1510
|
}
|
|
@@ -1523,7 +1524,8 @@ class MockNode {
|
|
|
1523
1524
|
return null;
|
|
1524
1525
|
}
|
|
1525
1526
|
get nodeValue() {
|
|
1526
|
-
|
|
1527
|
+
var _a;
|
|
1528
|
+
return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
|
|
1527
1529
|
}
|
|
1528
1530
|
set nodeValue(value) {
|
|
1529
1531
|
this._nodeValue = value;
|
|
@@ -1555,7 +1557,7 @@ class MockNode {
|
|
|
1555
1557
|
const index = this.childNodes.indexOf(childNode);
|
|
1556
1558
|
if (index > -1) {
|
|
1557
1559
|
this.childNodes.splice(index, 1);
|
|
1558
|
-
if (this.nodeType === 1 /* ELEMENT_NODE */) {
|
|
1560
|
+
if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
1559
1561
|
const wasConnected = this.isConnected;
|
|
1560
1562
|
childNode.parentNode = null;
|
|
1561
1563
|
if (wasConnected === true) {
|
|
@@ -1585,7 +1587,8 @@ class MockNode {
|
|
|
1585
1587
|
return null;
|
|
1586
1588
|
}
|
|
1587
1589
|
get textContent() {
|
|
1588
|
-
|
|
1590
|
+
var _a;
|
|
1591
|
+
return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
|
|
1589
1592
|
}
|
|
1590
1593
|
set textContent(value) {
|
|
1591
1594
|
this._nodeValue = String(value);
|
|
@@ -1607,8 +1610,10 @@ class MockNodeList {
|
|
|
1607
1610
|
}
|
|
1608
1611
|
class MockElement extends MockNode {
|
|
1609
1612
|
constructor(ownerDocument, nodeName) {
|
|
1610
|
-
super(ownerDocument, 1 /* ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
|
|
1613
|
+
super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
|
|
1611
1614
|
this.namespaceURI = null;
|
|
1615
|
+
this.__shadowRoot = null;
|
|
1616
|
+
this.__attributeMap = null;
|
|
1612
1617
|
}
|
|
1613
1618
|
addEventListener(type, handler) {
|
|
1614
1619
|
addEventListener(this, type, handler);
|
|
@@ -1635,7 +1640,9 @@ class MockElement extends MockNode {
|
|
|
1635
1640
|
}
|
|
1636
1641
|
get attributes() {
|
|
1637
1642
|
if (this.__attributeMap == null) {
|
|
1638
|
-
|
|
1643
|
+
const attrMap = createAttributeProxy(false);
|
|
1644
|
+
this.__attributeMap = attrMap;
|
|
1645
|
+
return attrMap;
|
|
1639
1646
|
}
|
|
1640
1647
|
return this.__attributeMap;
|
|
1641
1648
|
}
|
|
@@ -1643,10 +1650,10 @@ class MockElement extends MockNode {
|
|
|
1643
1650
|
this.__attributeMap = attrs;
|
|
1644
1651
|
}
|
|
1645
1652
|
get children() {
|
|
1646
|
-
return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */);
|
|
1653
|
+
return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
|
|
1647
1654
|
}
|
|
1648
1655
|
get childElementCount() {
|
|
1649
|
-
return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */).length;
|
|
1656
|
+
return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
|
|
1650
1657
|
}
|
|
1651
1658
|
get className() {
|
|
1652
1659
|
return this.getAttributeNS(null, 'class') || '';
|
|
@@ -1662,6 +1669,7 @@ class MockElement extends MockNode {
|
|
|
1662
1669
|
}
|
|
1663
1670
|
cloneNode(_deep) {
|
|
1664
1671
|
// implemented on MockElement.prototype from within element.ts
|
|
1672
|
+
// @ts-ignore - implemented on MockElement.prototype from within element.ts
|
|
1665
1673
|
return null;
|
|
1666
1674
|
}
|
|
1667
1675
|
closest(selector) {
|
|
@@ -1751,7 +1759,8 @@ class MockElement extends MockNode {
|
|
|
1751
1759
|
});
|
|
1752
1760
|
}
|
|
1753
1761
|
set innerHTML(html) {
|
|
1754
|
-
|
|
1762
|
+
var _a;
|
|
1763
|
+
if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
|
|
1755
1764
|
setTextContent(this, html);
|
|
1756
1765
|
}
|
|
1757
1766
|
else {
|
|
@@ -1863,9 +1872,9 @@ class MockElement extends MockNode {
|
|
|
1863
1872
|
get nextElementSibling() {
|
|
1864
1873
|
const parentElement = this.parentElement;
|
|
1865
1874
|
if (parentElement != null &&
|
|
1866
|
-
(parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
|
|
1867
|
-
parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
|
|
1868
|
-
parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
|
|
1875
|
+
(parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
|
|
1876
|
+
parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
|
|
1877
|
+
parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
|
|
1869
1878
|
const children = parentElement.children;
|
|
1870
1879
|
const index = children.indexOf(this) + 1;
|
|
1871
1880
|
return parentElement.children[index] || null;
|
|
@@ -1882,9 +1891,9 @@ class MockElement extends MockNode {
|
|
|
1882
1891
|
get previousElementSibling() {
|
|
1883
1892
|
const parentElement = this.parentElement;
|
|
1884
1893
|
if (parentElement != null &&
|
|
1885
|
-
(parentElement.nodeType === 1 /* ELEMENT_NODE */ ||
|
|
1886
|
-
parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ ||
|
|
1887
|
-
parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
|
|
1894
|
+
(parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
|
|
1895
|
+
parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
|
|
1896
|
+
parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
|
|
1888
1897
|
const children = parentElement.children;
|
|
1889
1898
|
const index = children.indexOf(this) - 1;
|
|
1890
1899
|
return parentElement.children[index] || null;
|
|
@@ -2017,7 +2026,8 @@ class MockElement extends MockNode {
|
|
|
2017
2026
|
this.setAttributeNS(null, 'tabindex', value);
|
|
2018
2027
|
}
|
|
2019
2028
|
get tagName() {
|
|
2020
|
-
|
|
2029
|
+
var _a;
|
|
2030
|
+
return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
|
|
2021
2031
|
}
|
|
2022
2032
|
set tagName(value) {
|
|
2023
2033
|
this.nodeName = value;
|
|
@@ -2332,10 +2342,11 @@ function getElementsByClassName(elm, classNames, foundElms) {
|
|
|
2332
2342
|
}
|
|
2333
2343
|
}
|
|
2334
2344
|
function getElementsByTagName(elm, tagName, foundElms) {
|
|
2345
|
+
var _a;
|
|
2335
2346
|
const children = elm.children;
|
|
2336
2347
|
for (let i = 0, ii = children.length; i < ii; i++) {
|
|
2337
2348
|
const childElm = children[i];
|
|
2338
|
-
if (tagName === '*' || childElm.nodeName.toLowerCase() === tagName) {
|
|
2349
|
+
if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
|
|
2339
2350
|
foundElms.push(childElm);
|
|
2340
2351
|
}
|
|
2341
2352
|
getElementsByTagName(childElm, tagName, foundElms);
|
|
@@ -2374,14 +2385,17 @@ class MockHTMLElement extends MockElement {
|
|
|
2374
2385
|
this.namespaceURI = 'http://www.w3.org/1999/xhtml';
|
|
2375
2386
|
}
|
|
2376
2387
|
get tagName() {
|
|
2377
|
-
|
|
2388
|
+
var _a;
|
|
2389
|
+
return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
|
|
2378
2390
|
}
|
|
2379
2391
|
set tagName(value) {
|
|
2380
2392
|
this.nodeName = value;
|
|
2381
2393
|
}
|
|
2382
2394
|
get attributes() {
|
|
2383
2395
|
if (this.__attributeMap == null) {
|
|
2384
|
-
|
|
2396
|
+
const attrMap = createAttributeProxy(true);
|
|
2397
|
+
this.__attributeMap = attrMap;
|
|
2398
|
+
return attrMap;
|
|
2385
2399
|
}
|
|
2386
2400
|
return this.__attributeMap;
|
|
2387
2401
|
}
|
|
@@ -2391,7 +2405,7 @@ class MockHTMLElement extends MockElement {
|
|
|
2391
2405
|
}
|
|
2392
2406
|
class MockTextNode extends MockNode {
|
|
2393
2407
|
constructor(ownerDocument, text) {
|
|
2394
|
-
super(ownerDocument, 3 /* TEXT_NODE */, "#text" /* TEXT_NODE */, text);
|
|
2408
|
+
super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
|
|
2395
2409
|
}
|
|
2396
2410
|
cloneNode(_deep) {
|
|
2397
2411
|
return new MockTextNode(null, this.nodeValue);
|
|
@@ -2413,7 +2427,7 @@ class MockTextNode extends MockNode {
|
|
|
2413
2427
|
const text = [];
|
|
2414
2428
|
for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
|
|
2415
2429
|
const childNode = this.parentNode.childNodes[i];
|
|
2416
|
-
if (childNode.nodeType === 3 /* TEXT_NODE */) {
|
|
2430
|
+
if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2417
2431
|
text.push(childNode.nodeValue);
|
|
2418
2432
|
}
|
|
2419
2433
|
}
|
|
@@ -2425,10 +2439,10 @@ class MockTextNode extends MockNode {
|
|
|
2425
2439
|
function getTextContent(childNodes, text) {
|
|
2426
2440
|
for (let i = 0, ii = childNodes.length; i < ii; i++) {
|
|
2427
2441
|
const childNode = childNodes[i];
|
|
2428
|
-
if (childNode.nodeType === 3 /* TEXT_NODE */) {
|
|
2442
|
+
if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2429
2443
|
text.push(childNode.nodeValue);
|
|
2430
2444
|
}
|
|
2431
|
-
else if (childNode.nodeType === 1 /* ELEMENT_NODE */) {
|
|
2445
|
+
else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
2432
2446
|
getTextContent(childNode.childNodes, text);
|
|
2433
2447
|
}
|
|
2434
2448
|
}
|
|
@@ -2443,7 +2457,7 @@ function setTextContent(elm, text) {
|
|
|
2443
2457
|
|
|
2444
2458
|
class MockComment extends MockNode {
|
|
2445
2459
|
constructor(ownerDocument, data) {
|
|
2446
|
-
super(ownerDocument, 8 /* COMMENT_NODE */, "#comment" /* COMMENT_NODE */, data);
|
|
2460
|
+
super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
|
|
2447
2461
|
}
|
|
2448
2462
|
cloneNode(_deep) {
|
|
2449
2463
|
return new MockComment(null, this.nodeValue);
|
|
@@ -2459,8 +2473,8 @@ class MockComment extends MockNode {
|
|
|
2459
2473
|
class MockDocumentFragment extends MockHTMLElement {
|
|
2460
2474
|
constructor(ownerDocument) {
|
|
2461
2475
|
super(ownerDocument, null);
|
|
2462
|
-
this.nodeName = "#document-fragment" /* DOCUMENT_FRAGMENT_NODE */;
|
|
2463
|
-
this.nodeType = 11 /* DOCUMENT_FRAGMENT_NODE */;
|
|
2476
|
+
this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
|
|
2477
|
+
this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
|
|
2464
2478
|
}
|
|
2465
2479
|
getElementById(id) {
|
|
2466
2480
|
return getElementById(this, id);
|
|
@@ -2470,9 +2484,9 @@ class MockDocumentFragment extends MockHTMLElement {
|
|
|
2470
2484
|
if (deep) {
|
|
2471
2485
|
for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
|
|
2472
2486
|
const childNode = this.childNodes[i];
|
|
2473
|
-
if (childNode.nodeType === 1 /* ELEMENT_NODE */ ||
|
|
2474
|
-
childNode.nodeType === 3 /* TEXT_NODE */ ||
|
|
2475
|
-
childNode.nodeType === 8 /* COMMENT_NODE */) {
|
|
2487
|
+
if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
|
|
2488
|
+
childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
|
|
2489
|
+
childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
|
|
2476
2490
|
const clonedChildNode = this.childNodes[i].cloneNode(true);
|
|
2477
2491
|
cloned.appendChild(clonedChildNode);
|
|
2478
2492
|
}
|
|
@@ -2485,7 +2499,7 @@ class MockDocumentFragment extends MockHTMLElement {
|
|
|
2485
2499
|
class MockDocumentTypeNode extends MockHTMLElement {
|
|
2486
2500
|
constructor(ownerDocument) {
|
|
2487
2501
|
super(ownerDocument, '!DOCTYPE');
|
|
2488
|
-
this.nodeType = 10 /* DOCUMENT_TYPE_NODE */;
|
|
2502
|
+
this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
|
|
2489
2503
|
this.setAttribute('html', '');
|
|
2490
2504
|
}
|
|
2491
2505
|
}
|
|
@@ -3630,6 +3644,7 @@ class MockNavigator {
|
|
|
3630
3644
|
class MockPerformance {
|
|
3631
3645
|
constructor() {
|
|
3632
3646
|
this.timeOrigin = Date.now();
|
|
3647
|
+
this.eventCounts = new Map();
|
|
3633
3648
|
}
|
|
3634
3649
|
addEventListener() {
|
|
3635
3650
|
//
|
|
@@ -4519,8 +4534,8 @@ function resetWindowDimensions(win) {
|
|
|
4519
4534
|
class MockDocument extends MockHTMLElement {
|
|
4520
4535
|
constructor(html = null, win = null) {
|
|
4521
4536
|
super(null, null);
|
|
4522
|
-
this.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
4523
|
-
this.nodeType = 9 /* DOCUMENT_NODE */;
|
|
4537
|
+
this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
|
|
4538
|
+
this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
|
|
4524
4539
|
this.defaultView = win;
|
|
4525
4540
|
this.cookie = '';
|
|
4526
4541
|
this.referrer = '';
|
|
@@ -4594,7 +4609,7 @@ class MockDocument extends MockHTMLElement {
|
|
|
4594
4609
|
}
|
|
4595
4610
|
set documentElement(documentElement) {
|
|
4596
4611
|
for (let i = this.childNodes.length - 1; i >= 0; i--) {
|
|
4597
|
-
if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
|
|
4612
|
+
if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
|
|
4598
4613
|
this.childNodes[i].remove();
|
|
4599
4614
|
}
|
|
4600
4615
|
}
|
|
@@ -4665,7 +4680,7 @@ class MockDocument extends MockHTMLElement {
|
|
|
4665
4680
|
return new MockAttr(attrName, '', namespaceURI);
|
|
4666
4681
|
}
|
|
4667
4682
|
createElement(tagName) {
|
|
4668
|
-
if (tagName === "#document" /* DOCUMENT_NODE */) {
|
|
4683
|
+
if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
|
|
4669
4684
|
const doc = new MockDocument(false);
|
|
4670
4685
|
doc.nodeName = tagName;
|
|
4671
4686
|
doc.parentNode = null;
|
|
@@ -4734,11 +4749,11 @@ function resetDocument(doc) {
|
|
|
4734
4749
|
}
|
|
4735
4750
|
}
|
|
4736
4751
|
try {
|
|
4737
|
-
doc.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
4752
|
+
doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
|
|
4738
4753
|
}
|
|
4739
4754
|
catch (e) { }
|
|
4740
4755
|
try {
|
|
4741
|
-
doc.nodeType = 9 /* DOCUMENT_NODE */;
|
|
4756
|
+
doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
|
|
4742
4757
|
}
|
|
4743
4758
|
catch (e) { }
|
|
4744
4759
|
try {
|
|
@@ -4788,7 +4803,7 @@ function getElementsByName(elm, elmName, foundElms = []) {
|
|
|
4788
4803
|
function setOwnerDocument(elm, ownerDocument) {
|
|
4789
4804
|
for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
|
|
4790
4805
|
elm.childNodes[i].ownerDocument = ownerDocument;
|
|
4791
|
-
if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
|
|
4806
|
+
if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
|
4792
4807
|
setOwnerDocument(elm.childNodes[i], ownerDocument);
|
|
4793
4808
|
}
|
|
4794
4809
|
}
|
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/rindo-core/index.cjs",
|
|
6
6
|
"module": "./internal/rindo-core/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"watch": "node scripts && npm run tsc && concurrently \"npm run rollup.watch\" \"npm run tsc.watch\""
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@
|
|
50
|
+
"@familyjs/prettier-config": "^2.0.0",
|
|
51
51
|
"@rollup/plugin-commonjs": "15.1.0",
|
|
52
52
|
"@rollup/plugin-json": "4.1.0",
|
|
53
53
|
"@rollup/plugin-node-resolve": "9.0.0",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@types/glob": "^7.1.2",
|
|
61
61
|
"@types/graceful-fs": "^4.1.5",
|
|
62
62
|
"@types/inquirer": "^7.3.1",
|
|
63
|
-
"@types/is-glob": "^4.0.1",
|
|
64
63
|
"@types/jest": "^27.0.3",
|
|
65
64
|
"@types/listr": "^0.14.2",
|
|
66
65
|
"@types/mime-types": "^2.1.0",
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
"conventional-changelog-cli": "^2.1.1",
|
|
85
84
|
"core-js-builder": "~3.6.5",
|
|
86
85
|
"css": "^3.0.0",
|
|
87
|
-
"dts-bundle-generator": "~
|
|
86
|
+
"dts-bundle-generator": "~6.12.0",
|
|
88
87
|
"eslint": "^8.13.0",
|
|
89
88
|
"eslint-config-prettier": "^8.5.0",
|
|
90
89
|
"eslint-plugin-jest": "^26.5.3",
|
|
@@ -92,7 +91,7 @@
|
|
|
92
91
|
"execa": "4.1.0",
|
|
93
92
|
"exit": "^0.1.2",
|
|
94
93
|
"fast-deep-equal": "3.1.3",
|
|
95
|
-
"fs-extra": "^
|
|
94
|
+
"fs-extra": "^10.1.0",
|
|
96
95
|
"glob": "7.1.6",
|
|
97
96
|
"graceful-fs": "~4.2.6",
|
|
98
97
|
"hash.js": "^1.1.7",
|
|
@@ -112,7 +111,7 @@
|
|
|
112
111
|
"path-browserify": "^1.0.1",
|
|
113
112
|
"pixelmatch": "4.0.2",
|
|
114
113
|
"postcss": "^8.2.8",
|
|
115
|
-
"prettier": "2.
|
|
114
|
+
"prettier": "2.7.1",
|
|
116
115
|
"prompts": "2.4.0",
|
|
117
116
|
"puppeteer": "~10.0.0",
|
|
118
117
|
"rollup": "2.42.3",
|
|
@@ -121,8 +120,7 @@
|
|
|
121
120
|
"semver": "7.3.4",
|
|
122
121
|
"sizzle": "^2.3.6",
|
|
123
122
|
"terser": "5.6.1",
|
|
124
|
-
"
|
|
125
|
-
"typescript": "4.5.4",
|
|
123
|
+
"typescript": "4.7.4",
|
|
126
124
|
"webpack": "^4.46.0",
|
|
127
125
|
"ws": "7.4.6"
|
|
128
126
|
},
|
|
@@ -132,22 +130,22 @@
|
|
|
132
130
|
},
|
|
133
131
|
"repository": {
|
|
134
132
|
"type": "git",
|
|
135
|
-
"url": "git+https://github.com/
|
|
133
|
+
"url": "git+https://github.com/familyjs/rindo.git"
|
|
136
134
|
},
|
|
137
|
-
"author": "
|
|
135
|
+
"author": "Family Team",
|
|
138
136
|
"homepage": "https://rindojs.web.app/",
|
|
139
137
|
"description": "A Compiler for Web Components and Progressive Web Apps",
|
|
140
138
|
"keywords": [
|
|
141
139
|
"web components",
|
|
142
140
|
"components",
|
|
143
141
|
"rindo",
|
|
144
|
-
"
|
|
142
|
+
"family",
|
|
145
143
|
"webapp",
|
|
146
144
|
"custom elements",
|
|
147
145
|
"pwa",
|
|
148
146
|
"progressive web app"
|
|
149
147
|
],
|
|
150
|
-
"prettier": "@
|
|
148
|
+
"prettier": "@familyjs/prettier-config",
|
|
151
149
|
"volta": {
|
|
152
150
|
"node": "16.13.0",
|
|
153
151
|
"npm": "8.1.1"
|