@marimo-team/frontend 0.19.10-dev30 → 0.19.10-dev34
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.
- package/dist/assets/Plot-DolV1EVq.js +3789 -0
- package/dist/assets/{index-BMHyx2Yb.js → index-855KJEhm.js} +20 -20
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/src/plugins/impl/plotly/Plot.tsx +2 -0
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +36 -0
- package/dist/assets/Plot-CN9AM0tY.js +0 -4030
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-855KJEhm.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-D2MJg03u.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/clsx-D8GwTfvk.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/cn-BKtXLv3a.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/frontend",
|
|
3
|
-
"version": "0.19.10-
|
|
3
|
+
"version": "0.19.10-dev34",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"mermaid": "^11.12.2",
|
|
145
145
|
"partysocket": "1.1.10",
|
|
146
146
|
"path-to-regexp": "^8.3.0",
|
|
147
|
-
"plotly.js": "^
|
|
147
|
+
"plotly.js": "^3.3.1",
|
|
148
148
|
"pyodide": "0.27.7",
|
|
149
149
|
"react-arborist": "^3.4.3",
|
|
150
150
|
"react-aria": "3.44.0",
|
|
@@ -35,6 +35,7 @@ export interface PlotProps {
|
|
|
35
35
|
onRelayouting?: (event: PlotlyTypes.PlotRelayoutEvent) => void;
|
|
36
36
|
onSelected?: (event: PlotlyTypes.PlotSelectionEvent) => void;
|
|
37
37
|
onDeselect?: () => void;
|
|
38
|
+
onClick?: (event: PlotlyTypes.PlotMouseEvent) => void;
|
|
38
39
|
onSunburstClick?: (event: PlotlyTypes.PlotMouseEvent) => void;
|
|
39
40
|
onTreemapClick?: (event: PlotlyTypes.PlotMouseEvent) => void;
|
|
40
41
|
onError?: (err: Error) => void;
|
|
@@ -48,6 +49,7 @@ const EVENT_NAMES = [
|
|
|
48
49
|
"Relayouting",
|
|
49
50
|
"Selected",
|
|
50
51
|
"Deselect",
|
|
52
|
+
"Click",
|
|
51
53
|
"SunburstClick",
|
|
52
54
|
"TreemapClick",
|
|
53
55
|
] as const;
|
|
@@ -193,6 +193,24 @@ export const PlotlyComponent = memo(
|
|
|
193
193
|
}));
|
|
194
194
|
})}
|
|
195
195
|
config={plotlyConfig}
|
|
196
|
+
onClick={useEvent((evt: Readonly<Plotly.PlotMouseEvent>) => {
|
|
197
|
+
if (!evt) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// Only handle clicks for chart types where box/lasso selection
|
|
201
|
+
// (onSelected) doesn't work, such as heatmaps.
|
|
202
|
+
const isHeatmap = evt.points.some(
|
|
203
|
+
(point) => point.data?.type === "heatmap",
|
|
204
|
+
);
|
|
205
|
+
if (!isHeatmap) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
setValue((prev) => ({
|
|
209
|
+
...prev,
|
|
210
|
+
points: extractPoints(evt.points),
|
|
211
|
+
indices: evt.points.map((point) => point.pointIndex),
|
|
212
|
+
}));
|
|
213
|
+
})}
|
|
196
214
|
onSelected={useEvent((evt: Readonly<Plotly.PlotSelectionEvent>) => {
|
|
197
215
|
if (!evt) {
|
|
198
216
|
return;
|
|
@@ -224,6 +242,17 @@ PlotlyComponent.displayName = "PlotlyComponent";
|
|
|
224
242
|
* instead of the ones that Plotly uses internally,
|
|
225
243
|
* by using the hovertemplate.
|
|
226
244
|
*/
|
|
245
|
+
const STANDARD_POINT_KEYS: string[] = [
|
|
246
|
+
"x",
|
|
247
|
+
"y",
|
|
248
|
+
"z",
|
|
249
|
+
"lat",
|
|
250
|
+
"lon",
|
|
251
|
+
"curveNumber",
|
|
252
|
+
"pointNumber",
|
|
253
|
+
"pointIndex",
|
|
254
|
+
];
|
|
255
|
+
|
|
227
256
|
function extractPoints(
|
|
228
257
|
points: Plotly.PlotDatum[],
|
|
229
258
|
): Record<AxisName, AxisDatum>[] {
|
|
@@ -238,6 +267,13 @@ function extractPoints(
|
|
|
238
267
|
const hovertemplate = Array.isArray(point.data.hovertemplate)
|
|
239
268
|
? point.data.hovertemplate[0]
|
|
240
269
|
: point.data.hovertemplate;
|
|
270
|
+
|
|
271
|
+
// For chart types with standard point keys (e.g. heatmaps),
|
|
272
|
+
// or when there's no hovertemplate, pick keys directly from the point.
|
|
273
|
+
if (!hovertemplate || point.data?.type === "heatmap") {
|
|
274
|
+
return pick(point, STANDARD_POINT_KEYS);
|
|
275
|
+
}
|
|
276
|
+
|
|
241
277
|
// Update or create a parser
|
|
242
278
|
parser = parser
|
|
243
279
|
? parser.update(hovertemplate)
|