@marimo-team/islands 0.23.12-dev19 → 0.23.12-dev20

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.
@@ -6,13 +6,13 @@ import { _ as Logger, c as Objects, g as cn, l as useEventListener, t as Button
6
6
  import { t as require_react } from "./react-DA-nE2FX.js";
7
7
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
8
8
  import { r as toast } from "./copy-COam1EG7.js";
9
- import { C as AccordionContent, D as ChatBubbleIcon, En as Trash2, Et as createVariableInfoElement, G as cellErrorsAtom, Gt as getTableType, In as ExternalLink, It as jotaiJsonStorage, Lt as variablesAtom, Mt as generateUUID, Nn as Info, P as base64ToDataURL, Pn as FileText, Rt as PluralWord, S as Accordion, T as AccordionTrigger, Tn as Wrench, Ut as allTablesAtom, V as renderHTML, Wt as dataSourceConnectionsAtom, X as notebookAtom, Zt as singleFacet, _ as Boosts, _n as atomWithStorage, b as AIContextProvider, c as Popover, d as PopoverTrigger, f as isOutputEmpty, h as DatasourceContextProvider, jn as LoaderCircle, kt as moveToEndOfEditor, n as Spinner, nn as ZodLocalStorage, qt as getRequestClient, r as MarkdownRenderer, sn as CellOutputId, t as toPng, u as PopoverContent, v as Sections, w as AccordionItem, x as AIContextRegistry, y as contextToXml, yn as Anchor2, yt as displayCellName, zn as CircleX } from "./html-to-image-Di0mtt6O.js";
9
+ import { C as AccordionContent, D as ChatBubbleIcon, En as Trash2, Et as createVariableInfoElement, G as cellErrorsAtom, Gt as getTableType, In as ExternalLink, It as jotaiJsonStorage, Lt as variablesAtom, Mt as generateUUID, Nn as Info, P as base64ToDataURL, Pn as FileText, Rt as PluralWord, S as Accordion, T as AccordionTrigger, Tn as Wrench, Ut as allTablesAtom, V as renderHTML, Wt as dataSourceConnectionsAtom, X as notebookAtom, Zt as singleFacet, _ as Boosts, _n as atomWithStorage, b as AIContextProvider, c as Popover, d as PopoverTrigger, f as isOutputEmpty, h as DatasourceContextProvider, jn as LoaderCircle, kt as moveToEndOfEditor, n as Spinner, nn as ZodLocalStorage, qt as getRequestClient, r as MarkdownRenderer, sn as CellOutputId, t as toPng, u as PopoverContent, v as Sections, w as AccordionItem, x as AIContextRegistry, y as contextToXml, yn as Anchor2, yt as displayCellName, zn as CircleX } from "./html-to-image-DXwLcQ6l.js";
10
10
  import "./chunk-5FQGJX7Z-BbqSm5gU.js";
11
11
  import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
12
12
  import { C as logNever, I as X, R as ChevronDown, t as Strings } from "./strings-Dq_j3Rxw.js";
13
13
  import { C as DropdownMenuTrigger, a as NumberField, f as DropdownMenu, h as DropdownMenuItem, p as DropdownMenuContent, r as Input } from "./input-CbEz_aj_.js";
14
14
  import { p as isUrl, v as CircleQuestionMark } from "./toDate-D-l5s8nn.js";
15
- import { a as MarimoIncomingMessageEvent, d as Square, f as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-BLd4KuwX.js";
15
+ import { a as MarimoIncomingMessageEvent, d as Square, f as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-C6_e1pT_.js";
16
16
  import "./react-dom-BTJzcVJ9.js";
17
17
  import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
18
18
  import { A as looseObject, B as union, C as any, D as discriminatedUnion, E as custom, H as safeParseAsync, I as record, L as strictObject, M as never, N as number, O as lazy, P as object$1, R as string, S as _null, T as boolean, V as unknown, W as toJSONSchema, b as _enum, k as literal, w as array$1, x as _instanceof } from "./zod-CijjQh4u.js";
@@ -6,7 +6,7 @@ import { _ as Logger, c as Objects, g as cn, h as Events, m as useComposedRefs,
6
6
  import { t as require_react } from "./react-DA-nE2FX.js";
7
7
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
8
8
  import { n as Copy, r as toast, t as copyToClipboard } from "./copy-COam1EG7.js";
9
- import { $t as extractAllTracebackInfo, A as ChevronRightIcon, An as Minus, At as goToCellLine, Bt as DATA_TYPE_ICON, C as AccordionContent, Ct as Checkbox, En as Trash2, Fn as Eye, Ft as adaptForLocalStorage, Hn as esm_default, I as base64ToUint8Array, In as ExternalLink, It as jotaiJsonStorage, M as PinLeftIcon, N as PinRightIcon, Nn as Info, Nt as useChromeActions, O as CheckIcon, Pn as FileText, Qt as elementContainsMarimoCellFile, R as extractBase64FromDataURL, Rt as PluralWord, S as Accordion, T as AccordionTrigger, Tn as Wrench, Un as import_lib, V as renderHTML, Vn as Braces, Vt as getDataTypeColor, X as notebookAtom, Yt as useRequestClient, _n as atomWithStorage, _t as DATA_CELL_ID, bn as Close$1, c as Popover, cn as HTMLCellId, d as PopoverTrigger, dt as viewStateAtom, en as getTracebackInfo, et as useCellActions, ft as outputIsLoading, g as getDatasourceContext, gt as sanitizeHtml, hn as jsonToMarkdown, j as DotFilledIcon, jn as LoaderCircle, kn as NotebookPen, l as PopoverClose, ln as SCRATCH_CELL_ID, lt as kioskModeAtom, m as useExpandedOutput, mn as jsonParseWithSpecialChar, n as Spinner, nt as useCellNames, ot as AnsiUp, q as getCellEditorView, qt as getRequestClient, r as MarkdownRenderer, rn as filenameAtom, sn as CellOutputId, t as toPng, tt as useCellIds, u as PopoverContent, ut as useInstallAllowed, vt as getCellDomProps, w as AccordionItem, yt as displayCellName, z as isDataURLString, zn as CircleX, __tla as __tla_0 } from "./html-to-image-Di0mtt6O.js";
9
+ import { $t as extractAllTracebackInfo, A as ChevronRightIcon, An as Minus, At as goToCellLine, Bt as DATA_TYPE_ICON, C as AccordionContent, Ct as Checkbox, En as Trash2, Fn as Eye, Ft as adaptForLocalStorage, Hn as esm_default, I as base64ToUint8Array, In as ExternalLink, It as jotaiJsonStorage, M as PinLeftIcon, N as PinRightIcon, Nn as Info, Nt as useChromeActions, O as CheckIcon, Pn as FileText, Qt as elementContainsMarimoCellFile, R as extractBase64FromDataURL, Rt as PluralWord, S as Accordion, T as AccordionTrigger, Tn as Wrench, Un as import_lib, V as renderHTML, Vn as Braces, Vt as getDataTypeColor, X as notebookAtom, Yt as useRequestClient, _n as atomWithStorage, _t as DATA_CELL_ID, bn as Close$1, c as Popover, cn as HTMLCellId, d as PopoverTrigger, dt as viewStateAtom, en as getTracebackInfo, et as useCellActions, ft as outputIsLoading, g as getDatasourceContext, gt as sanitizeHtml, hn as jsonToMarkdown, j as DotFilledIcon, jn as LoaderCircle, kn as NotebookPen, l as PopoverClose, ln as SCRATCH_CELL_ID, lt as kioskModeAtom, m as useExpandedOutput, mn as jsonParseWithSpecialChar, n as Spinner, nt as useCellNames, ot as AnsiUp, q as getCellEditorView, qt as getRequestClient, r as MarkdownRenderer, rn as filenameAtom, sn as CellOutputId, t as toPng, tt as useCellIds, u as PopoverContent, ut as useInstallAllowed, vt as getCellDomProps, w as AccordionItem, yt as displayCellName, z as isDataURLString, zn as CircleX, __tla as __tla_0 } from "./html-to-image-DXwLcQ6l.js";
10
10
  import { o as useSize, u as createLucideIcon } from "./dist--2Bqjvs0.js";
11
11
  import { c as Calendar, i as createReducerAndAtoms, r as Badge } from "./useLifecycle-AHlswLw-.js";
12
12
  import { a as ListFilter, i as Table$1, n as $fb18d541ea1ad717$export$ad991b66133851cf, o as ChartPie, r as $5a387cc49350e6db$export$722debc0e56fea39, t as $896ba0a80a8f4d36$export$85fd5fdf27bacc79 } from "./useDateFormatter-CMnRuVmN.js";
@@ -35997,7 +35997,7 @@ ${d}`,
35997
35997
  return Logger.warn("Failed to get version from mount config"), null;
35998
35998
  }
35999
35999
  }
36000
- marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.12-dev19");
36000
+ marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.12-dev20");
36001
36001
  showCodeInRunModeAtom = atom(true);
36002
36002
  atom(null);
36003
36003
  var import_compiler_runtime = require_compiler_runtime();
@@ -20006,18 +20006,25 @@ ${n.sqlString}
20006
20006
  case "ImportStatement": {
20007
20007
  let r2 = e.cursor();
20008
20008
  r2.firstChild();
20009
- do
20010
- r2.name === "VariableName" && t.doc.sliceString(r2.from, r2.to) === n && addDeclaration(i, l, r2.from);
20011
- while (r2.nextSibling());
20012
- break;
20013
- }
20014
- case "ImportFromStatement": {
20015
- let r2 = e.cursor();
20016
- r2.firstChild();
20017
- let a2 = false;
20018
- do
20019
- r2.name === "import" ? a2 = true : a2 && r2.name === "VariableName" && t.doc.sliceString(r2.from, r2.to) === n && addDeclaration(i, l, r2.from);
20020
- while (r2.nextSibling());
20009
+ let a2 = false, o2 = null, s2 = () => {
20010
+ (o2 == null ? void 0 : o2.matches) && addDeclaration(i, l, o2.from), o2 = null;
20011
+ };
20012
+ do {
20013
+ if (r2.name === "import") {
20014
+ a2 = true;
20015
+ continue;
20016
+ }
20017
+ if (!a2) continue;
20018
+ if (r2.name === "as") {
20019
+ o2 = null;
20020
+ continue;
20021
+ }
20022
+ r2.name === "VariableName" ? (s2(), o2 = {
20023
+ from: r2.from,
20024
+ matches: t.doc.sliceString(r2.from, r2.to) === n
20025
+ }) : r2.name === "," && s2();
20026
+ } while (r2.nextSibling());
20027
+ s2();
20021
20028
  break;
20022
20029
  }
20023
20030
  case "TryStatement":
@@ -20047,9 +20054,9 @@ ${n.sqlString}
20047
20054
  }
20048
20055
  return null;
20049
20056
  }
20050
- function goToVariableDefinition(e, t, n, r = true) {
20051
- let { state: i } = e, a = null;
20052
- return n !== void 0 && (a = findScopedDefinitionPosition(i, t, n)), a === null && r && (a = findFirstMatchingVariable(i, t)), a === null ? false : (goToPosition(e, a), true);
20057
+ function goToVariableDefinition(e, t, n) {
20058
+ let { state: r } = e, i = n === void 0 ? findFirstMatchingVariable(r, t) : findScopedDefinitionPosition(r, t, n);
20059
+ return i === null ? false : (goToPosition(e, i), true);
20053
20060
  }
20054
20061
  function goToLine(e, t) {
20055
20062
  return goToPosition(e, e.state.doc.line(t).from), true;
package/dist/main.js CHANGED
@@ -22,17 +22,17 @@ import { _ as Logger, c as Objects, g as cn, h as Events, i as NOT_SET, l as use
22
22
  import { t as require_react } from "./react-DA-nE2FX.js";
23
23
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
24
24
  import { n as Copy, r as toast, t as copyToClipboard } from "./copy-COam1EG7.js";
25
- import { $ as reducer, B as safeExtractSetUIElementMessageBuffers, Bn as CircleAlert, Bt as DATA_TYPE_ICON, C as AccordionContent, Cn as Root2$1, Ct as Checkbox, Dn as Table2, Dt as PathBuilder, E as BorderAllIcon, En as Trash2, F as base64ToDataView, Fn as Eye, H as getMarimoExportContext, Ht as require_client, It as jotaiJsonStorage, J as getCellNames, Jt as requestClientAtom, K as createActions, Kt as convertStatsName, L as dataViewToBase64, Ln as Database, Mn as Layers, Mt as generateUUID, Nn as Info, On as PaintRoller, Ot as Paths, Pn as FileText, Pt as repl, Q as numColumnsAtom, Rn as Columns2, S as Accordion, Sn as Item$1, St as normalizeName, T as AccordionTrigger, Tt as MarkdownLanguageAdapter, U as hasTrustedExportContext, V as renderHTML, Vn as Braces, W as hasRunAnyCellAtom, X as notebookAtom, Xt as isUninstantiated, Y as hasOnlyOneCellAtom, Yt as useRequestClient, Z as notebookOutline, _n as atomWithStorage, a as useCellFocusActions, an as parseDataset, bt as getValidName, cn as HTMLCellId, ct as initialModeAtom, dn as findCellId, et as useCellActions, f as isOutputEmpty, fn as OBJECT_ID_ATTR, ft as outputIsLoading, gn as atomWithReducer, ht as headingToIdentifier, i as LazyAnyLanguageCodeMirror, in as parseAttrValue, jn as LoaderCircle, jt as DeferredRequestRegistry, k as ChevronDownIcon, lt as kioskModeAtom, mn as jsonParseWithSpecialChar, mt as isErrorMime, n as Spinner, o as useLastFocusedCellId, on as parseInitialValue, p as useExpandedConsoleOutput, pn as RANDOM_ID_ATTR, pt as outputIsStale, qt as getRequestClient, rt as createCell, s as maybeAddAltairImport, st as getInitialAppMode, tn as NotebookScopedLocalStorage, tt as useCellIds, un as UIElementId, vn as selectAtom, w as AccordionItem, wn as Trigger2, wt as customPythonLanguageSupport, xn as Content2, xt as isInternalCellName, zt as PluralWords, __tla as __tla_0 } from "./html-to-image-Di0mtt6O.js";
25
+ import { $ as reducer, B as safeExtractSetUIElementMessageBuffers, Bn as CircleAlert, Bt as DATA_TYPE_ICON, C as AccordionContent, Cn as Root2$1, Ct as Checkbox, Dn as Table2, Dt as PathBuilder, E as BorderAllIcon, En as Trash2, F as base64ToDataView, Fn as Eye, H as getMarimoExportContext, Ht as require_client, It as jotaiJsonStorage, J as getCellNames, Jt as requestClientAtom, K as createActions, Kt as convertStatsName, L as dataViewToBase64, Ln as Database, Mn as Layers, Mt as generateUUID, Nn as Info, On as PaintRoller, Ot as Paths, Pn as FileText, Pt as repl, Q as numColumnsAtom, Rn as Columns2, S as Accordion, Sn as Item$1, St as normalizeName, T as AccordionTrigger, Tt as MarkdownLanguageAdapter, U as hasTrustedExportContext, V as renderHTML, Vn as Braces, W as hasRunAnyCellAtom, X as notebookAtom, Xt as isUninstantiated, Y as hasOnlyOneCellAtom, Yt as useRequestClient, Z as notebookOutline, _n as atomWithStorage, a as useCellFocusActions, an as parseDataset, bt as getValidName, cn as HTMLCellId, ct as initialModeAtom, dn as findCellId, et as useCellActions, f as isOutputEmpty, fn as OBJECT_ID_ATTR, ft as outputIsLoading, gn as atomWithReducer, ht as headingToIdentifier, i as LazyAnyLanguageCodeMirror, in as parseAttrValue, jn as LoaderCircle, jt as DeferredRequestRegistry, k as ChevronDownIcon, lt as kioskModeAtom, mn as jsonParseWithSpecialChar, mt as isErrorMime, n as Spinner, o as useLastFocusedCellId, on as parseInitialValue, p as useExpandedConsoleOutput, pn as RANDOM_ID_ATTR, pt as outputIsStale, qt as getRequestClient, rt as createCell, s as maybeAddAltairImport, st as getInitialAppMode, tn as NotebookScopedLocalStorage, tt as useCellIds, un as UIElementId, vn as selectAtom, w as AccordionItem, wn as Trigger2, wt as customPythonLanguageSupport, xn as Content2, xt as isInternalCellName, zt as PluralWords, __tla as __tla_0 } from "./html-to-image-DXwLcQ6l.js";
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-Bv-XlYiv.js";
29
- import { $ as contextAwarePanelOpen, $t as $fae977aafc393c5c$export$6b862160d295c8e, A as prettifyRowCount, At as SELECT_COLUMN_ID, B as DatePicker, Bt as TabsContent, C as downloadSizeLimitAtom, Ct as DelayMount, D as ErrorState, Dt as loadTableAndRawData, E as EmptyState, Et as getPageIndexForRow, F as ContextMenuSeparator, Ft as Maps, G as CommandEmpty, Gt as ChartLoadingState, H as Combobox, Ht as TabsTrigger, I as ContextMenuTrigger, It as dateToLocalISODate, J as CommandList, Jt as RenderTextWithLinks, K as CommandInput, Kt as LazyVegaEmbed, L as useInternalStateWithSync, Lt as dateToLocalISODateTime, M as ContextMenu, Mt as toFieldTypes, N as ContextMenuContent, Nt as getMimeValues, O as LoadingState, Ot as loadTableData, P as ContextMenuItem, Pt as isNullishFilter, Q as PANEL_TYPES, Qt as $fae977aafc393c5c$export$588937bcd60ade55, R as useSelectList, Rt as dateToLocalISOTime, S as Filenames, St as ColumnChartSpecModel, T as ColumnPreviewContainer, Tt as usePrevious$1, U as ComboboxItem, Ut as ChartErrorState, V as DateRangePicker, Vt as TabsList, W as Command, Wt as ChartInfoState, X as smartMatch, Xt as HtmlOutput, Y as CommandSeparator, Yt as Kbd, Z as ContextAwarePanelItem, Zt as EmotionCacheProvider, _ as ADD_PRINTING_CLASS, _t as NAMELESS_COLUMN_PREFIX, an as Ellipsis, at as Toggle, b as downloadHTMLAsImage, bt as renderCellValue, c as Slide, cn as ChevronsUpDown, d as RadioGroupItem, dn as ChevronsDownUp, dt as Table, en as TextWrap, et as contextAwarePanelOwner, f as JsonOutput, fn as ChevronLeft, ft as TableBody, g as InstallPackageButton, gt as TableRow, h as DataTable, ht as TableHeader, it as slotsController, j as getColumnCountForDisplay, jt as TOO_MANY_ROWS, k as prettifyRowColumnCount, kt as INDEX_COLUMN_NAME, l as Switch, ln as ChevronsRight, lt as Fill, m as OutputRenderer, mt as TableHead, n as marimoVersionAtom, nn as Funnel, nt as isCellAwareAtom, o as SLIDE_TYPE_OPTIONS_BY_VALUE, on as Download, p as OutputArea, pn as ArrowDownWideNarrow, pt as TableCell, q as CommandItem, qt as useOverflowDetection, r as showCodeInRunModeAtom, rn as EyeOff, rt as SlotNames, sn as Code, t as useNotebookCodeAvailable, tn as GripHorizontal, tt as contextAwarePanelType, u as RadioGroup, un as ChevronsLeft, ut as Provider$1, v as downloadBlob, vt as generateColumns, w as ColumnName, wt as useIntersectionObserver, x as Progress, xt as ColumnChartContext, y as downloadByURL, yt as inferFieldTypes, z as CompactChipRow, zt as Tabs, __tla as __tla_2 } from "./code-visibility-BY8oNoME.js";
29
+ import { $ as contextAwarePanelOpen, $t as $fae977aafc393c5c$export$6b862160d295c8e, A as prettifyRowCount, At as SELECT_COLUMN_ID, B as DatePicker, Bt as TabsContent, C as downloadSizeLimitAtom, Ct as DelayMount, D as ErrorState, Dt as loadTableAndRawData, E as EmptyState, Et as getPageIndexForRow, F as ContextMenuSeparator, Ft as Maps, G as CommandEmpty, Gt as ChartLoadingState, H as Combobox, Ht as TabsTrigger, I as ContextMenuTrigger, It as dateToLocalISODate, J as CommandList, Jt as RenderTextWithLinks, K as CommandInput, Kt as LazyVegaEmbed, L as useInternalStateWithSync, Lt as dateToLocalISODateTime, M as ContextMenu, Mt as toFieldTypes, N as ContextMenuContent, Nt as getMimeValues, O as LoadingState, Ot as loadTableData, P as ContextMenuItem, Pt as isNullishFilter, Q as PANEL_TYPES, Qt as $fae977aafc393c5c$export$588937bcd60ade55, R as useSelectList, Rt as dateToLocalISOTime, S as Filenames, St as ColumnChartSpecModel, T as ColumnPreviewContainer, Tt as usePrevious$1, U as ComboboxItem, Ut as ChartErrorState, V as DateRangePicker, Vt as TabsList, W as Command, Wt as ChartInfoState, X as smartMatch, Xt as HtmlOutput, Y as CommandSeparator, Yt as Kbd, Z as ContextAwarePanelItem, Zt as EmotionCacheProvider, _ as ADD_PRINTING_CLASS, _t as NAMELESS_COLUMN_PREFIX, an as Ellipsis, at as Toggle, b as downloadHTMLAsImage, bt as renderCellValue, c as Slide, cn as ChevronsUpDown, d as RadioGroupItem, dn as ChevronsDownUp, dt as Table, en as TextWrap, et as contextAwarePanelOwner, f as JsonOutput, fn as ChevronLeft, ft as TableBody, g as InstallPackageButton, gt as TableRow, h as DataTable, ht as TableHeader, it as slotsController, j as getColumnCountForDisplay, jt as TOO_MANY_ROWS, k as prettifyRowColumnCount, kt as INDEX_COLUMN_NAME, l as Switch, ln as ChevronsRight, lt as Fill, m as OutputRenderer, mt as TableHead, n as marimoVersionAtom, nn as Funnel, nt as isCellAwareAtom, o as SLIDE_TYPE_OPTIONS_BY_VALUE, on as Download, p as OutputArea, pn as ArrowDownWideNarrow, pt as TableCell, q as CommandItem, qt as useOverflowDetection, r as showCodeInRunModeAtom, rn as EyeOff, rt as SlotNames, sn as Code, t as useNotebookCodeAvailable, tn as GripHorizontal, tt as contextAwarePanelType, u as RadioGroup, un as ChevronsLeft, ut as Provider$1, v as downloadBlob, vt as generateColumns, w as ColumnName, wt as useIntersectionObserver, x as Progress, xt as ColumnChartContext, y as downloadByURL, yt as inferFieldTypes, z as CompactChipRow, zt as Tabs, __tla as __tla_2 } from "./code-visibility-02AuLxDs.js";
30
30
  import { c as Calendar, i as createReducerAndAtoms, n as useOnUnmount, o as ToggleLeft, t as useOnMount } from "./useLifecycle-AHlswLw-.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";
33
33
  import { B as $64fa3d84918910a7$export$4d86445c2cf5e3, C as DropdownMenuTrigger, Ft as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, It as $3ef42575df84b30b$export$9d1611c77c2fe928, W as $64fa3d84918910a7$export$df3a06d6289f983e, Wt as $ff5963eb1fccf552$export$e08e3b67e392101e, X as useDebouncedCallback, Y as useDebounceControlledState, a as NumberField, d as roundToFractionDigits, f as DropdownMenu, g as DropdownMenuLabel, gn as ChevronRight, h as DropdownMenuItem, hn as Circle, i as OnBlurredInput, l as prettyNumber, m as DropdownMenuGroup, n as DebouncedNumberInput, o as maxFractionDigitsForSteps, ot as $f7dceffc5ad7768b$export$4e328f61c538687f, p as DropdownMenuContent, pt as $6179b936705e76d3$export$ae780daf29e6d456, r as Input, st as $701a24aa0da5b062$export$ea18c227d4417cc3, t as DebouncedInput, u as prettyScientificNumber, v as DropdownMenuSeparator, xt as $458b0a5536c1a7cf$export$40bfa8c7b0832715, y as DropdownMenuShortcut, z as $64fa3d84918910a7$export$29f1550f4b0d4415 } from "./input-CbEz_aj_.js";
34
34
  import { _ as isWasm, c as asRemoteURL, d as isStaticNotebook, f as appendQueryParams, g as Deferred, m as require_cuid2, u as getStaticVirtualFiles, v as CircleQuestionMark } from "./toDate-D-l5s8nn.js";
35
- import { a as MarimoIncomingMessageEvent, c as MarimoValueUpdateEvent, d as Square, f as File, i as PythonIcon, l as createInputEvent, n as blobToString, o as MarimoValueInputEvent, r as filesToBase64, s as MarimoValueReadyEvent, t as processOutput, u as deserializeBlob } from "./process-output-BLd4KuwX.js";
35
+ import { a as MarimoIncomingMessageEvent, c as MarimoValueUpdateEvent, d as Square, f as File, i as PythonIcon, l as createInputEvent, n as blobToString, o as MarimoValueInputEvent, r as filesToBase64, s as MarimoValueReadyEvent, t as processOutput, u as deserializeBlob } from "./process-output-C6_e1pT_.js";
36
36
  import { n as Trash, r as Pencil, t as BulkEdit } from "./types-C2Ir191_.js";
37
37
  import { n as require_prop_types, r as Plus, t as ErrorBoundary } from "./ErrorBoundary-DE6tzZf-.js";
38
38
  import { t as require_react_dom } from "./react-dom-BTJzcVJ9.js";
@@ -8562,7 +8562,7 @@ let __tla = Promise.all([
8562
8562
  };
8563
8563
  }
8564
8564
  };
8565
- var LazyChatbot = import_react.lazy(() => import("./chat-ui-BEOvjkmJ.js").then((e) => ({
8565
+ var LazyChatbot = import_react.lazy(() => import("./chat-ui-CsPewo4h.js").then((e) => ({
8566
8566
  default: e.Chatbot
8567
8567
  }))), messageSchema = array(object({
8568
8568
  id: string(),
@@ -36221,7 +36221,7 @@ ${c}
36221
36221
  function _temp2$2(e) {
36222
36222
  e.target === e.currentTarget && e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), e.currentTarget.click());
36223
36223
  }
36224
- var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-BR6oU-3V.js"));
36224
+ var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-CX0nM3qj.js"));
36225
36225
  const SlidesLayoutRenderer = ({ layout: e, setLayout: r, cells: c, mode: l }) => {
36226
36226
  var _a3;
36227
36227
  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), [
@@ -1,6 +1,6 @@
1
1
  import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
3
- import { at as parseHtmlContent, it as ansiToPlainText } from "./html-to-image-Di0mtt6O.js";
3
+ import { at as parseHtmlContent, it as ansiToPlainText } from "./html-to-image-DXwLcQ6l.js";
4
4
  import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
5
5
  import { t as Strings } from "./strings-Dq_j3Rxw.js";
6
6
  import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
@@ -6,10 +6,10 @@ import { s as __toESM } from "./chunk-BNovOVIE.js";
6
6
  import { _ as Logger, g as cn, h as Events, l as useEventListener, t as Button } from "./button-BacYv-bE.js";
7
7
  import { t as require_react } from "./react-DA-nE2FX.js";
8
8
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
9
- import { lt as kioskModeAtom } from "./html-to-image-Di0mtt6O.js";
9
+ import { lt as kioskModeAtom } from "./html-to-image-DXwLcQ6l.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 PanelResizeHandle, i as DEFAULT_DECK_TRANSITION, in as Expand, ot as Panel, rn as EyeOff, s as SlideSidebar, sn as Code, st as PanelGroup, t as useNotebookCodeAvailable } from "./code-visibility-BY8oNoME.js";
12
+ import { a as DEFAULT_SLIDE_TYPE, c as Slide, ct as PanelResizeHandle, i as DEFAULT_DECK_TRANSITION, in as Expand, ot as Panel, rn as EyeOff, s as SlideSidebar, sn as Code, st as PanelGroup, t as useNotebookCodeAvailable } from "./code-visibility-02AuLxDs.js";
13
13
  import { X as useDebouncedCallback } from "./input-CbEz_aj_.js";
14
14
  import "./toDate-D-l5s8nn.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.12-dev19",
3
+ "version": "0.23.12-dev20",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -253,6 +253,73 @@ a = 10`;
253
253
  `);
254
254
  });
255
255
 
256
+ test("from-import alias is the binding, not the imported name", async () => {
257
+ const code = `\
258
+ from math import sin as my_sin
259
+ print(my_sin)`;
260
+ view = createEditor(code);
261
+ const usagePosition = code.lastIndexOf("my_sin");
262
+ const result = goToVariableDefinition(view, "my_sin", usagePosition);
263
+
264
+ expect(result).toBe(true);
265
+ await tick();
266
+ // The alias `my_sin` (after `as`) is the real binding.
267
+ expect(renderEditorView(view)).toMatchInlineSnapshot(`
268
+ "
269
+ from math import sin as my_sin
270
+ ^
271
+ print(my_sin)
272
+ "
273
+ `);
274
+ });
275
+
276
+ test("module path in from-import is not a local definition", async () => {
277
+ const code = `\
278
+ from math import sin
279
+ print(math)`;
280
+ view = createEditor(code);
281
+ const usagePosition = code.lastIndexOf("math");
282
+ // `math` is a module reference in the from-clause, not a binding in this
283
+ // cell, so the scoped resolver should return false and let the caller fall
284
+ // through to cross-cell resolution.
285
+ const result = goToVariableDefinition(view, "math", usagePosition);
286
+
287
+ expect(result).toBe(false);
288
+ expect(view.state.selection.main.head).toBe(0);
289
+ });
290
+
291
+ test("imported name without `as` is a local definition", async () => {
292
+ const code = `\
293
+ from math import sin
294
+ print(sin)`;
295
+ view = createEditor(code);
296
+ const usagePosition = code.lastIndexOf("sin");
297
+ const result = goToVariableDefinition(view, "sin", usagePosition);
298
+
299
+ expect(result).toBe(true);
300
+ await tick();
301
+ expect(renderEditorView(view)).toMatchInlineSnapshot(`
302
+ "
303
+ from math import sin
304
+ ^
305
+ print(sin)
306
+ "
307
+ `);
308
+ });
309
+
310
+ test("imported name shadowed by `as` is not a binding", async () => {
311
+ const code = `\
312
+ from math import sin as my_sin
313
+ print(sin)`;
314
+ view = createEditor(code);
315
+ const usagePosition = code.lastIndexOf("sin");
316
+ // `sin` here refers to nothing in this cell (it was renamed to `my_sin`),
317
+ // so the scoped resolver should return false.
318
+ const result = goToVariableDefinition(view, "sin", usagePosition);
319
+
320
+ expect(result).toBe(false);
321
+ });
322
+
256
323
  test("selects outer-scope function declaration", async () => {
257
324
  view = createEditor(`\
258
325
  def x():
@@ -133,4 +133,51 @@ output = _x + 10`;
133
133
  await tick();
134
134
  expect(view.state.selection.main.head).toBe(code.indexOf("_x = 10"));
135
135
  });
136
+
137
+ test("falls through to cross-cell when in-cell occurrence is only a module path in a from-import", async () => {
138
+ // Regression: ImportStatement used to register every VariableName child
139
+ // (the module path and pre-`as` names) as in-cell declarations, so the
140
+ // local-first short-circuit would steal F12 from cross-cell resolution.
141
+ const moduleCell = cellId("module-cell");
142
+ const usageCell = cellId("usage-cell");
143
+ const moduleCode = `mymodule = 100`;
144
+ const usageCode = `\
145
+ from mymodule import something
146
+ print(mymodule)`;
147
+
148
+ const moduleView = createEditor(moduleCode, moduleCode.length);
149
+ const usageView = createEditor(
150
+ usageCode,
151
+ usageCode.lastIndexOf("mymodule"),
152
+ );
153
+ views.push(moduleView, usageView);
154
+
155
+ const notebook = initialNotebookState();
156
+ notebook.cellHandles[moduleCell] = {
157
+ current: { editorView: moduleView, editorViewOrNull: moduleView },
158
+ } as never;
159
+ notebook.cellHandles[usageCell] = {
160
+ current: { editorView: usageView, editorViewOrNull: usageView },
161
+ } as never;
162
+
163
+ store.set(notebookAtom, notebook);
164
+ store.set(variablesAtom, {
165
+ [variableName("mymodule")]: {
166
+ dataType: "int",
167
+ declaredBy: [moduleCell],
168
+ name: variableName("mymodule"),
169
+ usedBy: [usageCell],
170
+ value: "100",
171
+ },
172
+ });
173
+
174
+ const result = goToDefinitionAtCursorPosition(usageView);
175
+
176
+ expect(result).toBe(true);
177
+ await tick();
178
+ // Cross-cell jump: moduleView's cursor should land on `mymodule = 100`.
179
+ expect(moduleView.state.selection.main.head).toBe(
180
+ moduleCode.indexOf("mymodule"),
181
+ );
182
+ });
136
183
  });
@@ -307,33 +307,52 @@ function collectMatchingDeclarations(
307
307
  break;
308
308
  }
309
309
  case "ImportStatement": {
310
+ // The grammar emits one ImportStatement for both `import x [as y]` and
311
+ // `from m import x [as y], ...`. Direct children include the keywords
312
+ // (`from`/`import`/`as`), commas, dots, and every VariableName from the
313
+ // module path AND the import list. We only want the names that actually
314
+ // bind in the current scope: the post-`as` alias if present, otherwise
315
+ // the imported name itself. Names before `import` (the from-path) and
316
+ // the original name when an alias follows it are NOT bindings.
310
317
  const subCursor = node.cursor();
311
318
  subCursor.firstChild();
312
- do {
313
- if (
314
- subCursor.name === "VariableName" &&
315
- state.doc.sliceString(subCursor.from, subCursor.to) === variableName
316
- ) {
317
- addDeclaration(declarations, currentScope, subCursor.from);
319
+ let pastImport = false;
320
+ // Buffer the most recent post-`import` VariableName so we can defer
321
+ // committing it until we know whether `as` follows.
322
+ let pending: { from: number; matches: boolean } | null = null;
323
+ const commit = () => {
324
+ if (pending?.matches) {
325
+ addDeclaration(declarations, currentScope, pending.from);
318
326
  }
319
- } while (subCursor.nextSibling());
320
- break;
321
- }
322
- case "ImportFromStatement": {
323
- const subCursor = node.cursor();
324
- subCursor.firstChild();
325
- let foundImport = false;
327
+ pending = null;
328
+ };
326
329
  do {
327
330
  if (subCursor.name === "import") {
328
- foundImport = true;
329
- } else if (
330
- foundImport &&
331
- subCursor.name === "VariableName" &&
332
- state.doc.sliceString(subCursor.from, subCursor.to) === variableName
333
- ) {
334
- addDeclaration(declarations, currentScope, subCursor.from);
331
+ pastImport = true;
332
+ continue;
333
+ }
334
+ if (!pastImport) {
335
+ continue;
336
+ }
337
+ if (subCursor.name === "as") {
338
+ // Next VariableName is the alias and replaces `pending`.
339
+ pending = null;
340
+ continue;
341
+ }
342
+ if (subCursor.name === "VariableName") {
343
+ // Flush any previous pending name (no `as` followed it).
344
+ commit();
345
+ pending = {
346
+ from: subCursor.from,
347
+ matches:
348
+ state.doc.sliceString(subCursor.from, subCursor.to) ===
349
+ variableName,
350
+ };
351
+ } else if (subCursor.name === ",") {
352
+ commit();
335
353
  }
336
354
  } while (subCursor.nextSibling());
355
+ commit();
337
356
  break;
338
357
  }
339
358
  case "TryStatement":
@@ -410,23 +429,21 @@ function findScopedDefinitionPosition(
410
429
  * @param view The editor view which contains the variable name.
411
430
  * @param variableName The name of the variable to select, if found in the editor.
412
431
  * @param usagePosition The position of the variable usage, if available.
413
- * @param fallbackToFirstMatch Whether to fall back to the first matching
414
- * variable name when no scoped definition is found. Defaults to true.
415
432
  */
416
433
  export function goToVariableDefinition(
417
434
  view: EditorView,
418
435
  variableName: string,
419
436
  usagePosition?: number,
420
- fallbackToFirstMatch = true,
421
437
  ): boolean {
422
438
  const { state } = view;
423
- let from: number | null = null;
424
- if (usagePosition !== undefined) {
425
- from = findScopedDefinitionPosition(state, variableName, usagePosition);
426
- }
427
- if (from === null && fallbackToFirstMatch) {
428
- from = findFirstMatchingVariable(state, variableName);
429
- }
439
+ // When the caller knows the usage position, trust the scoped lookup. Falling
440
+ // back to first-match would defeat the local-vs-cross-cell decision in
441
+ // goToDefinition: if the symbol only appears as a module path in an import,
442
+ // scoped resolution returns null and we want the caller to try other cells.
443
+ const from =
444
+ usagePosition !== undefined
445
+ ? findScopedDefinitionPosition(state, variableName, usagePosition)
446
+ : findFirstMatchingVariable(state, variableName);
430
447
 
431
448
  if (from === null) {
432
449
  return false;
@@ -82,7 +82,6 @@ export function goToDefinition(
82
82
  view,
83
83
  variableName,
84
84
  usagePosition,
85
- false,
86
85
  );
87
86
  if (foundLocally) {
88
87
  return true;
@@ -640,6 +640,60 @@ def run(polars):
640
640
  `);
641
641
  });
642
642
 
643
+ test("set comprehension target shadows outer global", () => {
644
+ // Regression: SCOPE_CREATING_NODES used "SetComprehension" instead of the
645
+ // grammar's "SetComprehensionExpression", so set comprehensions never
646
+ // created a scope and their for-target was treated as reactive.
647
+ expect(runHighlight(["x"], "result = {x for x in range(5)}"))
648
+ .toMatchInlineSnapshot(`
649
+ "
650
+ result = {x for x in range(5)}
651
+ "
652
+ `);
653
+ });
654
+
655
+ test("from-import module path stays reactive", () => {
656
+ // Regression: ImportStatement collected every VariableName child, so the
657
+ // module name in `from m import y` was wrongly treated as a local binding.
658
+ expect(
659
+ runHighlight(
660
+ ["math"],
661
+ `
662
+ def f():
663
+ from math import sin as my_sin
664
+ return math + my_sin(1)`,
665
+ ),
666
+ ).toMatchInlineSnapshot(`
667
+ "
668
+ def f():
669
+ from math import sin as my_sin
670
+ return math + my_sin(1)
671
+ ^^^^
672
+ "
673
+ `);
674
+ });
675
+
676
+ test("from-import: aliased imported name is not a binding", () => {
677
+ // Regression: `sin` in `from math import sin as my_sin` was incorrectly
678
+ // registered as a local binding, hiding genuine reactive uses of `sin`.
679
+ expect(
680
+ runHighlight(
681
+ ["sin"],
682
+ `
683
+ def f():
684
+ from math import sin as my_sin
685
+ return sin + my_sin(1)`,
686
+ ),
687
+ ).toMatchInlineSnapshot(`
688
+ "
689
+ def f():
690
+ from math import sin as my_sin
691
+ return sin + my_sin(1)
692
+ ^^^
693
+ "
694
+ `);
695
+ });
696
+
643
697
  test("lambda inside function with outer global", () => {
644
698
  expect(
645
699
  runHighlight(
@@ -16,7 +16,7 @@ const SCOPE_CREATING_NODES = new Set([
16
16
  "FunctionDefinition",
17
17
  "LambdaExpression",
18
18
  "ArrayComprehensionExpression",
19
- "SetComprehension",
19
+ "SetComprehensionExpression",
20
20
  "DictionaryComprehensionExpression",
21
21
  "ComprehensionExpression",
22
22
  "ClassDefinition",
@@ -152,7 +152,7 @@ export function findReactiveVariables(options: {
152
152
  }
153
153
  case "ArrayComprehensionExpression":
154
154
  case "DictionaryComprehensionExpression":
155
- case "SetComprehension":
155
+ case "SetComprehensionExpression":
156
156
  case "ComprehensionExpression": {
157
157
  // Domprehension variables - look for VariableName or TupleExpression after 'for'
158
158
  const subCursor = node.cursor();
@@ -276,49 +276,52 @@ export function findReactiveVariables(options: {
276
276
  break;
277
277
  }
278
278
  case "ImportStatement": {
279
- // Handle import x
279
+ // The grammar emits a single ImportStatement for both `import x [as y]`
280
+ // and `from m import x [as y], ...`. Direct children mix keywords,
281
+ // module-path names (before `import`), imported names, and aliases.
282
+ // Only post-`import` names that aren't shadowed by a following `as`
283
+ // (and the alias itself when `as` is present) bind in the current
284
+ // scope.
280
285
  const subCursor = node.cursor();
281
286
  subCursor.firstChild();
282
- do {
283
- if (subCursor.name === "VariableName") {
284
- const varName = options.state.doc.sliceString(
285
- subCursor.from,
286
- subCursor.to,
287
- );
288
-
289
- const currentScope =
290
- currentScopeStack[currentScopeStack.length - 1] ?? -1;
291
- if (!allDeclarations.has(currentScope)) {
292
- allDeclarations.set(currentScope, new Set());
293
- }
294
- allDeclarations.get(currentScope)?.add(varName);
287
+ const currentScope =
288
+ currentScopeStack[currentScopeStack.length - 1] ?? -1;
289
+ if (!allDeclarations.has(currentScope)) {
290
+ allDeclarations.set(currentScope, new Set());
291
+ }
292
+ const scope = allDeclarations.get(currentScope);
293
+ let pastImport = false;
294
+ let pending: string | null = null;
295
+ const commit = () => {
296
+ if (pending !== null) {
297
+ scope?.add(pending);
295
298
  }
296
- } while (subCursor.nextSibling());
297
-
298
- break;
299
- }
300
- case "ImportFromStatement": {
301
- // Handle from x import y as z
302
- const subCursor = node.cursor();
303
- subCursor.firstChild();
304
- let foundImport = false;
299
+ pending = null;
300
+ };
305
301
  do {
306
302
  if (subCursor.name === "import") {
307
- foundImport = true;
308
- } else if (foundImport && subCursor.name === "VariableName") {
309
- const varName = options.state.doc.sliceString(
303
+ pastImport = true;
304
+ continue;
305
+ }
306
+ if (!pastImport) {
307
+ continue;
308
+ }
309
+ if (subCursor.name === "as") {
310
+ // Drop the imported name; the next VariableName is the alias.
311
+ pending = null;
312
+ continue;
313
+ }
314
+ if (subCursor.name === "VariableName") {
315
+ commit();
316
+ pending = options.state.doc.sliceString(
310
317
  subCursor.from,
311
318
  subCursor.to,
312
319
  );
313
- // Add to the current innermost scope
314
- const currentScope =
315
- currentScopeStack[currentScopeStack.length - 1] ?? -1;
316
- if (!allDeclarations.has(currentScope)) {
317
- allDeclarations.set(currentScope, new Set());
318
- }
319
- allDeclarations.get(currentScope)?.add(varName);
320
+ } else if (subCursor.name === ",") {
321
+ commit();
320
322
  }
321
323
  } while (subCursor.nextSibling());
324
+ commit();
322
325
 
323
326
  break;
324
327
  }
@@ -424,6 +427,12 @@ export function findReactiveVariables(options: {
424
427
  const nodeName = cursor.name;
425
428
  const nodeStart = cursor.from;
426
429
 
430
+ // Names inside an import statement are module paths, imported names, or
431
+ // aliases — none of them are reactive *uses* of an outer-cell global.
432
+ if (nodeName === "ImportStatement") {
433
+ return;
434
+ }
435
+
427
436
  const isNewScope = SCOPE_CREATING_NODES.has(nodeName);
428
437
 
429
438
  let currentScopeStack = scopeStack;