@rindo/core 4.25.3 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +37 -13
- 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 +405 -14
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/shadow-css.js +30 -6
- package/internal/hydrate/index.js +434 -15
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +22 -5
- package/internal/hydrate/runner.js +29 -4
- package/internal/package.json +1 -1
- package/internal/rindo-public-compiler.d.ts +23 -6
- package/internal/testing/index.js +404 -23
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +3 -3
- package/mock-doc/index.d.ts +5 -1
- package/mock-doc/index.js +3 -3
- 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/jest/jest-27-and-under/matchers/html.d.ts +2 -1
- package/testing/jest/jest-28/matchers/html.d.ts +2 -1
- package/testing/jest/jest-29/matchers/html.d.ts +2 -1
- package/testing/package.json +1 -1
package/internal/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Client Platform v4.
|
|
2
|
+
Rindo Client Platform v4.26.0 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -315,6 +315,11 @@ function queryNonceMetaTagContent(doc2) {
|
|
|
315
315
|
return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
// src/utils/regular-expression.ts
|
|
319
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
320
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
321
|
+
};
|
|
322
|
+
|
|
318
323
|
// src/utils/result.ts
|
|
319
324
|
var result_exports = {};
|
|
320
325
|
__export(result_exports, {
|
|
@@ -1102,7 +1107,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1102
1107
|
delete hostElm["s-sc"];
|
|
1103
1108
|
}
|
|
1104
1109
|
}
|
|
1105
|
-
if (!plt.$orgLocNodes$) {
|
|
1110
|
+
if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
|
|
1106
1111
|
initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
|
|
1107
1112
|
}
|
|
1108
1113
|
hostElm[HYDRATE_ID] = hostId;
|
|
@@ -1196,13 +1201,25 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1196
1201
|
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
1197
1202
|
});
|
|
1198
1203
|
}
|
|
1199
|
-
if (BUILD12.shadowDom && shadowRoot) {
|
|
1204
|
+
if (BUILD12.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
|
|
1200
1205
|
let rnIdex = 0;
|
|
1201
1206
|
const rnLen = shadowRootNodes.length;
|
|
1202
|
-
|
|
1203
|
-
|
|
1207
|
+
if (rnLen) {
|
|
1208
|
+
for (rnIdex; rnIdex < rnLen; rnIdex++) {
|
|
1209
|
+
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
|
|
1210
|
+
}
|
|
1211
|
+
Array.from(hostElm.childNodes).forEach((node) => {
|
|
1212
|
+
if (typeof node["s-sn"] !== "string") {
|
|
1213
|
+
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
|
|
1214
|
+
node.removeAttribute("hidden");
|
|
1215
|
+
} else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
|
|
1216
|
+
node.parentNode.removeChild(node);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1204
1220
|
}
|
|
1205
1221
|
}
|
|
1222
|
+
plt.$orgLocNodes$.delete(hostElm["s-id"]);
|
|
1206
1223
|
hostRef.$hostElement$ = hostElm;
|
|
1207
1224
|
endHydrate();
|
|
1208
1225
|
};
|
|
@@ -1313,7 +1330,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1313
1330
|
$text$: null
|
|
1314
1331
|
});
|
|
1315
1332
|
if (childNodeType === TEXT_NODE_ID) {
|
|
1316
|
-
childVNode.$elm$ = node
|
|
1333
|
+
childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
|
|
1317
1334
|
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1318
1335
|
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1319
1336
|
childRenderNodes.push(childVNode);
|
|
@@ -1329,7 +1346,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1329
1346
|
}
|
|
1330
1347
|
}
|
|
1331
1348
|
} else if (childNodeType === COMMENT_NODE_ID) {
|
|
1332
|
-
childVNode.$elm$ = node
|
|
1349
|
+
childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
|
|
1333
1350
|
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
|
|
1334
1351
|
childRenderNodes.push(childVNode);
|
|
1335
1352
|
node.remove();
|
|
@@ -1363,6 +1380,10 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1363
1380
|
vnode.$elm$ = node;
|
|
1364
1381
|
vnode.$index$ = "0";
|
|
1365
1382
|
parentVNode.$children$ = [vnode];
|
|
1383
|
+
} else {
|
|
1384
|
+
if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
|
|
1385
|
+
node.remove();
|
|
1386
|
+
}
|
|
1366
1387
|
}
|
|
1367
1388
|
return parentVNode;
|
|
1368
1389
|
};
|
|
@@ -1452,10 +1473,367 @@ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =>
|
|
|
1452
1473
|
slottedNode = slottedNode.nextSibling;
|
|
1453
1474
|
}
|
|
1454
1475
|
};
|
|
1476
|
+
var findCorrespondingNode = (node, type) => {
|
|
1477
|
+
let sibling = node;
|
|
1478
|
+
do {
|
|
1479
|
+
sibling = sibling.nextSibling;
|
|
1480
|
+
} while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
|
|
1481
|
+
return sibling;
|
|
1482
|
+
};
|
|
1455
1483
|
|
|
1456
1484
|
// src/runtime/initialize-component.ts
|
|
1457
1485
|
import { BUILD as BUILD23 } from "@rindo/core/internal/app-data";
|
|
1458
1486
|
|
|
1487
|
+
// src/utils/shadow-css.ts
|
|
1488
|
+
/**
|
|
1489
|
+
* @license
|
|
1490
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
1491
|
+
*
|
|
1492
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1493
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1494
|
+
*
|
|
1495
|
+
* This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
|
|
1496
|
+
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
1497
|
+
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
1498
|
+
*/
|
|
1499
|
+
var safeSelector = (selector) => {
|
|
1500
|
+
const placeholders = [];
|
|
1501
|
+
let index = 0;
|
|
1502
|
+
selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
|
|
1503
|
+
const replaceBy = `__ph-${index}__`;
|
|
1504
|
+
placeholders.push(keep);
|
|
1505
|
+
index++;
|
|
1506
|
+
return replaceBy;
|
|
1507
|
+
});
|
|
1508
|
+
const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
1509
|
+
const replaceBy = `__ph-${index}__`;
|
|
1510
|
+
placeholders.push(exp);
|
|
1511
|
+
index++;
|
|
1512
|
+
return pseudo + replaceBy;
|
|
1513
|
+
});
|
|
1514
|
+
const ss = {
|
|
1515
|
+
content,
|
|
1516
|
+
placeholders
|
|
1517
|
+
};
|
|
1518
|
+
return ss;
|
|
1519
|
+
};
|
|
1520
|
+
var restoreSafeSelector = (placeholders, content) => {
|
|
1521
|
+
return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
|
|
1522
|
+
};
|
|
1523
|
+
var _polyfillHost = "-shadowcsshost";
|
|
1524
|
+
var _polyfillSlotted = "-shadowcssslotted";
|
|
1525
|
+
var _polyfillHostContext = "-shadowcsscontext";
|
|
1526
|
+
var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
1527
|
+
var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
1528
|
+
var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
1529
|
+
var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
1530
|
+
var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
1531
|
+
var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
1532
|
+
var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
1533
|
+
var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
|
|
1534
|
+
var _polyfillHostRe = /-shadowcsshost/gim;
|
|
1535
|
+
var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
|
|
1536
|
+
var _colonSlottedRe = createSupportsRuleRe("::slotted");
|
|
1537
|
+
var _colonHostRe = createSupportsRuleRe(":host");
|
|
1538
|
+
var _colonHostContextRe = createSupportsRuleRe(":host-context");
|
|
1539
|
+
var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
|
|
1540
|
+
var stripComments = (input) => {
|
|
1541
|
+
return input.replace(_commentRe, "");
|
|
1542
|
+
};
|
|
1543
|
+
var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
1544
|
+
var extractCommentsWithHash = (input) => {
|
|
1545
|
+
return input.match(_commentWithHashRe) || [];
|
|
1546
|
+
};
|
|
1547
|
+
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
1548
|
+
var _curlyRe = /([{}])/g;
|
|
1549
|
+
var _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
|
|
1550
|
+
var OPEN_CURLY = "{";
|
|
1551
|
+
var CLOSE_CURLY = "}";
|
|
1552
|
+
var BLOCK_PLACEHOLDER = "%BLOCK%";
|
|
1553
|
+
var processRules = (input, ruleCallback) => {
|
|
1554
|
+
const inputWithEscapedBlocks = escapeBlocks(input);
|
|
1555
|
+
let nextBlockIndex = 0;
|
|
1556
|
+
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
1557
|
+
const selector = m[2];
|
|
1558
|
+
let content = "";
|
|
1559
|
+
let suffix = m[4];
|
|
1560
|
+
let contentPrefix = "";
|
|
1561
|
+
if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
|
|
1562
|
+
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
1563
|
+
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
1564
|
+
contentPrefix = "{";
|
|
1565
|
+
}
|
|
1566
|
+
const cssRule = {
|
|
1567
|
+
selector,
|
|
1568
|
+
content
|
|
1569
|
+
};
|
|
1570
|
+
const rule = ruleCallback(cssRule);
|
|
1571
|
+
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
1572
|
+
});
|
|
1573
|
+
};
|
|
1574
|
+
var escapeBlocks = (input) => {
|
|
1575
|
+
const inputParts = input.split(_curlyRe);
|
|
1576
|
+
const resultParts = [];
|
|
1577
|
+
const escapedBlocks = [];
|
|
1578
|
+
let bracketCount = 0;
|
|
1579
|
+
let currentBlockParts = [];
|
|
1580
|
+
for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
|
|
1581
|
+
const part = inputParts[partIndex];
|
|
1582
|
+
if (part === CLOSE_CURLY) {
|
|
1583
|
+
bracketCount--;
|
|
1584
|
+
}
|
|
1585
|
+
if (bracketCount > 0) {
|
|
1586
|
+
currentBlockParts.push(part);
|
|
1587
|
+
} else {
|
|
1588
|
+
if (currentBlockParts.length > 0) {
|
|
1589
|
+
escapedBlocks.push(currentBlockParts.join(""));
|
|
1590
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
1591
|
+
currentBlockParts = [];
|
|
1592
|
+
}
|
|
1593
|
+
resultParts.push(part);
|
|
1594
|
+
}
|
|
1595
|
+
if (part === OPEN_CURLY) {
|
|
1596
|
+
bracketCount++;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
if (currentBlockParts.length > 0) {
|
|
1600
|
+
escapedBlocks.push(currentBlockParts.join(""));
|
|
1601
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
1602
|
+
}
|
|
1603
|
+
const strEscapedBlocks = {
|
|
1604
|
+
escapedString: resultParts.join(""),
|
|
1605
|
+
blocks: escapedBlocks
|
|
1606
|
+
};
|
|
1607
|
+
return strEscapedBlocks;
|
|
1608
|
+
};
|
|
1609
|
+
var insertPolyfillHostInCssText = (cssText) => {
|
|
1610
|
+
cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
|
|
1611
|
+
return cssText;
|
|
1612
|
+
};
|
|
1613
|
+
var convertColonRule = (cssText, regExp, partReplacer) => {
|
|
1614
|
+
return cssText.replace(regExp, (...m) => {
|
|
1615
|
+
if (m[2]) {
|
|
1616
|
+
const parts = m[2].split(",");
|
|
1617
|
+
const r = [];
|
|
1618
|
+
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
1619
|
+
const p = parts[i2].trim();
|
|
1620
|
+
if (!p) break;
|
|
1621
|
+
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
|
1622
|
+
}
|
|
1623
|
+
return r.join(",");
|
|
1624
|
+
} else {
|
|
1625
|
+
return _polyfillHostNoCombinator + m[3];
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
};
|
|
1629
|
+
var colonHostPartReplacer = (host, part, suffix) => {
|
|
1630
|
+
return host + part.replace(_polyfillHost, "") + suffix;
|
|
1631
|
+
};
|
|
1632
|
+
var convertColonHost = (cssText) => {
|
|
1633
|
+
return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
|
|
1634
|
+
};
|
|
1635
|
+
var colonHostContextPartReplacer = (host, part, suffix) => {
|
|
1636
|
+
if (part.indexOf(_polyfillHost) > -1) {
|
|
1637
|
+
return colonHostPartReplacer(host, part, suffix);
|
|
1638
|
+
} else {
|
|
1639
|
+
return host + part + suffix + ", " + part + " " + host + suffix;
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
var convertColonSlotted = (cssText, slotScopeId) => {
|
|
1643
|
+
const slotClass = "." + slotScopeId + " > ";
|
|
1644
|
+
const selectors = [];
|
|
1645
|
+
cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
|
|
1646
|
+
if (m[2]) {
|
|
1647
|
+
const compound = m[2].trim();
|
|
1648
|
+
const suffix = m[3];
|
|
1649
|
+
const slottedSelector = slotClass + compound + suffix;
|
|
1650
|
+
let prefixSelector = "";
|
|
1651
|
+
for (let i2 = m[4] - 1; i2 >= 0; i2--) {
|
|
1652
|
+
const char = m[5][i2];
|
|
1653
|
+
if (char === "}" || char === ",") {
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
prefixSelector = char + prefixSelector;
|
|
1657
|
+
}
|
|
1658
|
+
const orgSelector = (prefixSelector + slottedSelector).trim();
|
|
1659
|
+
const addedSelector = `${prefixSelector.trimEnd()}${slottedSelector.trim()}`.trim();
|
|
1660
|
+
if (orgSelector !== addedSelector) {
|
|
1661
|
+
const updatedSelector = `${addedSelector}, ${orgSelector}`;
|
|
1662
|
+
selectors.push({
|
|
1663
|
+
orgSelector,
|
|
1664
|
+
updatedSelector
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
return slottedSelector;
|
|
1668
|
+
} else {
|
|
1669
|
+
return _polyfillHostNoCombinator + m[3];
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
return {
|
|
1673
|
+
selectors,
|
|
1674
|
+
cssText
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
var convertColonHostContext = (cssText) => {
|
|
1678
|
+
return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
|
|
1679
|
+
};
|
|
1680
|
+
var convertShadowDOMSelectors = (cssText) => {
|
|
1681
|
+
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
1682
|
+
};
|
|
1683
|
+
var makeScopeMatcher = (scopeSelector2) => {
|
|
1684
|
+
const lre = /\[/g;
|
|
1685
|
+
const rre = /\]/g;
|
|
1686
|
+
scopeSelector2 = scopeSelector2.replace(lre, "\\[").replace(rre, "\\]");
|
|
1687
|
+
return new RegExp("^(" + scopeSelector2 + ")" + _selectorReSuffix, "m");
|
|
1688
|
+
};
|
|
1689
|
+
var selectorNeedsScoping = (selector, scopeSelector2) => {
|
|
1690
|
+
const re = makeScopeMatcher(scopeSelector2);
|
|
1691
|
+
return !re.test(selector);
|
|
1692
|
+
};
|
|
1693
|
+
var injectScopingSelector = (selector, scopingSelector) => {
|
|
1694
|
+
return selector.replace(_selectorPartsRe, (_, before = "", _colonGroup, colon = "", after = "") => {
|
|
1695
|
+
return before + scopingSelector + colon + after;
|
|
1696
|
+
});
|
|
1697
|
+
};
|
|
1698
|
+
var applySimpleSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
1699
|
+
_polyfillHostRe.lastIndex = 0;
|
|
1700
|
+
if (_polyfillHostRe.test(selector)) {
|
|
1701
|
+
const replaceBy = `.${hostSelector}`;
|
|
1702
|
+
return selector.replace(_polyfillHostNoCombinatorRe, (_, selector2) => injectScopingSelector(selector2, replaceBy)).replace(_polyfillHostRe, replaceBy + " ");
|
|
1703
|
+
}
|
|
1704
|
+
return scopeSelector2 + " " + selector;
|
|
1705
|
+
};
|
|
1706
|
+
var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
1707
|
+
const isRe = /\[is=([^\]]*)\]/g;
|
|
1708
|
+
scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]);
|
|
1709
|
+
const className = "." + scopeSelector2;
|
|
1710
|
+
const _scopeSelectorPart = (p) => {
|
|
1711
|
+
let scopedP = p.trim();
|
|
1712
|
+
if (!scopedP) {
|
|
1713
|
+
return "";
|
|
1714
|
+
}
|
|
1715
|
+
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
1716
|
+
scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector);
|
|
1717
|
+
} else {
|
|
1718
|
+
const t = p.replace(_polyfillHostRe, "");
|
|
1719
|
+
if (t.length > 0) {
|
|
1720
|
+
scopedP = injectScopingSelector(t, className);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
return scopedP;
|
|
1724
|
+
};
|
|
1725
|
+
const safeContent = safeSelector(selector);
|
|
1726
|
+
selector = safeContent.content;
|
|
1727
|
+
let scopedSelector = "";
|
|
1728
|
+
let startIndex = 0;
|
|
1729
|
+
let res;
|
|
1730
|
+
const sep = /( |>|\+|~(?!=))\s*/g;
|
|
1731
|
+
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1732
|
+
let shouldScope = !hasHost;
|
|
1733
|
+
while ((res = sep.exec(selector)) !== null) {
|
|
1734
|
+
const separator = res[1];
|
|
1735
|
+
const part2 = selector.slice(startIndex, res.index).trim();
|
|
1736
|
+
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1737
|
+
const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
|
|
1738
|
+
scopedSelector += `${scopedPart} ${separator} `;
|
|
1739
|
+
startIndex = sep.lastIndex;
|
|
1740
|
+
}
|
|
1741
|
+
const part = selector.substring(startIndex);
|
|
1742
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1743
|
+
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
1744
|
+
return restoreSafeSelector(safeContent.placeholders, scopedSelector);
|
|
1745
|
+
};
|
|
1746
|
+
var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
|
|
1747
|
+
return selector.split(",").map((shallowPart) => {
|
|
1748
|
+
if (slotSelector && shallowPart.indexOf("." + slotSelector) > -1) {
|
|
1749
|
+
return shallowPart.trim();
|
|
1750
|
+
}
|
|
1751
|
+
if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
|
|
1752
|
+
return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
|
|
1753
|
+
} else {
|
|
1754
|
+
return shallowPart.trim();
|
|
1755
|
+
}
|
|
1756
|
+
}).join(", ");
|
|
1757
|
+
};
|
|
1758
|
+
var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
1759
|
+
return processRules(cssText, (rule) => {
|
|
1760
|
+
let selector = rule.selector;
|
|
1761
|
+
let content = rule.content;
|
|
1762
|
+
if (rule.selector[0] !== "@") {
|
|
1763
|
+
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
1764
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
1765
|
+
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
1766
|
+
}
|
|
1767
|
+
const cssRule = {
|
|
1768
|
+
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
1769
|
+
content
|
|
1770
|
+
};
|
|
1771
|
+
return cssRule;
|
|
1772
|
+
});
|
|
1773
|
+
};
|
|
1774
|
+
var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
1775
|
+
cssText = insertPolyfillHostInCssText(cssText);
|
|
1776
|
+
cssText = convertColonHost(cssText);
|
|
1777
|
+
cssText = convertColonHostContext(cssText);
|
|
1778
|
+
const slotted = convertColonSlotted(cssText, slotScopeId);
|
|
1779
|
+
cssText = slotted.cssText;
|
|
1780
|
+
cssText = convertShadowDOMSelectors(cssText);
|
|
1781
|
+
if (scopeId2) {
|
|
1782
|
+
cssText = scopeSelectors(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1783
|
+
}
|
|
1784
|
+
cssText = replaceShadowCssHost(cssText, hostScopeId);
|
|
1785
|
+
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ");
|
|
1786
|
+
return {
|
|
1787
|
+
cssText: cssText.trim(),
|
|
1788
|
+
// We need to replace the shadow CSS host string in each of these selectors since we created
|
|
1789
|
+
// them prior to the replacement happening in the components CSS text.
|
|
1790
|
+
slottedSelectors: slotted.selectors.map((ref) => ({
|
|
1791
|
+
orgSelector: replaceShadowCssHost(ref.orgSelector, hostScopeId),
|
|
1792
|
+
updatedSelector: replaceShadowCssHost(ref.updatedSelector, hostScopeId)
|
|
1793
|
+
}))
|
|
1794
|
+
};
|
|
1795
|
+
};
|
|
1796
|
+
var replaceShadowCssHost = (cssText, hostScopeId) => {
|
|
1797
|
+
return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
1798
|
+
};
|
|
1799
|
+
var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
|
|
1800
|
+
const hostScopeId = scopeId2 + "-h";
|
|
1801
|
+
const slotScopeId = scopeId2 + "-s";
|
|
1802
|
+
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
1803
|
+
cssText = stripComments(cssText);
|
|
1804
|
+
const orgSelectors = [];
|
|
1805
|
+
if (commentOriginalSelector) {
|
|
1806
|
+
const processCommentedSelector = (rule) => {
|
|
1807
|
+
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
1808
|
+
const comment = `/*!@${rule.selector}*/`;
|
|
1809
|
+
orgSelectors.push({ placeholder, comment });
|
|
1810
|
+
rule.selector = placeholder + rule.selector;
|
|
1811
|
+
return rule;
|
|
1812
|
+
};
|
|
1813
|
+
cssText = processRules(cssText, (rule) => {
|
|
1814
|
+
if (rule.selector[0] !== "@") {
|
|
1815
|
+
return processCommentedSelector(rule);
|
|
1816
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
1817
|
+
rule.content = processRules(rule.content, processCommentedSelector);
|
|
1818
|
+
return rule;
|
|
1819
|
+
}
|
|
1820
|
+
return rule;
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
const scoped = scopeCssText(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1824
|
+
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
1825
|
+
if (commentOriginalSelector) {
|
|
1826
|
+
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
1827
|
+
cssText = cssText.replace(placeholder, comment);
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
1831
|
+
const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
|
|
1832
|
+
cssText = cssText.replace(regex, slottedSelector.updatedSelector);
|
|
1833
|
+
});
|
|
1834
|
+
return cssText;
|
|
1835
|
+
};
|
|
1836
|
+
|
|
1459
1837
|
// src/runtime/mode.ts
|
|
1460
1838
|
var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
|
|
1461
1839
|
var setMode = (handler) => modeResolutionChain.push(handler);
|
|
@@ -1561,7 +1939,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1561
1939
|
if (nonce != null) {
|
|
1562
1940
|
styleElm.setAttribute("nonce", nonce);
|
|
1563
1941
|
}
|
|
1564
|
-
if ((BUILD16.hydrateServerSide || BUILD16.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
1942
|
+
if ((BUILD16.hydrateServerSide || BUILD16.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
|
|
1565
1943
|
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
1566
1944
|
}
|
|
1567
1945
|
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
@@ -1589,7 +1967,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1589
1967
|
styleContainerNode.append(styleElm);
|
|
1590
1968
|
}
|
|
1591
1969
|
}
|
|
1592
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */
|
|
1970
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1593
1971
|
styleContainerNode.insertBefore(styleElm, null);
|
|
1594
1972
|
}
|
|
1595
1973
|
}
|
|
@@ -1616,13 +1994,21 @@ var attachStyles = (hostRef) => {
|
|
|
1616
1994
|
cmpMeta,
|
|
1617
1995
|
hostRef.$modeName$
|
|
1618
1996
|
);
|
|
1619
|
-
if ((BUILD16.shadowDom || BUILD16.scoped) && BUILD16.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
|
|
1997
|
+
if ((BUILD16.shadowDom || BUILD16.scoped) && BUILD16.cssAnnotations && (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
|
|
1620
1998
|
elm["s-sc"] = scopeId2;
|
|
1621
1999
|
elm.classList.add(scopeId2 + "-h");
|
|
1622
2000
|
}
|
|
1623
2001
|
endAttachStyles();
|
|
1624
2002
|
};
|
|
1625
2003
|
var getScopeId = (cmp, mode) => "sc-" + (BUILD16.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
2004
|
+
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
2005
|
+
var hydrateScopedToShadow = () => {
|
|
2006
|
+
const styles2 = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2007
|
+
let i2 = 0;
|
|
2008
|
+
for (; i2 < styles2.length; i2++) {
|
|
2009
|
+
registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
|
|
2010
|
+
}
|
|
2011
|
+
};
|
|
1626
2012
|
|
|
1627
2013
|
// src/runtime/vdom/vdom-render.ts
|
|
1628
2014
|
import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
|
|
@@ -2263,7 +2649,7 @@ render() {
|
|
|
2263
2649
|
if (BUILD19.scoped || BUILD19.shadowDom) {
|
|
2264
2650
|
scopeId = hostElm["s-sc"];
|
|
2265
2651
|
}
|
|
2266
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)
|
|
2652
|
+
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
2267
2653
|
if (BUILD19.slotRelocation) {
|
|
2268
2654
|
contentRef = hostElm["s-cr"];
|
|
2269
2655
|
checkSlotFallbackVisibility = false;
|
|
@@ -2955,9 +3341,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
2955
3341
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
2956
3342
|
if (!styles.has(scopeId2)) {
|
|
2957
3343
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
2958
|
-
if (
|
|
2959
|
-
|
|
2960
|
-
style = await import("./shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
|
|
3344
|
+
if (BUILD23.hydrateServerSide && BUILD23.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
3345
|
+
style = scopeCss(style, scopeId2, true);
|
|
2961
3346
|
}
|
|
2962
3347
|
registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
2963
3348
|
endRegisterStyles();
|
|
@@ -3128,6 +3513,9 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3128
3513
|
patchTextContent(Cstr.prototype);
|
|
3129
3514
|
}
|
|
3130
3515
|
}
|
|
3516
|
+
if (BUILD26.hydrateClientSide && BUILD26.shadowDom) {
|
|
3517
|
+
hydrateScopedToShadow();
|
|
3518
|
+
}
|
|
3131
3519
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
3132
3520
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
3133
3521
|
Object.assign(Cstr.prototype, {
|
|
@@ -3248,6 +3636,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3248
3636
|
if (BUILD27.hydrateClientSide) {
|
|
3249
3637
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
3250
3638
|
}
|
|
3639
|
+
if (BUILD27.hydrateClientSide && BUILD27.shadowDom) {
|
|
3640
|
+
hydrateScopedToShadow();
|
|
3641
|
+
}
|
|
3251
3642
|
let hasSlotRelocation = false;
|
|
3252
3643
|
lazyBundles.map((lazyBundle) => {
|
|
3253
3644
|
lazyBundle[1].map((compactMeta) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core/internal/client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.0",
|
|
4
4
|
"description": "Rindo internal client platform to be imported by the Rindo Compiler and internal runtime. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"exports": "./index.js",
|
|
@@ -274,14 +274,14 @@ var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) =>
|
|
|
274
274
|
}
|
|
275
275
|
}).join(", ");
|
|
276
276
|
};
|
|
277
|
-
var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector) => {
|
|
277
|
+
var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
278
278
|
return processRules(cssText, (rule) => {
|
|
279
279
|
let selector = rule.selector;
|
|
280
280
|
let content = rule.content;
|
|
281
281
|
if (rule.selector[0] !== "@") {
|
|
282
282
|
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
283
283
|
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
284
|
-
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
|
|
284
|
+
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
285
285
|
}
|
|
286
286
|
const cssRule = {
|
|
287
287
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
@@ -290,7 +290,7 @@ var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector) =>
|
|
|
290
290
|
return cssRule;
|
|
291
291
|
});
|
|
292
292
|
};
|
|
293
|
-
var scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId) => {
|
|
293
|
+
var scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
294
294
|
cssText = insertPolyfillHostInCssText(cssText);
|
|
295
295
|
cssText = convertColonHost(cssText);
|
|
296
296
|
cssText = convertColonHostContext(cssText);
|
|
@@ -298,7 +298,7 @@ var scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId) => {
|
|
|
298
298
|
cssText = slotted.cssText;
|
|
299
299
|
cssText = convertShadowDOMSelectors(cssText);
|
|
300
300
|
if (scopeId) {
|
|
301
|
-
cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
|
|
301
|
+
cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
302
302
|
}
|
|
303
303
|
cssText = replaceShadowCssHost(cssText, hostScopeId);
|
|
304
304
|
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ");
|
|
@@ -315,13 +315,37 @@ var scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId) => {
|
|
|
315
315
|
var replaceShadowCssHost = (cssText, hostScopeId) => {
|
|
316
316
|
return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
317
317
|
};
|
|
318
|
-
var scopeCss = (cssText, scopeId) => {
|
|
318
|
+
var scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
319
319
|
const hostScopeId = scopeId + "-h";
|
|
320
320
|
const slotScopeId = scopeId + "-s";
|
|
321
321
|
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
322
322
|
cssText = stripComments(cssText);
|
|
323
|
-
const
|
|
323
|
+
const orgSelectors = [];
|
|
324
|
+
if (commentOriginalSelector) {
|
|
325
|
+
const processCommentedSelector = (rule) => {
|
|
326
|
+
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
327
|
+
const comment = `/*!@${rule.selector}*/`;
|
|
328
|
+
orgSelectors.push({ placeholder, comment });
|
|
329
|
+
rule.selector = placeholder + rule.selector;
|
|
330
|
+
return rule;
|
|
331
|
+
};
|
|
332
|
+
cssText = processRules(cssText, (rule) => {
|
|
333
|
+
if (rule.selector[0] !== "@") {
|
|
334
|
+
return processCommentedSelector(rule);
|
|
335
|
+
} else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
|
|
336
|
+
rule.content = processRules(rule.content, processCommentedSelector);
|
|
337
|
+
return rule;
|
|
338
|
+
}
|
|
339
|
+
return rule;
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
324
343
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
344
|
+
if (commentOriginalSelector) {
|
|
345
|
+
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
346
|
+
cssText = cssText.replace(placeholder, comment);
|
|
347
|
+
});
|
|
348
|
+
}
|
|
325
349
|
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
326
350
|
const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
|
|
327
351
|
cssText = cssText.replace(regex, slottedSelector.updatedSelector);
|