@marimo-team/islands 0.19.10-dev32 → 0.19.10-dev35

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/main.js CHANGED
@@ -51904,7 +51904,7 @@ Database schema: ${c}`), (_a3 = r2.aiFix) == null ? void 0 : _a3.setAiCompletion
51904
51904
  }
51905
51905
  let w, E, O, M, I, z;
51906
51906
  if (r[2] !== y || r[3] !== d || r[4] !== _ || r[5] !== f || r[6] !== c || r[7] !== S || r[8] !== v) {
51907
- let e2 = c.filter(_temp7$2), G2 = c.filter(_temp8$1), q2 = c.filter(_temp9$1), IY = c.filter(_temp0$1), LY = c.filter(_temp1$1), RY = c.filter(_temp10), zY = c.filter(_temp11), BY = c.filter(_temp12), VY = c.filter(_temp13), HY = c.filter(_temp14), UY = c.filter(_temp15), WY = c.filter(_temp16), GY = c.filter(_temp17), KY;
51907
+ let e2 = c.filter(_temp7$3), G2 = c.filter(_temp8$2), q2 = c.filter(_temp9$1), IY = c.filter(_temp0$1), LY = c.filter(_temp1$1), RY = c.filter(_temp10), zY = c.filter(_temp11), BY = c.filter(_temp12), VY = c.filter(_temp13), HY = c.filter(_temp14), UY = c.filter(_temp15), WY = c.filter(_temp16), GY = c.filter(_temp17), KY;
51908
51908
  r[15] === _ ? KY = r[16] : (KY = () => {
51909
51909
  _.openApplication("scratchpad");
51910
51910
  }, r[15] = _, r[16] = KY);
@@ -52276,10 +52276,10 @@ Database schema: ${c}`), (_a3 = r2.aiFix) == null ? void 0 : _a3.setAiCompletion
52276
52276
  function _temp6$6(e) {
52277
52277
  return e.type === "exception";
52278
52278
  }
52279
- function _temp7$2(e) {
52279
+ function _temp7$3(e) {
52280
52280
  return e.type === "setup-refs";
52281
52281
  }
52282
- function _temp8$1(e) {
52282
+ function _temp8$2(e) {
52283
52283
  return e.type === "cycle";
52284
52284
  }
52285
52285
  function _temp9$1(e) {
@@ -73304,7 +73304,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
73304
73304
  return Logger.warn("Failed to get version from mount config"), null;
73305
73305
  }
73306
73306
  }
73307
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.10-dev32"), showCodeInRunModeAtom = atom(true);
73307
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.10-dev35"), showCodeInRunModeAtom = atom(true);
73308
73308
  atom(null);
73309
73309
  var import_compiler_runtime$88 = require_compiler_runtime();
73310
73310
  function useKeydownOnElement(e, r) {
@@ -79674,7 +79674,7 @@ ${c}
79674
79674
  render: w
79675
79675
  }), r[5] = c, r[6] = S.control, r[7] = w, r[8] = E) : E = r[8], E;
79676
79676
  }, AggregationSelect = (e) => {
79677
- let r = (0, import_compiler_runtime$73.c)(12), { fieldName: c, selectedDataType: d, binFieldName: f, defaultAggregation: _ } = e, v = useFormContext(), y = d === "string" ? STRING_AGGREGATION_FNS : AGGREGATION_FNS$1, { chartType: S } = useChartFormContext(), w = S !== ChartType.HEATMAP, E = _temp6$5, O = _temp7$1, M;
79677
+ let r = (0, import_compiler_runtime$73.c)(12), { fieldName: c, selectedDataType: d, binFieldName: f, defaultAggregation: _ } = e, v = useFormContext(), y = d === "string" ? STRING_AGGREGATION_FNS : AGGREGATION_FNS$1, { chartType: S } = useChartFormContext(), w = S !== ChartType.HEATMAP, E = _temp6$5, O = _temp7$2, M;
79678
79678
  r[0] !== f || r[1] !== v ? (M = (e2) => {
79679
79679
  let { value: r2, previousValue: c2, onChange: d2 } = e2;
79680
79680
  r2 === "bin" ? v.setValue(f, true) : c2 === "bin" && v.setValue(f, false), d2(r2);
@@ -79733,7 +79733,7 @@ ${c}
79733
79733
  render: z
79734
79734
  }), r[8] = c, r[9] = v.control, r[10] = z, r[11] = G) : G = r[11], G;
79735
79735
  }, TooltipSelect = (e) => {
79736
- let r = (0, import_compiler_runtime$73.c)(7), { fieldName: c, saveFunction: d } = e, f = useFormContext(), { fields: _ } = useChartFormContext(), v = _temp8, y;
79736
+ let r = (0, import_compiler_runtime$73.c)(7), { fieldName: c, saveFunction: d } = e, f = useFormContext(), { fields: _ } = useChartFormContext(), v = _temp8$1, y;
79737
79737
  r[0] !== _ || r[1] !== d ? (y = (e2) => {
79738
79738
  var _a2;
79739
79739
  let { field: r2 } = e2, c2 = ((_a2 = r2.value) == null ? void 0 : _a2.map(_temp9)) ?? [];
@@ -79846,7 +79846,7 @@ ${c}
79846
79846
  children: e
79847
79847
  });
79848
79848
  }
79849
- function _temp7$1(e) {
79849
+ function _temp7$2(e) {
79850
79850
  let { value: r, Icon: c, subtitle: d } = e;
79851
79851
  return (0, import_jsx_runtime.jsx)(SelectItem, {
79852
79852
  value: r,
@@ -79863,7 +79863,7 @@ ${c}
79863
79863
  })
79864
79864
  }, r);
79865
79865
  }
79866
- function _temp8(e, r) {
79866
+ function _temp8$1(e, r) {
79867
79867
  var _a2;
79868
79868
  return {
79869
79869
  field: e,
@@ -84518,7 +84518,7 @@ ${c}
84518
84518
  children: _temp6$2
84519
84519
  }),
84520
84520
  (0, import_jsx_runtime.jsx)(CalendarGridBody, {
84521
- children: _temp7
84521
+ children: _temp7$1
84522
84522
  })
84523
84523
  ]
84524
84524
  })
@@ -84564,7 +84564,7 @@ ${c}
84564
84564
  children: e
84565
84565
  });
84566
84566
  }
84567
- function _temp7(e) {
84567
+ function _temp7$1(e) {
84568
84568
  return (0, import_jsx_runtime.jsx)(CalendarCell, {
84569
84569
  date: e
84570
84570
  });
@@ -94116,7 +94116,7 @@ ${c}
94116
94116
  setValue: e.setValue
94117
94117
  });
94118
94118
  }
94119
- }, LazyPlot = (0, import_react.lazy)(() => import("./Plot-CmsrWWji.js").then((e) => ({
94119
+ }, LazyPlot = (0, import_react.lazy)(() => import("./Plot-C9vQQj4X.js").then((e) => ({
94120
94120
  default: e.Plot
94121
94121
  }))), SUNBURST_DATA_KEYS = [
94122
94122
  "color",
@@ -94134,7 +94134,7 @@ ${c}
94134
94134
  "value"
94135
94135
  ], TREE_MAP_DATA_KEYS = SUNBURST_DATA_KEYS;
94136
94136
  const PlotlyComponent = (0, import_react.memo)((e) => {
94137
- let r = (0, import_compiler_runtime$30.c)(34), { figure: c, value: d, setValue: f, config: _ } = e, v = useScript("https://cdn.jsdelivr.net/npm/mathjax-full@3.2.2/es5/tex-mml-svg.min.js") === "ready", y;
94137
+ let r = (0, import_compiler_runtime$30.c)(37), { figure: c, value: d, setValue: f, config: _ } = e, v = useScript("https://cdn.jsdelivr.net/npm/mathjax-full@3.2.2/es5/tex-mml-svg.min.js") === "ready", y;
94138
94138
  r[0] !== v || r[1] !== c || r[2] !== d ? (y = {
94139
94139
  originalFigure: c,
94140
94140
  initialValue: d,
@@ -94199,16 +94199,24 @@ ${c}
94199
94199
  }, r[19] = f, r[20] = HY);
94200
94200
  let UY = useEvent_default(HY), WY;
94201
94201
  r[21] === f ? WY = r[22] : (WY = (e2) => {
94202
+ e2 && e2.points.some(_temp5$1) && f((r2) => ({
94203
+ ...r2,
94204
+ points: extractPoints(e2.points),
94205
+ indices: e2.points.map(_temp6)
94206
+ }));
94207
+ }, r[21] = f, r[22] = WY);
94208
+ let GY = useEvent_default(WY), KY;
94209
+ r[23] === f ? KY = r[24] : (KY = (e2) => {
94202
94210
  e2 && f((r2) => ({
94203
94211
  ...r2,
94204
94212
  selections: "selections" in e2 ? e2.selections : [],
94205
94213
  points: extractPoints(e2.points),
94206
- indices: e2.points.map(_temp5$1),
94214
+ indices: e2.points.map(_temp7),
94207
94215
  range: e2.range
94208
94216
  }));
94209
- }, r[21] = f, r[22] = WY);
94210
- let GY = useEvent_default(WY), KY = S.frames ?? void 0, qY = useEvent_default(_temp6), JY;
94211
- return r[23] !== S || r[24] !== w || r[25] !== IY || r[26] !== VY || r[27] !== UY || r[28] !== GY || r[29] !== KY || r[30] !== qY || r[31] !== LY || r[32] !== zY ? (JY = (0, import_jsx_runtime.jsx)(LazyPlot, {
94217
+ }, r[23] = f, r[24] = KY);
94218
+ let qY = useEvent_default(KY), JY = S.frames ?? void 0, YY = useEvent_default(_temp8), XY;
94219
+ return r[25] !== S || r[26] !== w || r[27] !== IY || r[28] !== VY || r[29] !== UY || r[30] !== GY || r[31] !== qY || r[32] !== JY || r[33] !== YY || r[34] !== LY || r[35] !== zY ? (XY = (0, import_jsx_runtime.jsx)(LazyPlot, {
94212
94220
  ...S,
94213
94221
  layout: w,
94214
94222
  onRelayout: LY,
@@ -94216,20 +94224,32 @@ ${c}
94216
94224
  onTreemapClick: VY,
94217
94225
  onSunburstClick: UY,
94218
94226
  config: IY,
94219
- onSelected: GY,
94227
+ onClick: GY,
94228
+ onSelected: qY,
94220
94229
  className: "w-full",
94221
94230
  useResizeHandler: true,
94222
- frames: KY,
94223
- onError: qY
94224
- }), r[23] = S, r[24] = w, r[25] = IY, r[26] = VY, r[27] = UY, r[28] = GY, r[29] = KY, r[30] = qY, r[31] = LY, r[32] = zY, r[33] = JY) : JY = r[33], JY;
94231
+ frames: JY,
94232
+ onError: YY
94233
+ }), r[25] = S, r[26] = w, r[27] = IY, r[28] = VY, r[29] = UY, r[30] = GY, r[31] = qY, r[32] = JY, r[33] = YY, r[34] = LY, r[35] = zY, r[36] = XY) : XY = r[36], XY;
94225
94234
  });
94226
94235
  PlotlyComponent.displayName = "PlotlyComponent";
94236
+ var STANDARD_POINT_KEYS = [
94237
+ "x",
94238
+ "y",
94239
+ "z",
94240
+ "lat",
94241
+ "lon",
94242
+ "curveNumber",
94243
+ "pointNumber",
94244
+ "pointIndex"
94245
+ ];
94227
94246
  function extractPoints(e) {
94228
94247
  if (!e) return [];
94229
94248
  let r;
94230
94249
  return e.map((e2) => {
94250
+ var _a2;
94231
94251
  let c = Array.isArray(e2.data.hovertemplate) ? e2.data.hovertemplate[0] : e2.data.hovertemplate;
94232
- return r = r ? r.update(c) : createParser(c), r.parse(e2);
94252
+ return !c || ((_a2 = e2.data) == null ? void 0 : _a2.type) === "heatmap" ? pick_default(e2, STANDARD_POINT_KEYS) : (r = r ? r.update(c) : createParser(c), r.parse(e2));
94233
94253
  });
94234
94254
  }
94235
94255
  function _temp$7(e) {
@@ -94251,9 +94271,16 @@ ${c}
94251
94271
  return pick_default(e, SUNBURST_DATA_KEYS);
94252
94272
  }
94253
94273
  function _temp5$1(e) {
94254
- return e.pointIndex;
94274
+ var _a2;
94275
+ return ((_a2 = e.data) == null ? void 0 : _a2.type) === "heatmap";
94255
94276
  }
94256
94277
  function _temp6(e) {
94278
+ return e.pointIndex;
94279
+ }
94280
+ function _temp7(e) {
94281
+ return e.pointIndex;
94282
+ }
94283
+ function _temp8(e) {
94257
94284
  Logger.error("PlotlyPlugin: ", e);
94258
94285
  }
94259
94286
  var import_compiler_runtime$29 = require_compiler_runtime(), RadioPlugin = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.19.10-dev32",
3
+ "version": "0.19.10-dev35",
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": "^2.35.3",
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)