File size: 1,751 Bytes
ad51766
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""Loads and concatenates the modular CSS files under ``static/css/``.

Modules are loaded in a deterministic order that matches the cascade:
variables first, then layout, then components, then dark-mode overrides.

Adding a new stylesheet? Append it to ``_LOAD_ORDER`` below.
"""

from __future__ import annotations

from pathlib import Path

_CSS_DIR = Path(__file__).parent / "static" / "css"

_LOAD_ORDER = (
    "_variables.css",   # CSS custom properties (light + dark)
    "_layout.css",      # html/body/container/font
    "_chatbot.css",     # chat bubble / markdown / table rules
    "_chat.css",        # custom chat surface layout (loaded AFTER _chatbot
                        # so our overrides for #hy-chat-host / .message.user
                        # win conflicts with the !important rules above)
    "_perf.css",        # content-visibility / containment for long convos
    "_math.css",        # KaTeX math rendering
    "_thinking.css",    # collapsible reasoning block
    "_legacy.css",      # form/label/prose tweaks (Svelte-hash-free)
    "_input.css",       # message input, send/new buttons
    "_misc.css",        # request-id, code blocks, blockquote, slider
    "_modals.css",      # tool area + html preview modal
    "_typing.css",      # typing indicator (waiting for model)
    "_examples.css",    # empty-state examples overlay
    "_hide.css",        # hide gradio defaults (avatars/buttons)
    "_dark.css",        # remaining dark-mode overrides (sliders, scrollbars)
)


def _load_css() -> str:
    parts: list[str] = []
    for name in _LOAD_ORDER:
        path = _CSS_DIR / name
        parts.append(f"/* === {name} === */\n{path.read_text(encoding='utf-8')}")
    return "\n".join(parts)


CSS = _load_css()