fix(csr): suppress inactive theme token warnings
This commit is contained in:
@@ -268,8 +268,21 @@ export const REACTIVE_RUNTIME = String.raw`
|
||||
Array.prototype.forEach.call(rules || [], function (rule) {
|
||||
var cssText = rule.cssText || "";
|
||||
var match;
|
||||
var pattern = /var\(\s*(--wrn-[A-Za-z0-9_-]+)/g;
|
||||
while ((match = pattern.exec(cssText))) referenced[match[1]] = true;
|
||||
// Only inspect declarations that can affect the current document. A
|
||||
// component stylesheet may contain optional variants that are not
|
||||
// rendered on this page, and variables with fallbacks are intentionally
|
||||
// optional rather than missing theme tokens.
|
||||
if (rule.selectorText) {
|
||||
try {
|
||||
if (!document.querySelector(rule.selectorText)) return;
|
||||
} catch (_) {
|
||||
// Keep inspecting selectors that the DOM implementation cannot parse.
|
||||
}
|
||||
}
|
||||
var pattern = /var\(\s*(--wrn-[A-Za-z0-9_-]+)\s*(,)?/g;
|
||||
while ((match = pattern.exec(cssText))) {
|
||||
if (!match[2]) referenced[match[1]] = true;
|
||||
}
|
||||
if (rule.style) {
|
||||
Array.prototype.forEach.call(rule.style, function (property) {
|
||||
if (String(property).indexOf("--wrn-") === 0) declared[property] = true;
|
||||
|
||||
Reference in New Issue
Block a user