splent-feature-theme 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: splent_feature_theme
3
+ Version: 0.5.0
4
+ Requires-Python: >=3.13
5
+ Description-Content-Type: text/markdown
@@ -0,0 +1,22 @@
1
+ splent_io/splent_feature_theme/__init__.py,sha256=qhn7-MaqL_BF0-c_SK9rN8xs3Cl4h57XYjF90GIQBYw,4237
2
+ splent_io/splent_feature_theme/config.py,sha256=otThR2uLAtBTPFyDpMvqGOU_1xgoFQqnIaN4IHy5wjE,1398
3
+ splent_io/splent_feature_theme/hooks.py,sha256=cGdQ-rAOUVnTI6afhjRvOxxqxOIVIZ1iLzg_noMQOJo,3357
4
+ splent_io/splent_feature_theme/nav.py,sha256=eteMfVSHlwB8E5XJCLKSz3SaZ43Jojy2cvZQvXvRPFo,7250
5
+ splent_io/splent_feature_theme/routes.py,sha256=4KThVcKO8oNcmPBoqagyXUkJsvWbgTNkYAM95Qiws1k,2961
6
+ splent_io/splent_feature_theme/tokens.py,sha256=J3XQroS12WQatW_I5BDI4x-0krAH7x1B4YfIg4CV2FM,2628
7
+ splent_io/splent_feature_theme/assets/css/public.css,sha256=1a1KK1JYBnefxh4VV2OEuPt43SV6hXUrREzeZZGXVHM,24547
8
+ splent_io/splent_feature_theme/assets/js/code_blocks.js,sha256=OvFi2Z1SKe4D2P5Ecz4b3N6bT0_zp3cQ3u2BAnLj7jw,5740
9
+ splent_io/splent_feature_theme/templates/public_base.html,sha256=TkarH81NzQXvOhq4NKStjD7L71Ri2NyStcCTeIeRUAA,5911
10
+ splent_io/splent_feature_theme/templates/blocks/breadcrumb.html,sha256=2A_UX_nK0rnDRP2N8z3w_2cORU_32kEd76p6XPIvFUE,1400
11
+ splent_io/splent_feature_theme/templates/blocks/hero.html,sha256=wcnzfaT7aXoLATa0p7u4y6tPXMO6PTmxiTEGu2dHtpw,641
12
+ splent_io/splent_feature_theme/templates/theme/index.html,sha256=WtNcfv3Fa7NOK1dc_SaLZV2I4MeNbv-QpkMqMOZ8Lck,146
13
+ splent_io/splent_feature_theme/templates/theme/preview.html,sha256=wu7i45LnZLSSQFZ_xAaCYI8y_HynAKcm2irlfXjEclc,1181
14
+ splent_io/splent_feature_theme/templates/theme/admin/appearance.html,sha256=B1Ipky3w3l4jhV72nAe3NM37nWfNRI4fG1pTxlqZP3s,5059
15
+ splent_io/splent_feature_theme/templates/theme/admin/menus.html,sha256=o57rK01XkDVFPJNKhTbFaBlQWyYk1brdIOqui83pUq0,8112
16
+ splent_io/splent_feature_theme/translations/messages.pot,sha256=iBxOu8XPYU1Xodq3P8luoxVz3RZAuHAnotO5opVUGSs,999
17
+ splent_io/splent_feature_theme/translations/es/LC_MESSAGES/messages.mo,sha256=Jjwl0ur0LLkInjW565TQyG-uQsyeSkPBXNLVKlBJhSE,609
18
+ splent_io/splent_feature_theme/translations/es/LC_MESSAGES/messages.po,sha256=Hi9Ec__l5CHhXF0tlCAIq1j-hSGw2WJKQTh07LZd0uE,1101
19
+ splent_feature_theme-0.5.0.dist-info/METADATA,sha256=yLHRgQOqgROv-cgEvQyJW-mT08T1ztHlyp7REict3_Q,128
20
+ splent_feature_theme-0.5.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
21
+ splent_feature_theme-0.5.0.dist-info/top_level.txt,sha256=nksrfdr_edPhGPUsCqz08kyNRLBkNc2sInZYzmbZ4TA,10
22
+ splent_feature_theme-0.5.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ splent_io
@@ -0,0 +1,108 @@
1
+ from splent_framework.blueprints.base_blueprint import create_blueprint
2
+ from splent_io.splent_feature_theme.tokens import get_tokens, tokens_to_css
3
+
4
+ theme_bp = create_blueprint(__name__)
5
+
6
+
7
+ def init_feature(app):
8
+ # The theme's base stylesheet loads first (order 0) so feature and skin
9
+ # assets cascade on top of it. Declared through the asset registry like
10
+ # every other feature — no hardcoded <link> in the shell.
11
+ from splent_framework.assets.asset_registry import register_asset
12
+
13
+ register_asset(
14
+ "css", "theme.assets", order=0, subfolder="css", filename="public.css"
15
+ )
16
+ # Reading chrome for code blocks: the language, and a button that
17
+ # copies. Registered by the shell rather than by a content feature,
18
+ # because every feature that renders markdown gets code blocks and none
19
+ # of them should ship their own copy button.
20
+ register_asset(
21
+ "js", "theme.assets", order=0, subfolder="js", filename="code_blocks.js"
22
+ )
23
+
24
+
25
+ def _make_render_block():
26
+ from flask import render_template
27
+ from markupsafe import Markup
28
+
29
+ def render_block(name, **context):
30
+ """Render a composable theme block: templates/blocks/<name>.html.
31
+
32
+ Returns Markup so the rendered HTML is injected as-is (not escaped) when
33
+ used as {{ render_block('hero', …) }} inside autoescaped templates.
34
+ """
35
+ return Markup(render_template(f"blocks/{name}.html", **context))
36
+
37
+ return render_block
38
+
39
+
40
+ def inject_context_vars(app):
41
+ """Expose design tokens, the block renderer and the product's site config.
42
+
43
+ `site` (name/tagline/nav/social) comes from PRODUCT-level config
44
+ (`app.config['SITE_*']`), so the theme never hardcodes a product name —
45
+ each product is its own website.
46
+ """
47
+ import os
48
+
49
+ try:
50
+ from flask_babel import gettext as _translate
51
+ except Exception:
52
+
53
+ def _translate(s):
54
+ return s
55
+
56
+ from splent_framework.services.service_locator import service_proxy
57
+
58
+ def _s(key, default):
59
+ # runtime setting (admin Appearance editor) -> product config -> default
60
+ try:
61
+ v = service_proxy("SettingsService").get(key, None)
62
+ return v if v not in (None, "") else default
63
+ except Exception:
64
+ return default
65
+
66
+ tokens = get_tokens(app)
67
+ # Compose the main nav from the INSTALLED features (each declares its entry
68
+ # via register_nav_item) reconciled with the admin Menus editor's runtime
69
+ # override (order / visibility / label + custom links). Falls back to legacy
70
+ # SITE_NAV. Labels are translated to follow the active locale.
71
+ from splent_io.splent_feature_theme.nav import compose_nav
72
+
73
+ nav = compose_nav(app, _translate)
74
+ site = {
75
+ "name": _s(
76
+ "site_name",
77
+ app.config.get("SITE_NAME") or os.getenv("SPLENT_APP") or "Site",
78
+ ),
79
+ "tagline": _s("site_tagline", app.config.get("SITE_TAGLINE", "")),
80
+ "nav": nav,
81
+ "social": app.config.get("SITE_SOCIAL", []),
82
+ "event": app.config.get("SITE_EVENT", {}),
83
+ "sponsors": app.config.get("SITE_SPONSORS", []),
84
+ "logo": _s("site_logo", app.config.get("SITE_LOGO", "")),
85
+ "gallery": app.config.get("SITE_GALLERY", []),
86
+ "hero_eyebrow": app.config.get("SITE_HERO_EYEBROW", ""),
87
+ "hero_actions": app.config.get("SITE_HERO_ACTIONS", []),
88
+ "highlights_title": app.config.get("SITE_HIGHLIGHTS_TITLE", ""),
89
+ "highlights": app.config.get("SITE_HIGHLIGHTS", []),
90
+ "sponsors_title": app.config.get("SITE_SPONSORS_TITLE", "Patrocinadores"),
91
+ "gallery_title": app.config.get("SITE_GALLERY_TITLE", "Galería"),
92
+ "cta": app.config.get("SITE_CTA", {}),
93
+ }
94
+ try:
95
+ from flask_babel import get_locale as _get_locale
96
+
97
+ site["locale"] = str(
98
+ _get_locale() or app.config.get("BABEL_DEFAULT_LOCALE", "en")
99
+ )
100
+ except Exception:
101
+ site["locale"] = app.config.get("BABEL_DEFAULT_LOCALE", "en")
102
+ site["locales"] = app.config.get("BABEL_SUPPORTED_LOCALES", ["en"])
103
+ return {
104
+ "theme_tokens": tokens,
105
+ "theme_tokens_css": tokens_to_css(tokens),
106
+ "render_block": _make_render_block(),
107
+ "site": site,
108
+ }