streamlit-plugins 0.7.12__tar.gz → 0.7.13__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.
- {streamlit_plugins-0.7.12/streamlit_plugins.egg-info → streamlit_plugins-0.7.13}/PKG-INFO +1 -1
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/loader/__init__.py +38 -24
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/__init__.py +97 -72
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/st-styles.css +26 -26
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/multilit/app_wrapper.py +1 -2
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/multilit/loading_engine.py +22 -14
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/multilit/multilit.py +116 -199
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/reactlit/reactive.py +36 -3
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/reactlit/reactlit.py +71 -14
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/reactlit/test_reactive.py +35 -1
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13/streamlit_plugins.egg-info}/PKG-INFO +1 -1
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/LICENSE +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/README.md +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/setup.cfg +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/setup.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/annotated_text/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/input_chat_advance/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/asset-manifest.json +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/bootstrap.min.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/custom.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/index.html +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/css/2.4f758a59.chunk.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/css/2.4f758a59.chunk.css.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/2.524324ba.chunk.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/2.524324ba.chunk.js.LICENSE.txt +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/2.524324ba.chunk.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/main.34b82d10.chunk.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/main.34b82d10.chunk.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/runtime-main.65660c44.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/label_studio/frontend/build/static/js/runtime-main.65660c44.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/config.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/CrossOriginInterface.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/asset-manifest.json +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/bootstrap.min.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/bootstrap.min.css.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/index.html +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/material-fonts.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/material.woff2 +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/static/js/main.8bc23bfa.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/static/js/main.8bc23bfa.js.LICENSE.txt +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/static/js/main.8bc23bfa.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/frontend/build/style.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/navbar/inject_script.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/sankey_input/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/selectbox_enrich/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/skeleton/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/skeleton/template_builder.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/asset-manifest.json +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/index.html +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/drawsvg.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/drawsvg.v7.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/favicon.ico +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/images/sort_asc.png +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/images/sort_both.png +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/images/sort_desc.png +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/2.9cedfdc4.chunk.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/2.9cedfdc4.chunk.js.LICENSE.txt +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/2.9cedfdc4.chunk.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/main.1dfd8582.chunk.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/main.1dfd8582.chunk.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/runtime-main.8efd821a.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/js/runtime-main.8efd821a.js.map +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/snakeviz.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/snakeviz.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/d3.v3.min.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/immutable.min.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/jquery-3.2.1.min.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/jquery.dataTables.min.css +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/jquery.dataTables.min.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/static/vendor/lodash.min.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/templates/dir.html +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/snakeviz/frontend/build/templates/viz.html +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/theme_changer/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/theme_changer/config.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/theme_changer/entity.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/theme_changer/frontend/build/CrossOriginInterface.js +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/components/theme_changer/inject_script.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/extension/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/extension/button_group/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/multilit/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/reactlit/__init__.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/reactlit/advanced_patterns.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins/framework/reactlit/lab.py +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins.egg-info/SOURCES.txt +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins.egg-info/dependency_links.txt +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins.egg-info/requires.txt +0 -0
- {streamlit_plugins-0.7.12 → streamlit_plugins-0.7.13}/streamlit_plugins.egg-info/top_level.txt +0 -0
|
@@ -6,6 +6,8 @@ from typing import TypeVar, Callable, Tuple, Optional
|
|
|
6
6
|
|
|
7
7
|
import streamlit as st
|
|
8
8
|
|
|
9
|
+
LOADER_Z_INDEX = 999999
|
|
10
|
+
|
|
9
11
|
SHOWCASE2_GLOBAL_STYLES = """
|
|
10
12
|
<style>
|
|
11
13
|
a{
|
|
@@ -476,7 +478,7 @@ SHOWCASE_GLOBAL_STYLES = """
|
|
|
476
478
|
flex-wrap: nowrap;
|
|
477
479
|
justify-content: center;
|
|
478
480
|
pointer-events: none;
|
|
479
|
-
z-index:
|
|
481
|
+
z-index: LOADER_Z_INDEX_1;
|
|
480
482
|
}
|
|
481
483
|
|
|
482
484
|
.loader-star {
|
|
@@ -2403,7 +2405,7 @@ SHOWCASE_GLOBAL_STYLES = """
|
|
|
2403
2405
|
}
|
|
2404
2406
|
}
|
|
2405
2407
|
</style>
|
|
2406
|
-
"""
|
|
2408
|
+
""".replace("LOADER_Z_INDEX", str(LOADER_Z_INDEX)).replace("LOADER_Z_INDEX_1", str(LOADER_Z_INDEX-1))
|
|
2407
2409
|
|
|
2408
2410
|
|
|
2409
2411
|
def points_line(**kwargs):
|
|
@@ -2431,7 +2433,7 @@ def points_line(**kwargs):
|
|
|
2431
2433
|
}
|
|
2432
2434
|
.container {
|
|
2433
2435
|
text-align: center;
|
|
2434
|
-
z-index:
|
|
2436
|
+
z-index: LOADER_Z_INDEX_1;
|
|
2435
2437
|
}
|
|
2436
2438
|
section {
|
|
2437
2439
|
/* width: 30%; */
|
|
@@ -2588,7 +2590,7 @@ def grid_points(**kwargs):
|
|
|
2588
2590
|
}
|
|
2589
2591
|
.container {
|
|
2590
2592
|
text-align: center;
|
|
2591
|
-
z-index:
|
|
2593
|
+
z-index: LOADER_Z_INDEX_1;
|
|
2592
2594
|
}
|
|
2593
2595
|
section {
|
|
2594
2596
|
/* width: 30%; */
|
|
@@ -2734,7 +2736,7 @@ def pulse_bars(**kwargs):
|
|
|
2734
2736
|
}
|
|
2735
2737
|
.container {
|
|
2736
2738
|
text-align: center;
|
|
2737
|
-
z-index:
|
|
2739
|
+
z-index: LOADER_Z_INDEX_1;
|
|
2738
2740
|
}
|
|
2739
2741
|
section {
|
|
2740
2742
|
/* width: 30%; */
|
|
@@ -2858,7 +2860,7 @@ def pacman_loader(**kwargs):
|
|
|
2858
2860
|
}
|
|
2859
2861
|
.container {
|
|
2860
2862
|
text-align: center;
|
|
2861
|
-
z-index:
|
|
2863
|
+
z-index: LOADER_Z_INDEX_1;
|
|
2862
2864
|
}
|
|
2863
2865
|
@keyframes ldio-2h0ei997e6j-1 {
|
|
2864
2866
|
0% { transform: rotate(0deg) }
|
|
@@ -3313,7 +3315,7 @@ def standard_loaders(index=0):
|
|
|
3313
3315
|
}
|
|
3314
3316
|
.container {
|
|
3315
3317
|
text-align: center;
|
|
3316
|
-
z-index:
|
|
3318
|
+
z-index: LOADER_Z_INDEX_1;
|
|
3317
3319
|
}
|
|
3318
3320
|
section {
|
|
3319
3321
|
/* width: 30%; */
|
|
@@ -3445,7 +3447,7 @@ def book_loader(**kwargs):
|
|
|
3445
3447
|
height: 350px;
|
|
3446
3448
|
/* background: #000000e6; */
|
|
3447
3449
|
border-radius: 50%;
|
|
3448
|
-
z-index:
|
|
3450
|
+
z-index: LOADER_Z_INDEX;
|
|
3449
3451
|
}
|
|
3450
3452
|
.book-parent:after {
|
|
3451
3453
|
content: "";
|
|
@@ -3456,7 +3458,7 @@ def book_loader(**kwargs):
|
|
|
3456
3458
|
height: 100vh;
|
|
3457
3459
|
background: ||-bcolor-||;
|
|
3458
3460
|
backdrop-filter: blur(2px);
|
|
3459
|
-
z-index:
|
|
3461
|
+
z-index: LOADER_Z_INDEX_1;
|
|
3460
3462
|
}
|
|
3461
3463
|
.book-container {
|
|
3462
3464
|
--duration: 6s;
|
|
@@ -3469,7 +3471,7 @@ def book_loader(**kwargs):
|
|
|
3469
3471
|
flex-wrap: nowrap;
|
|
3470
3472
|
align-items: center;
|
|
3471
3473
|
pointer-events: none;
|
|
3472
|
-
z-index:
|
|
3474
|
+
z-index: LOADER_Z_INDEX;
|
|
3473
3475
|
}
|
|
3474
3476
|
.book-container .icon {
|
|
3475
3477
|
position: absolute;
|
|
@@ -4414,18 +4416,29 @@ def get_loader(loader_lib: LoadersLib | Callable[..., Tuple[str, str ,str], ], *
|
|
|
4414
4416
|
class BaseLoader(ABC):
|
|
4415
4417
|
LOADER_KEY = 'loader_container'
|
|
4416
4418
|
|
|
4417
|
-
def __init__(self,
|
|
4418
|
-
if
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4419
|
+
def __init__(self, loader_container_key: Optional[str] = None, **kwargs):
|
|
4420
|
+
if loader_container_key is None:
|
|
4421
|
+
loader_container_key = self.LOADER_KEY
|
|
4422
|
+
self.loader_container_key = loader_container_key
|
|
4423
|
+
|
|
4424
|
+
if "loader_container" in kwargs:
|
|
4425
|
+
loader_container = kwargs["loader_container"]
|
|
4426
|
+
else:
|
|
4427
|
+
loader_container = st.container(key=self.loader_container_key)
|
|
4428
|
+
|
|
4429
|
+
with loader_container:
|
|
4430
|
+
st.markdown(
|
|
4431
|
+
f"<style>\ndiv:has(>.st-key-{self.loader_container_key}){{\nheight: 0; position: absolute;left:0;z-index:{LOADER_Z_INDEX-1}\n}}\n</style>",
|
|
4432
|
+
unsafe_allow_html=True
|
|
4433
|
+
)
|
|
4425
4434
|
self.loader_container = loader_container
|
|
4426
4435
|
|
|
4427
4436
|
def recreate_loader_with(self, **loader_kwargs) -> "LoaderType":
|
|
4428
|
-
return self.__class__(
|
|
4437
|
+
return self.__class__(
|
|
4438
|
+
loader_container_key=self.loader_container_key,
|
|
4439
|
+
loader_container=self.loader_container,
|
|
4440
|
+
**loader_kwargs
|
|
4441
|
+
)
|
|
4429
4442
|
|
|
4430
4443
|
@abstractmethod
|
|
4431
4444
|
def run_loader(self, **kwargs):
|
|
@@ -4440,13 +4453,14 @@ LoaderType = TypeVar('LoaderType', bound=BaseLoader)
|
|
|
4440
4453
|
|
|
4441
4454
|
class DefaultLoader(BaseLoader):
|
|
4442
4455
|
def __init__(self,
|
|
4443
|
-
|
|
4456
|
+
loader_container_key: Optional[str] = None,
|
|
4444
4457
|
label='', height=256,
|
|
4445
4458
|
primary_color=None, background_color=None,
|
|
4446
4459
|
loader_lib: LoadersLib | Callable[..., Tuple[str, str ,str], ] = LoadersLib.book_loader, index=0, loader_lib_kwargs: dict = None,
|
|
4447
|
-
sleep_animation_time: float = 0.1
|
|
4460
|
+
sleep_animation_time: float = 0.1,
|
|
4461
|
+
**kwargs
|
|
4448
4462
|
):
|
|
4449
|
-
super().__init__(
|
|
4463
|
+
super().__init__(loader_container_key=loader_container_key, **kwargs)
|
|
4450
4464
|
self.sleep_animation_time = sleep_animation_time
|
|
4451
4465
|
if primary_color is None:
|
|
4452
4466
|
if st.get_option('theme.primaryColor') is None:
|
|
@@ -4479,10 +4493,10 @@ class DefaultLoader(BaseLoader):
|
|
|
4479
4493
|
|
|
4480
4494
|
loader_div, loader_style, loader_output_style = get_loader(loader_lib, index=index, **loader_lib_kwargs)
|
|
4481
4495
|
self.loader_div = loader_div
|
|
4482
|
-
self.loader_style = loader_style
|
|
4496
|
+
self.loader_style = loader_style.replace("LOADER_Z_INDEX", str(LOADER_Z_INDEX)).replace("LOADER_Z_INDEX_1", str(LOADER_Z_INDEX-1))
|
|
4483
4497
|
|
|
4484
4498
|
self.element_code = loader_div.replace("||-label-||", label)
|
|
4485
|
-
self.element_style = loader_style.replace('||-height-||', height_css)
|
|
4499
|
+
self.element_style = self.loader_style.replace('||-height-||', height_css)
|
|
4486
4500
|
self.element_style = self.element_style.replace('||-pcolor-||', primary_color)
|
|
4487
4501
|
self.element_style = self.element_style.replace('||-bcolor-||', background_color)
|
|
4488
4502
|
|
|
@@ -36,6 +36,9 @@ logger = logging.getLogger(__name__)
|
|
|
36
36
|
|
|
37
37
|
NavbarPositionType = Literal["top", "under", "side", "static", "hidden"]
|
|
38
38
|
|
|
39
|
+
NAVIGATION_KEY_PREFIX = "__navigation"
|
|
40
|
+
NAVBAR_KEY_PREFIX = "__navbar"
|
|
41
|
+
NAVIGATION_COMPONENT_KEY = "navigation-component"
|
|
39
42
|
GAP_BETWEEN_COMPS = 1
|
|
40
43
|
TOP_SIDE_ELEMENTS_MARGIN = 1.05
|
|
41
44
|
TOP_SIDE_ELEMENTS_WIDTH = 4
|
|
@@ -367,6 +370,13 @@ body.nav-open div:has(> iframe[title="{_component_func.name}"]) {{
|
|
|
367
370
|
}}
|
|
368
371
|
"""
|
|
369
372
|
|
|
373
|
+
HIDE_SKELETON_STYLE = f"""
|
|
374
|
+
div:has(> iframe[title="{_component_func.name}"]) [data-testid="stSkeleton"],
|
|
375
|
+
div:has(> iframe[title="{_component_func.name}"]) .stSkeleton {{
|
|
376
|
+
display: none;
|
|
377
|
+
}}
|
|
378
|
+
"""
|
|
379
|
+
|
|
370
380
|
# TODO: Hay que poner margenes en el iframe para que no ocupe el 100% de ancho si es menor la pantalla a 575
|
|
371
381
|
|
|
372
382
|
MATERIAL_ICON_HOME = ":material/home:"
|
|
@@ -618,6 +628,7 @@ def st_navbar(
|
|
|
618
628
|
input_styles: str | None = None,
|
|
619
629
|
themes_data: list[dict]| None = None,
|
|
620
630
|
theme_changer: bool = False,
|
|
631
|
+
hide_skeleton: bool = False,
|
|
621
632
|
collapsible: bool = True,
|
|
622
633
|
prefix_url: str = "",
|
|
623
634
|
# url_navigation: bool = False,
|
|
@@ -641,11 +652,11 @@ def st_navbar(
|
|
|
641
652
|
# Mostrar un warning de python de que no tendra efecto
|
|
642
653
|
warnings.warn("The sticky_nav parameter will have no effect when calling st_navbar directly")
|
|
643
654
|
|
|
644
|
-
if "
|
|
645
|
-
st.session_state
|
|
655
|
+
if f"{NAVBAR_KEY_PREFIX}_coi_instance" not in st.session_state:
|
|
656
|
+
st.session_state[f"{NAVBAR_KEY_PREFIX}_coi_instance"] = False
|
|
646
657
|
|
|
647
|
-
if "
|
|
648
|
-
st.session_state
|
|
658
|
+
if f"{NAVBAR_KEY_PREFIX}_st_styles_loaded" not in st.session_state:
|
|
659
|
+
st.session_state[f"{NAVBAR_KEY_PREFIX}_st_styles_loaded"] = False
|
|
649
660
|
|
|
650
661
|
if is_navigation:
|
|
651
662
|
if themes_data is None and theme_changer:
|
|
@@ -655,8 +666,8 @@ def st_navbar(
|
|
|
655
666
|
else:
|
|
656
667
|
theme_changer = False
|
|
657
668
|
|
|
658
|
-
navbar_view = st.container(key=f"{key}_container_navbar")
|
|
659
|
-
coi_styles_view = st.container(key=f"{key}_container_coi_styles")
|
|
669
|
+
navbar_view = st.container(key=f"{NAVBAR_KEY_PREFIX}_{key}_container_navbar")
|
|
670
|
+
coi_styles_view = st.container(key=f"{NAVBAR_KEY_PREFIX}_{key}_container_coi_styles")
|
|
660
671
|
|
|
661
672
|
# https://github.com/SnpM/streamlit-scroll-navigation
|
|
662
673
|
with coi_styles_view:
|
|
@@ -722,17 +733,19 @@ def st_navbar(
|
|
|
722
733
|
default_page_selected_id = override_page_selected_id
|
|
723
734
|
|
|
724
735
|
input_styles = input_styles or ""
|
|
725
|
-
styles = f"\ndiv:has(> .st-key-{key}_container_coi_styles) {{\nheight: 0;\nposition: absolute;\n}}\n"
|
|
726
|
-
if not st.session_state.
|
|
736
|
+
styles = f"\ndiv:has(> .st-key-{NAVBAR_KEY_PREFIX}_{key}_container_coi_styles) {{\nheight: 0;\nposition: absolute;\n}}\n"
|
|
737
|
+
if not st.session_state.get(f"{NAVBAR_KEY_PREFIX}_st_styles_loaded", False):
|
|
727
738
|
styles += load_st_styles()
|
|
739
|
+
if hide_skeleton:
|
|
740
|
+
styles += HIDE_SKELETON_STYLE
|
|
728
741
|
with coi_styles_view:
|
|
729
742
|
st.markdown(f"<style>\n{input_styles}\n{styles}\n<style>", unsafe_allow_html=True)
|
|
730
743
|
|
|
731
|
-
# if not st.session_state.
|
|
744
|
+
# if not st.session_state.get(f"{NAVBAR_KEY_PREFIX}_coi_instance", False):
|
|
732
745
|
# styles = load_st_styles()
|
|
733
746
|
with coi_styles_view:
|
|
734
747
|
instantiate_crossorigin_interface(_component_func.name, key, is_navigation, default_page_selected_id, position_mode, sticky_nav)
|
|
735
|
-
st.session_state
|
|
748
|
+
st.session_state[f"{NAVBAR_KEY_PREFIX}_coi_instance"] = True
|
|
736
749
|
|
|
737
750
|
with navbar_view:
|
|
738
751
|
component_value = _component_func(
|
|
@@ -771,7 +784,7 @@ def st_navbar(
|
|
|
771
784
|
return component_value
|
|
772
785
|
|
|
773
786
|
def st_which_page() -> str:
|
|
774
|
-
return st.session_state["
|
|
787
|
+
return st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_id"]
|
|
775
788
|
|
|
776
789
|
def st_navigation(
|
|
777
790
|
pages: list[StreamlitPage] | dict[str, list[StreamlitPage]],
|
|
@@ -785,23 +798,28 @@ def st_navigation(
|
|
|
785
798
|
input_styles: str | None = None,
|
|
786
799
|
themes_data: list[dict]| None = None,
|
|
787
800
|
theme_changer: bool = True,
|
|
788
|
-
prefix_url: str = ""
|
|
789
|
-
key="NavigationComponent",
|
|
801
|
+
prefix_url: str = ""
|
|
790
802
|
) -> StreamlitPage:
|
|
791
|
-
|
|
792
|
-
|
|
803
|
+
prev_url_page_id_key = f"{NAVIGATION_KEY_PREFIX}_prev_url_page_id"
|
|
804
|
+
prev_page_id_key = f"{NAVIGATION_KEY_PREFIX}_prev_page_id"
|
|
805
|
+
page_id_key = f"{NAVIGATION_KEY_PREFIX}_page_id"
|
|
806
|
+
force_page_id_key = f"{NAVIGATION_KEY_PREFIX}_force_page_id"
|
|
807
|
+
history_key = f"{NAVIGATION_KEY_PREFIX}_history"
|
|
808
|
+
|
|
809
|
+
if prev_url_page_id_key not in st.session_state:
|
|
810
|
+
st.session_state[prev_url_page_id_key] = None
|
|
793
811
|
|
|
794
|
-
if
|
|
795
|
-
st.session_state
|
|
812
|
+
if prev_page_id_key not in st.session_state:
|
|
813
|
+
st.session_state[prev_page_id_key] = None
|
|
796
814
|
|
|
797
|
-
if
|
|
798
|
-
st.session_state
|
|
815
|
+
if page_id_key not in st.session_state:
|
|
816
|
+
st.session_state[page_id_key] = None
|
|
799
817
|
|
|
800
|
-
if
|
|
801
|
-
st.session_state
|
|
818
|
+
if force_page_id_key not in st.session_state:
|
|
819
|
+
st.session_state[force_page_id_key] = None
|
|
802
820
|
|
|
803
|
-
if
|
|
804
|
-
st.session_state
|
|
821
|
+
if history_key not in st.session_state:
|
|
822
|
+
st.session_state[history_key] = []
|
|
805
823
|
|
|
806
824
|
# Build state
|
|
807
825
|
# {
|
|
@@ -883,41 +901,41 @@ def st_navigation(
|
|
|
883
901
|
logout_page=logout_page,
|
|
884
902
|
)
|
|
885
903
|
|
|
886
|
-
st.session_state["
|
|
887
|
-
st.session_state["
|
|
888
|
-
st.session_state["
|
|
904
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_menu_pages"] = menu_pages
|
|
905
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_menu_account_pages"] = menu_account_pages
|
|
906
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"] = default_page._script_hash
|
|
889
907
|
|
|
890
908
|
logout_page_id, login_page_id = None, None
|
|
891
909
|
if login_page:
|
|
892
910
|
login_page_id = login_page._script_hash
|
|
893
|
-
st.session_state["
|
|
894
|
-
|
|
911
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_login_page_id"] = login_page_id
|
|
912
|
+
|
|
895
913
|
if logout_page:
|
|
896
914
|
logout_page_id = logout_page._script_hash
|
|
897
|
-
st.session_state["
|
|
915
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_logout_page_id"] = logout_page_id
|
|
898
916
|
|
|
899
917
|
if account_page:
|
|
900
918
|
account_page_id = account_page._script_hash
|
|
901
|
-
st.session_state["
|
|
919
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_account_page_id"] = account_page_id
|
|
902
920
|
|
|
903
921
|
if settings_page:
|
|
904
922
|
settings_page_id = settings_page._script_hash
|
|
905
|
-
st.session_state["
|
|
923
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_settings_page_id"] = settings_page_id
|
|
906
924
|
|
|
907
925
|
|
|
908
|
-
st.session_state["
|
|
926
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_map"] = pages_map
|
|
909
927
|
|
|
910
928
|
|
|
911
|
-
if st.session_state[
|
|
912
|
-
st.session_state[
|
|
913
|
-
|
|
929
|
+
if st.session_state[page_id_key] is None:
|
|
930
|
+
st.session_state[page_id_key] = st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"]
|
|
931
|
+
|
|
914
932
|
next_page_id = st_navbar(
|
|
915
933
|
menu_definition=menu_pages, # if st.session_state.logged_in else [],
|
|
916
934
|
home_definition=home_definition,
|
|
917
935
|
login_definition=menu_account_pages,
|
|
918
936
|
hide_streamlit_markers=False,
|
|
919
|
-
default_page_selected_id=st.session_state[
|
|
920
|
-
override_page_selected_id=st.session_state[
|
|
937
|
+
default_page_selected_id=st.session_state[page_id_key] or st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"],
|
|
938
|
+
override_page_selected_id=st.session_state[force_page_id_key],
|
|
921
939
|
position_mode=position_mode,
|
|
922
940
|
sticky_nav=sticky_nav,
|
|
923
941
|
input_styles=input_styles,
|
|
@@ -925,11 +943,12 @@ def st_navigation(
|
|
|
925
943
|
theme_changer=theme_changer,
|
|
926
944
|
prefix_url=prefix_url,
|
|
927
945
|
# url_navigation=native_way, # and url_navigation,
|
|
928
|
-
key=
|
|
946
|
+
key=NAVIGATION_COMPONENT_KEY,
|
|
947
|
+
hide_skeleton=True,
|
|
929
948
|
)
|
|
930
|
-
st.session_state[
|
|
931
|
-
prev_page_id = st.session_state[
|
|
932
|
-
st.session_state[
|
|
949
|
+
st.session_state[force_page_id_key] = None
|
|
950
|
+
prev_page_id = st.session_state[page_id_key]
|
|
951
|
+
st.session_state[page_id_key] = next_page_id # Added to fix login/logout issue
|
|
933
952
|
# print("CUSTOM COMPONENT", pages_map[next_page_id].title)
|
|
934
953
|
if native_way:
|
|
935
954
|
# Si la url es el path igual al que devuelve el `next_page_id` quiere decir que la navegacion es por url
|
|
@@ -940,11 +959,11 @@ def st_navigation(
|
|
|
940
959
|
# pages_map, st.context.url, prefix_url=prefix_url
|
|
941
960
|
# )
|
|
942
961
|
# # print("URL PAGE", pages_map[url_page_id].title)
|
|
943
|
-
# if url_page_id != st.session_state["
|
|
962
|
+
# if url_page_id != st.session_state[f"{NAVIGATION_KEY_PREFIX}_prev_url_page_id"]:
|
|
944
963
|
# # Navegacion por url
|
|
945
964
|
# # Give enough time to the custom component to update
|
|
946
965
|
# time.sleep(0.1)
|
|
947
|
-
# st.session_state["
|
|
966
|
+
# st.session_state[f"{NAVIGATION_KEY_PREFIX}_prev_url_page_id"] = url_page_id
|
|
948
967
|
# next_page_id = url_page_id
|
|
949
968
|
|
|
950
969
|
page = st.navigation(
|
|
@@ -960,9 +979,9 @@ def st_navigation(
|
|
|
960
979
|
|
|
961
980
|
# Solo si se cambia de pagina
|
|
962
981
|
if prev_page_id != next_page_id:
|
|
963
|
-
st.session_state[
|
|
982
|
+
st.session_state[page_id_key] = next_page_id
|
|
964
983
|
if prev_page_id not in [logout_page_id, login_page_id]:
|
|
965
|
-
st.session_state[
|
|
984
|
+
st.session_state[prev_page_id_key] = prev_page_id
|
|
966
985
|
st_switch_page(next_page_id, native_way=native_way)
|
|
967
986
|
|
|
968
987
|
page._can_be_called = True
|
|
@@ -970,19 +989,20 @@ def st_navigation(
|
|
|
970
989
|
return page
|
|
971
990
|
|
|
972
991
|
def add_page_to_history(page_id: str):
|
|
973
|
-
|
|
974
|
-
|
|
992
|
+
history_key = f"{NAVIGATION_KEY_PREFIX}_history"
|
|
993
|
+
if history_key not in st.session_state:
|
|
994
|
+
st.session_state[history_key] = []
|
|
975
995
|
|
|
976
|
-
if len(st.session_state
|
|
977
|
-
last_page_id, runs =
|
|
996
|
+
if len(st.session_state[history_key]) > 0:
|
|
997
|
+
last_page_id, runs = st.session_state[history_key][-1].split("::")
|
|
978
998
|
if page_id == last_page_id:
|
|
979
|
-
st.session_state
|
|
999
|
+
st.session_state[history_key][-1] = f"{page_id}::{int(runs) + 1}"
|
|
980
1000
|
return
|
|
981
1001
|
|
|
982
|
-
st.session_state.
|
|
1002
|
+
st.session_state[history_key].append(f"{page_id}::1")
|
|
983
1003
|
|
|
984
1004
|
def has_changed_page() -> bool:
|
|
985
|
-
history = st.session_state.get("
|
|
1005
|
+
history = st.session_state.get(f"{NAVIGATION_KEY_PREFIX}_history", [])
|
|
986
1006
|
if not history or len(history) < 2:
|
|
987
1007
|
return False
|
|
988
1008
|
|
|
@@ -997,37 +1017,42 @@ def has_changed_page() -> bool:
|
|
|
997
1017
|
return False
|
|
998
1018
|
|
|
999
1019
|
def set_default_page(page_id: str):
|
|
1000
|
-
st.session_state["
|
|
1020
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"] = page_id
|
|
1001
1021
|
|
|
1002
1022
|
def init_navigation_transition(prev_page_id: str, page_id: str):
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
if
|
|
1006
|
-
st.session_state[
|
|
1023
|
+
prev_page_key = f"{NAVIGATION_KEY_PREFIX}_prev_page_id"
|
|
1024
|
+
page_key = f"{NAVIGATION_KEY_PREFIX}_page_id"
|
|
1025
|
+
if prev_page_key not in st.session_state:
|
|
1026
|
+
st.session_state[prev_page_key] = prev_page_id
|
|
1027
|
+
if page_key not in st.session_state:
|
|
1028
|
+
st.session_state[page_key] = page_id
|
|
1007
1029
|
|
|
1008
1030
|
def set_navigation_transition(prev_page_id: str, page_id: str):
|
|
1009
|
-
st.session_state["
|
|
1010
|
-
st.session_state["
|
|
1031
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_prev_page_id"] = prev_page_id
|
|
1032
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_id"] = page_id
|
|
1011
1033
|
|
|
1012
1034
|
def set_force_next_page(page_id: str):
|
|
1013
|
-
st.session_state["
|
|
1035
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_force_page_id"] = page_id
|
|
1014
1036
|
|
|
1015
1037
|
def get_navigation_transition() -> tuple[str, str]:
|
|
1016
|
-
return
|
|
1038
|
+
return (
|
|
1039
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_prev_page_id"],
|
|
1040
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_id"],
|
|
1041
|
+
)
|
|
1017
1042
|
|
|
1018
1043
|
def st_switch_home(native_way: bool = False):
|
|
1019
|
-
st_switch_page(st.session_state["
|
|
1044
|
+
st_switch_page(st.session_state[f"{NAVIGATION_KEY_PREFIX}_default_page_id"], native_way=native_way)
|
|
1020
1045
|
|
|
1021
1046
|
def st_switch_page(page_id: str, native_way: bool = False):
|
|
1022
|
-
pages = st.session_state["
|
|
1047
|
+
pages = st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_map"]
|
|
1023
1048
|
page = pages.get(page_id, None)
|
|
1024
1049
|
if page is None:
|
|
1025
1050
|
raise ValueError(f"Page with id {page_id} not found")
|
|
1026
1051
|
|
|
1027
1052
|
# add_page_to_history(page_id)
|
|
1028
|
-
st.session_state["
|
|
1053
|
+
st.session_state[f"{NAVIGATION_KEY_PREFIX}_force_page_id"] = page_id
|
|
1029
1054
|
if native_way:
|
|
1030
|
-
st.switch_page(page)
|
|
1055
|
+
st.switch_page(page, query_params=dict(st.query_params))
|
|
1031
1056
|
else:
|
|
1032
1057
|
st.rerun()
|
|
1033
1058
|
# ctx = get_script_run_ctx()
|
|
@@ -1041,7 +1066,7 @@ def st_switch_page(page_id: str, native_way: bool = False):
|
|
|
1041
1066
|
# raise RerunException(rerun_data)
|
|
1042
1067
|
|
|
1043
1068
|
def get_pages_info() -> tuple[dict[str, str], str, list[dict], list[dict], str | None, str | None, str | None, str | None]:
|
|
1044
|
-
pages = st.session_state["
|
|
1069
|
+
pages = st.session_state[f"{NAVIGATION_KEY_PREFIX}_page_map"]
|
|
1045
1070
|
|
|
1046
1071
|
default_page = next(filter(lambda p: p._default, pages.values()), None)
|
|
1047
1072
|
if default_page is None:
|
|
@@ -1049,12 +1074,12 @@ def get_pages_info() -> tuple[dict[str, str], str, list[dict], list[dict], str |
|
|
|
1049
1074
|
|
|
1050
1075
|
default_page_id = default_page._script_hash
|
|
1051
1076
|
|
|
1052
|
-
login_page_id = st.session_state.get("
|
|
1053
|
-
logout_page_id = st.session_state.get("
|
|
1054
|
-
account_page_id = st.session_state.get("
|
|
1055
|
-
settings_page_id = st.session_state.get("
|
|
1077
|
+
login_page_id = st.session_state.get(f"{NAVIGATION_KEY_PREFIX}_login_page_id", None)
|
|
1078
|
+
logout_page_id = st.session_state.get(f"{NAVIGATION_KEY_PREFIX}_logout_page_id", None)
|
|
1079
|
+
account_page_id = st.session_state.get(f"{NAVIGATION_KEY_PREFIX}_account_page_id", None)
|
|
1080
|
+
settings_page_id = st.session_state.get(f"{NAVIGATION_KEY_PREFIX}_settings_page_id", None)
|
|
1056
1081
|
|
|
1057
|
-
menu_pages = st.session_state["
|
|
1058
|
-
menu_account_pages = st.session_state["
|
|
1082
|
+
menu_pages = st.session_state[f"{NAVIGATION_KEY_PREFIX}_menu_pages"]
|
|
1083
|
+
menu_account_pages = st.session_state[f"{NAVIGATION_KEY_PREFIX}_menu_account_pages"]
|
|
1059
1084
|
|
|
1060
1085
|
return pages, default_page_id, menu_pages, menu_account_pages, login_page_id, logout_page_id, account_page_id, settings_page_id
|