@stencil/core 4.21.0-dev.1724734910.f741f44 → 4.21.0-dev.1724797245.5ff5ee2
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/package.json +1 -1
- package/compiler/stencil.js +14 -4
- 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/package.json +1 -1
- package/internal/client/index.js +1 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +6 -0
- package/internal/hydrate/runner.js +358 -239
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +6 -0
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1 -1
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Runner v4.21.0-dev.
|
|
2
|
+
Stencil Hydrate Runner v4.21.0-dev.1724797245.5ff5ee2 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -320,8 +320,8 @@ function jsCaseToCssCase(str) {
|
|
|
320
320
|
|
|
321
321
|
// src/mock-doc/custom-element-registry.ts
|
|
322
322
|
var MockCustomElementRegistry = class {
|
|
323
|
-
constructor(
|
|
324
|
-
this.win =
|
|
323
|
+
constructor(win2) {
|
|
324
|
+
this.win = win2;
|
|
325
325
|
}
|
|
326
326
|
define(tagName, cstr, options) {
|
|
327
327
|
if (tagName.toLowerCase() !== tagName) {
|
|
@@ -343,19 +343,19 @@ var MockCustomElementRegistry = class {
|
|
|
343
343
|
this.__whenDefined.delete(tagName);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
const hosts =
|
|
346
|
+
const doc2 = this.win.document;
|
|
347
|
+
if (doc2 != null) {
|
|
348
|
+
const hosts = doc2.querySelectorAll(tagName);
|
|
349
349
|
hosts.forEach((host) => {
|
|
350
350
|
if (upgradedElements.has(host) === false) {
|
|
351
|
-
tempDisableCallbacks.add(
|
|
352
|
-
const upgradedCmp = createCustomElement(this,
|
|
351
|
+
tempDisableCallbacks.add(doc2);
|
|
352
|
+
const upgradedCmp = createCustomElement(this, doc2, tagName);
|
|
353
353
|
for (let i = 0; i < host.childNodes.length; i++) {
|
|
354
354
|
const childNode = host.childNodes[i];
|
|
355
355
|
childNode.remove();
|
|
356
356
|
upgradedCmp.appendChild(childNode);
|
|
357
357
|
}
|
|
358
|
-
tempDisableCallbacks.delete(
|
|
358
|
+
tempDisableCallbacks.delete(doc2);
|
|
359
359
|
if (proxyElements.has(host)) {
|
|
360
360
|
proxyElements.set(host, upgradedCmp);
|
|
361
361
|
}
|
|
@@ -409,8 +409,8 @@ var MockCustomElementRegistry = class {
|
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
411
|
};
|
|
412
|
-
function createCustomElement(
|
|
413
|
-
const Cstr =
|
|
412
|
+
function createCustomElement(customElements2, ownerDocument, tagName) {
|
|
413
|
+
const Cstr = customElements2.get(tagName);
|
|
414
414
|
if (Cstr != null) {
|
|
415
415
|
const cmp = new Cstr(ownerDocument);
|
|
416
416
|
cmp.nodeName = tagName.toUpperCase();
|
|
@@ -458,8 +458,8 @@ function connectNode(ownerDocument, node) {
|
|
|
458
458
|
node.ownerDocument = ownerDocument;
|
|
459
459
|
if (node.nodeType === 1 /* ELEMENT_NODE */) {
|
|
460
460
|
if (ownerDocument != null && node.nodeName.includes("-")) {
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
461
|
+
const win2 = ownerDocument.defaultView;
|
|
462
|
+
if (win2 != null && typeof node.connectedCallback === "function" && node.isConnected) {
|
|
463
463
|
fireConnectedCallback(node);
|
|
464
464
|
}
|
|
465
465
|
const shadowRoot = node.shadowRoot;
|
|
@@ -4867,7 +4867,7 @@ var OpenElementStack = class {
|
|
|
4867
4867
|
get currentTmplContentOrNode() {
|
|
4868
4868
|
return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
|
|
4869
4869
|
}
|
|
4870
|
-
constructor(
|
|
4870
|
+
constructor(document2, treeAdapter, handler) {
|
|
4871
4871
|
this.treeAdapter = treeAdapter;
|
|
4872
4872
|
this.handler = handler;
|
|
4873
4873
|
this.items = [];
|
|
@@ -4875,7 +4875,7 @@ var OpenElementStack = class {
|
|
|
4875
4875
|
this.stackTop = -1;
|
|
4876
4876
|
this.tmplCount = 0;
|
|
4877
4877
|
this.currentTagId = TAG_ID.UNKNOWN;
|
|
4878
|
-
this.current =
|
|
4878
|
+
this.current = document2;
|
|
4879
4879
|
}
|
|
4880
4880
|
//Index of element
|
|
4881
4881
|
_indexOf(element) {
|
|
@@ -5292,8 +5292,8 @@ var defaultTreeAdapter = {
|
|
|
5292
5292
|
getTemplateContent(templateElement) {
|
|
5293
5293
|
return templateElement.content;
|
|
5294
5294
|
},
|
|
5295
|
-
setDocumentType(
|
|
5296
|
-
const doctypeNode =
|
|
5295
|
+
setDocumentType(document2, name, publicId, systemId) {
|
|
5296
|
+
const doctypeNode = document2.childNodes.find((node) => node.nodeName === "#documentType");
|
|
5297
5297
|
if (doctypeNode) {
|
|
5298
5298
|
doctypeNode.name = name;
|
|
5299
5299
|
doctypeNode.publicId = publicId;
|
|
@@ -5306,14 +5306,14 @@ var defaultTreeAdapter = {
|
|
|
5306
5306
|
systemId,
|
|
5307
5307
|
parentNode: null
|
|
5308
5308
|
};
|
|
5309
|
-
defaultTreeAdapter.appendChild(
|
|
5309
|
+
defaultTreeAdapter.appendChild(document2, node);
|
|
5310
5310
|
}
|
|
5311
5311
|
},
|
|
5312
|
-
setDocumentMode(
|
|
5313
|
-
|
|
5312
|
+
setDocumentMode(document2, mode) {
|
|
5313
|
+
document2.mode = mode;
|
|
5314
5314
|
},
|
|
5315
|
-
getDocumentMode(
|
|
5316
|
-
return
|
|
5315
|
+
getDocumentMode(document2) {
|
|
5316
|
+
return document2.mode;
|
|
5317
5317
|
},
|
|
5318
5318
|
detachNode(node) {
|
|
5319
5319
|
if (node.parentNode) {
|
|
@@ -5794,7 +5794,7 @@ var defaultParserOptions = {
|
|
|
5794
5794
|
onParseError: null
|
|
5795
5795
|
};
|
|
5796
5796
|
var Parser = class {
|
|
5797
|
-
constructor(options,
|
|
5797
|
+
constructor(options, document2, fragmentContext = null, scriptHandler = null) {
|
|
5798
5798
|
this.fragmentContext = fragmentContext;
|
|
5799
5799
|
this.scriptHandler = scriptHandler;
|
|
5800
5800
|
this.currentToken = null;
|
|
@@ -5819,7 +5819,7 @@ var Parser = class {
|
|
|
5819
5819
|
if (this.onParseError) {
|
|
5820
5820
|
this.options.sourceCodeLocationInfo = true;
|
|
5821
5821
|
}
|
|
5822
|
-
this.document =
|
|
5822
|
+
this.document = document2 !== null && document2 !== void 0 ? document2 : this.treeAdapter.createDocument();
|
|
5823
5823
|
this.tokenizer = new Tokenizer(this.options, this);
|
|
5824
5824
|
this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
|
|
5825
5825
|
this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
|
|
@@ -8796,11 +8796,11 @@ function parseFragment(fragmentContext, html, options) {
|
|
|
8796
8796
|
// src/mock-doc/parse-util.ts
|
|
8797
8797
|
var docParser = /* @__PURE__ */ new WeakMap();
|
|
8798
8798
|
function parseDocumentUtil(ownerDocument, html) {
|
|
8799
|
-
const
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
return
|
|
8799
|
+
const doc2 = parse(html.trim(), getParser(ownerDocument));
|
|
8800
|
+
doc2.documentElement = doc2.firstElementChild;
|
|
8801
|
+
doc2.head = doc2.documentElement.firstElementChild;
|
|
8802
|
+
doc2.body = doc2.head.nextElementSibling;
|
|
8803
|
+
return doc2;
|
|
8804
8804
|
}
|
|
8805
8805
|
function parseFragmentUtil(ownerDocument, html) {
|
|
8806
8806
|
if (typeof html === "string") {
|
|
@@ -8818,9 +8818,9 @@ function getParser(ownerDocument) {
|
|
|
8818
8818
|
}
|
|
8819
8819
|
const treeAdapter = {
|
|
8820
8820
|
createDocument() {
|
|
8821
|
-
const
|
|
8822
|
-
|
|
8823
|
-
return
|
|
8821
|
+
const doc2 = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
|
|
8822
|
+
doc2["x-mode"] = "no-quirks";
|
|
8823
|
+
return doc2;
|
|
8824
8824
|
},
|
|
8825
8825
|
setNodeSourceCodeLocation(node, location2) {
|
|
8826
8826
|
node.sourceCodeLocation = location2;
|
|
@@ -8858,22 +8858,22 @@ function getParser(ownerDocument) {
|
|
|
8858
8858
|
getTemplateContent(templateElement) {
|
|
8859
8859
|
return templateElement.content;
|
|
8860
8860
|
},
|
|
8861
|
-
setDocumentType(
|
|
8862
|
-
let doctypeNode =
|
|
8861
|
+
setDocumentType(doc2, name, publicId, systemId) {
|
|
8862
|
+
let doctypeNode = doc2.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
|
|
8863
8863
|
if (doctypeNode == null) {
|
|
8864
8864
|
doctypeNode = ownerDocument.createDocumentTypeNode();
|
|
8865
|
-
|
|
8865
|
+
doc2.insertBefore(doctypeNode, doc2.firstChild);
|
|
8866
8866
|
}
|
|
8867
8867
|
doctypeNode.nodeValue = "!DOCTYPE";
|
|
8868
8868
|
doctypeNode["x-name"] = name;
|
|
8869
8869
|
doctypeNode["x-publicId"] = publicId;
|
|
8870
8870
|
doctypeNode["x-systemId"] = systemId;
|
|
8871
8871
|
},
|
|
8872
|
-
setDocumentMode(
|
|
8873
|
-
|
|
8872
|
+
setDocumentMode(doc2, mode) {
|
|
8873
|
+
doc2["x-mode"] = mode;
|
|
8874
8874
|
},
|
|
8875
|
-
getDocumentMode(
|
|
8876
|
-
return
|
|
8875
|
+
getDocumentMode(doc2) {
|
|
8876
|
+
return doc2["x-mode"];
|
|
8877
8877
|
},
|
|
8878
8878
|
detachNode(node) {
|
|
8879
8879
|
node.remove();
|
|
@@ -9005,9 +9005,9 @@ var jquery_default = (
|
|
|
9005
9005
|
nodeName: "HTML"
|
|
9006
9006
|
}
|
|
9007
9007
|
}
|
|
9008
|
-
}, function(
|
|
9008
|
+
}, function(window2, noGlobal) {
|
|
9009
9009
|
"use strict";
|
|
9010
|
-
if (!
|
|
9010
|
+
if (!window2.document) {
|
|
9011
9011
|
throw new Error("jQuery requires a window with a document");
|
|
9012
9012
|
}
|
|
9013
9013
|
var arr = [];
|
|
@@ -9042,16 +9042,16 @@ var jquery_default = (
|
|
|
9042
9042
|
}
|
|
9043
9043
|
return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
|
|
9044
9044
|
}
|
|
9045
|
-
var
|
|
9045
|
+
var document2 = window2.document;
|
|
9046
9046
|
var preservedScriptAttributes = {
|
|
9047
9047
|
type: true,
|
|
9048
9048
|
src: true,
|
|
9049
9049
|
nonce: true,
|
|
9050
9050
|
noModule: true
|
|
9051
9051
|
};
|
|
9052
|
-
function DOMEval(code, node,
|
|
9053
|
-
|
|
9054
|
-
var i2, script =
|
|
9052
|
+
function DOMEval(code, node, doc2) {
|
|
9053
|
+
doc2 = doc2 || document2;
|
|
9054
|
+
var i2, script = doc2.createElement("script");
|
|
9055
9055
|
script.text = code;
|
|
9056
9056
|
if (node) {
|
|
9057
9057
|
for (i2 in preservedScriptAttributes) {
|
|
@@ -9060,7 +9060,7 @@ var jquery_default = (
|
|
|
9060
9060
|
}
|
|
9061
9061
|
}
|
|
9062
9062
|
}
|
|
9063
|
-
|
|
9063
|
+
doc2.head.appendChild(script).parentNode.removeChild(script);
|
|
9064
9064
|
}
|
|
9065
9065
|
const jQuery = {};
|
|
9066
9066
|
var version = "4.0.0-pre+9352011a7.dirty +selector", rhtmlSuffix = /HTML$/i, jQueryOrig = function(selector, context) {
|
|
@@ -9197,8 +9197,8 @@ var jquery_default = (
|
|
|
9197
9197
|
},
|
|
9198
9198
|
// Evaluates a script in a provided context; falls back to the global one
|
|
9199
9199
|
// if not specified.
|
|
9200
|
-
globalEval: function(code, options,
|
|
9201
|
-
DOMEval(code, { nonce: options && options.nonce },
|
|
9200
|
+
globalEval: function(code, options, doc2) {
|
|
9201
|
+
DOMEval(code, { nonce: options && options.nonce }, doc2);
|
|
9202
9202
|
},
|
|
9203
9203
|
each: function(obj, callback) {
|
|
9204
9204
|
var length, i2 = 0;
|
|
@@ -9325,9 +9325,9 @@ var jquery_default = (
|
|
|
9325
9325
|
}
|
|
9326
9326
|
var pop = arr.pop;
|
|
9327
9327
|
var whitespace = "[\\x20\\t\\r\\n\\f]";
|
|
9328
|
-
var isIE =
|
|
9328
|
+
var isIE = document2.documentMode;
|
|
9329
9329
|
try {
|
|
9330
|
-
|
|
9330
|
+
document2.querySelector(":has(*,:jqfake)");
|
|
9331
9331
|
support.cssHas = false;
|
|
9332
9332
|
} catch (e) {
|
|
9333
9333
|
support.cssHas = true;
|
|
@@ -9359,7 +9359,7 @@ var jquery_default = (
|
|
|
9359
9359
|
var rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*");
|
|
9360
9360
|
var rdescend = new RegExp(whitespace + "|>");
|
|
9361
9361
|
var rsibling = /[+~]/;
|
|
9362
|
-
var documentElement =
|
|
9362
|
+
var documentElement = document2.documentElement;
|
|
9363
9363
|
var matches2 = documentElement.matches || documentElement.msMatchesSelector;
|
|
9364
9364
|
function createCache() {
|
|
9365
9365
|
var keys = [];
|
|
@@ -9528,10 +9528,10 @@ var jquery_default = (
|
|
|
9528
9528
|
1
|
|
9529
9529
|
);
|
|
9530
9530
|
if (compare & 1) {
|
|
9531
|
-
if (a ==
|
|
9531
|
+
if (a == document2 || a.ownerDocument == document2 && jQuery.contains(document2, a)) {
|
|
9532
9532
|
return -1;
|
|
9533
9533
|
}
|
|
9534
|
-
if (b ==
|
|
9534
|
+
if (b == document2 || b.ownerDocument == document2 && jQuery.contains(document2, b)) {
|
|
9535
9535
|
return 1;
|
|
9536
9536
|
}
|
|
9537
9537
|
return 0;
|
|
@@ -9687,14 +9687,14 @@ var jquery_default = (
|
|
|
9687
9687
|
});
|
|
9688
9688
|
}
|
|
9689
9689
|
function setDocument(node) {
|
|
9690
|
-
var subWindow,
|
|
9691
|
-
if (
|
|
9690
|
+
var subWindow, doc2 = node ? node.ownerDocument || node : document2;
|
|
9691
|
+
if (doc2 == document$1 || doc2.nodeType !== 9) {
|
|
9692
9692
|
return;
|
|
9693
9693
|
}
|
|
9694
|
-
document$1 =
|
|
9694
|
+
document$1 = doc2;
|
|
9695
9695
|
documentElement$1 = document$1.documentElement;
|
|
9696
9696
|
documentIsHTML = !jQuery.isXMLDoc(document$1);
|
|
9697
|
-
if (isIE &&
|
|
9697
|
+
if (isIE && document2 != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
|
|
9698
9698
|
subWindow.addEventListener("unload", unloadHandler);
|
|
9699
9699
|
}
|
|
9700
9700
|
}
|
|
@@ -9925,7 +9925,7 @@ var jquery_default = (
|
|
|
9925
9925
|
}),
|
|
9926
9926
|
// Miscellaneous
|
|
9927
9927
|
target: function(elem) {
|
|
9928
|
-
var hash =
|
|
9928
|
+
var hash = window2.location && window2.location.hash;
|
|
9929
9929
|
return hash && hash.slice(1) === elem.id;
|
|
9930
9930
|
},
|
|
9931
9931
|
root: function(elem) {
|
|
@@ -11915,9 +11915,9 @@ function createElement(ownerDocument, tagName) {
|
|
|
11915
11915
|
return new MockUListElement(ownerDocument);
|
|
11916
11916
|
}
|
|
11917
11917
|
if (ownerDocument != null && tagName.includes("-")) {
|
|
11918
|
-
const
|
|
11919
|
-
if (
|
|
11920
|
-
return createCustomElement(
|
|
11918
|
+
const win2 = ownerDocument.defaultView;
|
|
11919
|
+
if (win2 != null && win2.customElements != null) {
|
|
11920
|
+
return createCustomElement(win2.customElements, ownerDocument, tagName);
|
|
11921
11921
|
}
|
|
11922
11922
|
}
|
|
11923
11923
|
return new MockHTMLElement(ownerDocument, tagName);
|
|
@@ -12339,9 +12339,9 @@ var CanvasRenderingContext = class {
|
|
|
12339
12339
|
}
|
|
12340
12340
|
clearRect() {
|
|
12341
12341
|
}
|
|
12342
|
-
getImageData(_, __, w,
|
|
12342
|
+
getImageData(_, __, w, h2) {
|
|
12343
12343
|
return {
|
|
12344
|
-
data: new Array(w *
|
|
12344
|
+
data: new Array(w * h2 * 4)
|
|
12345
12345
|
};
|
|
12346
12346
|
}
|
|
12347
12347
|
toDataURL() {
|
|
@@ -12403,9 +12403,9 @@ var MockCanvasElement = class extends MockHTMLElement {
|
|
|
12403
12403
|
function fullUrl(elm, attrName) {
|
|
12404
12404
|
const val = elm.getAttribute(attrName) || "";
|
|
12405
12405
|
if (elm.ownerDocument != null) {
|
|
12406
|
-
const
|
|
12407
|
-
if (
|
|
12408
|
-
const loc =
|
|
12406
|
+
const win2 = elm.ownerDocument.defaultView;
|
|
12407
|
+
if (win2 != null) {
|
|
12408
|
+
const loc = win2.location;
|
|
12409
12409
|
if (loc != null) {
|
|
12410
12410
|
try {
|
|
12411
12411
|
const url = new URL(val, loc.href);
|
|
@@ -13110,10 +13110,10 @@ var MockWindow = class {
|
|
|
13110
13110
|
}
|
|
13111
13111
|
get Document() {
|
|
13112
13112
|
if (this.__docCstr == null) {
|
|
13113
|
-
const
|
|
13113
|
+
const win2 = this;
|
|
13114
13114
|
this.__docCstr = class extends MockDocument {
|
|
13115
13115
|
constructor() {
|
|
13116
|
-
super(false,
|
|
13116
|
+
super(false, win2);
|
|
13117
13117
|
throw new Error("Illegal constructor: cannot construct Document");
|
|
13118
13118
|
}
|
|
13119
13119
|
};
|
|
@@ -13630,14 +13630,14 @@ var MockWindow = class {
|
|
|
13630
13630
|
}
|
|
13631
13631
|
};
|
|
13632
13632
|
addGlobalsToWindowPrototype(MockWindow.prototype);
|
|
13633
|
-
function resetWindowDefaults(
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13633
|
+
function resetWindowDefaults(win2) {
|
|
13634
|
+
win2.__clearInterval = nativeClearInterval;
|
|
13635
|
+
win2.__clearTimeout = nativeClearTimeout;
|
|
13636
|
+
win2.__setInterval = nativeSetInterval;
|
|
13637
|
+
win2.__setTimeout = nativeSetTimeout;
|
|
13638
|
+
win2.__maxTimeout = 3e4;
|
|
13639
|
+
win2.__allowInterval = true;
|
|
13640
|
+
win2.URL = nativeURL;
|
|
13641
13641
|
}
|
|
13642
13642
|
function cloneWindow(srcWin, opts = {}) {
|
|
13643
13643
|
if (srcWin == null) {
|
|
@@ -13656,72 +13656,72 @@ function cloneWindow(srcWin, opts = {}) {
|
|
|
13656
13656
|
}
|
|
13657
13657
|
return clonedWin;
|
|
13658
13658
|
}
|
|
13659
|
-
function constrainTimeouts(
|
|
13660
|
-
|
|
13661
|
-
|
|
13659
|
+
function constrainTimeouts(win2) {
|
|
13660
|
+
win2.__allowInterval = false;
|
|
13661
|
+
win2.__maxTimeout = 0;
|
|
13662
13662
|
}
|
|
13663
|
-
function resetWindow(
|
|
13664
|
-
if (
|
|
13665
|
-
if (
|
|
13666
|
-
|
|
13663
|
+
function resetWindow(win2) {
|
|
13664
|
+
if (win2 != null) {
|
|
13665
|
+
if (win2.__timeouts) {
|
|
13666
|
+
win2.__timeouts.forEach((timeoutId) => {
|
|
13667
13667
|
nativeClearInterval(timeoutId);
|
|
13668
13668
|
nativeClearTimeout(timeoutId);
|
|
13669
13669
|
});
|
|
13670
|
-
|
|
13670
|
+
win2.__timeouts.clear();
|
|
13671
13671
|
}
|
|
13672
|
-
if (
|
|
13673
|
-
|
|
13672
|
+
if (win2.customElements && win2.customElements.clear) {
|
|
13673
|
+
win2.customElements.clear();
|
|
13674
13674
|
}
|
|
13675
|
-
resetDocument(
|
|
13676
|
-
resetPerformance(
|
|
13677
|
-
for (const key in
|
|
13678
|
-
if (
|
|
13679
|
-
delete
|
|
13675
|
+
resetDocument(win2.document);
|
|
13676
|
+
resetPerformance(win2.performance);
|
|
13677
|
+
for (const key in win2) {
|
|
13678
|
+
if (win2.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
|
|
13679
|
+
delete win2[key];
|
|
13680
13680
|
}
|
|
13681
13681
|
}
|
|
13682
|
-
resetWindowDefaults(
|
|
13683
|
-
resetWindowDimensions(
|
|
13684
|
-
resetEventListeners(
|
|
13685
|
-
if (
|
|
13682
|
+
resetWindowDefaults(win2);
|
|
13683
|
+
resetWindowDimensions(win2);
|
|
13684
|
+
resetEventListeners(win2);
|
|
13685
|
+
if (win2.document != null) {
|
|
13686
13686
|
try {
|
|
13687
|
-
|
|
13687
|
+
win2.document.defaultView = win2;
|
|
13688
13688
|
} catch (e) {
|
|
13689
13689
|
}
|
|
13690
13690
|
}
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13691
|
+
win2.fetch = null;
|
|
13692
|
+
win2.Headers = null;
|
|
13693
|
+
win2.Request = null;
|
|
13694
|
+
win2.Response = null;
|
|
13695
|
+
win2.FetchError = null;
|
|
13696
13696
|
}
|
|
13697
13697
|
}
|
|
13698
|
-
function resetWindowDimensions(
|
|
13698
|
+
function resetWindowDimensions(win2) {
|
|
13699
13699
|
try {
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
availHeight:
|
|
13700
|
+
win2.devicePixelRatio = 1;
|
|
13701
|
+
win2.innerHeight = 768;
|
|
13702
|
+
win2.innerWidth = 1366;
|
|
13703
|
+
win2.pageXOffset = 0;
|
|
13704
|
+
win2.pageYOffset = 0;
|
|
13705
|
+
win2.screenLeft = 0;
|
|
13706
|
+
win2.screenTop = 0;
|
|
13707
|
+
win2.screenX = 0;
|
|
13708
|
+
win2.screenY = 0;
|
|
13709
|
+
win2.scrollX = 0;
|
|
13710
|
+
win2.scrollY = 0;
|
|
13711
|
+
win2.screen = {
|
|
13712
|
+
availHeight: win2.innerHeight,
|
|
13713
13713
|
availLeft: 0,
|
|
13714
13714
|
availTop: 0,
|
|
13715
|
-
availWidth:
|
|
13715
|
+
availWidth: win2.innerWidth,
|
|
13716
13716
|
colorDepth: 24,
|
|
13717
|
-
height:
|
|
13717
|
+
height: win2.innerHeight,
|
|
13718
13718
|
keepAwake: false,
|
|
13719
13719
|
orientation: {
|
|
13720
13720
|
angle: 0,
|
|
13721
13721
|
type: "portrait-primary"
|
|
13722
13722
|
},
|
|
13723
13723
|
pixelDepth: 24,
|
|
13724
|
-
width:
|
|
13724
|
+
width: win2.innerWidth
|
|
13725
13725
|
};
|
|
13726
13726
|
} catch (e) {
|
|
13727
13727
|
}
|
|
@@ -13729,11 +13729,11 @@ function resetWindowDimensions(win) {
|
|
|
13729
13729
|
|
|
13730
13730
|
// src/mock-doc/document.ts
|
|
13731
13731
|
var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
13732
|
-
constructor(html = null,
|
|
13732
|
+
constructor(html = null, win2 = null) {
|
|
13733
13733
|
super(null, null);
|
|
13734
13734
|
this.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
13735
13735
|
this.nodeType = 9 /* DOCUMENT_NODE */;
|
|
13736
|
-
this.defaultView =
|
|
13736
|
+
this.defaultView = win2;
|
|
13737
13737
|
this.cookie = "";
|
|
13738
13738
|
this.referrer = "";
|
|
13739
13739
|
this.appendChild(this.createDocumentTypeNode());
|
|
@@ -13880,10 +13880,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
|
13880
13880
|
}
|
|
13881
13881
|
createElement(tagName) {
|
|
13882
13882
|
if (tagName === "#document" /* DOCUMENT_NODE */) {
|
|
13883
|
-
const
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
return
|
|
13883
|
+
const doc2 = new _MockDocument(false);
|
|
13884
|
+
doc2.nodeName = tagName;
|
|
13885
|
+
doc2.parentNode = null;
|
|
13886
|
+
return doc2;
|
|
13887
13887
|
}
|
|
13888
13888
|
return createElement(this, tagName);
|
|
13889
13889
|
}
|
|
@@ -13923,10 +13923,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
|
13923
13923
|
title.textContent = value;
|
|
13924
13924
|
}
|
|
13925
13925
|
};
|
|
13926
|
-
function resetDocument(
|
|
13927
|
-
if (
|
|
13928
|
-
resetEventListeners(
|
|
13929
|
-
const documentElement =
|
|
13926
|
+
function resetDocument(doc2) {
|
|
13927
|
+
if (doc2 != null) {
|
|
13928
|
+
resetEventListeners(doc2);
|
|
13929
|
+
const documentElement = doc2.documentElement;
|
|
13930
13930
|
if (documentElement != null) {
|
|
13931
13931
|
resetElement(documentElement);
|
|
13932
13932
|
for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
|
|
@@ -13935,25 +13935,25 @@ function resetDocument(doc) {
|
|
|
13935
13935
|
childNode.childNodes.length = 0;
|
|
13936
13936
|
}
|
|
13937
13937
|
}
|
|
13938
|
-
for (const key in
|
|
13939
|
-
if (
|
|
13940
|
-
delete
|
|
13938
|
+
for (const key in doc2) {
|
|
13939
|
+
if (doc2.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
|
|
13940
|
+
delete doc2[key];
|
|
13941
13941
|
}
|
|
13942
13942
|
}
|
|
13943
13943
|
try {
|
|
13944
|
-
|
|
13944
|
+
doc2.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
13945
13945
|
} catch (e) {
|
|
13946
13946
|
}
|
|
13947
13947
|
try {
|
|
13948
|
-
|
|
13948
|
+
doc2.nodeType = 9 /* DOCUMENT_NODE */;
|
|
13949
13949
|
} catch (e) {
|
|
13950
13950
|
}
|
|
13951
13951
|
try {
|
|
13952
|
-
|
|
13952
|
+
doc2.cookie = "";
|
|
13953
13953
|
} catch (e) {
|
|
13954
13954
|
}
|
|
13955
13955
|
try {
|
|
13956
|
-
|
|
13956
|
+
doc2.referrer = "";
|
|
13957
13957
|
} catch (e) {
|
|
13958
13958
|
}
|
|
13959
13959
|
}
|
|
@@ -14009,14 +14009,65 @@ function createWindowFromHtml(templateHtml, uniqueId) {
|
|
|
14009
14009
|
templateWindow = new MockWindow(templateHtml);
|
|
14010
14010
|
templateWindows.set(uniqueId, templateWindow);
|
|
14011
14011
|
}
|
|
14012
|
-
const
|
|
14013
|
-
return
|
|
14012
|
+
const win2 = cloneWindow(templateWindow);
|
|
14013
|
+
return win2;
|
|
14014
14014
|
}
|
|
14015
14015
|
|
|
14016
14016
|
// src/hydrate/runner/render.ts
|
|
14017
14017
|
import { Readable } from "stream";
|
|
14018
14018
|
import { hydrateFactory } from "@stencil/core/hydrate-factory";
|
|
14019
14019
|
|
|
14020
|
+
// src/client/client-build.ts
|
|
14021
|
+
import { BUILD } from "@stencil/core/internal/app-data";
|
|
14022
|
+
var Build = {
|
|
14023
|
+
isDev: BUILD.isDev ? true : false,
|
|
14024
|
+
isBrowser: true,
|
|
14025
|
+
isServer: false,
|
|
14026
|
+
isTesting: BUILD.isTesting ? true : false
|
|
14027
|
+
};
|
|
14028
|
+
|
|
14029
|
+
// src/client/client-host-ref.ts
|
|
14030
|
+
import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
|
|
14031
|
+
var hostRefs = BUILD2.hotModuleReplacement ? window.__STENCIL_HOSTREFS__ || (window.__STENCIL_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
|
|
14032
|
+
|
|
14033
|
+
// src/client/client-load-module.ts
|
|
14034
|
+
import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
|
|
14035
|
+
|
|
14036
|
+
// src/client/client-log.ts
|
|
14037
|
+
import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
|
|
14038
|
+
var STENCIL_DEV_MODE = BUILD3.isTesting ? ["STENCIL:"] : [
|
|
14039
|
+
"%cstencil",
|
|
14040
|
+
"color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
|
|
14041
|
+
];
|
|
14042
|
+
|
|
14043
|
+
// src/client/client-style.ts
|
|
14044
|
+
var modeResolutionChain = [];
|
|
14045
|
+
|
|
14046
|
+
// src/client/client-task-queue.ts
|
|
14047
|
+
import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
|
|
14048
|
+
|
|
14049
|
+
// src/client/client-window.ts
|
|
14050
|
+
import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
|
|
14051
|
+
var win = typeof window !== "undefined" ? window : {};
|
|
14052
|
+
var doc = win.document || { head: {} };
|
|
14053
|
+
var H = win.HTMLElement || class {
|
|
14054
|
+
};
|
|
14055
|
+
var supportsShadow = BUILD5.shadowDom;
|
|
14056
|
+
var supportsConstructableStylesheets = BUILD5.constructableCSS ? /* @__PURE__ */ (() => {
|
|
14057
|
+
try {
|
|
14058
|
+
new CSSStyleSheet();
|
|
14059
|
+
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
14060
|
+
} catch (e) {
|
|
14061
|
+
}
|
|
14062
|
+
return false;
|
|
14063
|
+
})() : false;
|
|
14064
|
+
|
|
14065
|
+
// src/client/index.ts
|
|
14066
|
+
import { BUILD as BUILD27, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
|
|
14067
|
+
|
|
14068
|
+
// src/runtime/bootstrap-custom-element.ts
|
|
14069
|
+
import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
|
|
14070
|
+
|
|
14020
14071
|
// src/utils/helpers.ts
|
|
14021
14072
|
var isString = (v) => typeof v === "string";
|
|
14022
14073
|
|
|
@@ -14107,15 +14158,77 @@ var unwrapErr = (result) => {
|
|
|
14107
14158
|
}
|
|
14108
14159
|
};
|
|
14109
14160
|
|
|
14161
|
+
// src/runtime/connected-callback.ts
|
|
14162
|
+
import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
|
|
14163
|
+
|
|
14164
|
+
// src/runtime/client-hydrate.ts
|
|
14165
|
+
import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
|
|
14166
|
+
|
|
14167
|
+
// src/runtime/profile.ts
|
|
14168
|
+
import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
|
|
14169
|
+
|
|
14170
|
+
// src/runtime/vdom/h.ts
|
|
14171
|
+
import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
|
|
14172
|
+
|
|
14173
|
+
// src/runtime/initialize-component.ts
|
|
14174
|
+
import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
|
|
14175
|
+
|
|
14176
|
+
// src/runtime/mode.ts
|
|
14177
|
+
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
14178
|
+
|
|
14179
|
+
// src/runtime/proxy-component.ts
|
|
14180
|
+
import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
|
|
14181
|
+
|
|
14182
|
+
// src/runtime/set-value.ts
|
|
14183
|
+
import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
|
|
14184
|
+
|
|
14185
|
+
// src/runtime/parse-property-value.ts
|
|
14186
|
+
import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
|
|
14187
|
+
|
|
14188
|
+
// src/runtime/update-component.ts
|
|
14189
|
+
import { BUILD as BUILD17, NAMESPACE } from "@stencil/core/internal/app-data";
|
|
14190
|
+
|
|
14191
|
+
// src/runtime/event-emitter.ts
|
|
14192
|
+
import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
|
|
14193
|
+
|
|
14194
|
+
// src/runtime/element.ts
|
|
14195
|
+
import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
|
|
14196
|
+
|
|
14197
|
+
// src/runtime/styles.ts
|
|
14198
|
+
import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
|
|
14199
|
+
|
|
14200
|
+
// src/runtime/vdom/vdom-render.ts
|
|
14201
|
+
import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
|
|
14202
|
+
|
|
14203
|
+
// src/runtime/vdom/update-element.ts
|
|
14204
|
+
import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
|
|
14205
|
+
|
|
14206
|
+
// src/runtime/vdom/set-accessor.ts
|
|
14207
|
+
import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
|
|
14208
|
+
var CAPTURE_EVENT_SUFFIX = "Capture";
|
|
14209
|
+
var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
|
|
14210
|
+
|
|
14211
|
+
// src/runtime/disconnected-callback.ts
|
|
14212
|
+
import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
|
|
14213
|
+
|
|
14214
|
+
// src/runtime/dom-extras.ts
|
|
14215
|
+
import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
|
|
14216
|
+
|
|
14217
|
+
// src/runtime/bootstrap-lazy.ts
|
|
14218
|
+
import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
|
|
14219
|
+
|
|
14220
|
+
// src/runtime/host-listener.ts
|
|
14221
|
+
import { BUILD as BUILD26 } from "@stencil/core/internal/app-data";
|
|
14222
|
+
|
|
14110
14223
|
// src/compiler/html/canonical-link.ts
|
|
14111
|
-
var updateCanonicalLink = (
|
|
14224
|
+
var updateCanonicalLink = (doc2, href) => {
|
|
14112
14225
|
var _a2;
|
|
14113
|
-
let canonicalLinkElm =
|
|
14226
|
+
let canonicalLinkElm = doc2.head.querySelector('link[rel="canonical"]');
|
|
14114
14227
|
if (typeof href === "string") {
|
|
14115
14228
|
if (canonicalLinkElm == null) {
|
|
14116
|
-
canonicalLinkElm =
|
|
14229
|
+
canonicalLinkElm = doc2.createElement("link");
|
|
14117
14230
|
canonicalLinkElm.setAttribute("rel", "canonical");
|
|
14118
|
-
|
|
14231
|
+
doc2.head.appendChild(canonicalLinkElm);
|
|
14119
14232
|
}
|
|
14120
14233
|
canonicalLinkElm.setAttribute("href", href);
|
|
14121
14234
|
} else {
|
|
@@ -14129,11 +14242,11 @@ var updateCanonicalLink = (doc, href) => {
|
|
|
14129
14242
|
};
|
|
14130
14243
|
|
|
14131
14244
|
// src/compiler/html/relocate-meta-charset.ts
|
|
14132
|
-
var relocateMetaCharset = (
|
|
14133
|
-
const head =
|
|
14245
|
+
var relocateMetaCharset = (doc2) => {
|
|
14246
|
+
const head = doc2.head;
|
|
14134
14247
|
let charsetElm = head.querySelector("meta[charset]");
|
|
14135
14248
|
if (charsetElm == null) {
|
|
14136
|
-
charsetElm =
|
|
14249
|
+
charsetElm = doc2.createElement("meta");
|
|
14137
14250
|
charsetElm.setAttribute("charset", "utf-8");
|
|
14138
14251
|
} else {
|
|
14139
14252
|
charsetElm.remove();
|
|
@@ -14408,13 +14521,13 @@ var parseCss = (css, filePath) => {
|
|
|
14408
14521
|
const m = match(/^@([-\w]+)?document *([^{]+)/);
|
|
14409
14522
|
if (!m) return null;
|
|
14410
14523
|
const vendor = trim(m[1]);
|
|
14411
|
-
const
|
|
14524
|
+
const doc2 = trim(m[2]);
|
|
14412
14525
|
if (!open()) return error(`@document missing '{'`);
|
|
14413
14526
|
const style = comments().concat(rules());
|
|
14414
14527
|
if (!close()) return error(`@document missing '}'`);
|
|
14415
14528
|
return pos({
|
|
14416
14529
|
type: 3 /* Document */,
|
|
14417
|
-
document:
|
|
14530
|
+
document: doc2,
|
|
14418
14531
|
vendor,
|
|
14419
14532
|
rules: style
|
|
14420
14533
|
});
|
|
@@ -14740,11 +14853,11 @@ var serializeCssPage = (opts, node) => {
|
|
|
14740
14853
|
};
|
|
14741
14854
|
var serializeCssDocument = (opts, node) => {
|
|
14742
14855
|
const documentCss = serializeCssMapVisit(opts, node.rules);
|
|
14743
|
-
const
|
|
14856
|
+
const doc2 = "@" + (node.vendor || "") + "document " + node.document;
|
|
14744
14857
|
if (documentCss === "") {
|
|
14745
14858
|
return "";
|
|
14746
14859
|
}
|
|
14747
|
-
return
|
|
14860
|
+
return doc2 + "{" + documentCss + "}";
|
|
14748
14861
|
};
|
|
14749
14862
|
var serializeCssMapVisit = (opts, nodes) => {
|
|
14750
14863
|
let rtn = "";
|
|
@@ -14842,12 +14955,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
|
|
|
14842
14955
|
};
|
|
14843
14956
|
|
|
14844
14957
|
// src/compiler/html/remove-unused-styles.ts
|
|
14845
|
-
var removeUnusedStyles = (
|
|
14958
|
+
var removeUnusedStyles = (doc2, diagnostics) => {
|
|
14846
14959
|
try {
|
|
14847
|
-
const styleElms =
|
|
14960
|
+
const styleElms = doc2.head.querySelectorAll(`style[data-styles]`);
|
|
14848
14961
|
const styleLen = styleElms.length;
|
|
14849
14962
|
if (styleLen > 0) {
|
|
14850
|
-
const usedSelectors = getUsedSelectors(
|
|
14963
|
+
const usedSelectors = getUsedSelectors(doc2.documentElement);
|
|
14851
14964
|
for (let i = 0; i < styleLen; i++) {
|
|
14852
14965
|
removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
|
|
14853
14966
|
}
|
|
@@ -14980,49 +15093,49 @@ function collectAttributes(node) {
|
|
|
14980
15093
|
var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
|
|
14981
15094
|
|
|
14982
15095
|
// src/hydrate/runner/patch-dom-implementation.ts
|
|
14983
|
-
function patchDomImplementation(
|
|
14984
|
-
let
|
|
14985
|
-
if (
|
|
15096
|
+
function patchDomImplementation(doc2, opts) {
|
|
15097
|
+
let win2;
|
|
15098
|
+
if (doc2.defaultView != null) {
|
|
14986
15099
|
opts.destroyWindow = true;
|
|
14987
|
-
patchWindow(
|
|
14988
|
-
|
|
15100
|
+
patchWindow(doc2.defaultView);
|
|
15101
|
+
win2 = doc2.defaultView;
|
|
14989
15102
|
} else {
|
|
14990
15103
|
opts.destroyWindow = true;
|
|
14991
15104
|
opts.destroyDocument = false;
|
|
14992
|
-
|
|
15105
|
+
win2 = new MockWindow(false);
|
|
14993
15106
|
}
|
|
14994
|
-
if (
|
|
14995
|
-
|
|
15107
|
+
if (win2.document !== doc2) {
|
|
15108
|
+
win2.document = doc2;
|
|
14996
15109
|
}
|
|
14997
|
-
if (
|
|
14998
|
-
|
|
15110
|
+
if (doc2.defaultView !== win2) {
|
|
15111
|
+
doc2.defaultView = win2;
|
|
14999
15112
|
}
|
|
15000
|
-
const
|
|
15001
|
-
if (typeof
|
|
15002
|
-
const elm =
|
|
15113
|
+
const HTMLElement2 = doc2.documentElement.constructor.prototype;
|
|
15114
|
+
if (typeof HTMLElement2.getRootNode !== "function") {
|
|
15115
|
+
const elm = doc2.createElement("unknown-element");
|
|
15003
15116
|
const HTMLUnknownElement = elm.constructor.prototype;
|
|
15004
15117
|
HTMLUnknownElement.getRootNode = getRootNode;
|
|
15005
15118
|
}
|
|
15006
|
-
if (typeof
|
|
15007
|
-
const
|
|
15008
|
-
if (
|
|
15009
|
-
|
|
15119
|
+
if (typeof doc2.createEvent === "function") {
|
|
15120
|
+
const CustomEvent2 = doc2.createEvent("CustomEvent").constructor;
|
|
15121
|
+
if (win2.CustomEvent !== CustomEvent2) {
|
|
15122
|
+
win2.CustomEvent = CustomEvent2;
|
|
15010
15123
|
}
|
|
15011
15124
|
}
|
|
15012
15125
|
try {
|
|
15013
|
-
|
|
15126
|
+
win2.__stencil_baseURI = doc2.baseURI;
|
|
15014
15127
|
} catch (e) {
|
|
15015
|
-
Object.defineProperty(
|
|
15128
|
+
Object.defineProperty(doc2, "baseURI", {
|
|
15016
15129
|
get() {
|
|
15017
|
-
const baseElm =
|
|
15130
|
+
const baseElm = doc2.querySelector("base[href]");
|
|
15018
15131
|
if (baseElm) {
|
|
15019
|
-
return new URL(baseElm.getAttribute("href"),
|
|
15132
|
+
return new URL(baseElm.getAttribute("href"), win2.location.href).href;
|
|
15020
15133
|
}
|
|
15021
|
-
return
|
|
15134
|
+
return win2.location.href;
|
|
15022
15135
|
}
|
|
15023
15136
|
});
|
|
15024
15137
|
}
|
|
15025
|
-
return
|
|
15138
|
+
return win2;
|
|
15026
15139
|
}
|
|
15027
15140
|
function getRootNode(opts) {
|
|
15028
15141
|
const isComposed = opts != null && opts.composed === true;
|
|
@@ -15175,10 +15288,10 @@ function renderCatchError(results, err2) {
|
|
|
15175
15288
|
}
|
|
15176
15289
|
|
|
15177
15290
|
// src/hydrate/runner/runtime-log.ts
|
|
15178
|
-
function runtimeLogging(
|
|
15291
|
+
function runtimeLogging(win2, opts, results) {
|
|
15179
15292
|
try {
|
|
15180
|
-
const pathname =
|
|
15181
|
-
|
|
15293
|
+
const pathname = win2.location.pathname;
|
|
15294
|
+
win2.console.error = (...msgs) => {
|
|
15182
15295
|
const errMsg = msgs.reduce((errMsg2, m) => {
|
|
15183
15296
|
if (m) {
|
|
15184
15297
|
if (m.stack != null) {
|
|
@@ -15198,7 +15311,7 @@ function runtimeLogging(win, opts, results) {
|
|
|
15198
15311
|
}
|
|
15199
15312
|
}
|
|
15200
15313
|
};
|
|
15201
|
-
|
|
15314
|
+
win2.console.debug = (...msgs) => {
|
|
15202
15315
|
renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
|
|
15203
15316
|
if (opts.runtimeLogging) {
|
|
15204
15317
|
runtimeLog(pathname, "debug", msgs);
|
|
@@ -15206,7 +15319,7 @@ function runtimeLogging(win, opts, results) {
|
|
|
15206
15319
|
};
|
|
15207
15320
|
if (opts.runtimeLogging) {
|
|
15208
15321
|
["log", "warn", "assert", "info", "trace"].forEach((type) => {
|
|
15209
|
-
|
|
15322
|
+
win2.console[type] = (...msgs) => {
|
|
15210
15323
|
runtimeLog(pathname, type, msgs);
|
|
15211
15324
|
};
|
|
15212
15325
|
});
|
|
@@ -15220,58 +15333,58 @@ function runtimeLog(pathname, type, msgs) {
|
|
|
15220
15333
|
}
|
|
15221
15334
|
|
|
15222
15335
|
// src/hydrate/runner/window-initialize.ts
|
|
15223
|
-
function initializeWindow(
|
|
15336
|
+
function initializeWindow(win2, doc2, opts, results) {
|
|
15224
15337
|
if (typeof opts.url === "string") {
|
|
15225
15338
|
try {
|
|
15226
|
-
|
|
15339
|
+
win2.location.href = opts.url;
|
|
15227
15340
|
} catch (e) {
|
|
15228
15341
|
}
|
|
15229
15342
|
}
|
|
15230
15343
|
if (typeof opts.userAgent === "string") {
|
|
15231
15344
|
try {
|
|
15232
|
-
|
|
15345
|
+
win2.navigator.userAgent = opts.userAgent;
|
|
15233
15346
|
} catch (e) {
|
|
15234
15347
|
}
|
|
15235
15348
|
}
|
|
15236
15349
|
if (typeof opts.cookie === "string") {
|
|
15237
15350
|
try {
|
|
15238
|
-
|
|
15351
|
+
doc2.cookie = opts.cookie;
|
|
15239
15352
|
} catch (e) {
|
|
15240
15353
|
}
|
|
15241
15354
|
}
|
|
15242
15355
|
if (typeof opts.referrer === "string") {
|
|
15243
15356
|
try {
|
|
15244
|
-
|
|
15357
|
+
doc2.referrer = opts.referrer;
|
|
15245
15358
|
} catch (e) {
|
|
15246
15359
|
}
|
|
15247
15360
|
}
|
|
15248
15361
|
if (typeof opts.direction === "string") {
|
|
15249
15362
|
try {
|
|
15250
|
-
|
|
15363
|
+
doc2.documentElement.setAttribute("dir", opts.direction);
|
|
15251
15364
|
} catch (e) {
|
|
15252
15365
|
}
|
|
15253
15366
|
}
|
|
15254
15367
|
if (typeof opts.language === "string") {
|
|
15255
15368
|
try {
|
|
15256
|
-
|
|
15369
|
+
doc2.documentElement.setAttribute("lang", opts.language);
|
|
15257
15370
|
} catch (e) {
|
|
15258
15371
|
}
|
|
15259
15372
|
}
|
|
15260
15373
|
if (typeof opts.buildId === "string") {
|
|
15261
15374
|
try {
|
|
15262
|
-
|
|
15375
|
+
doc2.documentElement.setAttribute("data-stencil-build", opts.buildId);
|
|
15263
15376
|
} catch (e) {
|
|
15264
15377
|
}
|
|
15265
15378
|
}
|
|
15266
15379
|
try {
|
|
15267
|
-
|
|
15380
|
+
win2.customElements = null;
|
|
15268
15381
|
} catch (e) {
|
|
15269
15382
|
}
|
|
15270
15383
|
if (opts.constrainTimeouts) {
|
|
15271
|
-
constrainTimeouts(
|
|
15384
|
+
constrainTimeouts(win2);
|
|
15272
15385
|
}
|
|
15273
|
-
runtimeLogging(
|
|
15274
|
-
return
|
|
15386
|
+
runtimeLogging(win2, opts, results);
|
|
15387
|
+
return win2;
|
|
15275
15388
|
}
|
|
15276
15389
|
|
|
15277
15390
|
// src/hydrate/runner/render.ts
|
|
@@ -15288,44 +15401,44 @@ function renderToString(html, options, asStream) {
|
|
|
15288
15401
|
opts.constrainTimeouts = false;
|
|
15289
15402
|
return hydrateDocument(html, opts, asStream);
|
|
15290
15403
|
}
|
|
15291
|
-
function hydrateDocument(
|
|
15404
|
+
function hydrateDocument(doc2, options, asStream) {
|
|
15292
15405
|
const opts = normalizeHydrateOptions(options);
|
|
15293
|
-
let
|
|
15406
|
+
let win2 = null;
|
|
15294
15407
|
const results = generateHydrateResults(opts);
|
|
15295
15408
|
if (hasError(results.diagnostics)) {
|
|
15296
15409
|
return Promise.resolve(results);
|
|
15297
15410
|
}
|
|
15298
|
-
if (typeof
|
|
15411
|
+
if (typeof doc2 === "string") {
|
|
15299
15412
|
try {
|
|
15300
15413
|
opts.destroyWindow = true;
|
|
15301
15414
|
opts.destroyDocument = true;
|
|
15302
|
-
|
|
15415
|
+
win2 = new MockWindow(doc2);
|
|
15303
15416
|
if (!asStream) {
|
|
15304
|
-
return render(
|
|
15417
|
+
return render(win2, opts, results).then(() => results);
|
|
15305
15418
|
}
|
|
15306
|
-
return renderStream(
|
|
15419
|
+
return renderStream(win2, opts, results);
|
|
15307
15420
|
} catch (e) {
|
|
15308
|
-
if (
|
|
15309
|
-
|
|
15421
|
+
if (win2 && win2.close) {
|
|
15422
|
+
win2.close();
|
|
15310
15423
|
}
|
|
15311
|
-
|
|
15424
|
+
win2 = null;
|
|
15312
15425
|
renderCatchError(results, e);
|
|
15313
15426
|
return Promise.resolve(results);
|
|
15314
15427
|
}
|
|
15315
15428
|
}
|
|
15316
|
-
if (isValidDocument(
|
|
15429
|
+
if (isValidDocument(doc2)) {
|
|
15317
15430
|
try {
|
|
15318
15431
|
opts.destroyDocument = false;
|
|
15319
|
-
|
|
15432
|
+
win2 = patchDomImplementation(doc2, opts);
|
|
15320
15433
|
if (!asStream) {
|
|
15321
|
-
return render(
|
|
15434
|
+
return render(win2, opts, results).then(() => results);
|
|
15322
15435
|
}
|
|
15323
|
-
return renderStream(
|
|
15436
|
+
return renderStream(win2, opts, results);
|
|
15324
15437
|
} catch (e) {
|
|
15325
|
-
if (
|
|
15326
|
-
|
|
15438
|
+
if (win2 && win2.close) {
|
|
15439
|
+
win2.close();
|
|
15327
15440
|
}
|
|
15328
|
-
|
|
15441
|
+
win2 = null;
|
|
15329
15442
|
renderCatchError(results, e);
|
|
15330
15443
|
return Promise.resolve(results);
|
|
15331
15444
|
}
|
|
@@ -15333,75 +15446,81 @@ function hydrateDocument(doc, options, asStream) {
|
|
|
15333
15446
|
renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
|
|
15334
15447
|
return Promise.resolve(results);
|
|
15335
15448
|
}
|
|
15336
|
-
async function render(
|
|
15449
|
+
async function render(win2, opts, results) {
|
|
15337
15450
|
if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
|
|
15338
15451
|
process.__stencilErrors = true;
|
|
15339
15452
|
process.on("unhandledRejection", (e) => {
|
|
15340
15453
|
console.log("unhandledRejection", e);
|
|
15341
15454
|
});
|
|
15342
15455
|
}
|
|
15343
|
-
initializeWindow(
|
|
15456
|
+
initializeWindow(win2, win2.document, opts, results);
|
|
15344
15457
|
const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
|
|
15345
15458
|
try {
|
|
15346
|
-
await Promise.resolve(beforeHydrateFn(
|
|
15347
|
-
return new Promise((resolve) =>
|
|
15459
|
+
await Promise.resolve(beforeHydrateFn(win2.document));
|
|
15460
|
+
return new Promise((resolve) => {
|
|
15461
|
+
if (Array.isArray(opts.modes)) {
|
|
15462
|
+
modeResolutionChain.length = 0;
|
|
15463
|
+
opts.modes.forEach((mode) => setMode(mode));
|
|
15464
|
+
}
|
|
15465
|
+
return hydrateFactory(win2, opts, results, afterHydrate, resolve);
|
|
15466
|
+
});
|
|
15348
15467
|
} catch (e) {
|
|
15349
15468
|
renderCatchError(results, e);
|
|
15350
|
-
return finalizeHydrate(
|
|
15469
|
+
return finalizeHydrate(win2, win2.document, opts, results);
|
|
15351
15470
|
}
|
|
15352
15471
|
}
|
|
15353
|
-
function renderStream(
|
|
15472
|
+
function renderStream(win2, opts, results) {
|
|
15354
15473
|
async function* processRender() {
|
|
15355
|
-
const renderResult = await render(
|
|
15474
|
+
const renderResult = await render(win2, opts, results);
|
|
15356
15475
|
yield renderResult.html;
|
|
15357
15476
|
}
|
|
15358
15477
|
return Readable.from(processRender());
|
|
15359
15478
|
}
|
|
15360
|
-
async function afterHydrate(
|
|
15479
|
+
async function afterHydrate(win2, opts, results, resolve) {
|
|
15361
15480
|
const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
|
|
15362
15481
|
try {
|
|
15363
|
-
await Promise.resolve(afterHydrateFn(
|
|
15364
|
-
return resolve(finalizeHydrate(
|
|
15482
|
+
await Promise.resolve(afterHydrateFn(win2.document));
|
|
15483
|
+
return resolve(finalizeHydrate(win2, win2.document, opts, results));
|
|
15365
15484
|
} catch (e) {
|
|
15366
15485
|
renderCatchError(results, e);
|
|
15367
|
-
return resolve(finalizeHydrate(
|
|
15486
|
+
return resolve(finalizeHydrate(win2, win2.document, opts, results));
|
|
15368
15487
|
}
|
|
15369
15488
|
}
|
|
15370
|
-
function finalizeHydrate(
|
|
15489
|
+
function finalizeHydrate(win2, doc2, opts, results) {
|
|
15371
15490
|
try {
|
|
15372
|
-
inspectElement(results,
|
|
15491
|
+
inspectElement(results, doc2.documentElement, 0);
|
|
15373
15492
|
if (opts.removeUnusedStyles !== false) {
|
|
15374
15493
|
try {
|
|
15375
|
-
removeUnusedStyles(
|
|
15494
|
+
removeUnusedStyles(doc2, results.diagnostics);
|
|
15376
15495
|
} catch (e) {
|
|
15377
15496
|
renderCatchError(results, e);
|
|
15378
15497
|
}
|
|
15379
15498
|
}
|
|
15380
15499
|
if (typeof opts.title === "string") {
|
|
15381
15500
|
try {
|
|
15382
|
-
|
|
15501
|
+
doc2.title = opts.title;
|
|
15383
15502
|
} catch (e) {
|
|
15384
15503
|
renderCatchError(results, e);
|
|
15385
15504
|
}
|
|
15386
15505
|
}
|
|
15387
|
-
results.title =
|
|
15506
|
+
results.title = doc2.title;
|
|
15388
15507
|
if (opts.removeScripts) {
|
|
15389
|
-
removeScripts(
|
|
15508
|
+
removeScripts(doc2.documentElement);
|
|
15390
15509
|
}
|
|
15391
15510
|
try {
|
|
15392
|
-
updateCanonicalLink(
|
|
15511
|
+
updateCanonicalLink(doc2, opts.canonicalUrl);
|
|
15393
15512
|
} catch (e) {
|
|
15394
15513
|
renderCatchError(results, e);
|
|
15395
15514
|
}
|
|
15396
15515
|
try {
|
|
15397
|
-
relocateMetaCharset(
|
|
15516
|
+
relocateMetaCharset(doc2);
|
|
15398
15517
|
} catch (e) {
|
|
15399
15518
|
}
|
|
15400
15519
|
if (!hasError(results.diagnostics)) {
|
|
15401
15520
|
results.httpStatus = 200;
|
|
15402
15521
|
}
|
|
15403
15522
|
try {
|
|
15404
|
-
const metaStatus =
|
|
15523
|
+
const metaStatus = doc2.head.querySelector('meta[http-equiv="status"]');
|
|
15405
15524
|
if (metaStatus != null) {
|
|
15406
15525
|
const metaStatusContent = metaStatus.getAttribute("content");
|
|
15407
15526
|
if (metaStatusContent && metaStatusContent.length > 0) {
|
|
@@ -15411,35 +15530,35 @@ function finalizeHydrate(win, doc, opts, results) {
|
|
|
15411
15530
|
} catch (e) {
|
|
15412
15531
|
}
|
|
15413
15532
|
if (opts.clientHydrateAnnotations) {
|
|
15414
|
-
|
|
15533
|
+
doc2.documentElement.classList.add("hydrated");
|
|
15415
15534
|
}
|
|
15416
15535
|
if (opts.serializeToHtml) {
|
|
15417
|
-
results.html = serializeDocumentToString(
|
|
15536
|
+
results.html = serializeDocumentToString(doc2, opts);
|
|
15418
15537
|
}
|
|
15419
15538
|
} catch (e) {
|
|
15420
15539
|
renderCatchError(results, e);
|
|
15421
15540
|
}
|
|
15422
|
-
destroyWindow(
|
|
15541
|
+
destroyWindow(win2, doc2, opts, results);
|
|
15423
15542
|
return results;
|
|
15424
15543
|
}
|
|
15425
|
-
function destroyWindow(
|
|
15544
|
+
function destroyWindow(win2, doc2, opts, results) {
|
|
15426
15545
|
if (!opts.destroyWindow) {
|
|
15427
15546
|
return;
|
|
15428
15547
|
}
|
|
15429
15548
|
try {
|
|
15430
15549
|
if (!opts.destroyDocument) {
|
|
15431
|
-
|
|
15432
|
-
|
|
15550
|
+
win2.document = null;
|
|
15551
|
+
doc2.defaultView = null;
|
|
15433
15552
|
}
|
|
15434
|
-
if (
|
|
15435
|
-
|
|
15553
|
+
if (win2.close) {
|
|
15554
|
+
win2.close();
|
|
15436
15555
|
}
|
|
15437
15556
|
} catch (e) {
|
|
15438
15557
|
renderCatchError(results, e);
|
|
15439
15558
|
}
|
|
15440
15559
|
}
|
|
15441
|
-
function serializeDocumentToString(
|
|
15442
|
-
return serializeNodeToHtml(
|
|
15560
|
+
function serializeDocumentToString(doc2, opts) {
|
|
15561
|
+
return serializeNodeToHtml(doc2, {
|
|
15443
15562
|
approximateLineWidth: opts.approximateLineWidth,
|
|
15444
15563
|
outerHtml: false,
|
|
15445
15564
|
prettyHtml: opts.prettyHtml,
|
|
@@ -15451,8 +15570,8 @@ function serializeDocumentToString(doc, opts) {
|
|
|
15451
15570
|
fullDocument: opts.fullDocument
|
|
15452
15571
|
});
|
|
15453
15572
|
}
|
|
15454
|
-
function isValidDocument(
|
|
15455
|
-
return
|
|
15573
|
+
function isValidDocument(doc2) {
|
|
15574
|
+
return doc2 != null && doc2.nodeType === 9 && doc2.documentElement != null && doc2.documentElement.nodeType === 1 && doc2.body != null && doc2.body.nodeType === 1;
|
|
15456
15575
|
}
|
|
15457
15576
|
function removeScripts(elm) {
|
|
15458
15577
|
const children = elm.children;
|