diff --git a/folium/elements.py b/folium/elements.py index aa1dbd884..2c8cf866c 100644 --- a/folium/elements.py +++ b/folium/elements.py @@ -1,12 +1,12 @@ from typing import List, Tuple -from branca.element import CssLink, Element, Figure, JavascriptLink, MacroElement +from branca.element import CssLink, Figure, JavascriptLink, MacroElement from folium.template import Template from folium.utilities import JsCode -class JSCSSMixin(Element): +class JSCSSMixin(MacroElement): """Render links to external Javascript and CSS resources.""" default_js: List[Tuple[str, str]] = [] diff --git a/folium/features.py b/folium/features.py index cba87e8ef..a9319dceb 100644 --- a/folium/features.py +++ b/folium/features.py @@ -101,7 +101,7 @@ def __init__( ) -class Vega(JSCSSMixin, Element): +class Vega(JSCSSMixin): """ Creates a Vega chart element. @@ -193,6 +193,8 @@ def render(self, **kwargs) -> None: name=self.get_name(), ) + # TODO: this could be rewritten to use the facilities of MacroElement + # and the facilities of JSCSSMixin figure = self.get_root() assert isinstance( figure, Figure @@ -224,7 +226,7 @@ def render(self, **kwargs) -> None: ) -class VegaLite(Element): +class VegaLite(MacroElement): """ Creates a Vega-Lite chart element. @@ -297,6 +299,9 @@ def render(self, **kwargs) -> None: name=self.get_name(), ) + # TODO: this could be rewritten to use the facilities of MacroElement + # and the facilities of JSCSSMixin + figure = self.get_root() assert isinstance( figure, Figure diff --git a/folium/map.py b/folium/map.py index 3c5302b8a..201a89942 100644 --- a/folium/map.py +++ b/folium/map.py @@ -409,7 +409,7 @@ def render(self) -> None: super().render() -class Popup(Element): +class Popup(MacroElement): """Create a Popup instance that can be linked to a Layer. Parameters