@marimo-team/islands 0.23.15-dev5 → 0.23.15-dev7

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.
@@ -36209,7 +36209,7 @@ ${d}`,
36209
36209
  return Logger.warn("Failed to get version from mount config"), null;
36210
36210
  }
36211
36211
  }
36212
- marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.15-dev5");
36212
+ marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.15-dev7");
36213
36213
  showCodeInRunModeAtom = atom(true);
36214
36214
  atom(null);
36215
36215
  var import_compiler_runtime = require_compiler_runtime();
package/dist/main.js CHANGED
@@ -26,7 +26,7 @@ import { $ as reducer, $t as getRequestClient, A as ChevronDownIcon, An as Trigg
26
26
  import { __tla as __tla_1 } from "./chunk-5FQGJX7Z-BbqSm5gU.js";
27
27
  import { o as useSize, s as Root$1, u as createLucideIcon } from "./dist--2Bqjvs0.js";
28
28
  import { A as SquareFunction, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE_DESCRIPTIONS, E as EMPTY_VALUE$1, O as TIME_UNIT_DESCRIPTIONS, S as DEFAULT_AGGREGATION, T as DEFAULT_TIME_UNIT, _ as AGGREGATION_TYPE_DESCRIPTIONS, a as AGGREGATION_FNS$1, b as COLOR_SCHEMES, c as COLOR_BY_FIELDS, d as NONE_VALUE, f as SELECTABLE_DATA_TYPES, g as TIME_UNITS, h as STRING_AGGREGATION_FNS, i as convertDataTypeToSelectable, j as ChartColumn, k as escapeFieldName, l as COMBINED_TIME_UNITS, m as SORT_TYPES, n as createSpecWithoutData, o as BIN_AGGREGATION, p as SINGLE_TIME_UNITS, r as isFieldSet, s as CHART_TYPES, t as augmentSpecWithData, u as ChartType, v as AGGREGATION_TYPE_ICON, w as DEFAULT_MAX_BINS_FACET, x as COUNT_FIELD, y as CHART_TYPE_ICON } from "./spec-Cz-Bj1JI.js";
29
- import { $ as PANEL_TYPES, $t as hasFunctionProperty, A as prettifyRowCount, At as INDEX_COLUMN_NAME, B as CompactChipRow, Bt as Tabs, C as downloadSizeLimitAtom, Ct as ColumnChartSpecModel, D as ErrorState, Dt as getPageIndexForRow, E as EmptyState, Et as usePrevious$1, F as ContextMenuItem, Ft as isNullishFilter, G as Command, Gt as ChartInfoState, H as DateRangePicker, Ht as TabsList, I as ContextMenuSeparator, It as Maps, J as CommandItem, Jt as useOverflowDetection, K as CommandEmpty, Kt as ChartLoadingState, L as ContextMenuTrigger, Lt as dateToLocalISODate, M as getUserColumnVisibilityCounts, Mt as TOO_MANY_ROWS, N as ContextMenu, Nt as toFieldTypes, O as LoadingState, Ot as loadTableAndRawData, P as ContextMenuContent, Pt as getMimeValues, Q as ContextAwarePanelItem, Qt as EmotionCacheProvider, R as useInternalStateWithSync, Rt as dateToLocalISODateTime, S as Filenames, St as ColumnChartContext, T as ColumnPreviewContainer, Tt as useIntersectionObserver, U as Combobox, Ut as TabsTrigger, V as DatePicker, Vt as TabsContent, W as ComboboxItem, Wt as ChartErrorState, X as CommandSeparator, Xt as Kbd, Y as CommandList, Yt as RenderTextWithLinks, Z as smartMatch, Zt as HtmlOutput, _ as ADD_PRINTING_CLASS, _t as TableRow, an as Funnel, at as slotsController, b as downloadHTMLAsImage, bt as inferFieldTypes, c as Slide, cn as Ellipsis, d as RadioGroupItem, dn as ChevronsUpDown, dt as Provider$1, en as isRecord, et as contextAwarePanelOpen, f as JsonOutput, fn as ChevronsRight, ft as Table, g as InstallPackageButton, gn as ArrowDownWideNarrow, gt as TableHeader, h as DataTable, hn as ChevronLeft, ht as TableHead, in as GripHorizontal, it as SlotNames, j as getColumnCountForDisplay, jt as SELECT_COLUMN_ID, k as prettifyRowColumnCount, kt as loadTableData, l as Switch, ln as Download, m as OutputRenderer, mn as ChevronsDownUp, mt as TableCell, n as marimoVersionAtom, nn as $fae977aafc393c5c$export$6b862160d295c8e, nt as contextAwarePanelType, o as SLIDE_TYPE_OPTIONS_BY_VALUE, on as EyeOff, ot as Toggle, p as OutputArea, pn as ChevronsLeft, pt as TableBody, q as CommandInput, qt as LazyVegaEmbed, r as showCodeInRunModeAtom, rn as TextWrap, rt as isCellAwareAtom, t as useNotebookCodeAvailable, tn as $fae977aafc393c5c$export$588937bcd60ade55, tt as contextAwarePanelOwner, u as RadioGroup, un as Code, ut as Fill, v as downloadBlob, vt as NAMELESS_COLUMN_PREFIX, w as ColumnName, wt as DelayMount, x as Progress, xt as renderCellValue, y as downloadByURL, yt as generateColumns, z as useSelectList, zt as dateToLocalISOTime, __tla as __tla_2 } from "./code-visibility-DBuB5MVY.js";
29
+ import { $ as PANEL_TYPES, $t as hasFunctionProperty, A as prettifyRowCount, At as INDEX_COLUMN_NAME, B as CompactChipRow, Bt as Tabs, C as downloadSizeLimitAtom, Ct as ColumnChartSpecModel, D as ErrorState, Dt as getPageIndexForRow, E as EmptyState, Et as usePrevious$1, F as ContextMenuItem, Ft as isNullishFilter, G as Command, Gt as ChartInfoState, H as DateRangePicker, Ht as TabsList, I as ContextMenuSeparator, It as Maps, J as CommandItem, Jt as useOverflowDetection, K as CommandEmpty, Kt as ChartLoadingState, L as ContextMenuTrigger, Lt as dateToLocalISODate, M as getUserColumnVisibilityCounts, Mt as TOO_MANY_ROWS, N as ContextMenu, Nt as toFieldTypes, O as LoadingState, Ot as loadTableAndRawData, P as ContextMenuContent, Pt as getMimeValues, Q as ContextAwarePanelItem, Qt as EmotionCacheProvider, R as useInternalStateWithSync, Rt as dateToLocalISODateTime, S as Filenames, St as ColumnChartContext, T as ColumnPreviewContainer, Tt as useIntersectionObserver, U as Combobox, Ut as TabsTrigger, V as DatePicker, Vt as TabsContent, W as ComboboxItem, Wt as ChartErrorState, X as CommandSeparator, Xt as Kbd, Y as CommandList, Yt as RenderTextWithLinks, Z as smartMatch, Zt as HtmlOutput, _ as ADD_PRINTING_CLASS, _t as TableRow, an as Funnel, at as slotsController, b as downloadHTMLAsImage, bt as inferFieldTypes, c as Slide, cn as Ellipsis, d as RadioGroupItem, dn as ChevronsUpDown, dt as Provider$1, en as isRecord, et as contextAwarePanelOpen, f as JsonOutput, fn as ChevronsRight, ft as Table, g as InstallPackageButton, gn as ArrowDownWideNarrow, gt as TableHeader, h as DataTable, hn as ChevronLeft, ht as TableHead, in as GripHorizontal, it as SlotNames, j as getColumnCountForDisplay, jt as SELECT_COLUMN_ID, k as prettifyRowColumnCount, kt as loadTableData, l as Switch, ln as Download, m as OutputRenderer, mn as ChevronsDownUp, mt as TableCell, n as marimoVersionAtom, nn as $fae977aafc393c5c$export$6b862160d295c8e, nt as contextAwarePanelType, o as SLIDE_TYPE_OPTIONS_BY_VALUE, on as EyeOff, ot as Toggle, p as OutputArea, pn as ChevronsLeft, pt as TableBody, q as CommandInput, qt as LazyVegaEmbed, r as showCodeInRunModeAtom, rn as TextWrap, rt as isCellAwareAtom, t as useNotebookCodeAvailable, tn as $fae977aafc393c5c$export$588937bcd60ade55, tt as contextAwarePanelOwner, u as RadioGroup, un as Code, ut as Fill, v as downloadBlob, vt as NAMELESS_COLUMN_PREFIX, w as ColumnName, wt as DelayMount, x as Progress, xt as renderCellValue, y as downloadByURL, yt as generateColumns, z as useSelectList, zt as dateToLocalISOTime, __tla as __tla_2 } from "./code-visibility-B8b6lh5X.js";
30
30
  import { c as Calendar, i as createReducerAndAtoms, n as useOnUnmount, o as ToggleLeft, t as useOnMount } from "./useLifecycle-DegSo0lV.js";
31
31
  import { t as Check } from "./check-C9OoNtR4.js";
32
32
  import { A as Icon, C as logNever, D as $18f2051aff69b9bf$export$a54013f0d02a8f82, E as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, F as createCollection, I as X, M as clamp$2, N as usePrevious$2, P as useDirection, R as ChevronDown, S as assertNever, a as SelectGroup, c as SelectSeparator, d as NativeSelect, i as SelectContent, j as Trigger$1, l as SelectTrigger, n as capitalize, o as SelectItem, r as Select, s as SelectLabel, t as Strings, u as SelectValue, w as $a916eb452884faea$export$b7a616150fdb9f44 } from "./strings-Dq_j3Rxw.js";
@@ -26255,7 +26255,7 @@ ${c}
26255
26255
  __privateSet(this, _n6, e);
26256
26256
  let c = false;
26257
26257
  if ((e.width !== r.width || e.height !== r.height) && (__privateMethod(this, _MatplotlibRenderer_instances, c_fn2).call(this), c = true), e.chartBase64 !== __privateGet(this, _s2)) {
26258
- __privateMethod(this, _MatplotlibRenderer_instances, u_fn).call(this, e.chartBase64);
26258
+ __privateMethod(this, _MatplotlibRenderer_instances, u_fn).call(this, e.chartBase64), __privateGet(this, _b2).call(this, e.value);
26259
26259
  return;
26260
26260
  }
26261
26261
  let l = __privateGet(this, _r4).type !== "idle" && __privateGet(this, _r4).action !== null;
@@ -38040,7 +38040,7 @@ ${c}
38040
38040
  function _temp2$2(e) {
38041
38041
  e.target === e.currentTarget && e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), e.currentTarget.click());
38042
38042
  }
38043
- var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-DfOZrkd6.js"));
38043
+ var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-D0fwa0Mk.js"));
38044
38044
  const SlidesLayoutRenderer = ({ layout: e, setLayout: r, cells: c, mode: l }) => {
38045
38045
  var _a5;
38046
38046
  let u = useAtomValue(kioskModeAtom), d = l === "read" || u, f = useAtomValue(numColumnsAtom) > 1, [p, m] = (0, import_react.useState)(null), { slideCells: h, skippedIds: g, noOutputIds: _, slideTypes: v, startCellIndex: y } = (0, import_react.useMemo)(() => computeSlideCellsInfo(c, e), [
@@ -9,7 +9,7 @@ import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
9
9
  import { lt as kioskModeAtom, pt as outputIsStale } from "./html-to-image-_wGfk8V-.js";
10
10
  import "./chunk-5FQGJX7Z-BbqSm5gU.js";
11
11
  import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
12
- import { a as DEFAULT_SLIDE_TYPE, c as Slide, ct as PanelGroup, i as DEFAULT_DECK_TRANSITION, lt as PanelResizeHandle, on as EyeOff, s as SlideSidebar, sn as Expand, st as Panel, t as useNotebookCodeAvailable, un as Code } from "./code-visibility-DBuB5MVY.js";
12
+ import { a as DEFAULT_SLIDE_TYPE, c as Slide, ct as PanelGroup, i as DEFAULT_DECK_TRANSITION, lt as PanelResizeHandle, on as EyeOff, s as SlideSidebar, sn as Expand, st as Panel, t as useNotebookCodeAvailable, un as Code } from "./code-visibility-B8b6lh5X.js";
13
13
  import { X as useDebouncedCallback } from "./input-DtsN7xm-.js";
14
14
  import "./toDate-CWNNlFEX.js";
15
15
  import "./react-dom-BTJzcVJ9.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.23.15-dev5",
3
+ "version": "0.23.15-dev7",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1,7 +1,11 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
- import { describe, expect, it } from "vitest";
3
- import type { Data } from "../matplotlib-renderer";
4
- import { visibleForTesting } from "../matplotlib-renderer";
2
+ import { afterEach, describe, expect, it, vi } from "vitest";
3
+ import {
4
+ type Data,
5
+ MatplotlibRenderer,
6
+ type MatplotlibState,
7
+ visibleForTesting,
8
+ } from "../matplotlib-renderer";
5
9
 
6
10
  const {
7
11
  pixelToData,
@@ -185,3 +189,67 @@ describe("isInAxes", () => {
185
189
  expect(isInAxes({ x: 300, y: 351 }, LINEAR_AXES)).toBe(false);
186
190
  });
187
191
  });
192
+
193
+ describe("MatplotlibRenderer", () => {
194
+ afterEach(() => {
195
+ vi.unstubAllGlobals();
196
+ vi.restoreAllMocks();
197
+ });
198
+
199
+ it("restores a new selection when the chart changes", () => {
200
+ vi.stubGlobal(
201
+ "matchMedia",
202
+ vi.fn(() => ({ addEventListener: vi.fn() })),
203
+ );
204
+ vi.stubGlobal(
205
+ "requestAnimationFrame",
206
+ vi.fn(() => 1),
207
+ );
208
+ vi.stubGlobal("cancelAnimationFrame", vi.fn());
209
+ vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue(null);
210
+
211
+ const value = {
212
+ type: "box",
213
+ has_selection: true,
214
+ data: { x_min: 2, x_max: 4, y_min: 2, y_max: 4 },
215
+ } as const;
216
+ const state: MatplotlibState = {
217
+ ...LINEAR_AXES,
218
+ axesPixelBounds: [0, 0, 100, 100],
219
+ yBounds: [0, 10],
220
+ chartBase64: "first",
221
+ width: 100,
222
+ height: 100,
223
+ selectionColor: "blue",
224
+ selectionOpacity: 0.15,
225
+ strokeWidth: 2,
226
+ debounce: false,
227
+ value: { has_selection: false },
228
+ setValue: vi.fn(),
229
+ };
230
+ const container = document.createElement("div");
231
+ const controller = new AbortController();
232
+ const renderer = new MatplotlibRenderer(container, {
233
+ state,
234
+ signal: controller.signal,
235
+ });
236
+
237
+ // Cell reruns reuse the renderer, updating the chart and initial value together.
238
+ renderer.update({ ...state, chartBase64: "second", value });
239
+
240
+ const canvas = container.querySelector("canvas");
241
+ expect(canvas).not.toBeNull();
242
+ if (!canvas) {
243
+ return;
244
+ }
245
+ vi.spyOn(canvas, "getBoundingClientRect").mockReturnValue(
246
+ DOMRect.fromRect({ width: 100, height: 100 }),
247
+ );
248
+ canvas.dispatchEvent(
249
+ new MouseEvent("pointermove", { clientX: 30, clientY: 70 }),
250
+ );
251
+
252
+ expect(canvas.style.cursor).toBe("move");
253
+ controller.abort();
254
+ });
255
+ });
@@ -377,6 +377,7 @@ export class MatplotlibRenderer {
377
377
 
378
378
  if (state.chartBase64 !== this.#currentChartBase64) {
379
379
  this.#loadImage(state.chartBase64);
380
+ this.#restoreSelection(state.value);
380
381
  return;
381
382
  }
382
383