sistine 0.2.0__tar.gz → 0.2.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sistine
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: HTML builder with server routing for Python
5
5
  Author: Ararya Arka Anugraha
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sistine"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "HTML builder with server routing for Python"
9
9
  authors = [
10
10
  {name = "Ararya Arka Anugraha"},
@@ -1,14 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
- import os
4
- import urllib.request
5
3
  from typing import Any, Callable
6
4
 
7
5
  from .server import StreamlitServer
8
6
 
9
7
 
10
8
  _PAGE = """\
11
- <div class="sistine-wrap" style="opacity:0">
9
+ <div class="sistine-wrap">
10
+ <div class="sistine-overlay"></div>
12
11
  {global_css}
13
12
  {global_head}
14
13
  {content}
@@ -44,40 +43,9 @@ class Sistine:
44
43
  self._global_head.append(tag)
45
44
 
46
45
  def use_tailwind(self) -> None:
47
- script = self._load_tailwind_cdn()
48
- if script:
49
- self._global_scripts.append(script)
50
- else:
51
- self._global_scripts.append(
52
- '<script src="https://cdn.tailwindcss.com"></script>'
53
- )
54
-
55
- def _load_tailwind_cdn(self) -> str | None:
56
- cache_dir = os.path.join(os.getcwd(), ".sistine")
57
- cache_path = os.path.join(cache_dir, "tailwind_cdn.js")
58
-
59
- if os.path.exists(cache_path):
60
- with open(cache_path, encoding="utf-8") as f:
61
- return f"<script>{f.read()}</script>"
62
-
63
- url = "https://cdn.tailwindcss.com"
64
- os.makedirs(cache_dir, exist_ok=True)
65
- import sys as _sys
66
- try:
67
- _sys.stderr.write(f"[sistine] Downloading Tailwind CDN ({url})...\n")
68
- _sys.stderr.flush()
69
- req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
70
- with urllib.request.urlopen(req, timeout=30) as resp:
71
- code = resp.read().decode("utf-8")
72
- with open(cache_path, "w", encoding="utf-8") as f:
73
- f.write(code)
74
- _sys.stderr.write(f"[sistine] Tailwind cached ({len(code)} bytes)\n")
75
- _sys.stderr.flush()
76
- return f"<script>{code}</script>"
77
- except Exception as e:
78
- _sys.stderr.write(f"[sistine] Failed to download Tailwind CDN: {e}\n")
79
- _sys.stderr.flush()
80
- return None
46
+ self._global_scripts.append(
47
+ '<script src="https://cdn.tailwindcss.com"></script>'
48
+ )
81
49
 
82
50
  def sistine(self, path: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
83
51
  def decorator(fn: Callable[..., Any]) -> Callable[..., Any]:
@@ -86,7 +54,7 @@ class Sistine:
86
54
  return decorator
87
55
 
88
56
  def _reveal_script(self) -> str:
89
- return "<script>(function(){var w=document.querySelector('.sistine-wrap');if(w){w.style.opacity='1';w.style.animation='none'}})()</script>"
57
+ return "<script>requestAnimationFrame(function(){var o=document.querySelector('.sistine-overlay');if(o)o.remove()})</script>"
90
58
 
91
59
  def _render(self, html: str) -> str:
92
60
  return _PAGE.format(
@@ -49,11 +49,16 @@ class StreamlitServer:
49
49
  [data-testid="stAppViewContainer"] > section:first-child {padding-top: 0 !important;}
50
50
  [data-testid="stAppDeployButton"] {display: none !important;}
51
51
  [data-testid="stToolbar"] {display: none !important;}
52
- @keyframes sistine-pulse { 0%,100%{opacity:0} 50%{opacity:.12} }
53
- .sistine-wrap { opacity:0; animation:sistine-pulse 1.5s ease-in-out infinite; }
52
+ @keyframes sistine-pulse { 0%,100%{opacity:1} 50%{opacity:.9} }
53
+ .sistine-overlay {
54
+ position:fixed;inset:0;z-index:999999;
55
+ background:var(--sistine-loading-bg,#0f0f0f);
56
+ animation:sistine-pulse 1.5s ease-in-out infinite;
57
+ }
54
58
  .stApp { margin: 0; padding: 0; background: transparent !important; }
55
59
  body { margin: 0; padding: 0; }
56
- * { margin: 0; padding: 0; box-sizing: border-box; }
60
+ .sistine-wrap { min-height: 100vh; }
61
+ .sistine-wrap, .sistine-wrap * { margin: 0; padding: 0; box-sizing: border-box; }
57
62
  </style>
58
63
  """,
59
64
  unsafe_allow_html=True,
@@ -65,7 +70,7 @@ class StreamlitServer:
65
70
  if not is_running_in_streamlit():
66
71
  script = sys.argv[0]
67
72
  print(
68
- f"\n \033[1mSistine v0.2.0\033[0m — Starting Streamlit backend on http://{host}:{port}...\n"
73
+ f"\n \033[1mSistine v0.2.2\033[0m — Starting Streamlit backend on http://{host}:{port}...\n"
69
74
  )
70
75
 
71
76
  import subprocess
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sistine
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: HTML builder with server routing for Python
5
5
  Author: Ararya Arka Anugraha
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes