@marimo-team/islands 0.22.5-dev12 → 0.22.5-dev14

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.
@@ -34,6 +34,7 @@ import { getRequestClient } from "@/core/network/requests";
34
34
  import { isStaticNotebook } from "@/core/static/static-state";
35
35
  import { isWasm } from "@/core/wasm/utils";
36
36
  import { renderHTML } from "@/plugins/core/RenderHTML";
37
+ import { sanitizeHtml } from "@/plugins/core/sanitize-html";
37
38
  import { copyToClipboard } from "@/utils/copy";
38
39
  import {
39
40
  elementContainsMarimoCellFile,
@@ -173,9 +174,9 @@ export const MarimoTracebackOutput = ({
173
174
  </DropdownMenuItem>
174
175
  <DropdownMenuItem
175
176
  onClick={() => {
176
- // Strip HTML from the traceback
177
+ // Strip HTML from the traceback (sanitize first to prevent XSS)
177
178
  const div = document.createElement("div");
178
- div.innerHTML = traceback;
179
+ div.innerHTML = sanitizeHtml(traceback);
179
180
  const textContent = div.textContent || "";
180
181
  copyToClipboard(textContent);
181
182
  }}
@@ -193,7 +194,7 @@ export const MarimoTracebackOutput = ({
193
194
 
194
195
  function lastLine(text: string): string {
195
196
  const el = document.createElement("div");
196
- el.innerHTML = text;
197
+ el.innerHTML = sanitizeHtml(text);
197
198
  const lines = el.textContent?.split("\n").filter(Boolean);
198
199
  return lines?.at(-1) || "";
199
200
  }
@@ -117,6 +117,14 @@ describe("shouldHandleClickSelection", () => {
117
117
  expect(shouldHandleClickSelection([linePoint])).toBe(true);
118
118
  });
119
119
 
120
+ it("accepts waterfall clicks", () => {
121
+ const waterfallPoint = createPlotDatum({
122
+ data: { type: "waterfall" },
123
+ });
124
+
125
+ expect(shouldHandleClickSelection([waterfallPoint])).toBe(true);
126
+ });
127
+
120
128
  it("rejects non-line scatter marker clicks", () => {
121
129
  const markerPoint = createPlotDatum({
122
130
  data: { type: "scatter", mode: "markers" },
@@ -196,4 +204,18 @@ describe("extractPoints", () => {
196
204
 
197
205
  expect(extractPoints([point])).toEqual([{ x: 1, y: 2, z: 3 }]);
198
206
  });
207
+
208
+ it("returns x/y/pointIndex for waterfall clicks", () => {
209
+ const point = createPlotDatum({
210
+ x: "Revenue",
211
+ y: 400,
212
+ pointIndex: 1,
213
+ curveNumber: 0,
214
+ data: { type: "waterfall" },
215
+ });
216
+
217
+ expect(extractPoints([point])).toEqual([
218
+ { x: "Revenue", y: 400, pointIndex: 1, curveNumber: 0 },
219
+ ]);
220
+ });
199
221
  });
@@ -227,6 +227,7 @@ export function shouldHandleClickSelection(
227
227
  type === "bar" ||
228
228
  type === "heatmap" ||
229
229
  type === "histogram" ||
230
+ type === "waterfall" ||
230
231
  isLinePoint(point)
231
232
  );
232
233
  });