/* Copyright 2026 Marimo. All rights reserved. */ import type { JSX } from "react"; import { Tooltip } from "@/components/ui/tooltip"; import type { MangledSegment, UnmangledLocal } from "@/utils/local-variables"; import { CellLinkError } from "../links/cell-link"; interface Props { local: UnmangledLocal; } /** * Renders a compiler-mangled cell-local variable as the user's original name * (e.g. `_a`) with a tooltip linking to the defining cell. */ export const MangledLocalChip = ({ local }: Props): JSX.Element => { const tooltipContent = (
Local variable {local.name} in cell{" "} .
); return ( {local.name} ); }; interface MangledSegmentsProps { segments: MangledSegment[]; } /** * Render an array of `splitMangledLocals` segments as alternating text and * `` nodes. */ export const MangledSegments = ({ segments, }: MangledSegmentsProps): JSX.Element => ( <> {segments.map((segment, idx) => typeof segment === "string" ? ( {segment} ) : ( ), )} );