solara 1.29.1__py2.py3-none-any.whl → 1.30.0__py2.py3-none-any.whl
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.
- solara/__init__.py +5 -5
- solara/__main__.py +6 -2
- solara/autorouting.py +79 -38
- solara/cache.py +2 -2
- solara/checks.html +1 -1
- solara/components/__init__.py +1 -1
- solara/components/applayout.py +5 -5
- solara/components/button.py +4 -4
- solara/components/card.py +1 -2
- solara/components/component_vue.py +1 -1
- solara/components/cross_filter.py +6 -7
- solara/components/datatable.py +2 -3
- solara/components/figure_altair.py +1 -1
- solara/components/file_download.py +2 -2
- solara/components/file_drop.py +76 -33
- solara/components/file_drop.vue +24 -10
- solara/components/head.py +1 -2
- solara/components/head_tag.py +2 -3
- solara/components/link.py +3 -4
- solara/components/meta.py +1 -1
- solara/components/misc.py +5 -9
- solara/datatypes.py +2 -2
- solara/hooks/use_reactive.py +2 -2
- solara/lab/components/confirmation_dialog.py +1 -1
- solara/lab/components/tabs.py +6 -6
- solara/reactive.py +1 -1
- solara/routing.py +9 -8
- solara/server/app.py +44 -1
- solara/server/assets/style.css +6 -0
- solara/server/esm.py +28 -4
- solara/server/kernel_context.py +75 -7
- solara/server/patch.py +3 -0
- solara/server/reload.py +2 -2
- solara/server/server.py +3 -3
- solara/server/settings.py +1 -0
- solara/server/starlette.py +66 -33
- solara/server/static/solara_bootstrap.py +1 -1
- solara/server/templates/solara.html.j2 +62 -42
- solara/tasks.py +1 -6
- solara/util.py +23 -1
- solara/website/assets/custom.css +56 -0
- solara/website/components/__init__.py +1 -0
- solara/website/components/algolia_api.vue +157 -0
- solara/website/components/docs.py +118 -0
- solara/website/components/header.py +20 -10
- solara/website/components/hero.py +1 -1
- solara/website/pages/__init__.py +223 -20
- solara/website/pages/apps/jupyter-dashboard-1.py +1 -1
- solara/website/pages/apps/multipage/__init__.py +1 -1
- solara/website/pages/apps/multipage/page2.py +1 -1
- solara/website/pages/apps/scatter.py +21 -7
- solara/website/pages/changelog/__init__.py +8 -0
- solara/website/pages/{docs/content/95-changelog.md → changelog/changelog.md} +28 -2
- solara/website/pages/contact/__init__.py +8 -0
- solara/website/pages/documentation/__init__.py +184 -0
- solara/website/pages/documentation/advanced/__init__.py +36 -0
- solara/website/pages/documentation/advanced/content/00-overview.md +1 -0
- solara/website/pages/{docs/content/10-howto/20-multipage.md → documentation/advanced/content/10-howto/10-multipage.md} +4 -5
- solara/website/pages/{docs/content/10-howto/30-layout.md → documentation/advanced/content/10-howto/20-layout.md} +21 -21
- solara/website/pages/{docs/content/10-howto/80-embed.md → documentation/advanced/content/10-howto/40-embed.md} +1 -1
- solara/website/pages/{docs → documentation/advanced}/content/20-understanding/06-ipyvuetify.md +1 -1
- solara/website/pages/{docs → documentation/advanced}/content/20-understanding/12-reacton-basics.md +1 -1
- solara/website/pages/{docs → documentation/advanced}/content/20-understanding/15-anatomy.md +2 -2
- solara/website/pages/{docs → documentation/advanced}/content/20-understanding/18-containers.md +3 -3
- solara/website/pages/{docs → documentation/advanced}/content/20-understanding/40-routing.md +9 -9
- solara/website/pages/{docs → documentation/advanced}/content/20-understanding/50-solara-server.md +1 -1
- solara/website/pages/{docs/content/50-enterprise → documentation/advanced/content/30-enterprise}/10-oauth.md +3 -3
- solara/website/pages/{docs/content/10-howto → documentation/advanced/content/40-development}/01-contribute.md +5 -5
- solara/website/pages/{docs/content/90-development → documentation/advanced/content/40-development}/10-setup.md +2 -2
- solara/website/pages/documentation/advanced/content/__init__.py +0 -0
- solara/website/pages/documentation/api/__init__.py +19 -0
- solara/website/pages/documentation/api/cross_filter/__init__.py +9 -0
- solara/website/pages/documentation/api/hooks/__init__.py +9 -0
- solara/website/pages/{api → documentation/api/hooks}/use_effect.md +3 -3
- solara/website/pages/{api → documentation/api/hooks}/use_effect.py +2 -1
- solara/website/pages/{api → documentation/api/hooks}/use_memo.md +2 -2
- solara/website/pages/{api → documentation/api/hooks}/use_memo.py +2 -1
- solara/website/pages/{api → documentation/api/hooks}/use_reactive.py +1 -2
- solara/website/pages/{api → documentation/api/hooks}/use_state.py +1 -2
- solara/website/pages/documentation/api/routing/__init__.py +9 -0
- solara/website/pages/{api → documentation/api/routing}/generate_routes.py +1 -2
- solara/website/pages/{api → documentation/api/routing}/generate_routes_directory.py +1 -2
- solara/website/pages/{api → documentation/api/routing}/use_route.py +2 -2
- solara/website/pages/{api → documentation/api/routing}/use_router.py +1 -2
- solara/website/pages/documentation/api/utilities/__init__.py +9 -0
- solara/website/pages/{api → documentation/api/utilities}/component_vue.py +1 -2
- solara/website/pages/{api → documentation/api/utilities}/computed.py +2 -2
- solara/website/pages/{api → documentation/api/utilities}/display.py +1 -2
- solara/website/pages/{api → documentation/api/utilities}/get_kernel_id.py +2 -2
- solara/website/pages/{api → documentation/api/utilities}/get_session_id.py +2 -2
- solara/website/pages/{api → documentation/api/utilities}/on_kernel_start.py +9 -3
- solara/website/pages/{api → documentation/api/utilities}/reactive.py +1 -2
- solara/website/pages/{api → documentation/api/utilities}/widget.py +2 -2
- solara/website/pages/documentation/components/__init__.py +12 -0
- solara/website/pages/documentation/components/advanced/__init__.py +9 -0
- solara/website/pages/documentation/components/data/__init__.py +9 -0
- solara/website/pages/documentation/components/enterprise/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/enterprise}/avatar.py +1 -2
- solara/website/pages/{api → documentation/components/enterprise}/avatar_menu.py +1 -2
- solara/website/pages/documentation/components/input/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/input}/checkbox.py +1 -2
- solara/website/pages/documentation/components/input/file_drop.py +75 -0
- solara/website/pages/{api → documentation/components/input}/input.py +1 -2
- solara/website/pages/{api → documentation/components/input}/select.py +1 -2
- solara/website/pages/{api → documentation/components/input}/slider.py +1 -2
- solara/website/pages/{api → documentation/components/input}/switch.py +1 -2
- solara/website/pages/{api → documentation/components/input}/togglebuttons.py +1 -2
- solara/website/pages/documentation/components/lab/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/lab}/chat.py +2 -3
- solara/website/pages/{api → documentation/components/lab}/cookies_headers.py +1 -1
- solara/website/pages/{api → documentation/components/lab}/input_date.py +1 -2
- solara/website/pages/{api → documentation/components/lab}/menu.py +1 -2
- solara/website/pages/{api → documentation/components/lab}/task.py +1 -2
- solara/website/pages/{api → documentation/components/lab}/theming.py +1 -2
- solara/website/pages/{api → documentation/components/lab}/use_task.py +1 -2
- solara/website/pages/documentation/components/layout/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/layout}/app_bar.py +1 -2
- solara/website/pages/{api → documentation/components/layout}/app_bar_title.py +1 -2
- solara/website/pages/{api → documentation/components/layout}/card.py +1 -2
- solara/website/pages/{api → documentation/components/layout}/card_actions.py +1 -2
- solara/website/pages/{api → documentation/components/layout}/griddraggable.py +1 -1
- solara/website/pages/{api → documentation/components/layout}/gridfixed.py +1 -1
- solara/website/pages/{api → documentation/components/layout}/hbox.py +1 -1
- solara/website/pages/{api → documentation/components/layout}/vbox.py +1 -1
- solara/website/pages/documentation/components/output/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/output}/file_download.py +1 -2
- solara/website/pages/{api → documentation/components/output}/image.py +1 -2
- solara/website/pages/{api → documentation/components/output}/tooltip.py +1 -2
- solara/website/pages/documentation/components/page/__init__.py +9 -0
- solara/website/pages/documentation/components/status/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/status}/error.py +3 -3
- solara/website/pages/{api → documentation/components/status}/info.py +3 -3
- solara/website/pages/{api → documentation/components/status}/progress.py +1 -2
- solara/website/pages/{api → documentation/components/status}/spinner.py +1 -2
- solara/website/pages/{api → documentation/components/status}/success.py +3 -3
- solara/website/pages/{api → documentation/components/status}/warning.py +3 -3
- solara/website/pages/documentation/components/viz/__init__.py +9 -0
- solara/website/pages/{api → documentation/components/viz}/plotly.py +1 -0
- solara/website/pages/{examples → documentation/examples}/__init__.py +3 -43
- solara/website/pages/{examples → documentation/examples}/general/deploy_model.py +3 -3
- solara/website/pages/{examples → documentation/examples}/general/login_oauth.py +1 -1
- solara/website/pages/{examples → documentation/examples}/general/vue_component.py +1 -2
- solara/website/pages/{examples → documentation/examples}/libraries/altair.py +2 -3
- solara/website/pages/{examples → documentation/examples}/libraries/ipyleaflet_advanced.py +1 -1
- solara/website/pages/{examples → documentation/examples}/utilities/countdown_timer.py +1 -1
- solara/website/pages/{examples → documentation/examples}/visualization/plotly.py +1 -2
- solara/website/pages/documentation/faq/__init__.py +11 -0
- solara/website/pages/{docs → documentation/getting_started}/__init__.py +7 -1
- solara/website/pages/{docs/content/03-quickstart.md → documentation/getting_started/content/00-quickstart.md} +2 -2
- solara/website/pages/{docs/content/00-introduction.md → documentation/getting_started/content/01-introduction.md} +16 -16
- solara/website/pages/{docs → documentation/getting_started}/content/02-installing.md +1 -1
- solara/website/pages/documentation/getting_started/content/04-tutorials/00-overview.md +9 -0
- solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/20-web-app.md +4 -4
- solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/30-ipywidgets.md +9 -9
- solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/40-streamlit.md +13 -13
- solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/50-dash.md +3 -3
- solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/_data_science.ipynb +5 -5
- solara/website/pages/documentation/getting_started/content/05-fundamentals/00-overview.md +7 -0
- solara/website/pages/{docs/content/07-fundamentals → documentation/getting_started/content/05-fundamentals}/10-components.md +2 -2
- solara/website/pages/{docs/content/07-fundamentals → documentation/getting_started/content/05-fundamentals}/50-state-management.md +3 -3
- solara/website/pages/documentation/getting_started/content/06-reference/00-overview.md +3 -0
- solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/41-asset-files.md +1 -1
- solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/60-static-site-generation.md +1 -1
- solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/70-search.md +1 -1
- solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/80-reloading.md +3 -3
- solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/95-caching.md +1 -1
- solara/website/pages/documentation/getting_started/content/07-deploying/00-overview.md +3 -0
- solara/website/pages/{docs/content/30-deploying → documentation/getting_started/content/07-deploying}/10-self-hosted.md +3 -3
- solara/website/pages/{docs/content/30-deploying → documentation/getting_started/content/07-deploying}/20-cloud-hosted.md +1 -1
- solara/website/pages/documentation/getting_started/content/__init__.py +0 -0
- solara/website/pages/showcase/__init__.py +1 -1
- solara/website/pages/showcase/domino_code_assist.py +1 -1
- solara/website/pages/showcase/solara_dev.py +1 -1
- solara/website/public/social/discord.svg +1 -0
- solara/website/public/social/github.svg +1 -0
- solara/website/public/social/twitter.svg +3 -0
- {solara-1.29.1.dist-info → solara-1.30.0.dist-info}/METADATA +8 -7
- solara-1.30.0.dist-info/RECORD +438 -0
- {solara-1.29.1.dist-info → solara-1.30.0.dist-info}/WHEEL +1 -1
- solara/website/pages/api/__init__.py +0 -292
- solara/website/pages/api/default_layout.py +0 -16
- solara/website/pages/api/file_drop.py +0 -36
- solara/website/pages/docs/content/04-tutorial/00-overview.md +0 -9
- solara/website/pages/docs/content/07-fundamentals/00-overview.md +0 -7
- solara/website/pages/docs/content/15-reference/00-overview.md +0 -6
- solara/website/pages/docs/content/30-deploying/00-overview.md +0 -3
- solara-1.29.1.dist-info/RECORD +0 -411
- /solara/website/pages/{docs/content/99-contact.md → contact/contact.md} +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/10-howto/00-overview.md +0 -0
- /solara/website/pages/{docs/content/10-howto/50-testing.md → documentation/advanced/content/10-howto/30-testing.md} +0 -0
- /solara/website/pages/{docs/content/10-howto/51-debugging.md → documentation/advanced/content/10-howto/31-debugging.md} +0 -0
- /solara/website/pages/{docs/content/10-howto/ipywidget_libraries.md → documentation/advanced/content/10-howto/50-ipywidget_libraries.md} +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/20-understanding/00-introduction.md +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/20-understanding/05-ipywidgets.md +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/20-understanding/10-reacton.md +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/20-understanding/17-rules-of-hooks.md +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/20-understanding/20-solara.md +0 -0
- /solara/website/pages/{docs → documentation/advanced}/content/20-understanding/60-voila.md +0 -0
- /solara/website/pages/{docs/content/50-enterprise → documentation/advanced/content/30-enterprise}/00-overview.md +0 -0
- /solara/website/pages/{docs/content/__init__.py → documentation/advanced/content/40-development/00-overview.md} +0 -0
- /solara/website/pages/{api → documentation/api/cross_filter}/cross_filter_dataframe.py +0 -0
- /solara/website/pages/{api → documentation/api/cross_filter}/cross_filter_report.py +0 -0
- /solara/website/pages/{api → documentation/api/cross_filter}/cross_filter_select.py +0 -0
- /solara/website/pages/{api → documentation/api/cross_filter}/cross_filter_slider.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_cross_filter.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_dark_effective.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_exception.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_previous.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_state_or_update.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_thread.md +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_thread.py +0 -0
- /solara/website/pages/{api → documentation/api/hooks}/use_trait_observe.py +0 -0
- /solara/website/pages/{api → documentation/api/routing}/resolve_path.py +0 -0
- /solara/website/pages/{api → documentation/api/routing}/route.py +0 -0
- /solara/website/pages/{api → documentation/api/utilities}/memoize.py +0 -0
- /solara/website/pages/{api → documentation/components/advanced}/link.py +0 -0
- /solara/website/pages/{api → documentation/components/advanced}/meta.py +0 -0
- /solara/website/pages/{api → documentation/components/advanced}/style.py +0 -0
- /solara/website/pages/{api → documentation/components}/common.py +0 -0
- /solara/website/pages/{api → documentation/components/data}/dataframe.py +0 -0
- /solara/website/pages/{api → documentation/components/data}/pivot_table.py +0 -0
- /solara/website/pages/{api → documentation/components/input}/button.py +0 -0
- /solara/website/pages/{api → documentation/components/input}/file_browser.py +0 -0
- /solara/website/pages/{api → documentation/components/lab}/confirmation_dialog.py +0 -0
- /solara/website/pages/{api → documentation/components/lab}/tab.py +0 -0
- /solara/website/pages/{api → documentation/components/lab}/tabs.py +0 -0
- /solara/website/pages/{api → documentation/components/layout}/app_layout.py +0 -0
- /solara/website/pages/{api → documentation/components/layout}/column.py +0 -0
- /solara/website/pages/{api → documentation/components/layout}/columns.py +0 -0
- /solara/website/pages/{api → documentation/components/layout}/columns_responsive.py +0 -0
- /solara/website/pages/{api → documentation/components/layout}/row.py +0 -0
- /solara/website/pages/{api → documentation/components/layout}/sidebar.py +0 -0
- /solara/website/pages/{api → documentation/components/output}/html.py +0 -0
- /solara/website/pages/{api → documentation/components/output}/markdown.py +0 -0
- /solara/website/pages/{api → documentation/components/output}/markdown_editor.py +0 -0
- /solara/website/pages/{api → documentation/components/output}/sql_code.py +0 -0
- /solara/website/pages/{api → documentation/components/page}/head.py +0 -0
- /solara/website/pages/{api → documentation/components/page}/title.py +0 -0
- /solara/website/pages/{api → documentation/components/viz}/altair.py +0 -0
- /solara/website/pages/{api → documentation/components/viz}/echarts.py +0 -0
- /solara/website/pages/{api → documentation/components/viz}/matplotlib.py +0 -0
- /solara/website/pages/{api → documentation/components/viz}/plotly_express.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/ai/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/ai/chatbot.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/ai/tokenizer.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/basics/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/basics/sine.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/authorization.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/layout_demo.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/multipage.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/scatter.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/scrolling.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/fullscreen/tutorial_streamlit.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/general/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/general/custom_storage.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/general/live_update.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/general/mycard.vue +0 -0
- /solara/website/pages/{examples → documentation/examples}/general/pokemon_search.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/ipycanvas.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/libraries/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/libraries/bqplot.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/libraries/ipyleaflet.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/utilities/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/utilities/calculator.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/utilities/todo.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/visualization/__init__.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/visualization/annotator.py +0 -0
- /solara/website/pages/{examples → documentation/examples}/visualization/linked_views.py +0 -0
- /solara/website/pages/{docs → documentation/faq}/content/99-faq.md +0 -0
- /solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/10_data_science.py +0 -0
- /solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/60-jupyter-dashboard-part1.py +0 -0
- /solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/SF_crime_sample.csv.gz +0 -0
- /solara/website/pages/{docs/content/04-tutorial → documentation/getting_started/content/04-tutorials}/_jupyter_dashboard_1.ipynb +0 -0
- /solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/40-static_files.md +0 -0
- /solara/website/pages/{docs/content/15-reference → documentation/getting_started/content/06-reference}/90-notebook-support.md +0 -0
- /solara/website/pages/{docs/content/lab → documentation/getting_started/content/08-lab}/00-what-is-lab.md +0 -0
- /solara/website/pages/{docs → documentation/getting_started}/content/90-troubleshoot.md +0 -0
- {solara-1.29.1.data → solara-1.30.0.data}/data/etc/jupyter/jupyter_notebook_config.d/solara.json +0 -0
- {solara-1.29.1.data → solara-1.30.0.data}/data/etc/jupyter/jupyter_server_config.d/solara.json +0 -0
- {solara-1.29.1.dist-info → solara-1.30.0.dist-info}/entry_points.txt +0 -0
- {solara-1.29.1.dist-info → solara-1.30.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# Overview
|
|
3
|
+
Click on one of the items on the left.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import solara
|
|
7
|
+
from solara.website.components import CategoryLayout, Gallery
|
|
8
|
+
|
|
9
|
+
_title = "API"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@solara.component
|
|
13
|
+
def Page(route_external=None):
|
|
14
|
+
Gallery(route_external)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@solara.component
|
|
18
|
+
def Layout(children=[]):
|
|
19
|
+
CategoryLayout(children=children)
|
|
@@ -8,7 +8,7 @@ def use_effect(
|
|
|
8
8
|
...
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Execute non-declarative code within a callback, for instance to add event handlers. `effect` is executed *after* page render, letting us fetch the actual underlying widget object using `solara.get_widget` on an element. `dependencies` should be a list of variables, which when changed trigger re-execution of `effect`. If left empty, `effect` will never re-execute.
|
|
11
|
+
Execute non-declarative code within a callback, for instance to add event handlers. `effect` is executed *after* page render, letting us fetch the actual underlying widget object using `solara.get_widget` on an element. `dependencies` should be a list of variables, which when changed trigger re-execution of `effect`. If left empty, `effect` will never re-execute.
|
|
12
12
|
|
|
13
13
|
`effect` can return a cleanup function, which will be called before re-execution of `effect`, or when the component containing `use_effect` is removed.
|
|
14
14
|
|
|
@@ -34,10 +34,10 @@ def use_event(el: solara.Element, callback: Callable):
|
|
|
34
34
|
def Page():
|
|
35
35
|
def function():
|
|
36
36
|
#Do something...
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
input = solara.InputText():
|
|
39
39
|
use_event(input, function)
|
|
40
40
|
...
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
See also the [Reacton docs](https://reacton.solara.dev/en/latest/api/#use_effect).
|
|
43
|
+
See also the [Reacton docs](https://reacton.solara.dev/en/latest/api/#use_effect).
|
|
@@ -11,6 +11,6 @@ def use_memo(
|
|
|
11
11
|
|
|
12
12
|
`use_memo` stores ([memoize](https://en.wikipedia.org/wiki/Memoization)) the function return on first render, and then excludes it from being re-executed, except when one of the `dependencies` changes. `dependencies` can take the value `None`, in which case dependencies are automatically obtained from nonlocal variables. If an empty list is passed as `dependencies` instead, the function is only executed once over the entire lifetime of the component.
|
|
13
13
|
|
|
14
|
-
Not to be confused with [memorize](https://solara.dev/api/memoize) which can cache multiple return values and which can be used outside of component.
|
|
14
|
+
Not to be confused with [memorize](https://solara.dev/documentation/api/utilities/memoize) which can cache multiple return values and which can be used outside of component.
|
|
15
15
|
|
|
16
|
-
See also the [Reacton docs](https://reacton.solara.dev/en/latest/api/#use_memo).
|
|
16
|
+
See also the [Reacton docs](https://reacton.solara.dev/en/latest/api/#use_memo).
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"""
|
|
4
4
|
import solara
|
|
5
5
|
import solara.autorouting
|
|
6
|
+
from solara.website.components import NoPage
|
|
6
7
|
from solara.website.utils import apidoc
|
|
7
8
|
|
|
8
|
-
from . import NoPage
|
|
9
|
-
|
|
10
9
|
title = "use_state"
|
|
11
10
|
Page = NoPage
|
|
12
11
|
__doc__ += apidoc(solara.use_state) # type: ignore
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"""
|
|
4
4
|
import solara
|
|
5
5
|
import solara.autorouting
|
|
6
|
+
from solara.website.components import NoPage
|
|
6
7
|
from solara.website.utils import apidoc
|
|
7
8
|
|
|
8
|
-
from . import NoPage
|
|
9
|
-
|
|
10
9
|
title = "generate_routes"
|
|
11
10
|
Page = NoPage
|
|
12
11
|
__doc__ += apidoc(solara.autorouting.generate_routes) # type: ignore
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"""
|
|
4
4
|
import solara
|
|
5
5
|
import solara.autorouting
|
|
6
|
+
from solara.website.components import NoPage
|
|
6
7
|
from solara.website.utils import apidoc
|
|
7
8
|
|
|
8
|
-
from . import NoPage
|
|
9
|
-
|
|
10
9
|
title = "generate_routes_directory"
|
|
11
10
|
Page = NoPage
|
|
12
11
|
__doc__ += apidoc(solara.autorouting.generate_routes_directory) # type: ignore
|
|
@@ -29,9 +29,9 @@ def Fruit():
|
|
|
29
29
|
with solara.Link(solara.resolve_path(route_fruit)):
|
|
30
30
|
solara.Button(route_fruit.path)
|
|
31
31
|
|
|
32
|
-
with solara.Link("/api/use_route/fruit/nofruit", nofollow=True):
|
|
32
|
+
with solara.Link("/documentation/api/routing/use_route/fruit/nofruit", nofollow=True):
|
|
33
33
|
solara.Button("Wrong fruit")
|
|
34
|
-
with solara.Link("/api/use_route/not-routed", nofollow=True):
|
|
34
|
+
with solara.Link("/documentation/api/routing/use_route/not-routed", nofollow=True):
|
|
35
35
|
solara.Button("Wrong url")
|
|
36
36
|
solara.Success(f"You chose {route.path}")
|
|
37
37
|
return main
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"""
|
|
4
4
|
import solara
|
|
5
5
|
import solara.autorouting
|
|
6
|
+
from solara.website.components import NoPage
|
|
6
7
|
from solara.website.utils import apidoc
|
|
7
8
|
|
|
8
|
-
from . import NoPage
|
|
9
|
-
|
|
10
9
|
title = "component_vue"
|
|
11
10
|
Page = NoPage
|
|
12
11
|
__doc__ += apidoc(solara.component_vue) # type: ignore
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
Run a function when a virtual kernel (re)starts and optionally run a cleanup function on shutdown.
|
|
5
5
|
|
|
6
6
|
```python
|
|
7
|
-
def on_kernel_start(f: Callable[[], Optional[Callable[[], None]]]):
|
|
7
|
+
def on_kernel_start(f: Callable[[], Optional[Callable[[], None]]]) -> Callable[[], None]:
|
|
8
|
+
...
|
|
8
9
|
```
|
|
9
10
|
|
|
10
11
|
`f` will be called on each virtual kernel (re)start. This (usually) happens each time a browser tab connects to the server
|
|
@@ -12,10 +13,15 @@ def on_kernel_start(f: Callable[[], Optional[Callable[[], None]]]):
|
|
|
12
13
|
The (optional) function returned by `f` will be called on kernel shutdown.
|
|
13
14
|
|
|
14
15
|
Note that the cleanup functions are called in reverse order with respect to the order in which they were registered
|
|
15
|
-
(e.g. the cleanup function of the last call to `on_kernel_start` will be called first on kernel shutdown)
|
|
16
|
+
(e.g. the cleanup function of the last call to `on_kernel_start` will be called first on kernel shutdown).
|
|
17
|
+
|
|
18
|
+
The return value of on_kernel_start is a cleanup function that will remove the callback from the list of callbacks to be called on kernel start.
|
|
19
|
+
|
|
20
|
+
During hot reload, the callbacks that are added from scripts or modules that will be reloaded will be removed before the app is loaded
|
|
21
|
+
again. This can cause the order of the callbacks to be different than at first run.
|
|
16
22
|
"""
|
|
17
23
|
|
|
18
|
-
from . import NoPage
|
|
24
|
+
from solara.website.components import NoPage
|
|
19
25
|
|
|
20
26
|
title = "on_kernel_start"
|
|
21
27
|
Page = NoPage
|
|
@@ -21,7 +21,7 @@ widget = solara.FileDownload.widget(data="some text data", filename="solara-demo
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
This is very useful if you are migrating your application from a classic
|
|
24
|
-
ipywidget to solara. See [also the ipywidgets tutorial](/
|
|
24
|
+
ipywidget to solara. See [also the ipywidgets tutorial](/documentation/getting_started/tutorials/ipywidgets).
|
|
25
25
|
|
|
26
26
|
The `ipywidgets.ValueWidget` is used to enable the use of the widget in
|
|
27
27
|
interact, or interactive. The `ipywidgets.VBox` is used to enable
|
|
@@ -98,7 +98,7 @@ def Page():
|
|
|
98
98
|
|
|
99
99
|
"""
|
|
100
100
|
|
|
101
|
-
from . import NoPage
|
|
101
|
+
from solara.website.components import NoPage
|
|
102
102
|
|
|
103
103
|
Page = NoPage
|
|
104
104
|
title = "widget"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# FileDrop components
|
|
3
|
+
|
|
4
|
+
FileDrop comes in two flavours:
|
|
5
|
+
|
|
6
|
+
* `FileDrop` for a single file upload
|
|
7
|
+
* `FileDropMultiple` which allows for multiple file upload
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
import textwrap
|
|
12
|
+
from typing import List, cast
|
|
13
|
+
|
|
14
|
+
import solara
|
|
15
|
+
from solara.components.file_drop import FileInfo
|
|
16
|
+
from solara.website.utils import apidoc
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@solara.component
|
|
20
|
+
def FileDropMultipleDemo():
|
|
21
|
+
content, set_content = solara.use_state(cast(List[bytes], []))
|
|
22
|
+
filename, set_filename = solara.use_state(cast(List[str], []))
|
|
23
|
+
size, set_size = solara.use_state(cast(List[int], []))
|
|
24
|
+
|
|
25
|
+
def on_file(files: List[FileInfo]):
|
|
26
|
+
set_filename([f["name"] for f in files])
|
|
27
|
+
set_size([f["size"] for f in files])
|
|
28
|
+
set_content([f["file_obj"].read(100) for f in files])
|
|
29
|
+
|
|
30
|
+
solara.FileDropMultiple(
|
|
31
|
+
label="Drag and drop files(s) here to read the first 100 bytes.",
|
|
32
|
+
on_file=on_file,
|
|
33
|
+
lazy=True, # We will only read the first 100 bytes
|
|
34
|
+
)
|
|
35
|
+
if content:
|
|
36
|
+
solara.Info(f"Number of uploaded files: {len(filename)}")
|
|
37
|
+
for f, s, c in zip(filename, size, content):
|
|
38
|
+
solara.Info(f"File {f} has total length: {s}\n, first 100 bytes:")
|
|
39
|
+
solara.Preformatted("\n".join(textwrap.wrap(repr(c))))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@solara.component
|
|
43
|
+
def FileDropDemo():
|
|
44
|
+
content, set_content = solara.use_state(b"")
|
|
45
|
+
filename, set_filename = solara.use_state("")
|
|
46
|
+
size, set_size = solara.use_state(0)
|
|
47
|
+
|
|
48
|
+
def on_file(f: FileInfo):
|
|
49
|
+
set_filename(f["name"])
|
|
50
|
+
set_size(f["size"])
|
|
51
|
+
set_content(f["file_obj"].read(100))
|
|
52
|
+
|
|
53
|
+
solara.FileDrop(
|
|
54
|
+
label="Drag and drop a file here to read the first 100 bytes.",
|
|
55
|
+
on_file=on_file,
|
|
56
|
+
lazy=True, # We will only read the first 100 bytes
|
|
57
|
+
)
|
|
58
|
+
if content:
|
|
59
|
+
solara.Info(f"File {filename} has total length: {size}\n, first 100 bytes:")
|
|
60
|
+
solara.Preformatted("\n".join(textwrap.wrap(repr(content))))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@solara.component
|
|
64
|
+
def Page():
|
|
65
|
+
with solara.Row():
|
|
66
|
+
with solara.Card(title="FileDrop"):
|
|
67
|
+
FileDropDemo()
|
|
68
|
+
with solara.Card(title="FileDropMultiple"):
|
|
69
|
+
FileDropMultipleDemo()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
__doc__ += "# FileDrop"
|
|
73
|
+
__doc__ += apidoc(solara.FileDrop.f) # type: ignore
|
|
74
|
+
__doc__ += "# FileDropMultiple"
|
|
75
|
+
__doc__ += apidoc(solara.FileDropMultiple.f) # type: ignore
|
|
@@ -6,10 +6,9 @@ To support proper typechecks, we have multiple slider (all wrapping the ipyvueti
|
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
8
|
import solara
|
|
9
|
+
from solara.website.components import NoPage
|
|
9
10
|
from solara.website.utils import apidoc
|
|
10
11
|
|
|
11
|
-
from . import NoPage
|
|
12
|
-
|
|
13
12
|
Page = NoPage
|
|
14
13
|
|
|
15
14
|
__doc__ += "# SliderInt"
|
|
@@ -6,10 +6,9 @@ ToggleButtons are in two flavours, for single, and for multiple selections.
|
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
8
|
import solara
|
|
9
|
+
from solara.website.components import NoPage
|
|
9
10
|
from solara.website.utils import apidoc
|
|
10
11
|
|
|
11
|
-
from . import NoPage
|
|
12
|
-
|
|
13
12
|
title = "ToggleButtons"
|
|
14
13
|
|
|
15
14
|
Page = NoPage
|
|
@@ -5,15 +5,14 @@ These are the components available in Solara to build chat interfaces.
|
|
|
5
5
|
Although they can be used together to create a pre-built chat interface, inserting custom components is also possible.
|
|
6
6
|
For an example of how to use a custom message component, see the bottom of the page.
|
|
7
7
|
|
|
8
|
-
Also check out the [Chatbot](/examples/ai/chatbot) example.
|
|
8
|
+
Also check out the [Chatbot](/documentation/examples/ai/chatbot) example.
|
|
9
9
|
|
|
10
10
|
# ChatBox
|
|
11
11
|
"""
|
|
12
12
|
import solara
|
|
13
|
+
from solara.website.components import NoPage
|
|
13
14
|
from solara.website.utils import apidoc
|
|
14
15
|
|
|
15
|
-
from . import NoPage
|
|
16
|
-
|
|
17
16
|
title = "Chat Components"
|
|
18
17
|
|
|
19
18
|
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
import solara
|
|
5
5
|
import solara.autorouting
|
|
6
6
|
import solara.lab
|
|
7
|
+
from solara.website.components import NoPage
|
|
7
8
|
from solara.website.utils import apidoc
|
|
8
9
|
|
|
9
|
-
from . import NoPage
|
|
10
|
-
|
|
11
10
|
title = "Task"
|
|
12
11
|
Page = NoPage
|
|
13
12
|
__doc__ += apidoc(solara.lab.task) # type: ignore
|
|
@@ -64,10 +64,9 @@ responds to the theme variant change.
|
|
|
64
64
|
"""
|
|
65
65
|
|
|
66
66
|
import solara
|
|
67
|
+
from solara.website.components import NoPage
|
|
67
68
|
from solara.website.utils import apidoc
|
|
68
69
|
|
|
69
|
-
from . import NoPage
|
|
70
|
-
|
|
71
70
|
title = "Themes"
|
|
72
71
|
Page = NoPage
|
|
73
72
|
__doc__ += apidoc(solara.lab.ThemeToggle) # type: ignore
|