dara-core 1.21.0__py3-none-any.whl → 1.21.2__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/configuration.py +3 -2
- dara/core/defaults.py +4 -3
- dara/core/definitions.py +1 -1
- dara/core/interactivity/plain_variable.py +6 -2
- dara/core/internal/routing.py +528 -319
- dara/core/internal/tasks.py +1 -1
- dara/core/main.py +8 -84
- dara/core/persistence.py +6 -2
- dara/core/router/__init__.py +1 -0
- dara/core/router/components.py +43 -9
- dara/core/router/dependency_graph.py +62 -0
- dara/core/router/router.py +24 -5
- dara/core/umd/dara.core.umd.cjs +61072 -57651
- dara/core/umd/style.css +16 -11
- dara/core/visual/components/__init__.py +3 -3
- dara/core/visual/components/menu_link.py +0 -35
- dara/core/visual/components/theme_provider.py +44 -0
- dara/core/visual/dynamic_component.py +1 -1
- dara/core/visual/themes/definitions.py +2 -1
- {dara_core-1.21.0.dist-info → dara_core-1.21.2.dist-info}/METADATA +10 -10
- {dara_core-1.21.0.dist-info → dara_core-1.21.2.dist-info}/RECORD +24 -22
- {dara_core-1.21.0.dist-info → dara_core-1.21.2.dist-info}/LICENSE +0 -0
- {dara_core-1.21.0.dist-info → dara_core-1.21.2.dist-info}/WHEEL +0 -0
- {dara_core-1.21.0.dist-info → dara_core-1.21.2.dist-info}/entry_points.txt +0 -0
dara/core/configuration.py
CHANGED
|
@@ -55,6 +55,7 @@ from dara.core.definitions import (
|
|
|
55
55
|
)
|
|
56
56
|
from dara.core.interactivity.actions import ActionImpl, ResetVariables
|
|
57
57
|
from dara.core.interactivity.any_variable import AnyVariable
|
|
58
|
+
from dara.core.interactivity.client_variable import ClientVariable
|
|
58
59
|
from dara.core.internal.encoder_registry import Encoder
|
|
59
60
|
from dara.core.internal.import_discovery import (
|
|
60
61
|
create_action_definition,
|
|
@@ -525,14 +526,14 @@ class ConfigurationBuilder:
|
|
|
525
526
|
|
|
526
527
|
def set_theme(
|
|
527
528
|
self,
|
|
528
|
-
main_theme: Optional[Union[ThemeDef, Literal['light'], Literal['dark']]] = None,
|
|
529
|
+
main_theme: Optional[Union[ThemeDef, ClientVariable, Literal['light'], Literal['dark']]] = None,
|
|
529
530
|
base_theme: Optional[Union[Literal['light'], Literal['dark']]] = None,
|
|
530
531
|
):
|
|
531
532
|
"""
|
|
532
533
|
Sets the color theme of the app. Takes ThemeDef models for the app, and reverts
|
|
533
534
|
to the default themes if they are not supplied.
|
|
534
535
|
|
|
535
|
-
:param main_theme: ThemeDef defining colors for the app,
|
|
536
|
+
:param main_theme: ThemeDef defining colors for the app, a string 'light' or 'dark' to use default Dara colors, or a Variable containing one of the before
|
|
536
537
|
"""
|
|
537
538
|
if isinstance(main_theme, str):
|
|
538
539
|
if main_theme in ('dark', 'light'):
|
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, Outlet, OutletDef
|
|
37
|
+
from dara.core.router import Link, LinkDef, MenuLink, MenuLinkDef, Outlet, OutletDef
|
|
38
38
|
from dara.core.visual.components import (
|
|
39
39
|
DefaultFallbackDef,
|
|
40
40
|
DynamicComponent,
|
|
@@ -44,8 +44,6 @@ from dara.core.visual.components import (
|
|
|
44
44
|
ForDef,
|
|
45
45
|
Menu,
|
|
46
46
|
MenuDef,
|
|
47
|
-
MenuLink,
|
|
48
|
-
MenuLinkDef,
|
|
49
47
|
PoweredByCausalens,
|
|
50
48
|
PoweredByCausalensDef,
|
|
51
49
|
ProgressTracker,
|
|
@@ -55,6 +53,8 @@ from dara.core.visual.components import (
|
|
|
55
53
|
RowFallbackDef,
|
|
56
54
|
SideBarFrame,
|
|
57
55
|
SideBarFrameDef,
|
|
56
|
+
ThemeProvider,
|
|
57
|
+
ThemeProviderDef,
|
|
58
58
|
TopBarFrame,
|
|
59
59
|
TopBarFrameDef,
|
|
60
60
|
)
|
|
@@ -91,6 +91,7 @@ CORE_COMPONENTS: Dict[str, ComponentTypeAnnotation] = {
|
|
|
91
91
|
Link.__name__: LinkDef,
|
|
92
92
|
Outlet.__name__: OutletDef,
|
|
93
93
|
PoweredByCausalens.__name__: PoweredByCausalensDef,
|
|
94
|
+
ThemeProvider.__name__: ThemeProviderDef,
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
# These actions are provided by the core JS of this module
|
dara/core/definitions.py
CHANGED
|
@@ -123,7 +123,7 @@ class ComponentInstance(BaseModel):
|
|
|
123
123
|
Definition of a Component Instance
|
|
124
124
|
"""
|
|
125
125
|
|
|
126
|
-
uid:
|
|
126
|
+
uid: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
127
127
|
|
|
128
128
|
js_module: ClassVar[Optional[str]] = None
|
|
129
129
|
"""
|
|
@@ -284,7 +284,7 @@ class Variable(ClientVariable, Generic[VariableType]):
|
|
|
284
284
|
assert isinstance(self.store, BackendStore), 'This method can only be used with a BackendStore'
|
|
285
285
|
return await self.store.write(value, notify=notify, ignore_channel=ignore_channel)
|
|
286
286
|
|
|
287
|
-
async def write_partial(self, data: Union[List[Dict[str, Any]], Any], notify: bool = True):
|
|
287
|
+
async def write_partial(self, data: Union[List[Dict[str, Any]], Any], notify: bool = True, in_place: bool = False):
|
|
288
288
|
"""
|
|
289
289
|
Apply partial updates to the variable's BackendStore using JSON Patch operations or automatic diffing.
|
|
290
290
|
Raises an error if the variable does not have a BackendStore attached.
|
|
@@ -294,9 +294,13 @@ class Variable(ClientVariable, Generic[VariableType]):
|
|
|
294
294
|
|
|
295
295
|
:param data: Either a list of JSON patch operations (RFC 6902) or a full object to diff against current value
|
|
296
296
|
:param notify: whether to broadcast the patches to clients
|
|
297
|
+
:param in_place: whether to apply the patches in-place or return a new value.
|
|
298
|
+
When set to True, the value will be mutated when applying the patches rather than deep-cloned.
|
|
299
|
+
This is recommended when the updated value is large and deep-cloning it can be expensive; however, users should exercise
|
|
300
|
+
caution when using the option as previous results retrieved from `variable.read()` will potentially be mutated, depending on the backend used.
|
|
297
301
|
"""
|
|
298
302
|
assert isinstance(self.store, BackendStore), 'This method can only be used with a BackendStore'
|
|
299
|
-
return await self.store.write_partial(data, notify=notify)
|
|
303
|
+
return await self.store.write_partial(data, notify=notify, in_place=in_place)
|
|
300
304
|
|
|
301
305
|
async def read(self):
|
|
302
306
|
"""
|