From c36c161b0e10aefae692e56721ea1f1136df3f8d Mon Sep 17 00:00:00 2001 From: webjoin111 <455457521@qq.com> Date: Thu, 13 Nov 2025 17:16:36 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(renderer):=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=BB=84=E4=BB=B6=E5=8F=98=E4=BD=93=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=94=B6=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/services/renderer/service.py | 37 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/zhenxun/services/renderer/service.py b/zhenxun/services/renderer/service.py index d050aa37..2b470d2a 100644 --- a/zhenxun/services/renderer/service.py +++ b/zhenxun/services/renderer/service.py @@ -239,27 +239,36 @@ class RendererService: ) style_paths_to_load = [] - if manifest and "styles" in manifest: - styles = ( - [manifest["styles"]] - if isinstance(manifest["styles"], str) - else manifest["styles"] - ) - for style_path in styles: - full_style_path = str(Path(component_path_base) / style_path).replace( - "\\", "/" + if manifest and manifest.get("styles"): + styles = manifest["styles"] + styles = [styles] if isinstance(styles, str) else styles + + resolution_base_path = Path(component_path_base) + if variant: + skin_manifest_path = str(Path(component_path_base) / "skins" / variant) + skin_manifest = await context.theme_manager._load_single_manifest( + skin_manifest_path ) - style_paths_to_load.append(full_style_path) + if skin_manifest and "styles" in skin_manifest: + resolution_base_path = Path(skin_manifest_path) + + style_paths_to_load.extend( + str(resolution_base_path / style).replace("\\", "/") for style in styles + ) else: - resolved_template_name = ( + base_template_path = ( await context.theme_manager._resolve_component_template( component, context ) ) - conventional_style_path = str( - Path(resolved_template_name).with_name("style.css") + base_style_path = str( + Path(base_template_path).with_name("style.css") ).replace("\\", "/") - style_paths_to_load.append(conventional_style_path) + style_paths_to_load.append(base_style_path) + + if variant: + skin_style_path = f"{component_path_base}/skins/{variant}/style.css" + style_paths_to_load.append(skin_style_path) for css_template_path in style_paths_to_load: try: