mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ feat(renderer): 支持组件变体样式收集
This commit is contained in:
parent
b4df0c0fe9
commit
c36c161b0e
@ -239,27 +239,36 @@ class RendererService:
|
|||||||
)
|
)
|
||||||
|
|
||||||
style_paths_to_load = []
|
style_paths_to_load = []
|
||||||
if manifest and "styles" in manifest:
|
if manifest and manifest.get("styles"):
|
||||||
styles = (
|
styles = manifest["styles"]
|
||||||
[manifest["styles"]]
|
styles = [styles] if isinstance(styles, str) else styles
|
||||||
if isinstance(manifest["styles"], str)
|
|
||||||
else manifest["styles"]
|
resolution_base_path = Path(component_path_base)
|
||||||
)
|
if variant:
|
||||||
for style_path in styles:
|
skin_manifest_path = str(Path(component_path_base) / "skins" / variant)
|
||||||
full_style_path = str(Path(component_path_base) / style_path).replace(
|
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:
|
else:
|
||||||
resolved_template_name = (
|
base_template_path = (
|
||||||
await context.theme_manager._resolve_component_template(
|
await context.theme_manager._resolve_component_template(
|
||||||
component, context
|
component, context
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
conventional_style_path = str(
|
base_style_path = str(
|
||||||
Path(resolved_template_name).with_name("style.css")
|
Path(base_template_path).with_name("style.css")
|
||||||
).replace("\\", "/")
|
).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:
|
for css_template_path in style_paths_to_load:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user