From cb2d1cd4c2be2e3cccc5f3cc60c304e88a343458 Mon Sep 17 00:00:00 2001 From: ilhan007 Date: Fri, 9 Oct 2026 16:15:16 +0300 Subject: [PATCH] fix(tools): use correct CSS_VARIABLES_TARGET in auto theme selector The generateAutoThemes function was hardcoding :host for all non-theming packages. Consumer libraries that don't set cssVariablesTarget (defaulting to "root") need :root instead. Read the CSS_VARIABLES_TARGET env var (already set per-package by nps.js from options.cssVariablesTarget) to pick the correct selector. --- packages/tools/lib/css-processors/css-processor-themes.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tools/lib/css-processors/css-processor-themes.mjs b/packages/tools/lib/css-processors/css-processor-themes.mjs index cb637597a2e09..9a4972aec3d3e 100644 --- a/packages/tools/lib/css-processors/css-processor-themes.mjs +++ b/packages/tools/lib/css-processors/css-processor-themes.mjs @@ -106,7 +106,7 @@ const generate = async (argv) => { const darkCSS = processedCSS.get(darkPath); if (!darkCSS) continue; - const selector = isThemingPackage(lightPath) ? ":root" : ":host"; + const selector = isThemingPackage(lightPath) ? ":root" : CSS_VARIABLES_TARGET ? ":host" : ":root"; let autoCSS = mergeLightDark(lightCSS, darkCSS, selector); // For the theming package, add color-scheme and toggle setup