Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving design modifiers based on the theme type #4978

Merged
merged 4 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions panel/theme/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ResourceComponent, component_resource_path, get_dist_path,
resolve_custom_path,
)
from ..io.state import state
from ..util import relative_to

if TYPE_CHECKING:
Expand Down Expand Up @@ -157,7 +158,7 @@ def _resolve_stylesheets(cls, value, defining_cls, inherited):

@classmethod
@functools.lru_cache
def _resolve_modifiers(cls, vtype, theme):
def _resolve_modifiers(cls, vtype, theme, is_server=False):
"""
Iterate over the class hierarchy in reverse order and accumulate
all modifiers that apply to the objects class and its super classes.
Expand Down Expand Up @@ -185,7 +186,9 @@ def _get_modifiers(
from ..io.resources import (
CDN_DIST, component_resource_path, resolve_custom_path,
)
modifiers, child_modifiers = cls._resolve_modifiers(type(viewable), theme)
theme_type = type(theme) if isinstance(theme, Theme) else theme
is_server = bool(state.curdoc.session_context) if not state._is_pyodide and state.curdoc else False
modifiers, child_modifiers = cls._resolve_modifiers(type(viewable), theme_type, is_server=is_server)
modifiers = dict(modifiers)
if 'stylesheets' in modifiers:
if isolated:
Expand Down