@stencil/core 4.21.0-dev.1724797245.5ff5ee2 → 4.21.0-dev.1724907702.f741f44
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 +4 -14
- 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 +0 -6
- package/internal/hydrate/runner.js +239 -358
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +0 -6
- 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.1724907702.f741f44 | 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(win) {
|
|
324
|
+
this.win = win;
|
|
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 doc = this.win.document;
|
|
347
|
+
if (doc != null) {
|
|
348
|
+
const hosts = doc.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(doc);
|
|
352
|
+
const upgradedCmp = createCustomElement(this, doc, 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(doc);
|
|
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(customElements, ownerDocument, tagName) {
|
|
413
|
+
const Cstr = customElements.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 win = ownerDocument.defaultView;
|
|
462
|
+
if (win != 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(document, 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 = document;
|
|
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(document, name, publicId, systemId) {
|
|
5296
|
+
const doctypeNode = document.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(document, node);
|
|
5310
5310
|
}
|
|
5311
5311
|
},
|
|
5312
|
-
setDocumentMode(
|
|
5313
|
-
|
|
5312
|
+
setDocumentMode(document, mode) {
|
|
5313
|
+
document.mode = mode;
|
|
5314
5314
|
},
|
|
5315
|
-
getDocumentMode(
|
|
5316
|
-
return
|
|
5315
|
+
getDocumentMode(document) {
|
|
5316
|
+
return document.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, document, 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 = document !== null && document !== void 0 ? document : 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 doc = parse(html.trim(), getParser(ownerDocument));
|
|
8800
|
+
doc.documentElement = doc.firstElementChild;
|
|
8801
|
+
doc.head = doc.documentElement.firstElementChild;
|
|
8802
|
+
doc.body = doc.head.nextElementSibling;
|
|
8803
|
+
return doc;
|
|
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 doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
|
|
8822
|
+
doc["x-mode"] = "no-quirks";
|
|
8823
|
+
return doc;
|
|
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(doc, name, publicId, systemId) {
|
|
8862
|
+
let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
|
|
8863
8863
|
if (doctypeNode == null) {
|
|
8864
8864
|
doctypeNode = ownerDocument.createDocumentTypeNode();
|
|
8865
|
-
|
|
8865
|
+
doc.insertBefore(doctypeNode, doc.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(doc, mode) {
|
|
8873
|
+
doc["x-mode"] = mode;
|
|
8874
8874
|
},
|
|
8875
|
-
getDocumentMode(
|
|
8876
|
-
return
|
|
8875
|
+
getDocumentMode(doc) {
|
|
8876
|
+
return doc["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(window, noGlobal) {
|
|
9009
9009
|
"use strict";
|
|
9010
|
-
if (!
|
|
9010
|
+
if (!window.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 document = window.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, doc) {
|
|
9053
|
+
doc = doc || document;
|
|
9054
|
+
var i2, script = doc.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
|
+
doc.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, doc) {
|
|
9201
|
+
DOMEval(code, { nonce: options && options.nonce }, doc);
|
|
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 = document.documentMode;
|
|
9329
9329
|
try {
|
|
9330
|
-
|
|
9330
|
+
document.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 = document.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 == document || a.ownerDocument == document && jQuery.contains(document, a)) {
|
|
9532
9532
|
return -1;
|
|
9533
9533
|
}
|
|
9534
|
-
if (b ==
|
|
9534
|
+
if (b == document || b.ownerDocument == document && jQuery.contains(document, 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, doc = node ? node.ownerDocument || node : document;
|
|
9691
|
+
if (doc == document$1 || doc.nodeType !== 9) {
|
|
9692
9692
|
return;
|
|
9693
9693
|
}
|
|
9694
|
-
document$1 =
|
|
9694
|
+
document$1 = doc;
|
|
9695
9695
|
documentElement$1 = document$1.documentElement;
|
|
9696
9696
|
documentIsHTML = !jQuery.isXMLDoc(document$1);
|
|
9697
|
-
if (isIE &&
|
|
9697
|
+
if (isIE && document != 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 = window.location && window.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 win = ownerDocument.defaultView;
|
|
11919
|
+
if (win != null && win.customElements != null) {
|
|
11920
|
+
return createCustomElement(win.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, h) {
|
|
12343
12343
|
return {
|
|
12344
|
-
data: new Array(w *
|
|
12344
|
+
data: new Array(w * h * 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 win = elm.ownerDocument.defaultView;
|
|
12407
|
+
if (win != null) {
|
|
12408
|
+
const loc = win.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 win = this;
|
|
13114
13114
|
this.__docCstr = class extends MockDocument {
|
|
13115
13115
|
constructor() {
|
|
13116
|
-
super(false,
|
|
13116
|
+
super(false, win);
|
|
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(win) {
|
|
13634
|
+
win.__clearInterval = nativeClearInterval;
|
|
13635
|
+
win.__clearTimeout = nativeClearTimeout;
|
|
13636
|
+
win.__setInterval = nativeSetInterval;
|
|
13637
|
+
win.__setTimeout = nativeSetTimeout;
|
|
13638
|
+
win.__maxTimeout = 3e4;
|
|
13639
|
+
win.__allowInterval = true;
|
|
13640
|
+
win.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(win) {
|
|
13660
|
+
win.__allowInterval = false;
|
|
13661
|
+
win.__maxTimeout = 0;
|
|
13662
13662
|
}
|
|
13663
|
-
function resetWindow(
|
|
13664
|
-
if (
|
|
13665
|
-
if (
|
|
13666
|
-
|
|
13663
|
+
function resetWindow(win) {
|
|
13664
|
+
if (win != null) {
|
|
13665
|
+
if (win.__timeouts) {
|
|
13666
|
+
win.__timeouts.forEach((timeoutId) => {
|
|
13667
13667
|
nativeClearInterval(timeoutId);
|
|
13668
13668
|
nativeClearTimeout(timeoutId);
|
|
13669
13669
|
});
|
|
13670
|
-
|
|
13670
|
+
win.__timeouts.clear();
|
|
13671
13671
|
}
|
|
13672
|
-
if (
|
|
13673
|
-
|
|
13672
|
+
if (win.customElements && win.customElements.clear) {
|
|
13673
|
+
win.customElements.clear();
|
|
13674
13674
|
}
|
|
13675
|
-
resetDocument(
|
|
13676
|
-
resetPerformance(
|
|
13677
|
-
for (const key in
|
|
13678
|
-
if (
|
|
13679
|
-
delete
|
|
13675
|
+
resetDocument(win.document);
|
|
13676
|
+
resetPerformance(win.performance);
|
|
13677
|
+
for (const key in win) {
|
|
13678
|
+
if (win.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
|
|
13679
|
+
delete win[key];
|
|
13680
13680
|
}
|
|
13681
13681
|
}
|
|
13682
|
-
resetWindowDefaults(
|
|
13683
|
-
resetWindowDimensions(
|
|
13684
|
-
resetEventListeners(
|
|
13685
|
-
if (
|
|
13682
|
+
resetWindowDefaults(win);
|
|
13683
|
+
resetWindowDimensions(win);
|
|
13684
|
+
resetEventListeners(win);
|
|
13685
|
+
if (win.document != null) {
|
|
13686
13686
|
try {
|
|
13687
|
-
|
|
13687
|
+
win.document.defaultView = win;
|
|
13688
13688
|
} catch (e) {
|
|
13689
13689
|
}
|
|
13690
13690
|
}
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13691
|
+
win.fetch = null;
|
|
13692
|
+
win.Headers = null;
|
|
13693
|
+
win.Request = null;
|
|
13694
|
+
win.Response = null;
|
|
13695
|
+
win.FetchError = null;
|
|
13696
13696
|
}
|
|
13697
13697
|
}
|
|
13698
|
-
function resetWindowDimensions(
|
|
13698
|
+
function resetWindowDimensions(win) {
|
|
13699
13699
|
try {
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
availHeight:
|
|
13700
|
+
win.devicePixelRatio = 1;
|
|
13701
|
+
win.innerHeight = 768;
|
|
13702
|
+
win.innerWidth = 1366;
|
|
13703
|
+
win.pageXOffset = 0;
|
|
13704
|
+
win.pageYOffset = 0;
|
|
13705
|
+
win.screenLeft = 0;
|
|
13706
|
+
win.screenTop = 0;
|
|
13707
|
+
win.screenX = 0;
|
|
13708
|
+
win.screenY = 0;
|
|
13709
|
+
win.scrollX = 0;
|
|
13710
|
+
win.scrollY = 0;
|
|
13711
|
+
win.screen = {
|
|
13712
|
+
availHeight: win.innerHeight,
|
|
13713
13713
|
availLeft: 0,
|
|
13714
13714
|
availTop: 0,
|
|
13715
|
-
availWidth:
|
|
13715
|
+
availWidth: win.innerWidth,
|
|
13716
13716
|
colorDepth: 24,
|
|
13717
|
-
height:
|
|
13717
|
+
height: win.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: win.innerWidth
|
|
13725
13725
|
};
|
|
13726
13726
|
} catch (e) {
|
|
13727
13727
|
}
|
|
@@ -13729,11 +13729,11 @@ function resetWindowDimensions(win2) {
|
|
|
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, win = 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 = win;
|
|
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 doc = new _MockDocument(false);
|
|
13884
|
+
doc.nodeName = tagName;
|
|
13885
|
+
doc.parentNode = null;
|
|
13886
|
+
return doc;
|
|
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(doc) {
|
|
13927
|
+
if (doc != null) {
|
|
13928
|
+
resetEventListeners(doc);
|
|
13929
|
+
const documentElement = doc.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(doc2) {
|
|
|
13935
13935
|
childNode.childNodes.length = 0;
|
|
13936
13936
|
}
|
|
13937
13937
|
}
|
|
13938
|
-
for (const key in
|
|
13939
|
-
if (
|
|
13940
|
-
delete
|
|
13938
|
+
for (const key in doc) {
|
|
13939
|
+
if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
|
|
13940
|
+
delete doc[key];
|
|
13941
13941
|
}
|
|
13942
13942
|
}
|
|
13943
13943
|
try {
|
|
13944
|
-
|
|
13944
|
+
doc.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
13945
13945
|
} catch (e) {
|
|
13946
13946
|
}
|
|
13947
13947
|
try {
|
|
13948
|
-
|
|
13948
|
+
doc.nodeType = 9 /* DOCUMENT_NODE */;
|
|
13949
13949
|
} catch (e) {
|
|
13950
13950
|
}
|
|
13951
13951
|
try {
|
|
13952
|
-
|
|
13952
|
+
doc.cookie = "";
|
|
13953
13953
|
} catch (e) {
|
|
13954
13954
|
}
|
|
13955
13955
|
try {
|
|
13956
|
-
|
|
13956
|
+
doc.referrer = "";
|
|
13957
13957
|
} catch (e) {
|
|
13958
13958
|
}
|
|
13959
13959
|
}
|
|
@@ -14009,65 +14009,14 @@ function createWindowFromHtml(templateHtml, uniqueId) {
|
|
|
14009
14009
|
templateWindow = new MockWindow(templateHtml);
|
|
14010
14010
|
templateWindows.set(uniqueId, templateWindow);
|
|
14011
14011
|
}
|
|
14012
|
-
const
|
|
14013
|
-
return
|
|
14012
|
+
const win = cloneWindow(templateWindow);
|
|
14013
|
+
return win;
|
|
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
|
-
|
|
14071
14020
|
// src/utils/helpers.ts
|
|
14072
14021
|
var isString = (v) => typeof v === "string";
|
|
14073
14022
|
|
|
@@ -14158,77 +14107,15 @@ var unwrapErr = (result) => {
|
|
|
14158
14107
|
}
|
|
14159
14108
|
};
|
|
14160
14109
|
|
|
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
|
-
|
|
14223
14110
|
// src/compiler/html/canonical-link.ts
|
|
14224
|
-
var updateCanonicalLink = (
|
|
14111
|
+
var updateCanonicalLink = (doc, href) => {
|
|
14225
14112
|
var _a2;
|
|
14226
|
-
let canonicalLinkElm =
|
|
14113
|
+
let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
|
|
14227
14114
|
if (typeof href === "string") {
|
|
14228
14115
|
if (canonicalLinkElm == null) {
|
|
14229
|
-
canonicalLinkElm =
|
|
14116
|
+
canonicalLinkElm = doc.createElement("link");
|
|
14230
14117
|
canonicalLinkElm.setAttribute("rel", "canonical");
|
|
14231
|
-
|
|
14118
|
+
doc.head.appendChild(canonicalLinkElm);
|
|
14232
14119
|
}
|
|
14233
14120
|
canonicalLinkElm.setAttribute("href", href);
|
|
14234
14121
|
} else {
|
|
@@ -14242,11 +14129,11 @@ var updateCanonicalLink = (doc2, href) => {
|
|
|
14242
14129
|
};
|
|
14243
14130
|
|
|
14244
14131
|
// src/compiler/html/relocate-meta-charset.ts
|
|
14245
|
-
var relocateMetaCharset = (
|
|
14246
|
-
const head =
|
|
14132
|
+
var relocateMetaCharset = (doc) => {
|
|
14133
|
+
const head = doc.head;
|
|
14247
14134
|
let charsetElm = head.querySelector("meta[charset]");
|
|
14248
14135
|
if (charsetElm == null) {
|
|
14249
|
-
charsetElm =
|
|
14136
|
+
charsetElm = doc.createElement("meta");
|
|
14250
14137
|
charsetElm.setAttribute("charset", "utf-8");
|
|
14251
14138
|
} else {
|
|
14252
14139
|
charsetElm.remove();
|
|
@@ -14521,13 +14408,13 @@ var parseCss = (css, filePath) => {
|
|
|
14521
14408
|
const m = match(/^@([-\w]+)?document *([^{]+)/);
|
|
14522
14409
|
if (!m) return null;
|
|
14523
14410
|
const vendor = trim(m[1]);
|
|
14524
|
-
const
|
|
14411
|
+
const doc = trim(m[2]);
|
|
14525
14412
|
if (!open()) return error(`@document missing '{'`);
|
|
14526
14413
|
const style = comments().concat(rules());
|
|
14527
14414
|
if (!close()) return error(`@document missing '}'`);
|
|
14528
14415
|
return pos({
|
|
14529
14416
|
type: 3 /* Document */,
|
|
14530
|
-
document:
|
|
14417
|
+
document: doc,
|
|
14531
14418
|
vendor,
|
|
14532
14419
|
rules: style
|
|
14533
14420
|
});
|
|
@@ -14853,11 +14740,11 @@ var serializeCssPage = (opts, node) => {
|
|
|
14853
14740
|
};
|
|
14854
14741
|
var serializeCssDocument = (opts, node) => {
|
|
14855
14742
|
const documentCss = serializeCssMapVisit(opts, node.rules);
|
|
14856
|
-
const
|
|
14743
|
+
const doc = "@" + (node.vendor || "") + "document " + node.document;
|
|
14857
14744
|
if (documentCss === "") {
|
|
14858
14745
|
return "";
|
|
14859
14746
|
}
|
|
14860
|
-
return
|
|
14747
|
+
return doc + "{" + documentCss + "}";
|
|
14861
14748
|
};
|
|
14862
14749
|
var serializeCssMapVisit = (opts, nodes) => {
|
|
14863
14750
|
let rtn = "";
|
|
@@ -14955,12 +14842,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
|
|
|
14955
14842
|
};
|
|
14956
14843
|
|
|
14957
14844
|
// src/compiler/html/remove-unused-styles.ts
|
|
14958
|
-
var removeUnusedStyles = (
|
|
14845
|
+
var removeUnusedStyles = (doc, diagnostics) => {
|
|
14959
14846
|
try {
|
|
14960
|
-
const styleElms =
|
|
14847
|
+
const styleElms = doc.head.querySelectorAll(`style[data-styles]`);
|
|
14961
14848
|
const styleLen = styleElms.length;
|
|
14962
14849
|
if (styleLen > 0) {
|
|
14963
|
-
const usedSelectors = getUsedSelectors(
|
|
14850
|
+
const usedSelectors = getUsedSelectors(doc.documentElement);
|
|
14964
14851
|
for (let i = 0; i < styleLen; i++) {
|
|
14965
14852
|
removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
|
|
14966
14853
|
}
|
|
@@ -15093,49 +14980,49 @@ function collectAttributes(node) {
|
|
|
15093
14980
|
var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
|
|
15094
14981
|
|
|
15095
14982
|
// src/hydrate/runner/patch-dom-implementation.ts
|
|
15096
|
-
function patchDomImplementation(
|
|
15097
|
-
let
|
|
15098
|
-
if (
|
|
14983
|
+
function patchDomImplementation(doc, opts) {
|
|
14984
|
+
let win;
|
|
14985
|
+
if (doc.defaultView != null) {
|
|
15099
14986
|
opts.destroyWindow = true;
|
|
15100
|
-
patchWindow(
|
|
15101
|
-
|
|
14987
|
+
patchWindow(doc.defaultView);
|
|
14988
|
+
win = doc.defaultView;
|
|
15102
14989
|
} else {
|
|
15103
14990
|
opts.destroyWindow = true;
|
|
15104
14991
|
opts.destroyDocument = false;
|
|
15105
|
-
|
|
14992
|
+
win = new MockWindow(false);
|
|
15106
14993
|
}
|
|
15107
|
-
if (
|
|
15108
|
-
|
|
14994
|
+
if (win.document !== doc) {
|
|
14995
|
+
win.document = doc;
|
|
15109
14996
|
}
|
|
15110
|
-
if (
|
|
15111
|
-
|
|
14997
|
+
if (doc.defaultView !== win) {
|
|
14998
|
+
doc.defaultView = win;
|
|
15112
14999
|
}
|
|
15113
|
-
const
|
|
15114
|
-
if (typeof
|
|
15115
|
-
const elm =
|
|
15000
|
+
const HTMLElement = doc.documentElement.constructor.prototype;
|
|
15001
|
+
if (typeof HTMLElement.getRootNode !== "function") {
|
|
15002
|
+
const elm = doc.createElement("unknown-element");
|
|
15116
15003
|
const HTMLUnknownElement = elm.constructor.prototype;
|
|
15117
15004
|
HTMLUnknownElement.getRootNode = getRootNode;
|
|
15118
15005
|
}
|
|
15119
|
-
if (typeof
|
|
15120
|
-
const
|
|
15121
|
-
if (
|
|
15122
|
-
|
|
15006
|
+
if (typeof doc.createEvent === "function") {
|
|
15007
|
+
const CustomEvent = doc.createEvent("CustomEvent").constructor;
|
|
15008
|
+
if (win.CustomEvent !== CustomEvent) {
|
|
15009
|
+
win.CustomEvent = CustomEvent;
|
|
15123
15010
|
}
|
|
15124
15011
|
}
|
|
15125
15012
|
try {
|
|
15126
|
-
|
|
15013
|
+
win.__stencil_baseURI = doc.baseURI;
|
|
15127
15014
|
} catch (e) {
|
|
15128
|
-
Object.defineProperty(
|
|
15015
|
+
Object.defineProperty(doc, "baseURI", {
|
|
15129
15016
|
get() {
|
|
15130
|
-
const baseElm =
|
|
15017
|
+
const baseElm = doc.querySelector("base[href]");
|
|
15131
15018
|
if (baseElm) {
|
|
15132
|
-
return new URL(baseElm.getAttribute("href"),
|
|
15019
|
+
return new URL(baseElm.getAttribute("href"), win.location.href).href;
|
|
15133
15020
|
}
|
|
15134
|
-
return
|
|
15021
|
+
return win.location.href;
|
|
15135
15022
|
}
|
|
15136
15023
|
});
|
|
15137
15024
|
}
|
|
15138
|
-
return
|
|
15025
|
+
return win;
|
|
15139
15026
|
}
|
|
15140
15027
|
function getRootNode(opts) {
|
|
15141
15028
|
const isComposed = opts != null && opts.composed === true;
|
|
@@ -15288,10 +15175,10 @@ function renderCatchError(results, err2) {
|
|
|
15288
15175
|
}
|
|
15289
15176
|
|
|
15290
15177
|
// src/hydrate/runner/runtime-log.ts
|
|
15291
|
-
function runtimeLogging(
|
|
15178
|
+
function runtimeLogging(win, opts, results) {
|
|
15292
15179
|
try {
|
|
15293
|
-
const pathname =
|
|
15294
|
-
|
|
15180
|
+
const pathname = win.location.pathname;
|
|
15181
|
+
win.console.error = (...msgs) => {
|
|
15295
15182
|
const errMsg = msgs.reduce((errMsg2, m) => {
|
|
15296
15183
|
if (m) {
|
|
15297
15184
|
if (m.stack != null) {
|
|
@@ -15311,7 +15198,7 @@ function runtimeLogging(win2, opts, results) {
|
|
|
15311
15198
|
}
|
|
15312
15199
|
}
|
|
15313
15200
|
};
|
|
15314
|
-
|
|
15201
|
+
win.console.debug = (...msgs) => {
|
|
15315
15202
|
renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
|
|
15316
15203
|
if (opts.runtimeLogging) {
|
|
15317
15204
|
runtimeLog(pathname, "debug", msgs);
|
|
@@ -15319,7 +15206,7 @@ function runtimeLogging(win2, opts, results) {
|
|
|
15319
15206
|
};
|
|
15320
15207
|
if (opts.runtimeLogging) {
|
|
15321
15208
|
["log", "warn", "assert", "info", "trace"].forEach((type) => {
|
|
15322
|
-
|
|
15209
|
+
win.console[type] = (...msgs) => {
|
|
15323
15210
|
runtimeLog(pathname, type, msgs);
|
|
15324
15211
|
};
|
|
15325
15212
|
});
|
|
@@ -15333,58 +15220,58 @@ function runtimeLog(pathname, type, msgs) {
|
|
|
15333
15220
|
}
|
|
15334
15221
|
|
|
15335
15222
|
// src/hydrate/runner/window-initialize.ts
|
|
15336
|
-
function initializeWindow(
|
|
15223
|
+
function initializeWindow(win, doc, opts, results) {
|
|
15337
15224
|
if (typeof opts.url === "string") {
|
|
15338
15225
|
try {
|
|
15339
|
-
|
|
15226
|
+
win.location.href = opts.url;
|
|
15340
15227
|
} catch (e) {
|
|
15341
15228
|
}
|
|
15342
15229
|
}
|
|
15343
15230
|
if (typeof opts.userAgent === "string") {
|
|
15344
15231
|
try {
|
|
15345
|
-
|
|
15232
|
+
win.navigator.userAgent = opts.userAgent;
|
|
15346
15233
|
} catch (e) {
|
|
15347
15234
|
}
|
|
15348
15235
|
}
|
|
15349
15236
|
if (typeof opts.cookie === "string") {
|
|
15350
15237
|
try {
|
|
15351
|
-
|
|
15238
|
+
doc.cookie = opts.cookie;
|
|
15352
15239
|
} catch (e) {
|
|
15353
15240
|
}
|
|
15354
15241
|
}
|
|
15355
15242
|
if (typeof opts.referrer === "string") {
|
|
15356
15243
|
try {
|
|
15357
|
-
|
|
15244
|
+
doc.referrer = opts.referrer;
|
|
15358
15245
|
} catch (e) {
|
|
15359
15246
|
}
|
|
15360
15247
|
}
|
|
15361
15248
|
if (typeof opts.direction === "string") {
|
|
15362
15249
|
try {
|
|
15363
|
-
|
|
15250
|
+
doc.documentElement.setAttribute("dir", opts.direction);
|
|
15364
15251
|
} catch (e) {
|
|
15365
15252
|
}
|
|
15366
15253
|
}
|
|
15367
15254
|
if (typeof opts.language === "string") {
|
|
15368
15255
|
try {
|
|
15369
|
-
|
|
15256
|
+
doc.documentElement.setAttribute("lang", opts.language);
|
|
15370
15257
|
} catch (e) {
|
|
15371
15258
|
}
|
|
15372
15259
|
}
|
|
15373
15260
|
if (typeof opts.buildId === "string") {
|
|
15374
15261
|
try {
|
|
15375
|
-
|
|
15262
|
+
doc.documentElement.setAttribute("data-stencil-build", opts.buildId);
|
|
15376
15263
|
} catch (e) {
|
|
15377
15264
|
}
|
|
15378
15265
|
}
|
|
15379
15266
|
try {
|
|
15380
|
-
|
|
15267
|
+
win.customElements = null;
|
|
15381
15268
|
} catch (e) {
|
|
15382
15269
|
}
|
|
15383
15270
|
if (opts.constrainTimeouts) {
|
|
15384
|
-
constrainTimeouts(
|
|
15271
|
+
constrainTimeouts(win);
|
|
15385
15272
|
}
|
|
15386
|
-
runtimeLogging(
|
|
15387
|
-
return
|
|
15273
|
+
runtimeLogging(win, opts, results);
|
|
15274
|
+
return win;
|
|
15388
15275
|
}
|
|
15389
15276
|
|
|
15390
15277
|
// src/hydrate/runner/render.ts
|
|
@@ -15401,44 +15288,44 @@ function renderToString(html, options, asStream) {
|
|
|
15401
15288
|
opts.constrainTimeouts = false;
|
|
15402
15289
|
return hydrateDocument(html, opts, asStream);
|
|
15403
15290
|
}
|
|
15404
|
-
function hydrateDocument(
|
|
15291
|
+
function hydrateDocument(doc, options, asStream) {
|
|
15405
15292
|
const opts = normalizeHydrateOptions(options);
|
|
15406
|
-
let
|
|
15293
|
+
let win = null;
|
|
15407
15294
|
const results = generateHydrateResults(opts);
|
|
15408
15295
|
if (hasError(results.diagnostics)) {
|
|
15409
15296
|
return Promise.resolve(results);
|
|
15410
15297
|
}
|
|
15411
|
-
if (typeof
|
|
15298
|
+
if (typeof doc === "string") {
|
|
15412
15299
|
try {
|
|
15413
15300
|
opts.destroyWindow = true;
|
|
15414
15301
|
opts.destroyDocument = true;
|
|
15415
|
-
|
|
15302
|
+
win = new MockWindow(doc);
|
|
15416
15303
|
if (!asStream) {
|
|
15417
|
-
return render(
|
|
15304
|
+
return render(win, opts, results).then(() => results);
|
|
15418
15305
|
}
|
|
15419
|
-
return renderStream(
|
|
15306
|
+
return renderStream(win, opts, results);
|
|
15420
15307
|
} catch (e) {
|
|
15421
|
-
if (
|
|
15422
|
-
|
|
15308
|
+
if (win && win.close) {
|
|
15309
|
+
win.close();
|
|
15423
15310
|
}
|
|
15424
|
-
|
|
15311
|
+
win = null;
|
|
15425
15312
|
renderCatchError(results, e);
|
|
15426
15313
|
return Promise.resolve(results);
|
|
15427
15314
|
}
|
|
15428
15315
|
}
|
|
15429
|
-
if (isValidDocument(
|
|
15316
|
+
if (isValidDocument(doc)) {
|
|
15430
15317
|
try {
|
|
15431
15318
|
opts.destroyDocument = false;
|
|
15432
|
-
|
|
15319
|
+
win = patchDomImplementation(doc, opts);
|
|
15433
15320
|
if (!asStream) {
|
|
15434
|
-
return render(
|
|
15321
|
+
return render(win, opts, results).then(() => results);
|
|
15435
15322
|
}
|
|
15436
|
-
return renderStream(
|
|
15323
|
+
return renderStream(win, opts, results);
|
|
15437
15324
|
} catch (e) {
|
|
15438
|
-
if (
|
|
15439
|
-
|
|
15325
|
+
if (win && win.close) {
|
|
15326
|
+
win.close();
|
|
15440
15327
|
}
|
|
15441
|
-
|
|
15328
|
+
win = null;
|
|
15442
15329
|
renderCatchError(results, e);
|
|
15443
15330
|
return Promise.resolve(results);
|
|
15444
15331
|
}
|
|
@@ -15446,81 +15333,75 @@ function hydrateDocument(doc2, options, asStream) {
|
|
|
15446
15333
|
renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
|
|
15447
15334
|
return Promise.resolve(results);
|
|
15448
15335
|
}
|
|
15449
|
-
async function render(
|
|
15336
|
+
async function render(win, opts, results) {
|
|
15450
15337
|
if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
|
|
15451
15338
|
process.__stencilErrors = true;
|
|
15452
15339
|
process.on("unhandledRejection", (e) => {
|
|
15453
15340
|
console.log("unhandledRejection", e);
|
|
15454
15341
|
});
|
|
15455
15342
|
}
|
|
15456
|
-
initializeWindow(
|
|
15343
|
+
initializeWindow(win, win.document, opts, results);
|
|
15457
15344
|
const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
|
|
15458
15345
|
try {
|
|
15459
|
-
await Promise.resolve(beforeHydrateFn(
|
|
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
|
-
});
|
|
15346
|
+
await Promise.resolve(beforeHydrateFn(win.document));
|
|
15347
|
+
return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
|
|
15467
15348
|
} catch (e) {
|
|
15468
15349
|
renderCatchError(results, e);
|
|
15469
|
-
return finalizeHydrate(
|
|
15350
|
+
return finalizeHydrate(win, win.document, opts, results);
|
|
15470
15351
|
}
|
|
15471
15352
|
}
|
|
15472
|
-
function renderStream(
|
|
15353
|
+
function renderStream(win, opts, results) {
|
|
15473
15354
|
async function* processRender() {
|
|
15474
|
-
const renderResult = await render(
|
|
15355
|
+
const renderResult = await render(win, opts, results);
|
|
15475
15356
|
yield renderResult.html;
|
|
15476
15357
|
}
|
|
15477
15358
|
return Readable.from(processRender());
|
|
15478
15359
|
}
|
|
15479
|
-
async function afterHydrate(
|
|
15360
|
+
async function afterHydrate(win, opts, results, resolve) {
|
|
15480
15361
|
const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
|
|
15481
15362
|
try {
|
|
15482
|
-
await Promise.resolve(afterHydrateFn(
|
|
15483
|
-
return resolve(finalizeHydrate(
|
|
15363
|
+
await Promise.resolve(afterHydrateFn(win.document));
|
|
15364
|
+
return resolve(finalizeHydrate(win, win.document, opts, results));
|
|
15484
15365
|
} catch (e) {
|
|
15485
15366
|
renderCatchError(results, e);
|
|
15486
|
-
return resolve(finalizeHydrate(
|
|
15367
|
+
return resolve(finalizeHydrate(win, win.document, opts, results));
|
|
15487
15368
|
}
|
|
15488
15369
|
}
|
|
15489
|
-
function finalizeHydrate(
|
|
15370
|
+
function finalizeHydrate(win, doc, opts, results) {
|
|
15490
15371
|
try {
|
|
15491
|
-
inspectElement(results,
|
|
15372
|
+
inspectElement(results, doc.documentElement, 0);
|
|
15492
15373
|
if (opts.removeUnusedStyles !== false) {
|
|
15493
15374
|
try {
|
|
15494
|
-
removeUnusedStyles(
|
|
15375
|
+
removeUnusedStyles(doc, results.diagnostics);
|
|
15495
15376
|
} catch (e) {
|
|
15496
15377
|
renderCatchError(results, e);
|
|
15497
15378
|
}
|
|
15498
15379
|
}
|
|
15499
15380
|
if (typeof opts.title === "string") {
|
|
15500
15381
|
try {
|
|
15501
|
-
|
|
15382
|
+
doc.title = opts.title;
|
|
15502
15383
|
} catch (e) {
|
|
15503
15384
|
renderCatchError(results, e);
|
|
15504
15385
|
}
|
|
15505
15386
|
}
|
|
15506
|
-
results.title =
|
|
15387
|
+
results.title = doc.title;
|
|
15507
15388
|
if (opts.removeScripts) {
|
|
15508
|
-
removeScripts(
|
|
15389
|
+
removeScripts(doc.documentElement);
|
|
15509
15390
|
}
|
|
15510
15391
|
try {
|
|
15511
|
-
updateCanonicalLink(
|
|
15392
|
+
updateCanonicalLink(doc, opts.canonicalUrl);
|
|
15512
15393
|
} catch (e) {
|
|
15513
15394
|
renderCatchError(results, e);
|
|
15514
15395
|
}
|
|
15515
15396
|
try {
|
|
15516
|
-
relocateMetaCharset(
|
|
15397
|
+
relocateMetaCharset(doc);
|
|
15517
15398
|
} catch (e) {
|
|
15518
15399
|
}
|
|
15519
15400
|
if (!hasError(results.diagnostics)) {
|
|
15520
15401
|
results.httpStatus = 200;
|
|
15521
15402
|
}
|
|
15522
15403
|
try {
|
|
15523
|
-
const metaStatus =
|
|
15404
|
+
const metaStatus = doc.head.querySelector('meta[http-equiv="status"]');
|
|
15524
15405
|
if (metaStatus != null) {
|
|
15525
15406
|
const metaStatusContent = metaStatus.getAttribute("content");
|
|
15526
15407
|
if (metaStatusContent && metaStatusContent.length > 0) {
|
|
@@ -15530,35 +15411,35 @@ function finalizeHydrate(win2, doc2, opts, results) {
|
|
|
15530
15411
|
} catch (e) {
|
|
15531
15412
|
}
|
|
15532
15413
|
if (opts.clientHydrateAnnotations) {
|
|
15533
|
-
|
|
15414
|
+
doc.documentElement.classList.add("hydrated");
|
|
15534
15415
|
}
|
|
15535
15416
|
if (opts.serializeToHtml) {
|
|
15536
|
-
results.html = serializeDocumentToString(
|
|
15417
|
+
results.html = serializeDocumentToString(doc, opts);
|
|
15537
15418
|
}
|
|
15538
15419
|
} catch (e) {
|
|
15539
15420
|
renderCatchError(results, e);
|
|
15540
15421
|
}
|
|
15541
|
-
destroyWindow(
|
|
15422
|
+
destroyWindow(win, doc, opts, results);
|
|
15542
15423
|
return results;
|
|
15543
15424
|
}
|
|
15544
|
-
function destroyWindow(
|
|
15425
|
+
function destroyWindow(win, doc, opts, results) {
|
|
15545
15426
|
if (!opts.destroyWindow) {
|
|
15546
15427
|
return;
|
|
15547
15428
|
}
|
|
15548
15429
|
try {
|
|
15549
15430
|
if (!opts.destroyDocument) {
|
|
15550
|
-
|
|
15551
|
-
|
|
15431
|
+
win.document = null;
|
|
15432
|
+
doc.defaultView = null;
|
|
15552
15433
|
}
|
|
15553
|
-
if (
|
|
15554
|
-
|
|
15434
|
+
if (win.close) {
|
|
15435
|
+
win.close();
|
|
15555
15436
|
}
|
|
15556
15437
|
} catch (e) {
|
|
15557
15438
|
renderCatchError(results, e);
|
|
15558
15439
|
}
|
|
15559
15440
|
}
|
|
15560
|
-
function serializeDocumentToString(
|
|
15561
|
-
return serializeNodeToHtml(
|
|
15441
|
+
function serializeDocumentToString(doc, opts) {
|
|
15442
|
+
return serializeNodeToHtml(doc, {
|
|
15562
15443
|
approximateLineWidth: opts.approximateLineWidth,
|
|
15563
15444
|
outerHtml: false,
|
|
15564
15445
|
prettyHtml: opts.prettyHtml,
|
|
@@ -15570,8 +15451,8 @@ function serializeDocumentToString(doc2, opts) {
|
|
|
15570
15451
|
fullDocument: opts.fullDocument
|
|
15571
15452
|
});
|
|
15572
15453
|
}
|
|
15573
|
-
function isValidDocument(
|
|
15574
|
-
return
|
|
15454
|
+
function isValidDocument(doc) {
|
|
15455
|
+
return doc != null && doc.nodeType === 9 && doc.documentElement != null && doc.documentElement.nodeType === 1 && doc.body != null && doc.body.nodeType === 1;
|
|
15575
15456
|
}
|
|
15576
15457
|
function removeScripts(elm) {
|
|
15577
15458
|
const children = elm.children;
|