Skip to content

Conversation

@manzt
Copy link
Contributor

@manzt manzt commented Jul 21, 2025

This PR introduces a reactive notebook minimap (similar in spirit to Observable), but adapted marimo where multiple variables can be declared across cells. Selecting a cell highlights its upstream and downstream connections, visualizing data flow through the notebook.

For now, it's rendered as a floating window for testing. The current goal is to refine the UX and determine its final placement in the UI. I'd like to avoid burying it in the left panel and instead possibly have a floating window triggered either by button or keyboard shortcut.

Some nuance with Observable's minimap: Since our cells can declare multiple variables, our dataflow tracing is asymmetric. For upstream variabes, we can trace granularly which variables used by the selected cell and find where they were declared. For downstream tracing, we coarsely mark all variables that are in a dependent cell as connected (since they are all dependents).

TODO:

  • Handle unselected state. Right now, the minimap always shows a focused cell. We should have a state for when nothing is focused. This state is handled, but never shows up because lastFocusedCell is always defined. Would be nice to have some way to select/deselect items in the minimap. Wondering how it should play with command/edit modes.
  • Fix click selection behavior. We're currently using actions.focusCell({ cellId, before: false }), which causes the next/previous cell to be focused depending on cell state. Instead, we want to focus exactly the clicked cell regardless of position. Updated actions.focusCell({ cellId, mode: "before" | "after" | "exact" }).
  • Documentation. We can lean on aligning with observable, but this feature should be well documented with how to actually read the minimap. It takes a little adjustment, but once you grok it it's a very efficient encoding of the information.
minimap.mp4

@vercel
Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 11:20pm

@dmadisetti
Copy link
Collaborator

What do the dot sizes mean? (Some are big, some are small)

@manzt
Copy link
Contributor Author

manzt commented Jul 21, 2025

What do the dot sizes mean? (Some are big, some are small)

I followed this description of the feature from the Observable docs as closely as I could: https://observablehq.com/documentation/debugging/minimap#connection-types

image

small dot == independent, not in dependency tree. large dot == in dependency tree

@manzt manzt added enhancement New feature or request bash-focus Area to focus on during release bug bash includes-media Description includes multimedia provided to illustrate functionality. labels Jul 21, 2025
manzt and others added 20 commits July 22, 2025 19:14
This introduces a reactive notebook minimap (similar in spirit to
Observable), but adapted marimo model where multiple variables can be
declared across cells. It lists all cells in order and lets you click to
focus any one.

Selecting a cell highlights its upstream and downstream connections,
making variable flow across the notebook easier to understand without
jumping between cells manually.
The updated logic now correctly handles four distinct cases: variables
used by the selected cell, variables declared by the selected cell,
variables flowing through from ancestors, and variables in downstream
cells that will be re-executed. This provides more precise visual
feedback about which variables are actually affected by cell selection
in the minimap.
The `focusCell` action previously used a boolean `before` parameter to
determine whether to focus the cell before or after the current one.
This change replaces the boolean with an explicit `mode` parameter that
can be "before", "after", or "exact".
increase focus state to include currently focused and last focused
@manzt
Copy link
Contributor Author

manzt commented Jul 22, 2025

I'm happy where this is at. I added a launcher to the bottom. I'm wondering if a hot key for toggling (ctrl + shift + m) could be preferable to the command pallete. I was experimenting with it locally but we could add in a second PR.

@manzt manzt merged commit 958c19d into main Jul 23, 2025
24 of 25 checks passed
@manzt manzt deleted the manzt/minimap branch July 23, 2025 02:09
@manzt manzt added the release-highlight A feature or change to call out in upcoming release notes label Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash enhancement New feature or request includes-media Description includes multimedia provided to illustrate functionality. release-highlight A feature or change to call out in upcoming release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants