@danhachuel/thunderbolt 0.6.94 → 0.6.96

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.
Files changed (2) hide show
  1. package/app/main.py +46 -55
  2. package/package.json +1 -1
package/app/main.py CHANGED
@@ -35,6 +35,7 @@ from typing import Any
35
35
 
36
36
  import requests
37
37
  import streamlit as st
38
+ import streamlit.components.v1 as components
38
39
 
39
40
  ROOT = Path(__file__).resolve().parents[1]
40
41
  if str(ROOT) not in sys.path:
@@ -267,67 +268,57 @@ ensure_storage()
267
268
  st.set_page_config(page_title="Thunderbolt", page_icon="T", layout="wide", initial_sidebar_state="expanded")
268
269
 
269
270
  theme_base = (st.get_option("theme.base") or "dark").lower()
270
-
271
- if theme_base == "light":
272
- st.markdown(
273
- """
274
- <style>
275
- html,
276
- body,
277
- .stApp,
278
- [data-testid="stAppViewContainer"],
279
- [data-testid="stAppViewContainer"] > .main {
280
- background: linear-gradient(315deg, #4f2991 3%, #7dc4ff 38%, #36cfcc 68%, #a92ed3 98%);
281
- background-size: 400% 400%;
282
- background-attachment: fixed;
283
- animation: thunderbolt-prismatic-gradient 15s ease infinite;
284
- }
285
-
286
- .stApp,
287
- [data-testid="stAppViewContainer"],
288
- [data-testid="stAppViewContainer"] > .main {
289
- min-height: 100vh;
290
- margin: 0;
291
- background-color: transparent !important;
292
- background-image: linear-gradient(315deg, #4f2991 3%, #7dc4ff 38%, #36cfcc 68%, #a92ed3 98%) !important;
293
- background-size: 400% 400% !important;
294
- background-attachment: fixed;
271
+ components.html(
272
+ """
273
+ <script>
274
+ (() => {
275
+ const STYLE_ID = "thunderbolt-light-theme-style";
276
+ const COLOR = "#7A6FE4";
277
+ const getStoredTheme = () => {
278
+ try {
279
+ return JSON.parse(window.parent.localStorage.getItem("stActiveTheme-/-v2") || '"System"');
280
+ } catch (_error) {
281
+ return "System";
282
+ }
283
+ };
284
+ const isLightTheme = () => {
285
+ const selected = getStoredTheme();
286
+ if (selected === "Light") return true;
287
+ if (selected === "Dark") return false;
288
+ return window.parent.matchMedia("(prefers-color-scheme: light)").matches;
289
+ };
290
+ const applyTheme = () => {
291
+ const document = window.parent.document;
292
+ const existing = document.getElementById(STYLE_ID);
293
+ if (!isLightTheme()) {
294
+ if (existing) existing.remove();
295
+ return;
296
+ }
297
+ const style = existing || document.createElement("style");
298
+ style.id = STYLE_ID;
299
+ style.textContent = `
300
+ :root { --primary-bg-color: ${COLOR}; }
301
+ html, body, .stApp, [data-testid="stAppViewContainer"], [data-testid="stAppViewContainer"] > .main {
302
+ min-height: 100vh !important;
303
+ margin: 0 !important;
304
+ background: ${COLOR} !important;
305
+ background-image: none !important;
295
306
  }
296
-
297
307
  [data-testid="stSidebar"] {
298
- background: rgba(255, 255, 255, 0.72) !important;
308
+ background: ${COLOR} !important;
309
+ background-image: none !important;
299
310
  }
300
-
301
- @keyframes thunderbolt-prismatic-gradient {
302
- 0% { background-position: 0% 0%; }
303
- 50% { background-position: 100% 100%; }
304
- 100% { background-position: 0% 0%; }
305
- }
306
- </style>
307
- <script>
308
- (function () {
309
- const gradient = 'linear-gradient(315deg, #4f2991 3%, #7dc4ff 38%, #36cfcc 68%, #a92ed3 98%)';
310
- const selectors = [
311
- 'html',
312
- 'body',
313
- '.stApp',
314
- '[data-testid="stAppViewContainer"]',
315
- '[data-testid="stAppViewContainer"] > .main'
316
- ];
317
- const applyGradient = () => selectors.forEach((selector) => {
318
- document.querySelectorAll(selector).forEach((element) => {
319
- element.style.setProperty('background-image', gradient, 'important');
320
- element.style.setProperty('background-size', '400% 400%', 'important');
321
- element.style.setProperty('background-attachment', 'fixed');
322
- });
311
+ `;
312
+ if (!existing) document.head.appendChild(style);
323
313
  };
324
- applyGradient();
325
- new MutationObserver(applyGradient).observe(document.documentElement, { childList: true, subtree: true });
314
+ applyTheme();
315
+ window.setInterval(applyTheme, 500);
326
316
  })();
327
317
  </script>
328
- """,
329
- unsafe_allow_html=True,
330
- )
318
+ """,
319
+ height=0,
320
+ width=0,
321
+ )
331
322
 
332
323
  st.markdown("""
333
324
  <style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.6.94",
3
+ "version": "0.6.96",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",