Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load loading indicator from file instead of inlining #6112

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions panel/assets/arcs_spinner.svg

This file was deleted.

16 changes: 0 additions & 16 deletions panel/assets/bar_spinner.svg

This file was deleted.

66 changes: 0 additions & 66 deletions panel/assets/dots_spinner.svg

This file was deleted.

62 changes: 0 additions & 62 deletions panel/assets/petal_spinner.svg

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/dist/assets/arcs_spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/dist/assets/bar_spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/dist/assets/dots_spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panel/dist/assets/petal_spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 47 additions & 11 deletions panel/dist/css/loading.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,64 @@
overflow: hidden;
}

:host(.pn-loading) > *,
.pn-loading > * {
filter: blur(1px) opacity(0.5);
}

:host(.pn-loading):before,
.pn-loading:before {
position: absolute;
-webkit-mask-position: center;
-webkit-mask-repeat: no-repeat;
content: '';
cursor: progress;
height: 100%;
width: 100%;
content: '';
position: absolute;
z-index: 1000;
background-color: rgb(255, 255, 255, 0.5);
border-color: lightgray;
background-repeat: no-repeat;
background-position: center;
background-size: auto 50%;
border-width: 1px;
}

:host(.pn-loading):after,
.pn-loading:after {
content: '';
cursor: progress;
height: 100%;
width: 100%;
position: absolute;
z-index: 1000;
}

:host(.pn-loading) .pn-loading-msg,
.pn-loading .pn-loading-msg {
color: black;
font-size: 2em;
position: absolute;
top: 72%;
font-size: 2em;
color: black;
width: 100%;
text-align: center;
width: 100%;
}

:host(.pn-loading.pn-arc):before,
.pn-loading.pn-arc:before {
-webkit-mask-image: url('../assets/arc_spinner.svg');
}

:host(.pn-loading.pn-arcs):before,
.pn-loading.pn-arcs:before {
-webkit-mask-image: url('../assets/arcs_spinner.svg');
}

:host(.pn-loading.pn-petal):before,
.pn-loading.pn-petal:before {
-webkit-mask-image: url('../assets/petal_spinner.svg');
}

:host(.pn-loading.pn-bar):before,
.pn-loading.pn-bar:before {
-webkit-mask-image: url('../assets/bar_spinner.svg');
}

:host(.pn-loading.pn-dots):before,
.pn-loading.pn-dots:before {
-webkit-mask-image: url('../assets/dots_spinner.svg');
}
3 changes: 1 addition & 2 deletions panel/io/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,11 @@ def script_to_html(

# Collect resources
resources = Resources(mode='inline' if inline else 'cdn')
loading_base = (DIST_DIR / "css" / "loading.css").read_text(encoding='utf-8')
spinner_css = loading_css(
config.loading_spinner, config.loading_color, config.loading_max_height
)
css_resources.append(
f'<style type="text/css">\n{loading_base}\n{spinner_css}\n</style>'
f'<style type="text/css">\n{spinner_css}\n</style>'
)
with set_curdoc(document):
bokeh_js, bokeh_css = bundle_resources(document.roots, resources)
Expand Down
Loading