dara-core 1.21.4__py3-none-any.whl → 1.21.5__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.
dara/core/defaults.py CHANGED
@@ -34,7 +34,7 @@ from dara.core.interactivity.actions import (
34
34
  UpdateVariableDef,
35
35
  )
36
36
  from dara.core.internal.cache_store import CacheStore
37
- from dara.core.router import Link, LinkDef, MenuLink, MenuLinkDef, Outlet, OutletDef
37
+ from dara.core.router import Link, LinkDef, MenuLink, MenuLinkDef, Navigate, NavigateDef, Outlet, OutletDef
38
38
  from dara.core.visual.components import (
39
39
  DefaultFallbackDef,
40
40
  DynamicComponent,
@@ -90,6 +90,7 @@ CORE_COMPONENTS: Dict[str, ComponentTypeAnnotation] = {
90
90
  For.__name__: ForDef,
91
91
  Link.__name__: LinkDef,
92
92
  Outlet.__name__: OutletDef,
93
+ Navigate.__name__: NavigateDef,
93
94
  PoweredByCausalens.__name__: PoweredByCausalensDef,
94
95
  ThemeProvider.__name__: ThemeProviderDef,
95
96
  }
@@ -3,6 +3,7 @@ from typing import Annotated, Any, Literal, Optional, Union
3
3
  from pydantic import BaseModel, BeforeValidator
4
4
 
5
5
  from dara.core.definitions import ComponentInstance, JsComponentDef, StyledComponentInstance, transform_raw_css
6
+ from dara.core.interactivity import ClientVariable
6
7
 
7
8
 
8
9
  class RouterPath(BaseModel):
@@ -31,6 +32,30 @@ class Outlet(ComponentInstance):
31
32
  """
32
33
 
33
34
 
35
+ NavigateDef = JsComponentDef(name='Navigate', js_module='@darajs/core', py_module='dara.core')
36
+
37
+
38
+ class Navigate(ComponentInstance):
39
+ """
40
+ Navigate component immediately redirects to the specified route when rendered.
41
+ Can be useful for defining default redirects in some pages.
42
+
43
+ ```python
44
+ from dara.core.router import Navigate
45
+
46
+ def MyPage():
47
+ # always redirects to /some-route
48
+ return Navigate(to='/some-route')
49
+ ```
50
+ """
51
+
52
+ to: Union[str, RouterPath, ClientVariable]
53
+
54
+ replace: bool = False
55
+
56
+ relative: Literal['route', 'path'] = 'route'
57
+
58
+
34
59
  LinkDef = JsComponentDef(name='Link', js_module='@darajs/core', py_module='dara.core')
35
60
 
36
61
 
@@ -91,7 +116,7 @@ class Link(StyledComponentInstance):
91
116
  ```
92
117
  """
93
118
 
94
- to: Union[str, RouterPath]
119
+ to: Union[str, RouterPath, ClientVariable]
95
120
  """
96
121
  Can be a string or RouterPath object
97
122
  """
@@ -56822,7 +56822,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
56822
56822
  }
56823
56823
  );
56824
56824
  }
56825
- function Navigate({
56825
+ function Navigate$1({
56826
56826
  to,
56827
56827
  replace: replace22,
56828
56828
  state,
@@ -64016,7 +64016,7 @@ ${String(error)}`;
64016
64016
  MemoryRouter,
64017
64017
  Meta,
64018
64018
  NavLink,
64019
- Navigate,
64019
+ Navigate: Navigate$1,
64020
64020
  NavigationType: Action,
64021
64021
  Outlet,
64022
64022
  PrefetchPageLinks,
@@ -74646,7 +74646,7 @@ body,
74646
74646
  // fallback route, redirect to first navigatable path
74647
74647
  {
74648
74648
  path: "*",
74649
- element: /* @__PURE__ */ React__namespace.createElement(Navigate, { to: defaultPath })
74649
+ element: /* @__PURE__ */ React__namespace.createElement(Navigate$1, { to: defaultPath })
74650
74650
  }
74651
74651
  ]
74652
74652
  }
@@ -98207,6 +98207,7 @@ body,
98207
98207
  const [style, css2] = useComponentStyles(props);
98208
98208
  const [activeStyle, activeCss] = useComponentStyles(props, true, "active_css");
98209
98209
  const [inactiveStyle, inactiveCss] = useComponentStyles(props, false, "inactive_css");
98210
+ const [to] = useVariable(props.to);
98210
98211
  const preloadRoute = usePreloadRoute();
98211
98212
  const preloadTimeoutRef = React__namespace.useRef(null);
98212
98213
  const clearPreloadTimeout = React__namespace.useCallback(() => {
@@ -98219,17 +98220,17 @@ body,
98219
98220
  if (!props.prefetch) {
98220
98221
  return;
98221
98222
  }
98222
- preloadRoute(props.to);
98223
- }, [props.prefetch, preloadRoute, props.to]);
98223
+ preloadRoute(to);
98224
+ }, [props.prefetch, preloadRoute, to]);
98224
98225
  const handleDelayedPreload = React__namespace.useCallback(() => {
98225
98226
  if (!props.prefetch) {
98226
98227
  return;
98227
98228
  }
98228
98229
  clearPreloadTimeout();
98229
98230
  preloadTimeoutRef.current = window.setTimeout(() => {
98230
- preloadRoute(props.to);
98231
+ preloadRoute(to);
98231
98232
  }, 20);
98232
- }, [props.prefetch, props.to, clearPreloadTimeout, preloadRoute]);
98233
+ }, [props.prefetch, to, clearPreloadTimeout, preloadRoute]);
98233
98234
  const handleMouseMove = React__namespace.useCallback(() => {
98234
98235
  handleDelayedPreload();
98235
98236
  }, [handleDelayedPreload]);
@@ -98249,7 +98250,7 @@ body,
98249
98250
  {
98250
98251
  id: props.id_,
98251
98252
  className: props.className,
98252
- to: props.to,
98253
+ to,
98253
98254
  end: props.end,
98254
98255
  caseSensitive: props.case_sensitive,
98255
98256
  replace: props.replace,
@@ -98594,6 +98595,11 @@ body,
98594
98595
  const { suspend } = useFallbackCtx();
98595
98596
  return /* @__PURE__ */ React__namespace.createElement(fallbackCtx.Provider, { value: { suspend: false } }, /* @__PURE__ */ React__namespace.createElement(ForImpl, { ...props, suspend }));
98596
98597
  }
98598
+ function Navigate(props) {
98599
+ const { to, ...rest } = props;
98600
+ const [toValue] = useVariable(to);
98601
+ return /* @__PURE__ */ React.createElement(Navigate$1, { to: toValue, ...rest });
98602
+ }
98597
98603
  const StyledDiv = injectCss(styled.div`
98598
98604
  /* empty */
98599
98605
  `);
@@ -98632,6 +98638,7 @@ body,
98632
98638
  exports.LoaderError = LoaderError;
98633
98639
  exports.Menu = Menu;
98634
98640
  exports.MenuLink = MenuLink;
98641
+ exports.Navigate = Navigate;
98635
98642
  exports.NavigateTo = NavigateTo;
98636
98643
  exports.Notifications = index$1;
98637
98644
  exports.Notify = Notify;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-core
3
- Version: 1.21.4
3
+ Version: 1.21.5
4
4
  Summary: Dara Framework Core
5
5
  Home-page: https://dara.causalens.com/
6
6
  License: Apache-2.0
@@ -21,10 +21,10 @@ Requires-Dist: cachetools (>=5.0.0,<6.0.0)
21
21
  Requires-Dist: certifi (>=2024.7.4)
22
22
  Requires-Dist: click (==8.1.3)
23
23
  Requires-Dist: colorama (>=0.4.6,<0.5.0)
24
- Requires-Dist: create-dara-app (==1.21.4)
24
+ Requires-Dist: create-dara-app (==1.21.5)
25
25
  Requires-Dist: croniter (>=1.0.15,<3.0.0)
26
26
  Requires-Dist: cryptography (>=42.0.4)
27
- Requires-Dist: dara-components (==1.21.4) ; extra == "all"
27
+ Requires-Dist: dara-components (==1.21.5) ; extra == "all"
28
28
  Requires-Dist: exceptiongroup (>=1.1.3,<2.0.0)
29
29
  Requires-Dist: fastapi (>=0.115.0,<0.116.0)
30
30
  Requires-Dist: fastapi_vite_dara (==0.4.0)
@@ -55,7 +55,7 @@ Description-Content-Type: text/markdown
55
55
 
56
56
  # Dara Application Framework
57
57
 
58
- <img src="https://github.com/causalens/dara/blob/v1.21.4/img/dara_light.svg?raw=true">
58
+ <img src="https://github.com/causalens/dara/blob/v1.21.5/img/dara_light.svg?raw=true">
59
59
 
60
60
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
61
61
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -100,7 +100,7 @@ source .venv/bin/activate
100
100
  dara start
101
101
  ```
102
102
 
103
- ![Dara App](https://github.com/causalens/dara/blob/v1.21.4/img/components_gallery.png?raw=true)
103
+ ![Dara App](https://github.com/causalens/dara/blob/v1.21.5/img/components_gallery.png?raw=true)
104
104
 
105
105
  Note: `pip` installation uses [PEP 660](https://peps.python.org/pep-0660/) `pyproject.toml`-based editable installs which require `pip >= 21.3` and `setuptools >= 64.0.0`. You can upgrade both with:
106
106
 
@@ -117,9 +117,9 @@ Explore some of our favorite apps - a great way of getting started and getting t
117
117
 
118
118
  | Dara App | Description |
119
119
  | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120
- | ![Large Language Model](https://github.com/causalens/dara/blob/v1.21.4/img/llm.png?raw=true) | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
121
- | ![Plot Interactivity](https://github.com/causalens/dara/blob/v1.21.4/img/plot_interactivity.png?raw=true) | Demonstrates how to enable the user to interact with plots, trigger actions based on clicks, mouse movements and other interactions with `Bokeh` or `Plotly` plots |
122
- | ![Graph Editor](https://github.com/causalens/dara/blob/v1.21.4/img/graph_viewer.png?raw=true) | Demonstrates how to use the `CausalGraphViewer` component to display your graphs or networks, customising the displayed information through colors and tooltips, and updating the page based on user interaction. |
120
+ | ![Large Language Model](https://github.com/causalens/dara/blob/v1.21.5/img/llm.png?raw=true) | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
121
+ | ![Plot Interactivity](https://github.com/causalens/dara/blob/v1.21.5/img/plot_interactivity.png?raw=true) | Demonstrates how to enable the user to interact with plots, trigger actions based on clicks, mouse movements and other interactions with `Bokeh` or `Plotly` plots |
122
+ | ![Graph Editor](https://github.com/causalens/dara/blob/v1.21.5/img/graph_viewer.png?raw=true) | Demonstrates how to use the `CausalGraphViewer` component to display your graphs or networks, customising the displayed information through colors and tooltips, and updating the page based on user interaction. |
123
123
 
124
124
  Check out our [App Gallery](https://dara.causalens.com/gallery) for more inspiration!
125
125
 
@@ -146,9 +146,9 @@ And the supporting UI packages and tools.
146
146
  - `ui-utils` - miscellaneous utility functions
147
147
  - `ui-widgets` - widget components
148
148
 
149
- More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.21.4/CONTRIBUTING.md) file.
149
+ More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.21.5/CONTRIBUTING.md) file.
150
150
 
151
151
  ## License
152
152
 
153
- Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.21.4/LICENSE).
153
+ Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.21.5/LICENSE).
154
154
 
@@ -11,7 +11,7 @@ dara/core/cli.py,sha256=V__LAK3ozWGsVTEQHqvJwqSfpC3o6R76YGABJ-YVoSE,8185
11
11
  dara/core/configuration.py,sha256=caPebHNUmYqh9czEBwQiIDjGrH8ltsphayZICj1CRhc,23489
12
12
  dara/core/css.py,sha256=UkNZ6n7RDBLsHmpZvn_a3K2nAwxVggQJbQMKNbgXONA,1753
13
13
  dara/core/data_utils.py,sha256=RD5_GdyGyGr1LVThCo8mpuOMWrd9_c1iyRqjuyoarXM,12578
14
- dara/core/defaults.py,sha256=J1-IX4nKcE6kXzqx7kq1ereU4MKXiMitZxSZo2rs7-U,4681
14
+ dara/core/defaults.py,sha256=y-PU4DhF3uEEfrFmlJnenM8jhnQDTDaOU5kuAYZE2gw,4740
15
15
  dara/core/definitions.py,sha256=I4TUJ6zu968T4PNmeqbC-u-DfiKay-4XxurLNASkDz0,18358
16
16
  dara/core/http.py,sha256=-OzbCHlYSnfVnw2492C_UmaWOI5oSONfWk03eEGxSRI,4761
17
17
  dara/core/interactivity/__init__.py,sha256=ZppwTvxaCsaAdf0qX6j1qTcmbj6wxVcbiaMZfwTVKtU,2679
@@ -90,10 +90,10 @@ dara/core/metrics/utils.py,sha256=inR1Ab5hmWZY2lsgGwLCQOEdyhCD9PumU52X2JbwlKY,22
90
90
  dara/core/persistence.py,sha256=ZUmfAjcTwk_oYyaulDrtpiCwIg8vaOw8uTZd2qT4nNo,19410
91
91
  dara/core/router/__init__.py,sha256=yGI_MgLQU37ircCtYVNjnhqCjWQxKd5amoNqvMyrhOs,121
92
92
  dara/core/router/compat.py,sha256=WAVzDcJFJOVoIQ5inplIhXD58TWsWwTTebTCqpG4nGs,3137
93
- dara/core/router/components.py,sha256=MDaiQ8Y0-94EH0Jm4j7p9S141k8G4osSbOKSTSu3aOM,4433
93
+ dara/core/router/components.py,sha256=K6bj04_ZPJcU9JQjaxPJkbUeaHtA_jeJNEvCqQbDf3A,5090
94
94
  dara/core/router/dependency_graph.py,sha256=AyjSk3DuvCgACrgpID4oSpms1X6GQJUbt-scY5X_LN4,2305
95
95
  dara/core/router/router.py,sha256=1r3rFGiftOXC6GP66hKqTdcVNDRJsZWBWvL74wNG4dA,29719
96
- dara/core/umd/dara.core.umd.cjs,sha256=yL5RNTVCKf39V2ItxpFhMmwBZqFz4BdowFDjrKfH3NU,5148073
96
+ dara/core/umd/dara.core.umd.cjs,sha256=WT-s5ykdLYVEyxpwQ6hYBN_z-Ir72T1RGVLYRNus4j0,5148319
97
97
  dara/core/umd/style.css,sha256=yT3PKpi2sKI2-kQIF8xtVbTPQqgpK7-Ua7tfzDPuSsI,4095881
98
98
  dara/core/visual/__init__.py,sha256=QN0wbG9HPQ_vXh8BO8DnBXeYLIENVTNtRmYzZf1lx7c,577
99
99
  dara/core/visual/components/__init__.py,sha256=nmCsnMLXeZAjkhMYz-mIFodpVY-69IO1fvwwXbFlMQ4,2447
@@ -120,8 +120,8 @@ dara/core/visual/themes/__init__.py,sha256=aM4mgoIYo2neBSw5FRzswsht7PUKjLthiHLmF
120
120
  dara/core/visual/themes/dark.py,sha256=UQGDooOc8ric73eHs9E0ltYP4UCrwqQ3QxqN_fb4PwY,1942
121
121
  dara/core/visual/themes/definitions.py,sha256=5g83t24w8Ar51Cl9REBJfCU7_DtlashBQeUTKDg3D1M,2862
122
122
  dara/core/visual/themes/light.py,sha256=-Tviq8oEwGbdFULoDOqPuHO0UpAZGsBy8qFi0kAGolQ,1944
123
- dara_core-1.21.4.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
124
- dara_core-1.21.4.dist-info/METADATA,sha256=B3_u4qs8ZbvfSgO4LKfnS4IUTGM6hhFXEE_O7UUHryo,7534
125
- dara_core-1.21.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
126
- dara_core-1.21.4.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
127
- dara_core-1.21.4.dist-info/RECORD,,
123
+ dara_core-1.21.5.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
124
+ dara_core-1.21.5.dist-info/METADATA,sha256=7oehCtNZ2YNrDUpbrT4kgEJJ63XqSnfDVmzpu18yN90,7534
125
+ dara_core-1.21.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
126
+ dara_core-1.21.5.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
127
+ dara_core-1.21.5.dist-info/RECORD,,