@rindo/core 4.20.0 → 4.22.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.
- package/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/lib.es2023.array.d.ts +5 -5
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +3534 -273
- 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 +2 -2
- package/internal/app-data/index.cjs +1 -1
- package/internal/app-data/index.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +25 -13
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +27 -19
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +10 -4
- package/internal/hydrate/runner.js +389 -239
- package/internal/package.json +1 -1
- package/internal/rindo-public-compiler.d.ts +43 -4
- package/internal/rindo-public-runtime.d.ts +4 -0
- package/internal/testing/index.js +24 -12
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +32 -1
- package/mock-doc/index.d.ts +8 -0
- package/mock-doc/index.js +32 -1
- package/mock-doc/package.json +1 -1
- package/package.json +9 -7
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +47 -45
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +2 -2
- package/testing/index.js +39 -1
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Hydrate Runner v4.
|
|
2
|
+
Rindo Hydrate Runner v4.22.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -12,6 +12,7 @@ var CONTENT_REF_ID = "r";
|
|
|
12
12
|
var ORG_LOCATION_ID = "o";
|
|
13
13
|
var SLOT_NODE_ID = "s";
|
|
14
14
|
var TEXT_NODE_ID = "t";
|
|
15
|
+
var HYDRATE_ID = "s-id";
|
|
15
16
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
16
17
|
|
|
17
18
|
// src/mock-doc/attribute.ts
|
|
@@ -320,8 +321,8 @@ function jsCaseToCssCase(str) {
|
|
|
320
321
|
|
|
321
322
|
// src/mock-doc/custom-element-registry.ts
|
|
322
323
|
var MockCustomElementRegistry = class {
|
|
323
|
-
constructor(
|
|
324
|
-
this.win =
|
|
324
|
+
constructor(win2) {
|
|
325
|
+
this.win = win2;
|
|
325
326
|
}
|
|
326
327
|
define(tagName, cstr, options) {
|
|
327
328
|
if (tagName.toLowerCase() !== tagName) {
|
|
@@ -343,19 +344,19 @@ var MockCustomElementRegistry = class {
|
|
|
343
344
|
this.__whenDefined.delete(tagName);
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
const hosts =
|
|
347
|
+
const doc2 = this.win.document;
|
|
348
|
+
if (doc2 != null) {
|
|
349
|
+
const hosts = doc2.querySelectorAll(tagName);
|
|
349
350
|
hosts.forEach((host) => {
|
|
350
351
|
if (upgradedElements.has(host) === false) {
|
|
351
|
-
tempDisableCallbacks.add(
|
|
352
|
-
const upgradedCmp = createCustomElement(this,
|
|
352
|
+
tempDisableCallbacks.add(doc2);
|
|
353
|
+
const upgradedCmp = createCustomElement(this, doc2, tagName);
|
|
353
354
|
for (let i = 0; i < host.childNodes.length; i++) {
|
|
354
355
|
const childNode = host.childNodes[i];
|
|
355
356
|
childNode.remove();
|
|
356
357
|
upgradedCmp.appendChild(childNode);
|
|
357
358
|
}
|
|
358
|
-
tempDisableCallbacks.delete(
|
|
359
|
+
tempDisableCallbacks.delete(doc2);
|
|
359
360
|
if (proxyElements.has(host)) {
|
|
360
361
|
proxyElements.set(host, upgradedCmp);
|
|
361
362
|
}
|
|
@@ -409,8 +410,8 @@ var MockCustomElementRegistry = class {
|
|
|
409
410
|
});
|
|
410
411
|
}
|
|
411
412
|
};
|
|
412
|
-
function createCustomElement(
|
|
413
|
-
const Cstr =
|
|
413
|
+
function createCustomElement(customElements2, ownerDocument, tagName) {
|
|
414
|
+
const Cstr = customElements2.get(tagName);
|
|
414
415
|
if (Cstr != null) {
|
|
415
416
|
const cmp = new Cstr(ownerDocument);
|
|
416
417
|
cmp.nodeName = tagName.toUpperCase();
|
|
@@ -458,8 +459,8 @@ function connectNode(ownerDocument, node) {
|
|
|
458
459
|
node.ownerDocument = ownerDocument;
|
|
459
460
|
if (node.nodeType === 1 /* ELEMENT_NODE */) {
|
|
460
461
|
if (ownerDocument != null && node.nodeName.includes("-")) {
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
462
|
+
const win2 = ownerDocument.defaultView;
|
|
463
|
+
if (win2 != null && typeof node.connectedCallback === "function" && node.isConnected) {
|
|
463
464
|
fireConnectedCallback(node);
|
|
464
465
|
}
|
|
465
466
|
const shadowRoot = node.shadowRoot;
|
|
@@ -4867,7 +4868,7 @@ var OpenElementStack = class {
|
|
|
4867
4868
|
get currentTmplContentOrNode() {
|
|
4868
4869
|
return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
|
|
4869
4870
|
}
|
|
4870
|
-
constructor(
|
|
4871
|
+
constructor(document2, treeAdapter, handler) {
|
|
4871
4872
|
this.treeAdapter = treeAdapter;
|
|
4872
4873
|
this.handler = handler;
|
|
4873
4874
|
this.items = [];
|
|
@@ -4875,7 +4876,7 @@ var OpenElementStack = class {
|
|
|
4875
4876
|
this.stackTop = -1;
|
|
4876
4877
|
this.tmplCount = 0;
|
|
4877
4878
|
this.currentTagId = TAG_ID.UNKNOWN;
|
|
4878
|
-
this.current =
|
|
4879
|
+
this.current = document2;
|
|
4879
4880
|
}
|
|
4880
4881
|
//Index of element
|
|
4881
4882
|
_indexOf(element) {
|
|
@@ -5292,8 +5293,8 @@ var defaultTreeAdapter = {
|
|
|
5292
5293
|
getTemplateContent(templateElement) {
|
|
5293
5294
|
return templateElement.content;
|
|
5294
5295
|
},
|
|
5295
|
-
setDocumentType(
|
|
5296
|
-
const doctypeNode =
|
|
5296
|
+
setDocumentType(document2, name, publicId, systemId) {
|
|
5297
|
+
const doctypeNode = document2.childNodes.find((node) => node.nodeName === "#documentType");
|
|
5297
5298
|
if (doctypeNode) {
|
|
5298
5299
|
doctypeNode.name = name;
|
|
5299
5300
|
doctypeNode.publicId = publicId;
|
|
@@ -5306,14 +5307,14 @@ var defaultTreeAdapter = {
|
|
|
5306
5307
|
systemId,
|
|
5307
5308
|
parentNode: null
|
|
5308
5309
|
};
|
|
5309
|
-
defaultTreeAdapter.appendChild(
|
|
5310
|
+
defaultTreeAdapter.appendChild(document2, node);
|
|
5310
5311
|
}
|
|
5311
5312
|
},
|
|
5312
|
-
setDocumentMode(
|
|
5313
|
-
|
|
5313
|
+
setDocumentMode(document2, mode) {
|
|
5314
|
+
document2.mode = mode;
|
|
5314
5315
|
},
|
|
5315
|
-
getDocumentMode(
|
|
5316
|
-
return
|
|
5316
|
+
getDocumentMode(document2) {
|
|
5317
|
+
return document2.mode;
|
|
5317
5318
|
},
|
|
5318
5319
|
detachNode(node) {
|
|
5319
5320
|
if (node.parentNode) {
|
|
@@ -5794,7 +5795,7 @@ var defaultParserOptions = {
|
|
|
5794
5795
|
onParseError: null
|
|
5795
5796
|
};
|
|
5796
5797
|
var Parser = class {
|
|
5797
|
-
constructor(options,
|
|
5798
|
+
constructor(options, document2, fragmentContext = null, scriptHandler = null) {
|
|
5798
5799
|
this.fragmentContext = fragmentContext;
|
|
5799
5800
|
this.scriptHandler = scriptHandler;
|
|
5800
5801
|
this.currentToken = null;
|
|
@@ -5819,7 +5820,7 @@ var Parser = class {
|
|
|
5819
5820
|
if (this.onParseError) {
|
|
5820
5821
|
this.options.sourceCodeLocationInfo = true;
|
|
5821
5822
|
}
|
|
5822
|
-
this.document =
|
|
5823
|
+
this.document = document2 !== null && document2 !== void 0 ? document2 : this.treeAdapter.createDocument();
|
|
5823
5824
|
this.tokenizer = new Tokenizer(this.options, this);
|
|
5824
5825
|
this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
|
|
5825
5826
|
this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
|
|
@@ -8796,11 +8797,11 @@ function parseFragment(fragmentContext, html, options) {
|
|
|
8796
8797
|
// src/mock-doc/parse-util.ts
|
|
8797
8798
|
var docParser = /* @__PURE__ */ new WeakMap();
|
|
8798
8799
|
function parseDocumentUtil(ownerDocument, html) {
|
|
8799
|
-
const
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
return
|
|
8800
|
+
const doc2 = parse(html.trim(), getParser(ownerDocument));
|
|
8801
|
+
doc2.documentElement = doc2.firstElementChild;
|
|
8802
|
+
doc2.head = doc2.documentElement.firstElementChild;
|
|
8803
|
+
doc2.body = doc2.head.nextElementSibling;
|
|
8804
|
+
return doc2;
|
|
8804
8805
|
}
|
|
8805
8806
|
function parseFragmentUtil(ownerDocument, html) {
|
|
8806
8807
|
if (typeof html === "string") {
|
|
@@ -8818,9 +8819,9 @@ function getParser(ownerDocument) {
|
|
|
8818
8819
|
}
|
|
8819
8820
|
const treeAdapter = {
|
|
8820
8821
|
createDocument() {
|
|
8821
|
-
const
|
|
8822
|
-
|
|
8823
|
-
return
|
|
8822
|
+
const doc2 = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
|
|
8823
|
+
doc2["x-mode"] = "no-quirks";
|
|
8824
|
+
return doc2;
|
|
8824
8825
|
},
|
|
8825
8826
|
setNodeSourceCodeLocation(node, location2) {
|
|
8826
8827
|
node.sourceCodeLocation = location2;
|
|
@@ -8858,22 +8859,22 @@ function getParser(ownerDocument) {
|
|
|
8858
8859
|
getTemplateContent(templateElement) {
|
|
8859
8860
|
return templateElement.content;
|
|
8860
8861
|
},
|
|
8861
|
-
setDocumentType(
|
|
8862
|
-
let doctypeNode =
|
|
8862
|
+
setDocumentType(doc2, name, publicId, systemId) {
|
|
8863
|
+
let doctypeNode = doc2.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
|
|
8863
8864
|
if (doctypeNode == null) {
|
|
8864
8865
|
doctypeNode = ownerDocument.createDocumentTypeNode();
|
|
8865
|
-
|
|
8866
|
+
doc2.insertBefore(doctypeNode, doc2.firstChild);
|
|
8866
8867
|
}
|
|
8867
8868
|
doctypeNode.nodeValue = "!DOCTYPE";
|
|
8868
8869
|
doctypeNode["x-name"] = name;
|
|
8869
8870
|
doctypeNode["x-publicId"] = publicId;
|
|
8870
8871
|
doctypeNode["x-systemId"] = systemId;
|
|
8871
8872
|
},
|
|
8872
|
-
setDocumentMode(
|
|
8873
|
-
|
|
8873
|
+
setDocumentMode(doc2, mode) {
|
|
8874
|
+
doc2["x-mode"] = mode;
|
|
8874
8875
|
},
|
|
8875
|
-
getDocumentMode(
|
|
8876
|
-
return
|
|
8876
|
+
getDocumentMode(doc2) {
|
|
8877
|
+
return doc2["x-mode"];
|
|
8877
8878
|
},
|
|
8878
8879
|
detachNode(node) {
|
|
8879
8880
|
node.remove();
|
|
@@ -9005,9 +9006,9 @@ var jquery_default = (
|
|
|
9005
9006
|
nodeName: "HTML"
|
|
9006
9007
|
}
|
|
9007
9008
|
}
|
|
9008
|
-
}, function(
|
|
9009
|
+
}, function(window2, noGlobal) {
|
|
9009
9010
|
"use strict";
|
|
9010
|
-
if (!
|
|
9011
|
+
if (!window2.document) {
|
|
9011
9012
|
throw new Error("jQuery requires a window with a document");
|
|
9012
9013
|
}
|
|
9013
9014
|
var arr = [];
|
|
@@ -9042,16 +9043,16 @@ var jquery_default = (
|
|
|
9042
9043
|
}
|
|
9043
9044
|
return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
|
|
9044
9045
|
}
|
|
9045
|
-
var
|
|
9046
|
+
var document2 = window2.document;
|
|
9046
9047
|
var preservedScriptAttributes = {
|
|
9047
9048
|
type: true,
|
|
9048
9049
|
src: true,
|
|
9049
9050
|
nonce: true,
|
|
9050
9051
|
noModule: true
|
|
9051
9052
|
};
|
|
9052
|
-
function DOMEval(code, node,
|
|
9053
|
-
|
|
9054
|
-
var i2, script =
|
|
9053
|
+
function DOMEval(code, node, doc2) {
|
|
9054
|
+
doc2 = doc2 || document2;
|
|
9055
|
+
var i2, script = doc2.createElement("script");
|
|
9055
9056
|
script.text = code;
|
|
9056
9057
|
if (node) {
|
|
9057
9058
|
for (i2 in preservedScriptAttributes) {
|
|
@@ -9060,7 +9061,7 @@ var jquery_default = (
|
|
|
9060
9061
|
}
|
|
9061
9062
|
}
|
|
9062
9063
|
}
|
|
9063
|
-
|
|
9064
|
+
doc2.head.appendChild(script).parentNode.removeChild(script);
|
|
9064
9065
|
}
|
|
9065
9066
|
const jQuery = {};
|
|
9066
9067
|
var version = "4.0.0-pre+9352011a7.dirty +selector", rhtmlSuffix = /HTML$/i, jQueryOrig = function(selector, context) {
|
|
@@ -9197,8 +9198,8 @@ var jquery_default = (
|
|
|
9197
9198
|
},
|
|
9198
9199
|
// Evaluates a script in a provided context; falls back to the global one
|
|
9199
9200
|
// if not specified.
|
|
9200
|
-
globalEval: function(code, options,
|
|
9201
|
-
DOMEval(code, { nonce: options && options.nonce },
|
|
9201
|
+
globalEval: function(code, options, doc2) {
|
|
9202
|
+
DOMEval(code, { nonce: options && options.nonce }, doc2);
|
|
9202
9203
|
},
|
|
9203
9204
|
each: function(obj, callback) {
|
|
9204
9205
|
var length, i2 = 0;
|
|
@@ -9325,9 +9326,9 @@ var jquery_default = (
|
|
|
9325
9326
|
}
|
|
9326
9327
|
var pop = arr.pop;
|
|
9327
9328
|
var whitespace = "[\\x20\\t\\r\\n\\f]";
|
|
9328
|
-
var isIE =
|
|
9329
|
+
var isIE = document2.documentMode;
|
|
9329
9330
|
try {
|
|
9330
|
-
|
|
9331
|
+
document2.querySelector(":has(*,:jqfake)");
|
|
9331
9332
|
support.cssHas = false;
|
|
9332
9333
|
} catch (e) {
|
|
9333
9334
|
support.cssHas = true;
|
|
@@ -9359,7 +9360,7 @@ var jquery_default = (
|
|
|
9359
9360
|
var rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*");
|
|
9360
9361
|
var rdescend = new RegExp(whitespace + "|>");
|
|
9361
9362
|
var rsibling = /[+~]/;
|
|
9362
|
-
var documentElement =
|
|
9363
|
+
var documentElement = document2.documentElement;
|
|
9363
9364
|
var matches2 = documentElement.matches || documentElement.msMatchesSelector;
|
|
9364
9365
|
function createCache() {
|
|
9365
9366
|
var keys = [];
|
|
@@ -9528,10 +9529,10 @@ var jquery_default = (
|
|
|
9528
9529
|
1
|
|
9529
9530
|
);
|
|
9530
9531
|
if (compare & 1) {
|
|
9531
|
-
if (a ==
|
|
9532
|
+
if (a == document2 || a.ownerDocument == document2 && jQuery.contains(document2, a)) {
|
|
9532
9533
|
return -1;
|
|
9533
9534
|
}
|
|
9534
|
-
if (b ==
|
|
9535
|
+
if (b == document2 || b.ownerDocument == document2 && jQuery.contains(document2, b)) {
|
|
9535
9536
|
return 1;
|
|
9536
9537
|
}
|
|
9537
9538
|
return 0;
|
|
@@ -9687,14 +9688,14 @@ var jquery_default = (
|
|
|
9687
9688
|
});
|
|
9688
9689
|
}
|
|
9689
9690
|
function setDocument(node) {
|
|
9690
|
-
var subWindow,
|
|
9691
|
-
if (
|
|
9691
|
+
var subWindow, doc2 = node ? node.ownerDocument || node : document2;
|
|
9692
|
+
if (doc2 == document$1 || doc2.nodeType !== 9) {
|
|
9692
9693
|
return;
|
|
9693
9694
|
}
|
|
9694
|
-
document$1 =
|
|
9695
|
+
document$1 = doc2;
|
|
9695
9696
|
documentElement$1 = document$1.documentElement;
|
|
9696
9697
|
documentIsHTML = !jQuery.isXMLDoc(document$1);
|
|
9697
|
-
if (isIE &&
|
|
9698
|
+
if (isIE && document2 != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
|
|
9698
9699
|
subWindow.addEventListener("unload", unloadHandler);
|
|
9699
9700
|
}
|
|
9700
9701
|
}
|
|
@@ -9925,7 +9926,7 @@ var jquery_default = (
|
|
|
9925
9926
|
}),
|
|
9926
9927
|
// Miscellaneous
|
|
9927
9928
|
target: function(elem) {
|
|
9928
|
-
var hash =
|
|
9929
|
+
var hash = window2.location && window2.location.hash;
|
|
9929
9930
|
return hash && hash.slice(1) === elem.id;
|
|
9930
9931
|
},
|
|
9931
9932
|
root: function(elem) {
|
|
@@ -10565,6 +10566,13 @@ style="${cssText}">`;
|
|
|
10565
10566
|
output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
|
|
10566
10567
|
}
|
|
10567
10568
|
for (let i = 0; i < childNodeLength; i++) {
|
|
10569
|
+
const sId = node.attributes.getNamedItem(HYDRATE_ID);
|
|
10570
|
+
const isRindoDeclarativeShadowDOM = childNodes[i].nodeName.toLowerCase() === "template" && sId;
|
|
10571
|
+
if (isRindoDeclarativeShadowDOM) {
|
|
10572
|
+
yield `
|
|
10573
|
+
${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
|
|
10574
|
+
continue;
|
|
10575
|
+
}
|
|
10568
10576
|
yield* streamToHtml(childNodes[i], opts, output);
|
|
10569
10577
|
}
|
|
10570
10578
|
if (ignoreTag === false) {
|
|
@@ -11915,9 +11923,9 @@ function createElement(ownerDocument, tagName) {
|
|
|
11915
11923
|
return new MockUListElement(ownerDocument);
|
|
11916
11924
|
}
|
|
11917
11925
|
if (ownerDocument != null && tagName.includes("-")) {
|
|
11918
|
-
const
|
|
11919
|
-
if (
|
|
11920
|
-
return createCustomElement(
|
|
11926
|
+
const win2 = ownerDocument.defaultView;
|
|
11927
|
+
if (win2 != null && win2.customElements != null) {
|
|
11928
|
+
return createCustomElement(win2.customElements, ownerDocument, tagName);
|
|
11921
11929
|
}
|
|
11922
11930
|
}
|
|
11923
11931
|
return new MockHTMLElement(ownerDocument, tagName);
|
|
@@ -11980,6 +11988,11 @@ patchPropAttributes(
|
|
|
11980
11988
|
type: "submit"
|
|
11981
11989
|
}
|
|
11982
11990
|
);
|
|
11991
|
+
Object.defineProperty(MockButtonElement.prototype, "form", {
|
|
11992
|
+
get() {
|
|
11993
|
+
return this.hasAttribute("form") ? this.getAttribute("form") : null;
|
|
11994
|
+
}
|
|
11995
|
+
});
|
|
11983
11996
|
var MockImageElement = class extends MockHTMLElement {
|
|
11984
11997
|
constructor(ownerDocument) {
|
|
11985
11998
|
super(ownerDocument, "img");
|
|
@@ -12334,9 +12347,9 @@ var CanvasRenderingContext = class {
|
|
|
12334
12347
|
}
|
|
12335
12348
|
clearRect() {
|
|
12336
12349
|
}
|
|
12337
|
-
getImageData(_, __, w,
|
|
12350
|
+
getImageData(_, __, w, h2) {
|
|
12338
12351
|
return {
|
|
12339
|
-
data: new Array(w *
|
|
12352
|
+
data: new Array(w * h2 * 4)
|
|
12340
12353
|
};
|
|
12341
12354
|
}
|
|
12342
12355
|
toDataURL() {
|
|
@@ -12398,9 +12411,9 @@ var MockCanvasElement = class extends MockHTMLElement {
|
|
|
12398
12411
|
function fullUrl(elm, attrName) {
|
|
12399
12412
|
const val = elm.getAttribute(attrName) || "";
|
|
12400
12413
|
if (elm.ownerDocument != null) {
|
|
12401
|
-
const
|
|
12402
|
-
if (
|
|
12403
|
-
const loc =
|
|
12414
|
+
const win2 = elm.ownerDocument.defaultView;
|
|
12415
|
+
if (win2 != null) {
|
|
12416
|
+
const loc = win2.location;
|
|
12404
12417
|
if (loc != null) {
|
|
12405
12418
|
try {
|
|
12406
12419
|
const url = new URL(val, loc.href);
|
|
@@ -13005,6 +13018,21 @@ function resetPerformance(perf) {
|
|
|
13005
13018
|
}
|
|
13006
13019
|
}
|
|
13007
13020
|
|
|
13021
|
+
// src/mock-doc/resize-observer.ts
|
|
13022
|
+
var MockResizeObserver = class {
|
|
13023
|
+
constructor() {
|
|
13024
|
+
}
|
|
13025
|
+
disconnect() {
|
|
13026
|
+
}
|
|
13027
|
+
observe() {
|
|
13028
|
+
}
|
|
13029
|
+
takeRecords() {
|
|
13030
|
+
return [];
|
|
13031
|
+
}
|
|
13032
|
+
unobserve() {
|
|
13033
|
+
}
|
|
13034
|
+
};
|
|
13035
|
+
|
|
13008
13036
|
// src/mock-doc/storage.ts
|
|
13009
13037
|
var MockStorage = class {
|
|
13010
13038
|
constructor() {
|
|
@@ -13105,10 +13133,10 @@ var MockWindow = class {
|
|
|
13105
13133
|
}
|
|
13106
13134
|
get Document() {
|
|
13107
13135
|
if (this.__docCstr == null) {
|
|
13108
|
-
const
|
|
13136
|
+
const win2 = this;
|
|
13109
13137
|
this.__docCstr = class extends MockDocument {
|
|
13110
13138
|
constructor() {
|
|
13111
|
-
super(false,
|
|
13139
|
+
super(false, win2);
|
|
13112
13140
|
throw new Error("Illegal constructor: cannot construct Document");
|
|
13113
13141
|
}
|
|
13114
13142
|
};
|
|
@@ -13244,6 +13272,9 @@ var MockWindow = class {
|
|
|
13244
13272
|
get IntersectionObserver() {
|
|
13245
13273
|
return MockIntersectionObserver;
|
|
13246
13274
|
}
|
|
13275
|
+
get ResizeObserver() {
|
|
13276
|
+
return MockResizeObserver;
|
|
13277
|
+
}
|
|
13247
13278
|
get localStorage() {
|
|
13248
13279
|
if (this.__localStorage == null) {
|
|
13249
13280
|
this.__localStorage = new MockStorage();
|
|
@@ -13625,14 +13656,14 @@ var MockWindow = class {
|
|
|
13625
13656
|
}
|
|
13626
13657
|
};
|
|
13627
13658
|
addGlobalsToWindowPrototype(MockWindow.prototype);
|
|
13628
|
-
function resetWindowDefaults(
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13659
|
+
function resetWindowDefaults(win2) {
|
|
13660
|
+
win2.__clearInterval = nativeClearInterval;
|
|
13661
|
+
win2.__clearTimeout = nativeClearTimeout;
|
|
13662
|
+
win2.__setInterval = nativeSetInterval;
|
|
13663
|
+
win2.__setTimeout = nativeSetTimeout;
|
|
13664
|
+
win2.__maxTimeout = 3e4;
|
|
13665
|
+
win2.__allowInterval = true;
|
|
13666
|
+
win2.URL = nativeURL;
|
|
13636
13667
|
}
|
|
13637
13668
|
function cloneWindow(srcWin, opts = {}) {
|
|
13638
13669
|
if (srcWin == null) {
|
|
@@ -13651,72 +13682,72 @@ function cloneWindow(srcWin, opts = {}) {
|
|
|
13651
13682
|
}
|
|
13652
13683
|
return clonedWin;
|
|
13653
13684
|
}
|
|
13654
|
-
function constrainTimeouts(
|
|
13655
|
-
|
|
13656
|
-
|
|
13685
|
+
function constrainTimeouts(win2) {
|
|
13686
|
+
win2.__allowInterval = false;
|
|
13687
|
+
win2.__maxTimeout = 0;
|
|
13657
13688
|
}
|
|
13658
|
-
function resetWindow(
|
|
13659
|
-
if (
|
|
13660
|
-
if (
|
|
13661
|
-
|
|
13689
|
+
function resetWindow(win2) {
|
|
13690
|
+
if (win2 != null) {
|
|
13691
|
+
if (win2.__timeouts) {
|
|
13692
|
+
win2.__timeouts.forEach((timeoutId) => {
|
|
13662
13693
|
nativeClearInterval(timeoutId);
|
|
13663
13694
|
nativeClearTimeout(timeoutId);
|
|
13664
13695
|
});
|
|
13665
|
-
|
|
13696
|
+
win2.__timeouts.clear();
|
|
13666
13697
|
}
|
|
13667
|
-
if (
|
|
13668
|
-
|
|
13698
|
+
if (win2.customElements && win2.customElements.clear) {
|
|
13699
|
+
win2.customElements.clear();
|
|
13669
13700
|
}
|
|
13670
|
-
resetDocument(
|
|
13671
|
-
resetPerformance(
|
|
13672
|
-
for (const key in
|
|
13673
|
-
if (
|
|
13674
|
-
delete
|
|
13701
|
+
resetDocument(win2.document);
|
|
13702
|
+
resetPerformance(win2.performance);
|
|
13703
|
+
for (const key in win2) {
|
|
13704
|
+
if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
|
|
13705
|
+
delete win2[key];
|
|
13675
13706
|
}
|
|
13676
13707
|
}
|
|
13677
|
-
resetWindowDefaults(
|
|
13678
|
-
resetWindowDimensions(
|
|
13679
|
-
resetEventListeners(
|
|
13680
|
-
if (
|
|
13708
|
+
resetWindowDefaults(win2);
|
|
13709
|
+
resetWindowDimensions(win2);
|
|
13710
|
+
resetEventListeners(win2);
|
|
13711
|
+
if (win2.document != null) {
|
|
13681
13712
|
try {
|
|
13682
|
-
|
|
13713
|
+
win2.document.defaultView = win2;
|
|
13683
13714
|
} catch (e) {
|
|
13684
13715
|
}
|
|
13685
13716
|
}
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13717
|
+
win2.fetch = null;
|
|
13718
|
+
win2.Headers = null;
|
|
13719
|
+
win2.Request = null;
|
|
13720
|
+
win2.Response = null;
|
|
13721
|
+
win2.FetchError = null;
|
|
13691
13722
|
}
|
|
13692
13723
|
}
|
|
13693
|
-
function resetWindowDimensions(
|
|
13724
|
+
function resetWindowDimensions(win2) {
|
|
13694
13725
|
try {
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
13707
|
-
availHeight:
|
|
13726
|
+
win2.devicePixelRatio = 1;
|
|
13727
|
+
win2.innerHeight = 768;
|
|
13728
|
+
win2.innerWidth = 1366;
|
|
13729
|
+
win2.pageXOffset = 0;
|
|
13730
|
+
win2.pageYOffset = 0;
|
|
13731
|
+
win2.screenLeft = 0;
|
|
13732
|
+
win2.screenTop = 0;
|
|
13733
|
+
win2.screenX = 0;
|
|
13734
|
+
win2.screenY = 0;
|
|
13735
|
+
win2.scrollX = 0;
|
|
13736
|
+
win2.scrollY = 0;
|
|
13737
|
+
win2.screen = {
|
|
13738
|
+
availHeight: win2.innerHeight,
|
|
13708
13739
|
availLeft: 0,
|
|
13709
13740
|
availTop: 0,
|
|
13710
|
-
availWidth:
|
|
13741
|
+
availWidth: win2.innerWidth,
|
|
13711
13742
|
colorDepth: 24,
|
|
13712
|
-
height:
|
|
13743
|
+
height: win2.innerHeight,
|
|
13713
13744
|
keepAwake: false,
|
|
13714
13745
|
orientation: {
|
|
13715
13746
|
angle: 0,
|
|
13716
13747
|
type: "portrait-primary"
|
|
13717
13748
|
},
|
|
13718
13749
|
pixelDepth: 24,
|
|
13719
|
-
width:
|
|
13750
|
+
width: win2.innerWidth
|
|
13720
13751
|
};
|
|
13721
13752
|
} catch (e) {
|
|
13722
13753
|
}
|
|
@@ -13724,11 +13755,11 @@ function resetWindowDimensions(win) {
|
|
|
13724
13755
|
|
|
13725
13756
|
// src/mock-doc/document.ts
|
|
13726
13757
|
var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
13727
|
-
constructor(html = null,
|
|
13758
|
+
constructor(html = null, win2 = null) {
|
|
13728
13759
|
super(null, null);
|
|
13729
13760
|
this.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
13730
13761
|
this.nodeType = 9 /* DOCUMENT_NODE */;
|
|
13731
|
-
this.defaultView =
|
|
13762
|
+
this.defaultView = win2;
|
|
13732
13763
|
this.cookie = "";
|
|
13733
13764
|
this.referrer = "";
|
|
13734
13765
|
this.appendChild(this.createDocumentTypeNode());
|
|
@@ -13875,10 +13906,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
|
13875
13906
|
}
|
|
13876
13907
|
createElement(tagName) {
|
|
13877
13908
|
if (tagName === "#document" /* DOCUMENT_NODE */) {
|
|
13878
|
-
const
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
return
|
|
13909
|
+
const doc2 = new _MockDocument(false);
|
|
13910
|
+
doc2.nodeName = tagName;
|
|
13911
|
+
doc2.parentNode = null;
|
|
13912
|
+
return doc2;
|
|
13882
13913
|
}
|
|
13883
13914
|
return createElement(this, tagName);
|
|
13884
13915
|
}
|
|
@@ -13918,10 +13949,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
|
13918
13949
|
title.textContent = value;
|
|
13919
13950
|
}
|
|
13920
13951
|
};
|
|
13921
|
-
function resetDocument(
|
|
13922
|
-
if (
|
|
13923
|
-
resetEventListeners(
|
|
13924
|
-
const documentElement =
|
|
13952
|
+
function resetDocument(doc2) {
|
|
13953
|
+
if (doc2 != null) {
|
|
13954
|
+
resetEventListeners(doc2);
|
|
13955
|
+
const documentElement = doc2.documentElement;
|
|
13925
13956
|
if (documentElement != null) {
|
|
13926
13957
|
resetElement(documentElement);
|
|
13927
13958
|
for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
|
|
@@ -13930,25 +13961,25 @@ function resetDocument(doc) {
|
|
|
13930
13961
|
childNode.childNodes.length = 0;
|
|
13931
13962
|
}
|
|
13932
13963
|
}
|
|
13933
|
-
for (const key in
|
|
13934
|
-
if (
|
|
13935
|
-
delete
|
|
13964
|
+
for (const key in doc2) {
|
|
13965
|
+
if (doc2.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
|
|
13966
|
+
delete doc2[key];
|
|
13936
13967
|
}
|
|
13937
13968
|
}
|
|
13938
13969
|
try {
|
|
13939
|
-
|
|
13970
|
+
doc2.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
13940
13971
|
} catch (e) {
|
|
13941
13972
|
}
|
|
13942
13973
|
try {
|
|
13943
|
-
|
|
13974
|
+
doc2.nodeType = 9 /* DOCUMENT_NODE */;
|
|
13944
13975
|
} catch (e) {
|
|
13945
13976
|
}
|
|
13946
13977
|
try {
|
|
13947
|
-
|
|
13978
|
+
doc2.cookie = "";
|
|
13948
13979
|
} catch (e) {
|
|
13949
13980
|
}
|
|
13950
13981
|
try {
|
|
13951
|
-
|
|
13982
|
+
doc2.referrer = "";
|
|
13952
13983
|
} catch (e) {
|
|
13953
13984
|
}
|
|
13954
13985
|
}
|
|
@@ -14004,14 +14035,65 @@ function createWindowFromHtml(templateHtml, uniqueId) {
|
|
|
14004
14035
|
templateWindow = new MockWindow(templateHtml);
|
|
14005
14036
|
templateWindows.set(uniqueId, templateWindow);
|
|
14006
14037
|
}
|
|
14007
|
-
const
|
|
14008
|
-
return
|
|
14038
|
+
const win2 = cloneWindow(templateWindow);
|
|
14039
|
+
return win2;
|
|
14009
14040
|
}
|
|
14010
14041
|
|
|
14011
14042
|
// src/hydrate/runner/render.ts
|
|
14012
14043
|
import { Readable } from "stream";
|
|
14013
14044
|
import { hydrateFactory } from "@rindo/core/hydrate-factory";
|
|
14014
14045
|
|
|
14046
|
+
// src/client/client-build.ts
|
|
14047
|
+
import { BUILD } from "@rindo/core/internal/app-data";
|
|
14048
|
+
var Build = {
|
|
14049
|
+
isDev: BUILD.isDev ? true : false,
|
|
14050
|
+
isBrowser: true,
|
|
14051
|
+
isServer: false,
|
|
14052
|
+
isTesting: BUILD.isTesting ? true : false
|
|
14053
|
+
};
|
|
14054
|
+
|
|
14055
|
+
// src/client/client-host-ref.ts
|
|
14056
|
+
import { BUILD as BUILD2 } from "@rindo/core/internal/app-data";
|
|
14057
|
+
var hostRefs = BUILD2.hotModuleReplacement ? window.__RINDO_HOSTREFS__ || (window.__RINDO_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
|
|
14058
|
+
|
|
14059
|
+
// src/client/client-load-module.ts
|
|
14060
|
+
import { BUILD as BUILD4 } from "@rindo/core/internal/app-data";
|
|
14061
|
+
|
|
14062
|
+
// src/client/client-log.ts
|
|
14063
|
+
import { BUILD as BUILD3 } from "@rindo/core/internal/app-data";
|
|
14064
|
+
var RINDO_DEV_MODE = BUILD3.isTesting ? ["RINDO:"] : [
|
|
14065
|
+
"%crindo",
|
|
14066
|
+
"color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
|
|
14067
|
+
];
|
|
14068
|
+
|
|
14069
|
+
// src/client/client-style.ts
|
|
14070
|
+
var modeResolutionChain = [];
|
|
14071
|
+
|
|
14072
|
+
// src/client/client-task-queue.ts
|
|
14073
|
+
import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
|
|
14074
|
+
|
|
14075
|
+
// src/client/client-window.ts
|
|
14076
|
+
import { BUILD as BUILD5 } from "@rindo/core/internal/app-data";
|
|
14077
|
+
var win = typeof window !== "undefined" ? window : {};
|
|
14078
|
+
var doc = win.document || { head: {} };
|
|
14079
|
+
var H = win.HTMLElement || class {
|
|
14080
|
+
};
|
|
14081
|
+
var supportsShadow = BUILD5.shadowDom;
|
|
14082
|
+
var supportsConstructableStylesheets = BUILD5.constructableCSS ? /* @__PURE__ */ (() => {
|
|
14083
|
+
try {
|
|
14084
|
+
new CSSStyleSheet();
|
|
14085
|
+
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
14086
|
+
} catch (e) {
|
|
14087
|
+
}
|
|
14088
|
+
return false;
|
|
14089
|
+
})() : false;
|
|
14090
|
+
|
|
14091
|
+
// src/client/index.ts
|
|
14092
|
+
import { BUILD as BUILD27, Env, NAMESPACE as NAMESPACE2 } from "@rindo/core/internal/app-data";
|
|
14093
|
+
|
|
14094
|
+
// src/runtime/bootstrap-custom-element.ts
|
|
14095
|
+
import { BUILD as BUILD24 } from "@rindo/core/internal/app-data";
|
|
14096
|
+
|
|
14015
14097
|
// src/utils/helpers.ts
|
|
14016
14098
|
var isString = (v) => typeof v === "string";
|
|
14017
14099
|
|
|
@@ -14102,15 +14184,77 @@ var unwrapErr = (result) => {
|
|
|
14102
14184
|
}
|
|
14103
14185
|
};
|
|
14104
14186
|
|
|
14187
|
+
// src/runtime/connected-callback.ts
|
|
14188
|
+
import { BUILD as BUILD21 } from "@rindo/core/internal/app-data";
|
|
14189
|
+
|
|
14190
|
+
// src/runtime/client-hydrate.ts
|
|
14191
|
+
import { BUILD as BUILD9 } from "@rindo/core/internal/app-data";
|
|
14192
|
+
|
|
14193
|
+
// src/runtime/profile.ts
|
|
14194
|
+
import { BUILD as BUILD7 } from "@rindo/core/internal/app-data";
|
|
14195
|
+
|
|
14196
|
+
// src/runtime/vdom/h.ts
|
|
14197
|
+
import { BUILD as BUILD8 } from "@rindo/core/internal/app-data";
|
|
14198
|
+
|
|
14199
|
+
// src/runtime/initialize-component.ts
|
|
14200
|
+
import { BUILD as BUILD20 } from "@rindo/core/internal/app-data";
|
|
14201
|
+
|
|
14202
|
+
// src/runtime/mode.ts
|
|
14203
|
+
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
14204
|
+
|
|
14205
|
+
// src/runtime/proxy-component.ts
|
|
14206
|
+
import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
|
|
14207
|
+
|
|
14208
|
+
// src/runtime/set-value.ts
|
|
14209
|
+
import { BUILD as BUILD18 } from "@rindo/core/internal/app-data";
|
|
14210
|
+
|
|
14211
|
+
// src/runtime/parse-property-value.ts
|
|
14212
|
+
import { BUILD as BUILD10 } from "@rindo/core/internal/app-data";
|
|
14213
|
+
|
|
14214
|
+
// src/runtime/update-component.ts
|
|
14215
|
+
import { BUILD as BUILD17, NAMESPACE } from "@rindo/core/internal/app-data";
|
|
14216
|
+
|
|
14217
|
+
// src/runtime/event-emitter.ts
|
|
14218
|
+
import { BUILD as BUILD12 } from "@rindo/core/internal/app-data";
|
|
14219
|
+
|
|
14220
|
+
// src/runtime/element.ts
|
|
14221
|
+
import { BUILD as BUILD11 } from "@rindo/core/internal/app-data";
|
|
14222
|
+
|
|
14223
|
+
// src/runtime/styles.ts
|
|
14224
|
+
import { BUILD as BUILD13 } from "@rindo/core/internal/app-data";
|
|
14225
|
+
|
|
14226
|
+
// src/runtime/vdom/vdom-render.ts
|
|
14227
|
+
import { BUILD as BUILD16 } from "@rindo/core/internal/app-data";
|
|
14228
|
+
|
|
14229
|
+
// src/runtime/vdom/update-element.ts
|
|
14230
|
+
import { BUILD as BUILD15 } from "@rindo/core/internal/app-data";
|
|
14231
|
+
|
|
14232
|
+
// src/runtime/vdom/set-accessor.ts
|
|
14233
|
+
import { BUILD as BUILD14 } from "@rindo/core/internal/app-data";
|
|
14234
|
+
var CAPTURE_EVENT_SUFFIX = "Capture";
|
|
14235
|
+
var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
|
|
14236
|
+
|
|
14237
|
+
// src/runtime/disconnected-callback.ts
|
|
14238
|
+
import { BUILD as BUILD22 } from "@rindo/core/internal/app-data";
|
|
14239
|
+
|
|
14240
|
+
// src/runtime/dom-extras.ts
|
|
14241
|
+
import { BUILD as BUILD23 } from "@rindo/core/internal/app-data";
|
|
14242
|
+
|
|
14243
|
+
// src/runtime/bootstrap-lazy.ts
|
|
14244
|
+
import { BUILD as BUILD25 } from "@rindo/core/internal/app-data";
|
|
14245
|
+
|
|
14246
|
+
// src/runtime/host-listener.ts
|
|
14247
|
+
import { BUILD as BUILD26 } from "@rindo/core/internal/app-data";
|
|
14248
|
+
|
|
14105
14249
|
// src/compiler/html/canonical-link.ts
|
|
14106
|
-
var updateCanonicalLink = (
|
|
14250
|
+
var updateCanonicalLink = (doc2, href) => {
|
|
14107
14251
|
var _a2;
|
|
14108
|
-
let canonicalLinkElm =
|
|
14252
|
+
let canonicalLinkElm = doc2.head.querySelector('link[rel="canonical"]');
|
|
14109
14253
|
if (typeof href === "string") {
|
|
14110
14254
|
if (canonicalLinkElm == null) {
|
|
14111
|
-
canonicalLinkElm =
|
|
14255
|
+
canonicalLinkElm = doc2.createElement("link");
|
|
14112
14256
|
canonicalLinkElm.setAttribute("rel", "canonical");
|
|
14113
|
-
|
|
14257
|
+
doc2.head.appendChild(canonicalLinkElm);
|
|
14114
14258
|
}
|
|
14115
14259
|
canonicalLinkElm.setAttribute("href", href);
|
|
14116
14260
|
} else {
|
|
@@ -14124,11 +14268,11 @@ var updateCanonicalLink = (doc, href) => {
|
|
|
14124
14268
|
};
|
|
14125
14269
|
|
|
14126
14270
|
// src/compiler/html/relocate-meta-charset.ts
|
|
14127
|
-
var relocateMetaCharset = (
|
|
14128
|
-
const head =
|
|
14271
|
+
var relocateMetaCharset = (doc2) => {
|
|
14272
|
+
const head = doc2.head;
|
|
14129
14273
|
let charsetElm = head.querySelector("meta[charset]");
|
|
14130
14274
|
if (charsetElm == null) {
|
|
14131
|
-
charsetElm =
|
|
14275
|
+
charsetElm = doc2.createElement("meta");
|
|
14132
14276
|
charsetElm.setAttribute("charset", "utf-8");
|
|
14133
14277
|
} else {
|
|
14134
14278
|
charsetElm.remove();
|
|
@@ -14403,13 +14547,13 @@ var parseCss = (css, filePath) => {
|
|
|
14403
14547
|
const m = match(/^@([-\w]+)?document *([^{]+)/);
|
|
14404
14548
|
if (!m) return null;
|
|
14405
14549
|
const vendor = trim(m[1]);
|
|
14406
|
-
const
|
|
14550
|
+
const doc2 = trim(m[2]);
|
|
14407
14551
|
if (!open()) return error(`@document missing '{'`);
|
|
14408
14552
|
const style = comments().concat(rules());
|
|
14409
14553
|
if (!close()) return error(`@document missing '}'`);
|
|
14410
14554
|
return pos({
|
|
14411
14555
|
type: 3 /* Document */,
|
|
14412
|
-
document:
|
|
14556
|
+
document: doc2,
|
|
14413
14557
|
vendor,
|
|
14414
14558
|
rules: style
|
|
14415
14559
|
});
|
|
@@ -14735,11 +14879,11 @@ var serializeCssPage = (opts, node) => {
|
|
|
14735
14879
|
};
|
|
14736
14880
|
var serializeCssDocument = (opts, node) => {
|
|
14737
14881
|
const documentCss = serializeCssMapVisit(opts, node.rules);
|
|
14738
|
-
const
|
|
14882
|
+
const doc2 = "@" + (node.vendor || "") + "document " + node.document;
|
|
14739
14883
|
if (documentCss === "") {
|
|
14740
14884
|
return "";
|
|
14741
14885
|
}
|
|
14742
|
-
return
|
|
14886
|
+
return doc2 + "{" + documentCss + "}";
|
|
14743
14887
|
};
|
|
14744
14888
|
var serializeCssMapVisit = (opts, nodes) => {
|
|
14745
14889
|
let rtn = "";
|
|
@@ -14837,12 +14981,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
|
|
|
14837
14981
|
};
|
|
14838
14982
|
|
|
14839
14983
|
// src/compiler/html/remove-unused-styles.ts
|
|
14840
|
-
var removeUnusedStyles = (
|
|
14984
|
+
var removeUnusedStyles = (doc2, diagnostics) => {
|
|
14841
14985
|
try {
|
|
14842
|
-
const styleElms =
|
|
14986
|
+
const styleElms = doc2.head.querySelectorAll(`style[data-styles]`);
|
|
14843
14987
|
const styleLen = styleElms.length;
|
|
14844
14988
|
if (styleLen > 0) {
|
|
14845
|
-
const usedSelectors = getUsedSelectors(
|
|
14989
|
+
const usedSelectors = getUsedSelectors(doc2.documentElement);
|
|
14846
14990
|
for (let i = 0; i < styleLen; i++) {
|
|
14847
14991
|
removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
|
|
14848
14992
|
}
|
|
@@ -14975,49 +15119,49 @@ function collectAttributes(node) {
|
|
|
14975
15119
|
var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
|
|
14976
15120
|
|
|
14977
15121
|
// src/hydrate/runner/patch-dom-implementation.ts
|
|
14978
|
-
function patchDomImplementation(
|
|
14979
|
-
let
|
|
14980
|
-
if (
|
|
15122
|
+
function patchDomImplementation(doc2, opts) {
|
|
15123
|
+
let win2;
|
|
15124
|
+
if (doc2.defaultView != null) {
|
|
14981
15125
|
opts.destroyWindow = true;
|
|
14982
|
-
patchWindow(
|
|
14983
|
-
|
|
15126
|
+
patchWindow(doc2.defaultView);
|
|
15127
|
+
win2 = doc2.defaultView;
|
|
14984
15128
|
} else {
|
|
14985
15129
|
opts.destroyWindow = true;
|
|
14986
15130
|
opts.destroyDocument = false;
|
|
14987
|
-
|
|
15131
|
+
win2 = new MockWindow(false);
|
|
14988
15132
|
}
|
|
14989
|
-
if (
|
|
14990
|
-
|
|
15133
|
+
if (win2.document !== doc2) {
|
|
15134
|
+
win2.document = doc2;
|
|
14991
15135
|
}
|
|
14992
|
-
if (
|
|
14993
|
-
|
|
15136
|
+
if (doc2.defaultView !== win2) {
|
|
15137
|
+
doc2.defaultView = win2;
|
|
14994
15138
|
}
|
|
14995
|
-
const
|
|
14996
|
-
if (typeof
|
|
14997
|
-
const elm =
|
|
15139
|
+
const HTMLElement2 = doc2.documentElement.constructor.prototype;
|
|
15140
|
+
if (typeof HTMLElement2.getRootNode !== "function") {
|
|
15141
|
+
const elm = doc2.createElement("unknown-element");
|
|
14998
15142
|
const HTMLUnknownElement = elm.constructor.prototype;
|
|
14999
15143
|
HTMLUnknownElement.getRootNode = getRootNode;
|
|
15000
15144
|
}
|
|
15001
|
-
if (typeof
|
|
15002
|
-
const
|
|
15003
|
-
if (
|
|
15004
|
-
|
|
15145
|
+
if (typeof doc2.createEvent === "function") {
|
|
15146
|
+
const CustomEvent2 = doc2.createEvent("CustomEvent").constructor;
|
|
15147
|
+
if (win2.CustomEvent !== CustomEvent2) {
|
|
15148
|
+
win2.CustomEvent = CustomEvent2;
|
|
15005
15149
|
}
|
|
15006
15150
|
}
|
|
15007
15151
|
try {
|
|
15008
|
-
|
|
15152
|
+
win2.__rindo_baseURI = doc2.baseURI;
|
|
15009
15153
|
} catch (e) {
|
|
15010
|
-
Object.defineProperty(
|
|
15154
|
+
Object.defineProperty(doc2, "baseURI", {
|
|
15011
15155
|
get() {
|
|
15012
|
-
const baseElm =
|
|
15156
|
+
const baseElm = doc2.querySelector("base[href]");
|
|
15013
15157
|
if (baseElm) {
|
|
15014
|
-
return new URL(baseElm.getAttribute("href"),
|
|
15158
|
+
return new URL(baseElm.getAttribute("href"), win2.location.href).href;
|
|
15015
15159
|
}
|
|
15016
|
-
return
|
|
15160
|
+
return win2.location.href;
|
|
15017
15161
|
}
|
|
15018
15162
|
});
|
|
15019
15163
|
}
|
|
15020
|
-
return
|
|
15164
|
+
return win2;
|
|
15021
15165
|
}
|
|
15022
15166
|
function getRootNode(opts) {
|
|
15023
15167
|
const isComposed = opts != null && opts.composed === true;
|
|
@@ -15170,10 +15314,10 @@ function renderCatchError(results, err2) {
|
|
|
15170
15314
|
}
|
|
15171
15315
|
|
|
15172
15316
|
// src/hydrate/runner/runtime-log.ts
|
|
15173
|
-
function runtimeLogging(
|
|
15317
|
+
function runtimeLogging(win2, opts, results) {
|
|
15174
15318
|
try {
|
|
15175
|
-
const pathname =
|
|
15176
|
-
|
|
15319
|
+
const pathname = win2.location.pathname;
|
|
15320
|
+
win2.console.error = (...msgs) => {
|
|
15177
15321
|
const errMsg = msgs.reduce((errMsg2, m) => {
|
|
15178
15322
|
if (m) {
|
|
15179
15323
|
if (m.stack != null) {
|
|
@@ -15193,7 +15337,7 @@ function runtimeLogging(win, opts, results) {
|
|
|
15193
15337
|
}
|
|
15194
15338
|
}
|
|
15195
15339
|
};
|
|
15196
|
-
|
|
15340
|
+
win2.console.debug = (...msgs) => {
|
|
15197
15341
|
renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
|
|
15198
15342
|
if (opts.runtimeLogging) {
|
|
15199
15343
|
runtimeLog(pathname, "debug", msgs);
|
|
@@ -15201,7 +15345,7 @@ function runtimeLogging(win, opts, results) {
|
|
|
15201
15345
|
};
|
|
15202
15346
|
if (opts.runtimeLogging) {
|
|
15203
15347
|
["log", "warn", "assert", "info", "trace"].forEach((type) => {
|
|
15204
|
-
|
|
15348
|
+
win2.console[type] = (...msgs) => {
|
|
15205
15349
|
runtimeLog(pathname, type, msgs);
|
|
15206
15350
|
};
|
|
15207
15351
|
});
|
|
@@ -15215,58 +15359,58 @@ function runtimeLog(pathname, type, msgs) {
|
|
|
15215
15359
|
}
|
|
15216
15360
|
|
|
15217
15361
|
// src/hydrate/runner/window-initialize.ts
|
|
15218
|
-
function initializeWindow(
|
|
15362
|
+
function initializeWindow(win2, doc2, opts, results) {
|
|
15219
15363
|
if (typeof opts.url === "string") {
|
|
15220
15364
|
try {
|
|
15221
|
-
|
|
15365
|
+
win2.location.href = opts.url;
|
|
15222
15366
|
} catch (e) {
|
|
15223
15367
|
}
|
|
15224
15368
|
}
|
|
15225
15369
|
if (typeof opts.userAgent === "string") {
|
|
15226
15370
|
try {
|
|
15227
|
-
|
|
15371
|
+
win2.navigator.userAgent = opts.userAgent;
|
|
15228
15372
|
} catch (e) {
|
|
15229
15373
|
}
|
|
15230
15374
|
}
|
|
15231
15375
|
if (typeof opts.cookie === "string") {
|
|
15232
15376
|
try {
|
|
15233
|
-
|
|
15377
|
+
doc2.cookie = opts.cookie;
|
|
15234
15378
|
} catch (e) {
|
|
15235
15379
|
}
|
|
15236
15380
|
}
|
|
15237
15381
|
if (typeof opts.referrer === "string") {
|
|
15238
15382
|
try {
|
|
15239
|
-
|
|
15383
|
+
doc2.referrer = opts.referrer;
|
|
15240
15384
|
} catch (e) {
|
|
15241
15385
|
}
|
|
15242
15386
|
}
|
|
15243
15387
|
if (typeof opts.direction === "string") {
|
|
15244
15388
|
try {
|
|
15245
|
-
|
|
15389
|
+
doc2.documentElement.setAttribute("dir", opts.direction);
|
|
15246
15390
|
} catch (e) {
|
|
15247
15391
|
}
|
|
15248
15392
|
}
|
|
15249
15393
|
if (typeof opts.language === "string") {
|
|
15250
15394
|
try {
|
|
15251
|
-
|
|
15395
|
+
doc2.documentElement.setAttribute("lang", opts.language);
|
|
15252
15396
|
} catch (e) {
|
|
15253
15397
|
}
|
|
15254
15398
|
}
|
|
15255
15399
|
if (typeof opts.buildId === "string") {
|
|
15256
15400
|
try {
|
|
15257
|
-
|
|
15401
|
+
doc2.documentElement.setAttribute("data-rindo-build", opts.buildId);
|
|
15258
15402
|
} catch (e) {
|
|
15259
15403
|
}
|
|
15260
15404
|
}
|
|
15261
15405
|
try {
|
|
15262
|
-
|
|
15406
|
+
win2.customElements = null;
|
|
15263
15407
|
} catch (e) {
|
|
15264
15408
|
}
|
|
15265
15409
|
if (opts.constrainTimeouts) {
|
|
15266
|
-
constrainTimeouts(
|
|
15410
|
+
constrainTimeouts(win2);
|
|
15267
15411
|
}
|
|
15268
|
-
runtimeLogging(
|
|
15269
|
-
return
|
|
15412
|
+
runtimeLogging(win2, opts, results);
|
|
15413
|
+
return win2;
|
|
15270
15414
|
}
|
|
15271
15415
|
|
|
15272
15416
|
// src/hydrate/runner/render.ts
|
|
@@ -15283,44 +15427,44 @@ function renderToString(html, options, asStream) {
|
|
|
15283
15427
|
opts.constrainTimeouts = false;
|
|
15284
15428
|
return hydrateDocument(html, opts, asStream);
|
|
15285
15429
|
}
|
|
15286
|
-
function hydrateDocument(
|
|
15430
|
+
function hydrateDocument(doc2, options, asStream) {
|
|
15287
15431
|
const opts = normalizeHydrateOptions(options);
|
|
15288
|
-
let
|
|
15432
|
+
let win2 = null;
|
|
15289
15433
|
const results = generateHydrateResults(opts);
|
|
15290
15434
|
if (hasError(results.diagnostics)) {
|
|
15291
15435
|
return Promise.resolve(results);
|
|
15292
15436
|
}
|
|
15293
|
-
if (typeof
|
|
15437
|
+
if (typeof doc2 === "string") {
|
|
15294
15438
|
try {
|
|
15295
15439
|
opts.destroyWindow = true;
|
|
15296
15440
|
opts.destroyDocument = true;
|
|
15297
|
-
|
|
15441
|
+
win2 = new MockWindow(doc2);
|
|
15298
15442
|
if (!asStream) {
|
|
15299
|
-
return render(
|
|
15443
|
+
return render(win2, opts, results).then(() => results);
|
|
15300
15444
|
}
|
|
15301
|
-
return renderStream(
|
|
15445
|
+
return renderStream(win2, opts, results);
|
|
15302
15446
|
} catch (e) {
|
|
15303
|
-
if (
|
|
15304
|
-
|
|
15447
|
+
if (win2 && win2.close) {
|
|
15448
|
+
win2.close();
|
|
15305
15449
|
}
|
|
15306
|
-
|
|
15450
|
+
win2 = null;
|
|
15307
15451
|
renderCatchError(results, e);
|
|
15308
15452
|
return Promise.resolve(results);
|
|
15309
15453
|
}
|
|
15310
15454
|
}
|
|
15311
|
-
if (isValidDocument(
|
|
15455
|
+
if (isValidDocument(doc2)) {
|
|
15312
15456
|
try {
|
|
15313
15457
|
opts.destroyDocument = false;
|
|
15314
|
-
|
|
15458
|
+
win2 = patchDomImplementation(doc2, opts);
|
|
15315
15459
|
if (!asStream) {
|
|
15316
|
-
return render(
|
|
15460
|
+
return render(win2, opts, results).then(() => results);
|
|
15317
15461
|
}
|
|
15318
|
-
return renderStream(
|
|
15462
|
+
return renderStream(win2, opts, results);
|
|
15319
15463
|
} catch (e) {
|
|
15320
|
-
if (
|
|
15321
|
-
|
|
15464
|
+
if (win2 && win2.close) {
|
|
15465
|
+
win2.close();
|
|
15322
15466
|
}
|
|
15323
|
-
|
|
15467
|
+
win2 = null;
|
|
15324
15468
|
renderCatchError(results, e);
|
|
15325
15469
|
return Promise.resolve(results);
|
|
15326
15470
|
}
|
|
@@ -15328,75 +15472,81 @@ function hydrateDocument(doc, options, asStream) {
|
|
|
15328
15472
|
renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
|
|
15329
15473
|
return Promise.resolve(results);
|
|
15330
15474
|
}
|
|
15331
|
-
async function render(
|
|
15475
|
+
async function render(win2, opts, results) {
|
|
15332
15476
|
if ("process" in globalThis && typeof process.on === "function" && !process.__rindoErrors) {
|
|
15333
15477
|
process.__rindoErrors = true;
|
|
15334
15478
|
process.on("unhandledRejection", (e) => {
|
|
15335
15479
|
console.log("unhandledRejection", e);
|
|
15336
15480
|
});
|
|
15337
15481
|
}
|
|
15338
|
-
initializeWindow(
|
|
15482
|
+
initializeWindow(win2, win2.document, opts, results);
|
|
15339
15483
|
const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
|
|
15340
15484
|
try {
|
|
15341
|
-
await Promise.resolve(beforeHydrateFn(
|
|
15342
|
-
return new Promise((resolve) =>
|
|
15485
|
+
await Promise.resolve(beforeHydrateFn(win2.document));
|
|
15486
|
+
return new Promise((resolve) => {
|
|
15487
|
+
if (Array.isArray(opts.modes)) {
|
|
15488
|
+
modeResolutionChain.length = 0;
|
|
15489
|
+
opts.modes.forEach((mode) => setMode(mode));
|
|
15490
|
+
}
|
|
15491
|
+
return hydrateFactory(win2, opts, results, afterHydrate, resolve);
|
|
15492
|
+
});
|
|
15343
15493
|
} catch (e) {
|
|
15344
15494
|
renderCatchError(results, e);
|
|
15345
|
-
return finalizeHydrate(
|
|
15495
|
+
return finalizeHydrate(win2, win2.document, opts, results);
|
|
15346
15496
|
}
|
|
15347
15497
|
}
|
|
15348
|
-
function renderStream(
|
|
15498
|
+
function renderStream(win2, opts, results) {
|
|
15349
15499
|
async function* processRender() {
|
|
15350
|
-
const renderResult = await render(
|
|
15500
|
+
const renderResult = await render(win2, opts, results);
|
|
15351
15501
|
yield renderResult.html;
|
|
15352
15502
|
}
|
|
15353
15503
|
return Readable.from(processRender());
|
|
15354
15504
|
}
|
|
15355
|
-
async function afterHydrate(
|
|
15505
|
+
async function afterHydrate(win2, opts, results, resolve) {
|
|
15356
15506
|
const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
|
|
15357
15507
|
try {
|
|
15358
|
-
await Promise.resolve(afterHydrateFn(
|
|
15359
|
-
return resolve(finalizeHydrate(
|
|
15508
|
+
await Promise.resolve(afterHydrateFn(win2.document));
|
|
15509
|
+
return resolve(finalizeHydrate(win2, win2.document, opts, results));
|
|
15360
15510
|
} catch (e) {
|
|
15361
15511
|
renderCatchError(results, e);
|
|
15362
|
-
return resolve(finalizeHydrate(
|
|
15512
|
+
return resolve(finalizeHydrate(win2, win2.document, opts, results));
|
|
15363
15513
|
}
|
|
15364
15514
|
}
|
|
15365
|
-
function finalizeHydrate(
|
|
15515
|
+
function finalizeHydrate(win2, doc2, opts, results) {
|
|
15366
15516
|
try {
|
|
15367
|
-
inspectElement(results,
|
|
15517
|
+
inspectElement(results, doc2.documentElement, 0);
|
|
15368
15518
|
if (opts.removeUnusedStyles !== false) {
|
|
15369
15519
|
try {
|
|
15370
|
-
removeUnusedStyles(
|
|
15520
|
+
removeUnusedStyles(doc2, results.diagnostics);
|
|
15371
15521
|
} catch (e) {
|
|
15372
15522
|
renderCatchError(results, e);
|
|
15373
15523
|
}
|
|
15374
15524
|
}
|
|
15375
15525
|
if (typeof opts.title === "string") {
|
|
15376
15526
|
try {
|
|
15377
|
-
|
|
15527
|
+
doc2.title = opts.title;
|
|
15378
15528
|
} catch (e) {
|
|
15379
15529
|
renderCatchError(results, e);
|
|
15380
15530
|
}
|
|
15381
15531
|
}
|
|
15382
|
-
results.title =
|
|
15532
|
+
results.title = doc2.title;
|
|
15383
15533
|
if (opts.removeScripts) {
|
|
15384
|
-
removeScripts(
|
|
15534
|
+
removeScripts(doc2.documentElement);
|
|
15385
15535
|
}
|
|
15386
15536
|
try {
|
|
15387
|
-
updateCanonicalLink(
|
|
15537
|
+
updateCanonicalLink(doc2, opts.canonicalUrl);
|
|
15388
15538
|
} catch (e) {
|
|
15389
15539
|
renderCatchError(results, e);
|
|
15390
15540
|
}
|
|
15391
15541
|
try {
|
|
15392
|
-
relocateMetaCharset(
|
|
15542
|
+
relocateMetaCharset(doc2);
|
|
15393
15543
|
} catch (e) {
|
|
15394
15544
|
}
|
|
15395
15545
|
if (!hasError(results.diagnostics)) {
|
|
15396
15546
|
results.httpStatus = 200;
|
|
15397
15547
|
}
|
|
15398
15548
|
try {
|
|
15399
|
-
const metaStatus =
|
|
15549
|
+
const metaStatus = doc2.head.querySelector('meta[http-equiv="status"]');
|
|
15400
15550
|
if (metaStatus != null) {
|
|
15401
15551
|
const metaStatusContent = metaStatus.getAttribute("content");
|
|
15402
15552
|
if (metaStatusContent && metaStatusContent.length > 0) {
|
|
@@ -15406,35 +15556,35 @@ function finalizeHydrate(win, doc, opts, results) {
|
|
|
15406
15556
|
} catch (e) {
|
|
15407
15557
|
}
|
|
15408
15558
|
if (opts.clientHydrateAnnotations) {
|
|
15409
|
-
|
|
15559
|
+
doc2.documentElement.classList.add("hydrated");
|
|
15410
15560
|
}
|
|
15411
15561
|
if (opts.serializeToHtml) {
|
|
15412
|
-
results.html = serializeDocumentToString(
|
|
15562
|
+
results.html = serializeDocumentToString(doc2, opts);
|
|
15413
15563
|
}
|
|
15414
15564
|
} catch (e) {
|
|
15415
15565
|
renderCatchError(results, e);
|
|
15416
15566
|
}
|
|
15417
|
-
destroyWindow(
|
|
15567
|
+
destroyWindow(win2, doc2, opts, results);
|
|
15418
15568
|
return results;
|
|
15419
15569
|
}
|
|
15420
|
-
function destroyWindow(
|
|
15570
|
+
function destroyWindow(win2, doc2, opts, results) {
|
|
15421
15571
|
if (!opts.destroyWindow) {
|
|
15422
15572
|
return;
|
|
15423
15573
|
}
|
|
15424
15574
|
try {
|
|
15425
15575
|
if (!opts.destroyDocument) {
|
|
15426
|
-
|
|
15427
|
-
|
|
15576
|
+
win2.document = null;
|
|
15577
|
+
doc2.defaultView = null;
|
|
15428
15578
|
}
|
|
15429
|
-
if (
|
|
15430
|
-
|
|
15579
|
+
if (win2.close) {
|
|
15580
|
+
win2.close();
|
|
15431
15581
|
}
|
|
15432
15582
|
} catch (e) {
|
|
15433
15583
|
renderCatchError(results, e);
|
|
15434
15584
|
}
|
|
15435
15585
|
}
|
|
15436
|
-
function serializeDocumentToString(
|
|
15437
|
-
return serializeNodeToHtml(
|
|
15586
|
+
function serializeDocumentToString(doc2, opts) {
|
|
15587
|
+
return serializeNodeToHtml(doc2, {
|
|
15438
15588
|
approximateLineWidth: opts.approximateLineWidth,
|
|
15439
15589
|
outerHtml: false,
|
|
15440
15590
|
prettyHtml: opts.prettyHtml,
|
|
@@ -15446,8 +15596,8 @@ function serializeDocumentToString(doc, opts) {
|
|
|
15446
15596
|
fullDocument: opts.fullDocument
|
|
15447
15597
|
});
|
|
15448
15598
|
}
|
|
15449
|
-
function isValidDocument(
|
|
15450
|
-
return
|
|
15599
|
+
function isValidDocument(doc2) {
|
|
15600
|
+
return doc2 != null && doc2.nodeType === 9 && doc2.documentElement != null && doc2.documentElement.nodeType === 1 && doc2.body != null && doc2.body.nodeType === 1;
|
|
15451
15601
|
}
|
|
15452
15602
|
function removeScripts(elm) {
|
|
15453
15603
|
const children = elm.children;
|