Source code for betty.extension.maps

"""Integrate Betty with `Leaflet.js <https://leafletjs.com/>`_."""

from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING, final

from typing_extensions import override

from betty.extension.webpack import Webpack, WebpackEntryPointProvider
from betty.locale.localizable import _, Localizable
from betty.project.extension import Extension

if TYPE_CHECKING:
    from betty.plugin import PluginIdentifier
    from betty.machine_name import MachineName
    from collections.abc import Sequence


[docs] @final class Maps(Extension, WebpackEntryPointProvider): """ Provide interactive maps for use on web pages. """
[docs] @override @classmethod def plugin_id(cls) -> MachineName: return "maps"
[docs] @override @classmethod def depends_on(cls) -> set[PluginIdentifier[Extension]]: return {Webpack}
[docs] @override @classmethod def webpack_entry_point_directory_path(cls) -> Path: return Path(__file__).parent / "webpack"
[docs] @override def webpack_entry_point_cache_keys(self) -> Sequence[str]: return ()
[docs] @override @classmethod def plugin_label(cls) -> Localizable: return _("Maps")
[docs] @override @classmethod def plugin_description(cls) -> Localizable: return _( 'Display lists of places as interactive maps using <a href="https://leafletjs.com/">Leaflet</a>.' )