@rindo/core 4.26.0 → 4.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +4 -4
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +1518 -1472
- 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 +4 -4
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +4 -4
- package/internal/app-data/index.cjs +3 -14
- package/internal/app-data/index.js +0 -11
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +304 -263
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +3 -3
- package/internal/hydrate/index.js +308 -266
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +110 -111
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +6 -13
- package/internal/testing/index.js +299 -266
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +231 -231
- package/mock-doc/index.js +228 -228
- package/mock-doc/package.json +1 -1
- package/package.json +2 -2
- package/screenshot/index.js +4 -4
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +3 -3
- package/sys/node/index.js +9 -9
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +9 -16
- package/testing/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/hydrate",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.27.1",
|
|
4
4
|
"description": "Rindo internal hydrate platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Hydrate Runner v4.
|
|
2
|
+
Rindo Hydrate Runner v4.27.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -345,19 +345,19 @@ var MockCustomElementRegistry = class {
|
|
|
345
345
|
this.__whenDefined.delete(tagName);
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
const hosts =
|
|
348
|
+
const doc = this.win.document;
|
|
349
|
+
if (doc != null) {
|
|
350
|
+
const hosts = doc.querySelectorAll(tagName);
|
|
351
351
|
hosts.forEach((host) => {
|
|
352
352
|
if (upgradedElements.has(host) === false) {
|
|
353
|
-
tempDisableCallbacks.add(
|
|
354
|
-
const upgradedCmp = createCustomElement(this,
|
|
353
|
+
tempDisableCallbacks.add(doc);
|
|
354
|
+
const upgradedCmp = createCustomElement(this, doc, tagName);
|
|
355
355
|
for (let i = 0; i < host.childNodes.length; i++) {
|
|
356
356
|
const childNode = host.childNodes[i];
|
|
357
357
|
childNode.remove();
|
|
358
358
|
upgradedCmp.appendChild(childNode);
|
|
359
359
|
}
|
|
360
|
-
tempDisableCallbacks.delete(
|
|
360
|
+
tempDisableCallbacks.delete(doc);
|
|
361
361
|
if (proxyElements.has(host)) {
|
|
362
362
|
proxyElements.set(host, upgradedCmp);
|
|
363
363
|
}
|
|
@@ -1447,6 +1447,7 @@ var EntityDecoder = class {
|
|
|
1447
1447
|
case EntityDecoderState.NamedEntity: {
|
|
1448
1448
|
return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
|
|
1449
1449
|
}
|
|
1450
|
+
// Otherwise, emit a numeric entity if we have one.
|
|
1450
1451
|
case EntityDecoderState.NumericDecimal: {
|
|
1451
1452
|
return this.emitNumericEntity(0, 2);
|
|
1452
1453
|
}
|
|
@@ -8494,6 +8495,7 @@ function endTagInSelectInTable(p, token) {
|
|
|
8494
8495
|
}
|
|
8495
8496
|
function startTagInTemplate(p, token) {
|
|
8496
8497
|
switch (token.tagID) {
|
|
8498
|
+
// First, handle tags that can start without a mode change
|
|
8497
8499
|
case TAG_ID.BASE:
|
|
8498
8500
|
case TAG_ID.BASEFONT:
|
|
8499
8501
|
case TAG_ID.BGSOUND:
|
|
@@ -8507,6 +8509,7 @@ function startTagInTemplate(p, token) {
|
|
|
8507
8509
|
startTagInHead(p, token);
|
|
8508
8510
|
break;
|
|
8509
8511
|
}
|
|
8512
|
+
// Re-process the token in the appropriate mode
|
|
8510
8513
|
case TAG_ID.CAPTION:
|
|
8511
8514
|
case TAG_ID.COLGROUP:
|
|
8512
8515
|
case TAG_ID.TBODY:
|
|
@@ -8798,11 +8801,11 @@ function parseFragment(fragmentContext, html, options) {
|
|
|
8798
8801
|
// src/mock-doc/parse-util.ts
|
|
8799
8802
|
var docParser = /* @__PURE__ */ new WeakMap();
|
|
8800
8803
|
function parseDocumentUtil(ownerDocument, html) {
|
|
8801
|
-
const
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
return
|
|
8804
|
+
const doc = parse(html.trim(), getParser(ownerDocument));
|
|
8805
|
+
doc.documentElement = doc.firstElementChild;
|
|
8806
|
+
doc.head = doc.documentElement.firstElementChild;
|
|
8807
|
+
doc.body = doc.head.nextElementSibling;
|
|
8808
|
+
return doc;
|
|
8806
8809
|
}
|
|
8807
8810
|
function parseFragmentUtil(ownerDocument, html) {
|
|
8808
8811
|
if (typeof html === "string") {
|
|
@@ -8820,9 +8823,9 @@ function getParser(ownerDocument) {
|
|
|
8820
8823
|
}
|
|
8821
8824
|
const treeAdapter = {
|
|
8822
8825
|
createDocument() {
|
|
8823
|
-
const
|
|
8824
|
-
|
|
8825
|
-
return
|
|
8826
|
+
const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
|
|
8827
|
+
doc["x-mode"] = "no-quirks";
|
|
8828
|
+
return doc;
|
|
8826
8829
|
},
|
|
8827
8830
|
setNodeSourceCodeLocation(node, location2) {
|
|
8828
8831
|
node.sourceCodeLocation = location2;
|
|
@@ -8860,22 +8863,22 @@ function getParser(ownerDocument) {
|
|
|
8860
8863
|
getTemplateContent(templateElement) {
|
|
8861
8864
|
return templateElement.content;
|
|
8862
8865
|
},
|
|
8863
|
-
setDocumentType(
|
|
8864
|
-
let doctypeNode =
|
|
8866
|
+
setDocumentType(doc, name, publicId, systemId) {
|
|
8867
|
+
let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
|
|
8865
8868
|
if (doctypeNode == null) {
|
|
8866
8869
|
doctypeNode = ownerDocument.createDocumentTypeNode();
|
|
8867
|
-
|
|
8870
|
+
doc.insertBefore(doctypeNode, doc.firstChild);
|
|
8868
8871
|
}
|
|
8869
8872
|
doctypeNode.nodeValue = "!DOCTYPE";
|
|
8870
8873
|
doctypeNode["x-name"] = name;
|
|
8871
8874
|
doctypeNode["x-publicId"] = publicId;
|
|
8872
8875
|
doctypeNode["x-systemId"] = systemId;
|
|
8873
8876
|
},
|
|
8874
|
-
setDocumentMode(
|
|
8875
|
-
|
|
8877
|
+
setDocumentMode(doc, mode) {
|
|
8878
|
+
doc["x-mode"] = mode;
|
|
8876
8879
|
},
|
|
8877
|
-
getDocumentMode(
|
|
8878
|
-
return
|
|
8880
|
+
getDocumentMode(doc) {
|
|
8881
|
+
return doc["x-mode"];
|
|
8879
8882
|
},
|
|
8880
8883
|
detachNode(node) {
|
|
8881
8884
|
node.remove();
|
|
@@ -8989,14 +8992,14 @@ var jquery_default = (
|
|
|
8989
8992
|
*
|
|
8990
8993
|
* Date: 2023-12-11T17:55Z
|
|
8991
8994
|
*/
|
|
8992
|
-
function(global2, factory) {
|
|
8995
|
+
(function(global2, factory) {
|
|
8993
8996
|
"use strict";
|
|
8994
8997
|
if (true) {
|
|
8995
8998
|
return factory(global2, true);
|
|
8996
8999
|
} else {
|
|
8997
9000
|
factory(global2);
|
|
8998
9001
|
}
|
|
8999
|
-
}({
|
|
9002
|
+
})({
|
|
9000
9003
|
document: {
|
|
9001
9004
|
createElement() {
|
|
9002
9005
|
return {};
|
|
@@ -9051,9 +9054,9 @@ var jquery_default = (
|
|
|
9051
9054
|
nonce: true,
|
|
9052
9055
|
noModule: true
|
|
9053
9056
|
};
|
|
9054
|
-
function DOMEval(code, node,
|
|
9055
|
-
|
|
9056
|
-
var i2, script =
|
|
9057
|
+
function DOMEval(code, node, doc) {
|
|
9058
|
+
doc = doc || document2;
|
|
9059
|
+
var i2, script = doc.createElement("script");
|
|
9057
9060
|
script.text = code;
|
|
9058
9061
|
if (node) {
|
|
9059
9062
|
for (i2 in preservedScriptAttributes) {
|
|
@@ -9062,7 +9065,7 @@ var jquery_default = (
|
|
|
9062
9065
|
}
|
|
9063
9066
|
}
|
|
9064
9067
|
}
|
|
9065
|
-
|
|
9068
|
+
doc.head.appendChild(script).parentNode.removeChild(script);
|
|
9066
9069
|
}
|
|
9067
9070
|
const jQuery = {};
|
|
9068
9071
|
var version = "4.0.0-pre+9352011a7.dirty +selector", rhtmlSuffix = /HTML$/i, jQueryOrig = function(selector, context) {
|
|
@@ -9199,8 +9202,8 @@ var jquery_default = (
|
|
|
9199
9202
|
},
|
|
9200
9203
|
// Evaluates a script in a provided context; falls back to the global one
|
|
9201
9204
|
// if not specified.
|
|
9202
|
-
globalEval: function(code, options,
|
|
9203
|
-
DOMEval(code, { nonce: options && options.nonce },
|
|
9205
|
+
globalEval: function(code, options, doc) {
|
|
9206
|
+
DOMEval(code, { nonce: options && options.nonce }, doc);
|
|
9204
9207
|
},
|
|
9205
9208
|
each: function(obj, callback) {
|
|
9206
9209
|
var length, i2 = 0;
|
|
@@ -9689,11 +9692,11 @@ var jquery_default = (
|
|
|
9689
9692
|
});
|
|
9690
9693
|
}
|
|
9691
9694
|
function setDocument(node) {
|
|
9692
|
-
var subWindow,
|
|
9693
|
-
if (
|
|
9695
|
+
var subWindow, doc = node ? node.ownerDocument || node : document2;
|
|
9696
|
+
if (doc == document$1 || doc.nodeType !== 9) {
|
|
9694
9697
|
return;
|
|
9695
9698
|
}
|
|
9696
|
-
document$1 =
|
|
9699
|
+
document$1 = doc;
|
|
9697
9700
|
documentElement$1 = document$1.documentElement;
|
|
9698
9701
|
documentIsHTML = !jQuery.isXMLDoc(document$1);
|
|
9699
9702
|
if (isIE && document2 != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
|
|
@@ -14038,10 +14041,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
|
14038
14041
|
}
|
|
14039
14042
|
createElement(tagName) {
|
|
14040
14043
|
if (tagName === "#document" /* DOCUMENT_NODE */) {
|
|
14041
|
-
const
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
return
|
|
14044
|
+
const doc = new _MockDocument(false);
|
|
14045
|
+
doc.nodeName = tagName;
|
|
14046
|
+
doc.parentNode = null;
|
|
14047
|
+
return doc;
|
|
14045
14048
|
}
|
|
14046
14049
|
return createElement(this, tagName);
|
|
14047
14050
|
}
|
|
@@ -14081,10 +14084,10 @@ var MockDocument = class _MockDocument extends MockHTMLElement {
|
|
|
14081
14084
|
title.textContent = value;
|
|
14082
14085
|
}
|
|
14083
14086
|
};
|
|
14084
|
-
function resetDocument(
|
|
14085
|
-
if (
|
|
14086
|
-
resetEventListeners(
|
|
14087
|
-
const documentElement =
|
|
14087
|
+
function resetDocument(doc) {
|
|
14088
|
+
if (doc != null) {
|
|
14089
|
+
resetEventListeners(doc);
|
|
14090
|
+
const documentElement = doc.documentElement;
|
|
14088
14091
|
if (documentElement != null) {
|
|
14089
14092
|
resetElement(documentElement);
|
|
14090
14093
|
for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
|
|
@@ -14093,25 +14096,25 @@ function resetDocument(doc2) {
|
|
|
14093
14096
|
childNode.childNodes.length = 0;
|
|
14094
14097
|
}
|
|
14095
14098
|
}
|
|
14096
|
-
for (const key in
|
|
14097
|
-
if (
|
|
14098
|
-
delete
|
|
14099
|
+
for (const key in doc) {
|
|
14100
|
+
if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
|
|
14101
|
+
delete doc[key];
|
|
14099
14102
|
}
|
|
14100
14103
|
}
|
|
14101
14104
|
try {
|
|
14102
|
-
|
|
14105
|
+
doc.nodeName = "#document" /* DOCUMENT_NODE */;
|
|
14103
14106
|
} catch (e) {
|
|
14104
14107
|
}
|
|
14105
14108
|
try {
|
|
14106
|
-
|
|
14109
|
+
doc.nodeType = 9 /* DOCUMENT_NODE */;
|
|
14107
14110
|
} catch (e) {
|
|
14108
14111
|
}
|
|
14109
14112
|
try {
|
|
14110
|
-
|
|
14113
|
+
doc.cookie = "";
|
|
14111
14114
|
} catch (e) {
|
|
14112
14115
|
}
|
|
14113
14116
|
try {
|
|
14114
|
-
|
|
14117
|
+
doc.referrer = "";
|
|
14115
14118
|
} catch (e) {
|
|
14116
14119
|
}
|
|
14117
14120
|
}
|
|
@@ -14190,9 +14193,6 @@ import { BUILD as BUILD3 } from "@rindo/core/internal/app-data";
|
|
|
14190
14193
|
// src/utils/es2022-rewire-class-members.ts
|
|
14191
14194
|
import { BUILD as BUILD2 } from "@rindo/core/internal/app-data";
|
|
14192
14195
|
|
|
14193
|
-
// src/client/client-host-ref.ts
|
|
14194
|
-
var hostRefs = BUILD3.hotModuleReplacement ? window.__RINDO_HOSTREFS__ || (window.__RINDO_HOSTREFS__ = /* @__PURE__ */ new WeakMap()) : /* @__PURE__ */ new WeakMap();
|
|
14195
|
-
|
|
14196
14196
|
// src/client/client-load-module.ts
|
|
14197
14197
|
import { BUILD as BUILD5 } from "@rindo/core/internal/app-data";
|
|
14198
14198
|
|
|
@@ -14212,7 +14212,6 @@ import { BUILD as BUILD7 } from "@rindo/core/internal/app-data";
|
|
|
14212
14212
|
// src/client/client-window.ts
|
|
14213
14213
|
import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
|
|
14214
14214
|
var win = typeof window !== "undefined" ? window : {};
|
|
14215
|
-
var doc = win.document || { head: {} };
|
|
14216
14215
|
var H = win.HTMLElement || class {
|
|
14217
14216
|
};
|
|
14218
14217
|
var supportsShadow = BUILD6.shadowDom;
|
|
@@ -14412,14 +14411,14 @@ import { BUILD as BUILD27 } from "@rindo/core/internal/app-data";
|
|
|
14412
14411
|
import { BUILD as BUILD28 } from "@rindo/core/internal/app-data";
|
|
14413
14412
|
|
|
14414
14413
|
// src/compiler/html/canonical-link.ts
|
|
14415
|
-
var updateCanonicalLink = (
|
|
14414
|
+
var updateCanonicalLink = (doc, href) => {
|
|
14416
14415
|
var _a2;
|
|
14417
|
-
let canonicalLinkElm =
|
|
14416
|
+
let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
|
|
14418
14417
|
if (typeof href === "string") {
|
|
14419
14418
|
if (canonicalLinkElm == null) {
|
|
14420
|
-
canonicalLinkElm =
|
|
14419
|
+
canonicalLinkElm = doc.createElement("link");
|
|
14421
14420
|
canonicalLinkElm.setAttribute("rel", "canonical");
|
|
14422
|
-
|
|
14421
|
+
doc.head.appendChild(canonicalLinkElm);
|
|
14423
14422
|
}
|
|
14424
14423
|
canonicalLinkElm.setAttribute("href", href);
|
|
14425
14424
|
} else {
|
|
@@ -14433,11 +14432,11 @@ var updateCanonicalLink = (doc2, href) => {
|
|
|
14433
14432
|
};
|
|
14434
14433
|
|
|
14435
14434
|
// src/compiler/html/relocate-meta-charset.ts
|
|
14436
|
-
var relocateMetaCharset = (
|
|
14437
|
-
const head =
|
|
14435
|
+
var relocateMetaCharset = (doc) => {
|
|
14436
|
+
const head = doc.head;
|
|
14438
14437
|
let charsetElm = head.querySelector("meta[charset]");
|
|
14439
14438
|
if (charsetElm == null) {
|
|
14440
|
-
charsetElm =
|
|
14439
|
+
charsetElm = doc.createElement("meta");
|
|
14441
14440
|
charsetElm.setAttribute("charset", "utf-8");
|
|
14442
14441
|
} else {
|
|
14443
14442
|
charsetElm.remove();
|
|
@@ -14712,13 +14711,13 @@ var parseCss = (css, filePath) => {
|
|
|
14712
14711
|
const m = match(/^@([-\w]+)?document *([^{]+)/);
|
|
14713
14712
|
if (!m) return null;
|
|
14714
14713
|
const vendor = trim(m[1]);
|
|
14715
|
-
const
|
|
14714
|
+
const doc = trim(m[2]);
|
|
14716
14715
|
if (!open()) return error(`@document missing '{'`);
|
|
14717
14716
|
const style = comments().concat(rules());
|
|
14718
14717
|
if (!close()) return error(`@document missing '}'`);
|
|
14719
14718
|
return pos({
|
|
14720
14719
|
type: 3 /* Document */,
|
|
14721
|
-
document:
|
|
14720
|
+
document: doc,
|
|
14722
14721
|
vendor,
|
|
14723
14722
|
rules: style
|
|
14724
14723
|
});
|
|
@@ -15044,11 +15043,11 @@ var serializeCssPage = (opts, node) => {
|
|
|
15044
15043
|
};
|
|
15045
15044
|
var serializeCssDocument = (opts, node) => {
|
|
15046
15045
|
const documentCss = serializeCssMapVisit(opts, node.rules);
|
|
15047
|
-
const
|
|
15046
|
+
const doc = "@" + (node.vendor || "") + "document " + node.document;
|
|
15048
15047
|
if (documentCss === "") {
|
|
15049
15048
|
return "";
|
|
15050
15049
|
}
|
|
15051
|
-
return
|
|
15050
|
+
return doc + "{" + documentCss + "}";
|
|
15052
15051
|
};
|
|
15053
15052
|
var serializeCssMapVisit = (opts, nodes) => {
|
|
15054
15053
|
let rtn = "";
|
|
@@ -15146,12 +15145,12 @@ var collectUsedSelectors = (usedSelectors, elm) => {
|
|
|
15146
15145
|
};
|
|
15147
15146
|
|
|
15148
15147
|
// src/compiler/html/remove-unused-styles.ts
|
|
15149
|
-
var removeUnusedStyles = (
|
|
15148
|
+
var removeUnusedStyles = (doc, diagnostics) => {
|
|
15150
15149
|
try {
|
|
15151
|
-
const styleElms =
|
|
15150
|
+
const styleElms = doc.head.querySelectorAll(`style[data-styles]`);
|
|
15152
15151
|
const styleLen = styleElms.length;
|
|
15153
15152
|
if (styleLen > 0) {
|
|
15154
|
-
const usedSelectors = getUsedSelectors(
|
|
15153
|
+
const usedSelectors = getUsedSelectors(doc.documentElement);
|
|
15155
15154
|
for (let i = 0; i < styleLen; i++) {
|
|
15156
15155
|
removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
|
|
15157
15156
|
}
|
|
@@ -15284,41 +15283,41 @@ function collectAttributes(node) {
|
|
|
15284
15283
|
var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
|
|
15285
15284
|
|
|
15286
15285
|
// src/hydrate/runner/patch-dom-implementation.ts
|
|
15287
|
-
function patchDomImplementation(
|
|
15286
|
+
function patchDomImplementation(doc, opts) {
|
|
15288
15287
|
let win2;
|
|
15289
|
-
if (
|
|
15288
|
+
if (doc.defaultView != null) {
|
|
15290
15289
|
opts.destroyWindow = true;
|
|
15291
|
-
patchWindow(
|
|
15292
|
-
win2 =
|
|
15290
|
+
patchWindow(doc.defaultView);
|
|
15291
|
+
win2 = doc.defaultView;
|
|
15293
15292
|
} else {
|
|
15294
15293
|
opts.destroyWindow = true;
|
|
15295
15294
|
opts.destroyDocument = false;
|
|
15296
15295
|
win2 = new MockWindow(false);
|
|
15297
15296
|
}
|
|
15298
|
-
if (win2.document !==
|
|
15299
|
-
win2.document =
|
|
15297
|
+
if (win2.document !== doc) {
|
|
15298
|
+
win2.document = doc;
|
|
15300
15299
|
}
|
|
15301
|
-
if (
|
|
15302
|
-
|
|
15300
|
+
if (doc.defaultView !== win2) {
|
|
15301
|
+
doc.defaultView = win2;
|
|
15303
15302
|
}
|
|
15304
|
-
const HTMLElement2 =
|
|
15303
|
+
const HTMLElement2 = doc.documentElement.constructor.prototype;
|
|
15305
15304
|
if (typeof HTMLElement2.getRootNode !== "function") {
|
|
15306
|
-
const elm =
|
|
15305
|
+
const elm = doc.createElement("unknown-element");
|
|
15307
15306
|
const HTMLUnknownElement = elm.constructor.prototype;
|
|
15308
15307
|
HTMLUnknownElement.getRootNode = getRootNode;
|
|
15309
15308
|
}
|
|
15310
|
-
if (typeof
|
|
15311
|
-
const CustomEvent2 =
|
|
15309
|
+
if (typeof doc.createEvent === "function") {
|
|
15310
|
+
const CustomEvent2 = doc.createEvent("CustomEvent").constructor;
|
|
15312
15311
|
if (win2.CustomEvent !== CustomEvent2) {
|
|
15313
15312
|
win2.CustomEvent = CustomEvent2;
|
|
15314
15313
|
}
|
|
15315
15314
|
}
|
|
15316
15315
|
try {
|
|
15317
|
-
win2.__rindo_baseURI =
|
|
15316
|
+
win2.__rindo_baseURI = doc.baseURI;
|
|
15318
15317
|
} catch (e) {
|
|
15319
|
-
Object.defineProperty(
|
|
15318
|
+
Object.defineProperty(doc, "baseURI", {
|
|
15320
15319
|
get() {
|
|
15321
|
-
const baseElm =
|
|
15320
|
+
const baseElm = doc.querySelector("base[href]");
|
|
15322
15321
|
if (baseElm) {
|
|
15323
15322
|
return new URL(baseElm.getAttribute("href"), win2.location.href).href;
|
|
15324
15323
|
}
|
|
@@ -15529,7 +15528,7 @@ var docData = {
|
|
|
15529
15528
|
rootLevelIds: 0,
|
|
15530
15529
|
staticComponents: /* @__PURE__ */ new Set()
|
|
15531
15530
|
};
|
|
15532
|
-
function initializeWindow(win2,
|
|
15531
|
+
function initializeWindow(win2, doc, opts, results) {
|
|
15533
15532
|
if (typeof opts.url === "string") {
|
|
15534
15533
|
try {
|
|
15535
15534
|
win2.location.href = opts.url;
|
|
@@ -15544,31 +15543,31 @@ function initializeWindow(win2, doc2, opts, results) {
|
|
|
15544
15543
|
}
|
|
15545
15544
|
if (typeof opts.cookie === "string") {
|
|
15546
15545
|
try {
|
|
15547
|
-
|
|
15546
|
+
doc.cookie = opts.cookie;
|
|
15548
15547
|
} catch (e) {
|
|
15549
15548
|
}
|
|
15550
15549
|
}
|
|
15551
15550
|
if (typeof opts.referrer === "string") {
|
|
15552
15551
|
try {
|
|
15553
|
-
|
|
15552
|
+
doc.referrer = opts.referrer;
|
|
15554
15553
|
} catch (e) {
|
|
15555
15554
|
}
|
|
15556
15555
|
}
|
|
15557
15556
|
if (typeof opts.direction === "string") {
|
|
15558
15557
|
try {
|
|
15559
|
-
|
|
15558
|
+
doc.documentElement.setAttribute("dir", opts.direction);
|
|
15560
15559
|
} catch (e) {
|
|
15561
15560
|
}
|
|
15562
15561
|
}
|
|
15563
15562
|
if (typeof opts.language === "string") {
|
|
15564
15563
|
try {
|
|
15565
|
-
|
|
15564
|
+
doc.documentElement.setAttribute("lang", opts.language);
|
|
15566
15565
|
} catch (e) {
|
|
15567
15566
|
}
|
|
15568
15567
|
}
|
|
15569
15568
|
if (typeof opts.buildId === "string") {
|
|
15570
15569
|
try {
|
|
15571
|
-
|
|
15570
|
+
doc.documentElement.setAttribute("data-rindo-build", opts.buildId);
|
|
15572
15571
|
} catch (e) {
|
|
15573
15572
|
}
|
|
15574
15573
|
}
|
|
@@ -15580,7 +15579,7 @@ function initializeWindow(win2, doc2, opts, results) {
|
|
|
15580
15579
|
constrainTimeouts(win2);
|
|
15581
15580
|
}
|
|
15582
15581
|
runtimeLogging(win2, opts, results);
|
|
15583
|
-
|
|
15582
|
+
doc[RINDO_DOC_DATA] = docData;
|
|
15584
15583
|
return win2;
|
|
15585
15584
|
}
|
|
15586
15585
|
|
|
@@ -15598,18 +15597,18 @@ function renderToString(html, options, asStream) {
|
|
|
15598
15597
|
opts.constrainTimeouts = false;
|
|
15599
15598
|
return hydrateDocument(html, opts, asStream);
|
|
15600
15599
|
}
|
|
15601
|
-
function hydrateDocument(
|
|
15600
|
+
function hydrateDocument(doc, options, asStream) {
|
|
15602
15601
|
const opts = normalizeHydrateOptions(options);
|
|
15603
15602
|
let win2 = null;
|
|
15604
15603
|
const results = generateHydrateResults(opts);
|
|
15605
15604
|
if (hasError(results.diagnostics)) {
|
|
15606
15605
|
return Promise.resolve(results);
|
|
15607
15606
|
}
|
|
15608
|
-
if (typeof
|
|
15607
|
+
if (typeof doc === "string") {
|
|
15609
15608
|
try {
|
|
15610
15609
|
opts.destroyWindow = true;
|
|
15611
15610
|
opts.destroyDocument = true;
|
|
15612
|
-
win2 = new MockWindow(
|
|
15611
|
+
win2 = new MockWindow(doc);
|
|
15613
15612
|
if (!asStream) {
|
|
15614
15613
|
return render(win2, opts, results).then(() => results);
|
|
15615
15614
|
}
|
|
@@ -15623,10 +15622,10 @@ function hydrateDocument(doc2, options, asStream) {
|
|
|
15623
15622
|
return Promise.resolve(results);
|
|
15624
15623
|
}
|
|
15625
15624
|
}
|
|
15626
|
-
if (isValidDocument(
|
|
15625
|
+
if (isValidDocument(doc)) {
|
|
15627
15626
|
try {
|
|
15628
15627
|
opts.destroyDocument = false;
|
|
15629
|
-
win2 = patchDomImplementation(
|
|
15628
|
+
win2 = patchDomImplementation(doc, opts);
|
|
15630
15629
|
if (!asStream) {
|
|
15631
15630
|
return render(win2, opts, results).then(() => results);
|
|
15632
15631
|
}
|
|
@@ -15683,41 +15682,41 @@ async function afterHydrate(win2, opts, results, resolve) {
|
|
|
15683
15682
|
return resolve(finalizeHydrate(win2, win2.document, opts, results));
|
|
15684
15683
|
}
|
|
15685
15684
|
}
|
|
15686
|
-
function finalizeHydrate(win2,
|
|
15685
|
+
function finalizeHydrate(win2, doc, opts, results) {
|
|
15687
15686
|
try {
|
|
15688
|
-
inspectElement(results,
|
|
15687
|
+
inspectElement(results, doc.documentElement, 0);
|
|
15689
15688
|
if (opts.removeUnusedStyles !== false) {
|
|
15690
15689
|
try {
|
|
15691
|
-
removeUnusedStyles(
|
|
15690
|
+
removeUnusedStyles(doc, results.diagnostics);
|
|
15692
15691
|
} catch (e) {
|
|
15693
15692
|
renderCatchError(results, e);
|
|
15694
15693
|
}
|
|
15695
15694
|
}
|
|
15696
15695
|
if (typeof opts.title === "string") {
|
|
15697
15696
|
try {
|
|
15698
|
-
|
|
15697
|
+
doc.title = opts.title;
|
|
15699
15698
|
} catch (e) {
|
|
15700
15699
|
renderCatchError(results, e);
|
|
15701
15700
|
}
|
|
15702
15701
|
}
|
|
15703
|
-
results.title =
|
|
15702
|
+
results.title = doc.title;
|
|
15704
15703
|
if (opts.removeScripts) {
|
|
15705
|
-
removeScripts(
|
|
15704
|
+
removeScripts(doc.documentElement);
|
|
15706
15705
|
}
|
|
15707
15706
|
try {
|
|
15708
|
-
updateCanonicalLink(
|
|
15707
|
+
updateCanonicalLink(doc, opts.canonicalUrl);
|
|
15709
15708
|
} catch (e) {
|
|
15710
15709
|
renderCatchError(results, e);
|
|
15711
15710
|
}
|
|
15712
15711
|
try {
|
|
15713
|
-
relocateMetaCharset(
|
|
15712
|
+
relocateMetaCharset(doc);
|
|
15714
15713
|
} catch (e) {
|
|
15715
15714
|
}
|
|
15716
15715
|
if (!hasError(results.diagnostics)) {
|
|
15717
15716
|
results.httpStatus = 200;
|
|
15718
15717
|
}
|
|
15719
15718
|
try {
|
|
15720
|
-
const metaStatus =
|
|
15719
|
+
const metaStatus = doc.head.querySelector('meta[http-equiv="status"]');
|
|
15721
15720
|
if (metaStatus != null) {
|
|
15722
15721
|
const metaStatusContent = metaStatus.getAttribute("content");
|
|
15723
15722
|
if (metaStatusContent && metaStatusContent.length > 0) {
|
|
@@ -15727,25 +15726,25 @@ function finalizeHydrate(win2, doc2, opts, results) {
|
|
|
15727
15726
|
} catch (e) {
|
|
15728
15727
|
}
|
|
15729
15728
|
if (opts.clientHydrateAnnotations) {
|
|
15730
|
-
|
|
15729
|
+
doc.documentElement.classList.add("hydrated");
|
|
15731
15730
|
}
|
|
15732
15731
|
if (opts.serializeToHtml) {
|
|
15733
|
-
results.html = serializeDocumentToString(
|
|
15732
|
+
results.html = serializeDocumentToString(doc, opts);
|
|
15734
15733
|
}
|
|
15735
15734
|
} catch (e) {
|
|
15736
15735
|
renderCatchError(results, e);
|
|
15737
15736
|
}
|
|
15738
|
-
destroyWindow(win2,
|
|
15737
|
+
destroyWindow(win2, doc, opts, results);
|
|
15739
15738
|
return results;
|
|
15740
15739
|
}
|
|
15741
|
-
function destroyWindow(win2,
|
|
15740
|
+
function destroyWindow(win2, doc, opts, results) {
|
|
15742
15741
|
if (!opts.destroyWindow) {
|
|
15743
15742
|
return;
|
|
15744
15743
|
}
|
|
15745
15744
|
try {
|
|
15746
15745
|
if (!opts.destroyDocument) {
|
|
15747
15746
|
win2.document = null;
|
|
15748
|
-
|
|
15747
|
+
doc.defaultView = null;
|
|
15749
15748
|
}
|
|
15750
15749
|
if (win2.close) {
|
|
15751
15750
|
win2.close();
|
|
@@ -15754,8 +15753,8 @@ function destroyWindow(win2, doc2, opts, results) {
|
|
|
15754
15753
|
renderCatchError(results, e);
|
|
15755
15754
|
}
|
|
15756
15755
|
}
|
|
15757
|
-
function serializeDocumentToString(
|
|
15758
|
-
return serializeNodeToHtml(
|
|
15756
|
+
function serializeDocumentToString(doc, opts) {
|
|
15757
|
+
return serializeNodeToHtml(doc, {
|
|
15759
15758
|
approximateLineWidth: opts.approximateLineWidth,
|
|
15760
15759
|
outerHtml: false,
|
|
15761
15760
|
prettyHtml: opts.prettyHtml,
|
|
@@ -15767,8 +15766,8 @@ function serializeDocumentToString(doc2, opts) {
|
|
|
15767
15766
|
fullDocument: opts.fullDocument
|
|
15768
15767
|
});
|
|
15769
15768
|
}
|
|
15770
|
-
function isValidDocument(
|
|
15771
|
-
return
|
|
15769
|
+
function isValidDocument(doc) {
|
|
15770
|
+
return doc != null && doc.nodeType === 9 && doc.documentElement != null && doc.documentElement.nodeType === 1 && doc.body != null && doc.body.nodeType === 1;
|
|
15772
15771
|
}
|
|
15773
15772
|
function removeScripts(elm) {
|
|
15774
15773
|
const children = elm.children;
|
package/internal/package.json
CHANGED
|
@@ -100,16 +100,6 @@ export interface BuildFeatures {
|
|
|
100
100
|
propString: boolean;
|
|
101
101
|
modernPropertyDecls: boolean;
|
|
102
102
|
lifecycle: boolean;
|
|
103
|
-
cmpDidLoad: boolean;
|
|
104
|
-
cmpShouldUpdate: boolean;
|
|
105
|
-
cmpWillLoad: boolean;
|
|
106
|
-
cmpDidUpdate: boolean;
|
|
107
|
-
cmpWillUpdate: boolean;
|
|
108
|
-
cmpWillRender: boolean;
|
|
109
|
-
cmpDidRender: boolean;
|
|
110
|
-
cmpDidUnload: boolean;
|
|
111
|
-
connectedCallback: boolean;
|
|
112
|
-
disconnectedCallback: boolean;
|
|
113
103
|
asyncLoading: boolean;
|
|
114
104
|
observeAttribute: boolean;
|
|
115
105
|
reflect: boolean;
|
|
@@ -447,7 +437,6 @@ export interface ComponentCompilerFeatures {
|
|
|
447
437
|
hasComponentDidUpdateFn: boolean;
|
|
448
438
|
hasComponentWillRenderFn: boolean;
|
|
449
439
|
hasComponentDidRenderFn: boolean;
|
|
450
|
-
hasComponentDidUnloadFn: boolean;
|
|
451
440
|
hasConnectedCallbackFn: boolean;
|
|
452
441
|
hasDisconnectedCallbackFn: boolean;
|
|
453
442
|
hasElement: boolean;
|
|
@@ -941,6 +930,7 @@ export interface HostElement extends HTMLElement {
|
|
|
941
930
|
disconnectedCallback?: () => void;
|
|
942
931
|
host?: Element;
|
|
943
932
|
forceUpdate?: () => void;
|
|
933
|
+
__rindo__getHostRef?: () => HostRef;
|
|
944
934
|
/**
|
|
945
935
|
* Unique rindo id for this element
|
|
946
936
|
*/
|
|
@@ -1245,7 +1235,7 @@ export interface RenderNode extends HostElement {
|
|
|
1245
1235
|
['s-ol']?: RenderNode;
|
|
1246
1236
|
/**
|
|
1247
1237
|
* Node reference:
|
|
1248
|
-
* This is a reference
|
|
1238
|
+
* This is a reference from an original location node
|
|
1249
1239
|
* back to the node that's been moved around.
|
|
1250
1240
|
*/
|
|
1251
1241
|
['s-nr']?: PatchedSlotNode | RenderNode;
|
|
@@ -1496,7 +1486,9 @@ export type ComponentRuntimeReflectingAttr = [string, string | undefined];
|
|
|
1496
1486
|
* keys in a `WeakMap` which maps {@link HostElement} instances to their
|
|
1497
1487
|
* associated {@link HostRef} instance.
|
|
1498
1488
|
*/
|
|
1499
|
-
export type RuntimeRef = HostElement | {
|
|
1489
|
+
export type RuntimeRef = HostElement | {
|
|
1490
|
+
__rindo__getHostRef?: () => HostRef;
|
|
1491
|
+
};
|
|
1500
1492
|
/**
|
|
1501
1493
|
* Interface used to track an Element, it's virtual Node (`VNode`), and other data
|
|
1502
1494
|
*/
|
|
@@ -2267,6 +2259,7 @@ export interface TypesModule {
|
|
|
2267
2259
|
export type TypeInfo = {
|
|
2268
2260
|
name: string;
|
|
2269
2261
|
type: string;
|
|
2262
|
+
attributeName?: string;
|
|
2270
2263
|
optional: boolean;
|
|
2271
2264
|
required: boolean;
|
|
2272
2265
|
internal: boolean;
|