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

Render shiny.min.css using bs_theme() #1191

Merged
merged 7 commits into from
Mar 5, 2024
Merged

Conversation

gadenbuie
Copy link
Collaborator

@gadenbuie gadenbuie commented Mar 5, 2024

Currently, we're using shiny.min.css directly, which does not include Bootstrap 5 adjustments. The most notable place this causes problems is with the notifications messages, which are currently using partially incorrect styles. (Example app)

image

After this change, we re-render shiny.min.css using the bs_theme() object, which gives us better looking notifications.

image

Also while here, I updated the update script to use cli if availble for a much cleaner log experience.

❯ Rscript scripts/htmlDependencies.R
✔ Checking for node / npm [41ms]
✔ Installing GitHub packages: bslib, shiny, htmltools [5.8s]
✔ Copy shiny www/shared [320ms]
✔ Copy bslib components [49ms]
✔ Copy htmltools - fill [24ms]
✔ Cleanup shiny www/shared [13ms]
✔ Save ionRangeSlider dep [394ms]
✔ Save bootstrap bundle [506ms]
✔ Reduce font files [23ms]
✔ Render shiny.min.css with bs_theme() [52ms]
✔ Render selectize.min.js with bs_theme() [60ms]
✔ Render datepicker.min.css with bs_theme() [63ms]
✔ Cleanup bootstrap bundle [18ms]
✔ Save requirejs [144ms]
✔ Save _versions.py [9ms]

I applied the same process to other dependencies from shiny:

  • shiny
  • selectize
  • datepicker

@gadenbuie gadenbuie requested a review from schloerke March 5, 2024 16:26
@cpsievert
Copy link
Collaborator

Thanks! I'm pretty sure we should doing the same for selectize.css

@schloerke
Copy link
Collaborator

Do we need to do the same for shinyswatch?

@gadenbuie
Copy link
Collaborator Author

Do we need to do the same for shinyswatch?

I'm not sure... I thought shinyswatch was replacing just the Boostrap CSS. If it included these component CSS files, I'd imagine you're already running bs_theme() through them.

We'd like to move toward a setup where we can replace the core Bootstrap CSS and have these component files work via CSS variables. I think we're close here but there might be places where we need to update the CSS upstream in rstudio/shiny.

@schloerke
Copy link
Collaborator

schloerke commented Mar 5, 2024

From https://github.com/posit-dev/py-shinyswatch/tree/e6f097b792bbba61fc4c03b0bbc78e4ae422f0c1/shinyswatch/bsw5/cerulean , shinyswatch is only aware of the ionRangeSlider and is missing selectize and datepicker. (The bootstrap.min.css is equivalent to the shiny.min.css.)

May I request a PR to add those two files (to here)? Thank you!

@gadenbuie
Copy link
Collaborator Author

With this change, shinyswatch shouldn't need to do anything with ionRangeSlider. I'll take a look

@gadenbuie gadenbuie merged commit 4e9955b into main Mar 5, 2024
30 checks passed
@gadenbuie gadenbuie deleted the fix/render-shiny-scss branch March 5, 2024 20:47
schloerke added a commit that referenced this pull request Mar 6, 2024
* main: (35 commits)
  test: Speed up tests by using single page. Do not attempt deploys job unless conditions are valid (#1197)
  ci: Run `playwright-examples` on Python 3.12 as well (#1195)
  Shiny preset style updates and nudges (#1176)
  tests: Upload trace on failed tests (#1196)
  Fix datetime input in airmass example app (#1194)
  Better docs for `render.download` (#1193)
  Render `shiny.min.css` using `bs_theme()` (#1191)
  Fix `express.ui.update_date` and`express.ui.update_text` links (#1192)
  Use `cast()` for asgiref types only when type checking (#1190)
  Remove uvicorn and click dependencies in Emscripten (#1187)
  Remove asgiref run-time dependency (#1183)
  Install dev-shinylive via Makefile (#1184)
  Put all "Other Changes" items into one section
  Use consistent formatting for items in changelog
  Don't run playwright-deploys tests on release
  tests(resolve-id): Update window size to ensure tooltip is visible (#1179)
  Setup dev version 0.8.0.9000 (#1181)
  Bump version to 0.8.0
  Revert API changes made in `Selected rows method` #1121 (#1174)
  Make autoreload work on codespaces (#1167)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants