dara-core 1.21.22__py3-none-any.whl → 1.21.23__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 +3 -0
- dara/core/interactivity/__init__.py +2 -0
- dara/core/interactivity/actions.py +81 -0
- dara/core/umd/dara.core.umd.cjs +64 -2
- {dara_core-1.21.22.dist-info → dara_core-1.21.23.dist-info}/METADATA +10 -10
- {dara_core-1.21.22.dist-info → dara_core-1.21.23.dist-info}/RECORD +9 -9
- {dara_core-1.21.22.dist-info → dara_core-1.21.23.dist-info}/LICENSE +0 -0
- {dara_core-1.21.22.dist-info → dara_core-1.21.23.dist-info}/WHEEL +0 -0
- {dara_core-1.21.22.dist-info → dara_core-1.21.23.dist-info}/entry_points.txt +0 -0
dara/core/defaults.py
CHANGED
|
@@ -21,6 +21,8 @@ from typing import TYPE_CHECKING, cast
|
|
|
21
21
|
|
|
22
22
|
from dara.core.base_definitions import ActionDef
|
|
23
23
|
from dara.core.interactivity.actions import (
|
|
24
|
+
CopyToClipboard,
|
|
25
|
+
CopyToClipboardDef,
|
|
24
26
|
DownloadContentDef,
|
|
25
27
|
DownloadVariable,
|
|
26
28
|
DownloadVariableDef,
|
|
@@ -102,6 +104,7 @@ CORE_ACTIONS: dict[str, ActionDef] = {
|
|
|
102
104
|
TriggerVariable.__name__: TriggerVariableDef,
|
|
103
105
|
ResetVariables.__name__: ResetVariablesDef,
|
|
104
106
|
DownloadVariable.__name__: DownloadVariableDef,
|
|
107
|
+
CopyToClipboard.__name__: CopyToClipboardDef,
|
|
105
108
|
'DownloadContent': DownloadContentDef,
|
|
106
109
|
Notify.__name__: NotifyDef,
|
|
107
110
|
}
|
|
@@ -23,6 +23,7 @@ from pydantic import BaseModel
|
|
|
23
23
|
|
|
24
24
|
from dara.core.interactivity.actions import (
|
|
25
25
|
ActionCtx,
|
|
26
|
+
CopyToClipboard,
|
|
26
27
|
DownloadContent,
|
|
27
28
|
DownloadContentImpl,
|
|
28
29
|
DownloadVariable,
|
|
@@ -64,6 +65,7 @@ __all__ = [
|
|
|
64
65
|
'DerivedVariable',
|
|
65
66
|
'DerivedDataVariable',
|
|
66
67
|
'UrlVariable',
|
|
68
|
+
'CopyToClipboard',
|
|
67
69
|
'DownloadVariable',
|
|
68
70
|
'DownloadContent',
|
|
69
71
|
'DownloadContentImpl',
|
|
@@ -62,6 +62,7 @@ from dara.core.internal.utils import run_user_handler
|
|
|
62
62
|
if TYPE_CHECKING:
|
|
63
63
|
from dara.core.interactivity import (
|
|
64
64
|
AnyVariable,
|
|
65
|
+
ClientVariable,
|
|
65
66
|
DerivedVariable,
|
|
66
67
|
Variable,
|
|
67
68
|
)
|
|
@@ -727,6 +728,41 @@ class DownloadVariable(ActionImpl):
|
|
|
727
728
|
type: Literal['csv', 'xlsx', 'json'] = 'csv'
|
|
728
729
|
|
|
729
730
|
|
|
731
|
+
CopyToClipboardDef = ActionDef(name='CopyToClipboard', js_module='@darajs/core', py_module='dara.core')
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
class CopyToClipboard(ActionImpl):
|
|
735
|
+
"""
|
|
736
|
+
CopyToClipboard action copies the provided value to the user's clipboard.
|
|
737
|
+
|
|
738
|
+
```python
|
|
739
|
+
|
|
740
|
+
from dara.core import action, ConfigurationBuilder, CopyToClipboard
|
|
741
|
+
from dara.components import Stack, Button
|
|
742
|
+
|
|
743
|
+
config = ConfigurationBuilder()
|
|
744
|
+
|
|
745
|
+
def test_page():
|
|
746
|
+
return Stack(
|
|
747
|
+
Button(
|
|
748
|
+
'Copy to clipboard',
|
|
749
|
+
onclick=CopyToClipboard(value='Hello, World!')
|
|
750
|
+
)
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
config.router.add_page(path='copy-to-clipboard', content=test_page)
|
|
755
|
+
"""
|
|
756
|
+
|
|
757
|
+
value: str | ClientVariable
|
|
758
|
+
|
|
759
|
+
success_message: str | None = None
|
|
760
|
+
"""Message to display when the value is copied to the clipboard"""
|
|
761
|
+
|
|
762
|
+
error_message: str | None = None
|
|
763
|
+
"""Message to display when the value could not be copied to the clipboard"""
|
|
764
|
+
|
|
765
|
+
|
|
730
766
|
@deprecated('Use @action instead')
|
|
731
767
|
def SideEffect(
|
|
732
768
|
function: Callable[[ComponentActionContext], Any],
|
|
@@ -826,6 +862,51 @@ class ActionCtx:
|
|
|
826
862
|
)
|
|
827
863
|
self._on_action = _on_action
|
|
828
864
|
|
|
865
|
+
async def copy_to_clipboard(
|
|
866
|
+
self,
|
|
867
|
+
value: str,
|
|
868
|
+
success_message: str | None = None,
|
|
869
|
+
error_message: str | None = None,
|
|
870
|
+
):
|
|
871
|
+
"""
|
|
872
|
+
Copy a given value to the user's clipboard.
|
|
873
|
+
|
|
874
|
+
Note that this could fail in some browsers if e.g. user has disabled clipboard access.
|
|
875
|
+
Dara will display an error notification in this case, the message can be customized with the `error_message` parameter.
|
|
876
|
+
|
|
877
|
+
```python
|
|
878
|
+
|
|
879
|
+
from dara.core import action, ConfigurationBuilder, CopyToClipboard
|
|
880
|
+
from dara.components import Stack, Button
|
|
881
|
+
|
|
882
|
+
config = ConfigurationBuilder()
|
|
883
|
+
|
|
884
|
+
@action
|
|
885
|
+
async def copy_demo(ctx: action.Ctx, value: str):
|
|
886
|
+
await ctx.copy_to_clipboard(value)
|
|
887
|
+
|
|
888
|
+
def test_page():
|
|
889
|
+
return Stack(
|
|
890
|
+
Button(
|
|
891
|
+
'Copy to clipboard',
|
|
892
|
+
onclick=copy_demo(value='Hello, World!')
|
|
893
|
+
)
|
|
894
|
+
)
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
config.router.add_page(path='copy-to-clipboard', content=test_page)
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
:param value: the value to copy to the clipboard
|
|
901
|
+
:param success_message: the message to display when the value is copied to the clipboard
|
|
902
|
+
:param error_message: the message to display when the value could not be copied to the clipboard
|
|
903
|
+
"""
|
|
904
|
+
return await CopyToClipboard(
|
|
905
|
+
value=value,
|
|
906
|
+
success_message=success_message,
|
|
907
|
+
error_message=error_message,
|
|
908
|
+
).execute(self)
|
|
909
|
+
|
|
829
910
|
@overload
|
|
830
911
|
async def update(self, variable: ServerVariable, value: DataFrame | None): ...
|
|
831
912
|
|
dara/core/umd/dara.core.umd.cjs
CHANGED
|
@@ -9364,7 +9364,7 @@
|
|
|
9364
9364
|
|
|
9365
9365
|
background-color: ${(props) => props.theme.colors.blue1};
|
|
9366
9366
|
`;
|
|
9367
|
-
|
|
9367
|
+
var __awaiter$2 = function(thisArg, _arguments, P, generator) {
|
|
9368
9368
|
function adopt(value) {
|
|
9369
9369
|
return value instanceof P ? value : new P(function(resolve) {
|
|
9370
9370
|
resolve(value);
|
|
@@ -9390,7 +9390,35 @@
|
|
|
9390
9390
|
}
|
|
9391
9391
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9392
9392
|
});
|
|
9393
|
-
}
|
|
9393
|
+
};
|
|
9394
|
+
function copyToClipboard(value) {
|
|
9395
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
9396
|
+
let success2 = true;
|
|
9397
|
+
if (navigator.clipboard) {
|
|
9398
|
+
try {
|
|
9399
|
+
yield navigator.clipboard.writeText(value);
|
|
9400
|
+
} catch (_a) {
|
|
9401
|
+
success2 = false;
|
|
9402
|
+
}
|
|
9403
|
+
} else {
|
|
9404
|
+
const tempComponent = document.createElement("textarea");
|
|
9405
|
+
tempComponent.value = value;
|
|
9406
|
+
tempComponent.style.top = "0";
|
|
9407
|
+
tempComponent.style.left = "0";
|
|
9408
|
+
tempComponent.style.position = "fixed";
|
|
9409
|
+
document.body.appendChild(tempComponent);
|
|
9410
|
+
tempComponent.focus();
|
|
9411
|
+
tempComponent.select();
|
|
9412
|
+
try {
|
|
9413
|
+
success2 = document.execCommand("copy");
|
|
9414
|
+
} catch (_b) {
|
|
9415
|
+
success2 = false;
|
|
9416
|
+
}
|
|
9417
|
+
document.body.removeChild(tempComponent);
|
|
9418
|
+
}
|
|
9419
|
+
return success2;
|
|
9420
|
+
});
|
|
9421
|
+
}
|
|
9394
9422
|
var Status;
|
|
9395
9423
|
(function(Status2) {
|
|
9396
9424
|
Status2["CANCELED"] = "CANCELED";
|
|
@@ -98078,6 +98106,39 @@ body,
|
|
|
98078
98106
|
title: actionImpl.title
|
|
98079
98107
|
});
|
|
98080
98108
|
};
|
|
98109
|
+
const CopyToClipboard = async (ctx, actionImpl) => {
|
|
98110
|
+
let value;
|
|
98111
|
+
if (!isVariable(actionImpl.value)) {
|
|
98112
|
+
value = actionImpl.value;
|
|
98113
|
+
} else {
|
|
98114
|
+
if (!isSingleVariable(actionImpl.value)) {
|
|
98115
|
+
throw new UserError("CopyToClipboard only supports simple Variables");
|
|
98116
|
+
}
|
|
98117
|
+
value = await resolveVariable(
|
|
98118
|
+
actionImpl.value,
|
|
98119
|
+
ctx.wsClient,
|
|
98120
|
+
ctx.taskCtx,
|
|
98121
|
+
ctx.extras,
|
|
98122
|
+
(v) => ctx.snapshot.getPromise(v)
|
|
98123
|
+
);
|
|
98124
|
+
}
|
|
98125
|
+
const success2 = await copyToClipboard(value);
|
|
98126
|
+
if (!success2) {
|
|
98127
|
+
ctx.notificationCtx.pushNotification({
|
|
98128
|
+
key: "_copyToClipboard",
|
|
98129
|
+
message: actionImpl.error_message ?? "",
|
|
98130
|
+
status: Status.ERROR,
|
|
98131
|
+
title: "Error copying to clipboard"
|
|
98132
|
+
});
|
|
98133
|
+
} else {
|
|
98134
|
+
ctx.notificationCtx.pushNotification({
|
|
98135
|
+
key: "_copyToClipboard",
|
|
98136
|
+
message: actionImpl.success_message ?? "",
|
|
98137
|
+
status: Status.SUCCESS,
|
|
98138
|
+
title: "Copied to clipboard"
|
|
98139
|
+
});
|
|
98140
|
+
}
|
|
98141
|
+
};
|
|
98081
98142
|
const MenuItem = styled(NavLink)`
|
|
98082
98143
|
cursor: pointer;
|
|
98083
98144
|
|
|
@@ -98576,6 +98637,7 @@ body,
|
|
|
98576
98637
|
exports.ComponentType = ComponentType;
|
|
98577
98638
|
exports.ConditionOperator = ConditionOperator;
|
|
98578
98639
|
exports.ConfigContextProvider = ConfigContextProvider;
|
|
98640
|
+
exports.CopyToClipboard = CopyToClipboard;
|
|
98579
98641
|
exports.CustomFallback = DefaultFallback;
|
|
98580
98642
|
exports.DARA_JWT_TOKEN = DARA_JWT_TOKEN;
|
|
98581
98643
|
exports.DEFAULT_BUS = DEFAULT_BUS;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dara-core
|
|
3
|
-
Version: 1.21.
|
|
3
|
+
Version: 1.21.23
|
|
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,<9.0.0)
|
|
23
23
|
Requires-Dist: colorama (>=0.4.6,<0.5.0)
|
|
24
|
-
Requires-Dist: create-dara-app (==1.21.
|
|
24
|
+
Requires-Dist: create-dara-app (==1.21.23)
|
|
25
25
|
Requires-Dist: croniter (>=6.0.0,<7.0.0)
|
|
26
26
|
Requires-Dist: cryptography (>=42.0.4)
|
|
27
|
-
Requires-Dist: dara-components (==1.21.
|
|
27
|
+
Requires-Dist: dara-components (==1.21.23) ; extra == "all"
|
|
28
28
|
Requires-Dist: exceptiongroup (>=1.1.3,<2.0.0)
|
|
29
29
|
Requires-Dist: fastapi (>=0.115.0,<0.121.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.
|
|
58
|
+
<img src="https://github.com/causalens/dara/blob/v1.21.23/img/dara_light.svg?raw=true">
|
|
59
59
|
|
|
60
60
|

|
|
61
61
|
[](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
|
-

|
|
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
|
-
|  | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
|
|
121
|
+
|  | 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
|
+
|  | 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.
|
|
149
|
+
More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.21.23/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.
|
|
153
|
+
Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.21.23/LICENSE).
|
|
154
154
|
|
|
@@ -11,11 +11,11 @@ dara/core/cli.py,sha256=i9-Xtdee80b153TSU9fFSWbHQYCi01ci_Lo8SzwnW7M,8130
|
|
|
11
11
|
dara/core/configuration.py,sha256=PAxtnIF86kRh3D7DrdB3lxwl2QkA008aKSykvcLGlCE,23353
|
|
12
12
|
dara/core/css.py,sha256=c1TMGzOcXYIy-qU-TxeirGlq2BNEigP80eDG3ItjRbU,1740
|
|
13
13
|
dara/core/data_utils.py,sha256=haR-SPCFm90RfOIndPBGOpFtOEmhiJgizmzcqzZOZBg,12455
|
|
14
|
-
dara/core/defaults.py,sha256=
|
|
14
|
+
dara/core/defaults.py,sha256=lmVSGKnc5NQMsBtQArLrb_jI_BBDrgzbNNAvZ5GvKYI,4829
|
|
15
15
|
dara/core/definitions.py,sha256=uf8dVhEff9LMBLEK4SaZjod_WP5PH2jnuasni__ZeL8,18010
|
|
16
16
|
dara/core/http.py,sha256=gFkUV3jBY6lx0ZIIzeFw8zEH6WAb8uIKfo_t8heZDEw,4739
|
|
17
|
-
dara/core/interactivity/__init__.py,sha256=
|
|
18
|
-
dara/core/interactivity/actions.py,sha256=
|
|
17
|
+
dara/core/interactivity/__init__.py,sha256=uHIKFBs2ifHeM-VxhcSVqr2RgYmo1anuP5lfVcYXTFU,2772
|
|
18
|
+
dara/core/interactivity/actions.py,sha256=AOvOGnl0rgf5QYpwccM9kFMiehMSRw84HUSAVHmdZRA,50741
|
|
19
19
|
dara/core/interactivity/any_data_variable.py,sha256=qnJAgTV_AleBwobz2GovezvX2pXrcSwD18yKQPjt32I,306
|
|
20
20
|
dara/core/interactivity/any_variable.py,sha256=mOCBW5m1CCM-gzOMlN-rnlAIktb2rZJAPWE-WKiR3-A,13648
|
|
21
21
|
dara/core/interactivity/client_variable.py,sha256=Ku59TBDXrqEsMkc-upQ_GspWqHGBdtisDvpzGV6NUSs,2289
|
|
@@ -93,7 +93,7 @@ dara/core/router/compat.py,sha256=B83wq46AwQARTDfZwGrpr0slrnQmi_T7shOUNpqltSM,31
|
|
|
93
93
|
dara/core/router/components.py,sha256=Wsf_bBnnN-1EE5jhbjPSOyDv_TVKEsY4royyOQOazM4,6132
|
|
94
94
|
dara/core/router/dependency_graph.py,sha256=A0xGuZWSOCGs7rwHbeZC5vLvZouUt-2fnEX9VM2Ukp0,2280
|
|
95
95
|
dara/core/router/router.py,sha256=5Nh7ms7ynnUWEV1FuCus-XvGp4NAe4OB1jdS2x5SS7Q,31249
|
|
96
|
-
dara/core/umd/dara.core.umd.cjs,sha256=
|
|
96
|
+
dara/core/umd/dara.core.umd.cjs,sha256=zonfzOidVkoHJ_8lfFcEszljMmUxeVF_9ZY8qU-iLHo,5148440
|
|
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=jywX4ObSPSW5ppm5mki50L_dPEIeAWweYre1C225STk,2697
|
|
122
122
|
dara/core/visual/themes/light.py,sha256=-Tviq8oEwGbdFULoDOqPuHO0UpAZGsBy8qFi0kAGolQ,1944
|
|
123
|
-
dara_core-1.21.
|
|
124
|
-
dara_core-1.21.
|
|
125
|
-
dara_core-1.21.
|
|
126
|
-
dara_core-1.21.
|
|
127
|
-
dara_core-1.21.
|
|
123
|
+
dara_core-1.21.23.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
|
|
124
|
+
dara_core-1.21.23.dist-info/METADATA,sha256=G4yr8A5kaAmu4SzGoTjU1yJnrxxItWluQxn5aSkvVuI,7541
|
|
125
|
+
dara_core-1.21.23.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
126
|
+
dara_core-1.21.23.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
|
|
127
|
+
dara_core-1.21.23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|