@marimo-team/islands 0.22.5-dev19 → 0.22.5-dev22

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.
@@ -5,12 +5,12 @@ import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
5
5
  import { t as require_react } from "./react-Bs6Z0kvn.js";
6
6
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
7
7
  import { r as toast } from "./copy-BRF7ryOP.js";
8
- import { $t as singleFacet, A as MarimoIncomingMessageEvent, Bt as PluralWord, C as contextToXml, D as AccordionContent, E as Accordion, Fn as Info, Gt as allTablesAtom, I as ChatBubbleIcon, In as File$1, Kt as dataSourceConnectionsAtom, Nn as LoaderCircle, O as AccordionItem, On as Wrench, Ot as createVariableInfoElement, Q as cellErrorsAtom, Rt as jotaiJsonStorage, S as Sections, Sn as Anchor2, T as AIContextRegistry, U as deserializeBlob, Vn as CircleX, W as base64ToDataURL, Yt as getRequestClient, Z as renderHTML, a as toPng, bn as atomWithStorage, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, in as ZodLocalStorage, jt as moveToEndOfEditor, k as AccordionTrigger, kn as Trash2, ln as CellOutputId, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as getTableType, t as processOutput, w as AIContextProvider, x as Boosts, xt as displayCellName, y as DatasourceContextProvider, zt as variablesAtom } from "./process-output-Dw_U2LSR.js";
8
+ import { $t as singleFacet, A as MarimoIncomingMessageEvent, Bt as PluralWord, C as contextToXml, D as AccordionContent, E as Accordion, Fn as Info, Gt as allTablesAtom, I as ChatBubbleIcon, In as File$1, Kt as dataSourceConnectionsAtom, Nn as LoaderCircle, O as AccordionItem, On as Wrench, Ot as createVariableInfoElement, Q as cellErrorsAtom, Rt as jotaiJsonStorage, S as Sections, Sn as Anchor2, T as AIContextRegistry, U as deserializeBlob, Vn as CircleX, W as base64ToDataURL, Yt as getRequestClient, Z as renderHTML, a as toPng, bn as atomWithStorage, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, in as ZodLocalStorage, jt as moveToEndOfEditor, k as AccordionTrigger, kn as Trash2, ln as CellOutputId, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as getTableType, t as processOutput, w as AIContextProvider, x as Boosts, xt as displayCellName, y as DatasourceContextProvider, zt as variablesAtom } from "./process-output-CefHb9q-.js";
9
9
  import "./chunk-5FQGJX7Z-C428iZBW.js";
10
10
  import { u as createLucideIcon } from "./dist-D56NKWim.js";
11
11
  import { C as logNever, I as X, n as Strings, t as Label } from "./label-CIR53v8V.js";
12
12
  import { a as NumberField, b as DropdownMenuTrigger, d as DropdownMenuContent, p as DropdownMenuItem, r as Input, u as DropdownMenu } from "./input-SSWXiS6n.js";
13
- import { g as CircleQuestionMark } from "./toDate-D1_ZulwM.js";
13
+ import { g as CircleQuestionMark } from "./toDate-D0QaHNwR.js";
14
14
  import { c as Objects, g as Logger, l as useEventListener, t as Button, y as cn } from "./button-DNlNlZY_.js";
15
15
  import "./react-dom-BSUuJjCR.js";
16
16
  import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
package/dist/main.js CHANGED
@@ -21,7 +21,7 @@ import { a as __toCommonJS, n as __esmMin, r as __export, s as __toESM, t as __c
21
21
  import { t as require_react } from "./react-Bs6Z0kvn.js";
22
22
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
23
23
  import { n as Copy, r as toast, t as copyToClipboard } from "./copy-BRF7ryOP.js";
24
- import { $ as createActions, A as MarimoIncomingMessageEvent, An as Table2, At as Paths, B as DotFilledIcon, Bn as Columns2, Bt as PluralWord, Cn as Close$1, Ct as isInternalCellName, D as AccordionContent, Dn as Trigger2, Dt as MarkdownLanguageAdapter, E as Accordion, En as Root2$4, Et as customPythonLanguageSupport, F as BorderAllIcon, Fn as Info, Ft as useChromeActions, G as base64ToDataView, Gn as import_lib, H as PinRightIcon, Hn as CircleAlert, Ht as DATA_TYPE_ICON, In as File, It as repl, J as extractBase64FromDataURL, Jt as convertStatsName, K as base64ToUint8Array, L as CheckIcon, Ln as FileText, Lt as adaptForLocalStorage, M as MarimoValueReadyEvent, Mn as NotebookPen, Mt as goToCellLine, N as MarimoValueUpdateEvent, Nn as LoaderCircle, Nt as DeferredRequestRegistry, O as AccordionItem, On as Wrench, P as createInputEvent, Pn as Layers, Pt as generateUUID, Qt as isUninstantiated, R as ChevronDownIcon, Rn as Eye, Rt as jotaiJsonStorage, St as getValidName, Tn as Item$1, Tt as Checkbox, U as deserializeBlob, Un as Braces, Ut as getDataTypeColor, V as PinLeftIcon, Vn as CircleX, Vt as PluralWords, Wn as esm_default$1, Wt as require_client, X as safeExtractSetUIElementMessageBuffers, Xt as requestClientAtom, Y as isDataURLString, Yt as getRequestClient, Z as renderHTML, Zt as useRequestClient, _ as useExpandedConsoleOutput, _n as jsonToMarkdown, _t as headingToIdentifier, a as toPng, an as filenameAtom, at as useCellActions, b as getDatasourceContext, bn as atomWithStorage, bt as getCellDomProps, c as useCellFocusActions, cn as parseInitialValue, ct as createCell, d as Spinner, dn as SCRATCH_CELL_ID, dt as initialModeAtom, en as elementContainsMarimoCellFile, et as getCellEditorView, f as Popover$1, fn as UIElementId, ft as kioskModeAtom, g as isOutputEmpty, gn as jsonParseWithSpecialChar, gt as isErrorMime, h as PopoverTrigger, hn as RANDOM_ID_ATTR, ht as outputIsStale, i as PythonIcon, it as reducer, j as MarimoValueInputEvent, jn as PaintRoller, k as AccordionTrigger, kn as Trash2, kt as PathBuilder, l as useLastFocusedCellId, ln as CellOutputId, lt as AnsiUp, m as PopoverContent, mn as OBJECT_ID_ATTR, mt as outputIsLoading, n as blobToString, nn as getTracebackInfo, nt as notebookAtom, o as MarkdownRenderer, on as parseAttrValue, ot as useCellIds, p as PopoverClose$1, pn as findCellId, pt as viewStateAtom, q as dataViewToBase64, r as filesToBase64, rn as NotebookScopedLocalStorage, rt as notebookOutline, s as LazyAnyLanguageCodeMirror, sn as parseDataset, st as useCellNames, t as processOutput, tn as extractAllTracebackInfo, tt as getCellNames, u as maybeAddAltairImport, un as HTMLCellId, ut as getInitialAppMode, v as useExpandedOutput, vn as jsonToTSV, vt as sanitizeHtml, wn as Content2$1, wt as normalizeName, xn as selectAtom, xt as displayCellName, yn as atomWithReducer, yt as DATA_CELL_ID, z as ChevronRightIcon, zn as Database, __tla as __tla_0 } from "./process-output-Dw_U2LSR.js";
24
+ import { $ as createActions, A as MarimoIncomingMessageEvent, An as Table2, At as Paths, B as DotFilledIcon, Bn as Columns2, Bt as PluralWord, Cn as Close$1, Ct as isInternalCellName, D as AccordionContent, Dn as Trigger2, Dt as MarkdownLanguageAdapter, E as Accordion, En as Root2$4, Et as customPythonLanguageSupport, F as BorderAllIcon, Fn as Info, Ft as useChromeActions, G as base64ToDataView, Gn as import_lib, H as PinRightIcon, Hn as CircleAlert, Ht as DATA_TYPE_ICON, In as File, It as repl, J as extractBase64FromDataURL, Jt as convertStatsName, K as base64ToUint8Array, L as CheckIcon, Ln as FileText, Lt as adaptForLocalStorage, M as MarimoValueReadyEvent, Mn as NotebookPen, Mt as goToCellLine, N as MarimoValueUpdateEvent, Nn as LoaderCircle, Nt as DeferredRequestRegistry, O as AccordionItem, On as Wrench, P as createInputEvent, Pn as Layers, Pt as generateUUID, Qt as isUninstantiated, R as ChevronDownIcon, Rn as Eye, Rt as jotaiJsonStorage, St as getValidName, Tn as Item$1, Tt as Checkbox, U as deserializeBlob, Un as Braces, Ut as getDataTypeColor, V as PinLeftIcon, Vn as CircleX, Vt as PluralWords, Wn as esm_default$1, Wt as require_client, X as safeExtractSetUIElementMessageBuffers, Xt as requestClientAtom, Y as isDataURLString, Yt as getRequestClient, Z as renderHTML, Zt as useRequestClient, _ as useExpandedConsoleOutput, _n as jsonToMarkdown, _t as headingToIdentifier, a as toPng, an as filenameAtom, at as useCellActions, b as getDatasourceContext, bn as atomWithStorage, bt as getCellDomProps, c as useCellFocusActions, cn as parseInitialValue, ct as createCell, d as Spinner, dn as SCRATCH_CELL_ID, dt as initialModeAtom, en as elementContainsMarimoCellFile, et as getCellEditorView, f as Popover$1, fn as UIElementId, ft as kioskModeAtom, g as isOutputEmpty, gn as jsonParseWithSpecialChar, gt as isErrorMime, h as PopoverTrigger, hn as RANDOM_ID_ATTR, ht as outputIsStale, i as PythonIcon, it as reducer, j as MarimoValueInputEvent, jn as PaintRoller, k as AccordionTrigger, kn as Trash2, kt as PathBuilder, l as useLastFocusedCellId, ln as CellOutputId, lt as AnsiUp, m as PopoverContent, mn as OBJECT_ID_ATTR, mt as outputIsLoading, n as blobToString, nn as getTracebackInfo, nt as notebookAtom, o as MarkdownRenderer, on as parseAttrValue, ot as useCellIds, p as PopoverClose$1, pn as findCellId, pt as viewStateAtom, q as dataViewToBase64, r as filesToBase64, rn as NotebookScopedLocalStorage, rt as notebookOutline, s as LazyAnyLanguageCodeMirror, sn as parseDataset, st as useCellNames, t as processOutput, tn as extractAllTracebackInfo, tt as getCellNames, u as maybeAddAltairImport, un as HTMLCellId, ut as getInitialAppMode, v as useExpandedOutput, vn as jsonToTSV, vt as sanitizeHtml, wn as Content2$1, wt as normalizeName, xn as selectAtom, xt as displayCellName, yn as atomWithReducer, yt as DATA_CELL_ID, z as ChevronRightIcon, zn as Database, __tla as __tla_0 } from "./process-output-CefHb9q-.js";
25
25
  import { __tla as __tla_1 } from "./chunk-5FQGJX7Z-C428iZBW.js";
26
26
  import { o as useSize, s as Root$4, u as createLucideIcon } from "./dist-D56NKWim.js";
27
27
  import { A as $896ba0a80a8f4d36$export$85fd5fdf27bacc79, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE_DESCRIPTIONS, E as EMPTY_VALUE$1, F as ListFilter, I as ChartPie, L as ChartColumn, M as $5a387cc49350e6db$export$722debc0e56fea39, N as Table$1, O as TIME_UNIT_DESCRIPTIONS, P as SquareFunction, 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 $fb18d541ea1ad717$export$ad991b66133851cf, 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-ByDEU1T3.js";
@@ -29,7 +29,7 @@ import { c as Calendar, i as createReducerAndAtoms, n as useOnUnmount, o as Togg
29
29
  import { t as Check } from "./check-Cex3x9fD.js";
30
30
  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$3, N as usePrevious$1, O as $b5e257d569688ac6$export$535bd6ca7f90a273, P as useDirection, R as ChevronDown, S as assertNever, T as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5, _ as menuControlVariants, a as SelectContent, b as menuSeparatorVariants, c as SelectLabel, d as SelectValue, f as NativeSelect, g as menuControlCheckVariants, h as menuContentCommon, i as Select, j as Trigger$3, l as SelectSeparator, m as MENU_ITEM_DISABLED, n as Strings, o as SelectGroup, p as selectStyles, r as capitalize, s as SelectItem, t as Label, u as SelectTrigger, v as menuItemVariants, w as $a916eb452884faea$export$b7a616150fdb9f44, x as menuSubTriggerVariants, y as menuLabelVariants } from "./label-CIR53v8V.js";
31
31
  import { $ as $e5be200c675c3b3a$export$aca958c65c314e6c, $t as Portal, A as $d2b4bc8c273e7be6$export$24d547caef80ccd1, At as $c87311424ea30a05$export$fedb369cb70207f1, B as $64fa3d84918910a7$export$c62b8e45d58ddad9, Bt as $431fbd86ca7dc216$export$f21a1ffae260145a, C as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4, Ct as $8ae05eaa5c114e9c$export$7f54fc3180508a52, D as $ee014567cb39d3f0$export$ff05c3ac10437e03, Dt as $c87311424ea30a05$export$78551043582a6a98, E as $ee014567cb39d3f0$export$f551688fc98f2e09, Et as $c87311424ea30a05$export$6446a186d09e379e, F as $64fa3d84918910a7$export$2881499e37b75b9a, Ft as $d4ee10de306f2510$export$b4f377a2b6254582, G as marked, Gt as Anchor2, H as $64fa3d84918910a7$export$ef03459518577ad4, Ht as $bdb11010cef70236$export$b4cc09c592e8fdb8, I as $64fa3d84918910a7$export$29f1550f4b0d4415, It as $d4ee10de306f2510$export$cd4e5573fbe2b576, J as $d2e8511e6f209edf$export$e908e06f4b8e3402, Jt as Content2$2, K as useDebounceControlledState, Kt as Arrow2, L as $64fa3d84918910a7$export$4d86445c2cf5e3, Lt as $d4ee10de306f2510$export$e58f029f0fbfdb29, M as $01b77f81d0f07f68$export$75b6ee27786ba447, Mt as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, N as $01b77f81d0f07f68$export$b04be29aa201d4f5, Nt as $3ef42575df84b30b$export$9d1611c77c2fe928, O as $514c0188e459b4c0$export$5f1af8db9871e1d6, Ot as $c87311424ea30a05$export$9ac100e40613ea10, P as $f39a9eba43920ace$export$b5d7cc18bb8d2b59, Pt as $d4ee10de306f2510$export$4282f70798064fe0, Q as $e5be200c675c3b3a$export$a763b9476acd3eb, Qt as Label$2, R as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, Rt as $f4e2df6bd15f8569$export$98658e8c59125e6a, S as $3985021b0ad6602f$export$f5b8910cec6cf069, St as $e9faafb641e167db$export$90fc3a17d93f704c, T as $d3e0e05bdfcf66bd$export$c24727297075ec6a, Tt as $313b98861ee5dd6c$export$d6875122194c7b44, U as $64fa3d84918910a7$export$fabf2dc03a41866e, Ut as $bdb11010cef70236$export$f680877a34711e37, V as $64fa3d84918910a7$export$df3a06d6289f983e, Vt as $ff5963eb1fccf552$export$e08e3b67e392101e, Wt as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, X as $e93e671b31057976$export$b8473d3665f3a75a, Xt as Item2$2, Y as $2baaea4c71418dea$export$294aa081a6c6f55d, Yt as Group$1, Z as $e5be200c675c3b3a$export$75ee7c75d68f5b0e, Zt as ItemIndicator, _ as DropdownMenuSub, _t as $9446cca9a3875146$export$7d15b64cf5a3a4c4, a as NumberField, an as SubContent, at as $6c7bd7858deea686$export$cd11ab140839f11d, b as DropdownMenuTrigger, bt as $b4b717babfbb907b$export$bebd5a1431fec25d, c as prettyNumber, cn as Item$2, ct as $6db58dc88e78b024$export$2f817fcdc4b89ae0, d as DropdownMenuContent, dn as Search, dt as $9ab94262bd0047c7$export$420e68273165f4ec, en as RadioGroup$2, et as $e5be200c675c3b3a$export$dad6ae84456c676a, f as DropdownMenuGroup, fn as Circle, ft as $3ad3f6e1647bc98d$export$80f3e147d781571c, g as DropdownMenuSeparator, gt as $ae1eeba8b9eafd08$export$5165eccb35aaadb5, h as DropdownMenuPortal, ht as _class_private_field_init, i as OnBlurredInput, in as Sub, it as $701a24aa0da5b062$export$ea18c227d4417cc3, j as $d2b4bc8c273e7be6$export$353f5b6fc5456de1, jt as $7215afc6de606d6b$export$de79e2c695e052f3, k as $514c0188e459b4c0$export$9afb8bc826b033ea, kt as $c87311424ea30a05$export$a11b0059900ceec8, l as prettyScientificNumber, ln as Root$5, lt as $5b160d28a433310d$export$c17fa47878dc55b6, m as DropdownMenuLabel, mt as $f6c31cce2adf654f$export$45712eceda6fad21, n as DebouncedNumberInput, nn as Root3, nt as $319e236875307eab$export$a9b970dcc4ae71a9, o as maxFractionalDigits, on as SubTrigger, ot as $fca6afa0e843324b$export$87b761675e8eaa10, p as DropdownMenuItem, pn as ChevronRight, pt as $507fabe10e71c6fb$export$630ff653c5ada6a9, q as useDebouncedCallback, qt as CheckboxItem, r as Input, rn as Separator, rt as $f7dceffc5ad7768b$export$4e328f61c538687f, s as prettyEngineeringNumber, sn as createMenuScope, st as $fca6afa0e843324b$export$f12b703ca79dfbb1, t as DebouncedInput, tn as RadioItem, tt as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, u as DropdownMenu, un as createRovingFocusGroupScope, ut as $6179b936705e76d3$export$ae780daf29e6d456, v as DropdownMenuSubContent, vt as $458b0a5536c1a7cf$export$40bfa8c7b0832715, w as $a049562f99e7db0e$export$f9c6924e160136d1, wt as $df56164dff5785e2$export$4338b53315abf666, x as $3985021b0ad6602f$export$37fb8590cf2c088c, xt as $99facab73266f662$export$5add1d006293d136, y as DropdownMenuSubTrigger, yt as $b4b717babfbb907b$export$4c063cf1350e6fed, z as $64fa3d84918910a7$export$c245e6201fed2f75, zt as $431fbd86ca7dc216$export$b204af158042fbac } from "./input-SSWXiS6n.js";
32
- import { a as millisecondsInMinute, c as asRemoteURL, d as isUrl, f as require_cuid2, g as CircleQuestionMark, h as isWasm, i as millisecondsInHour, m as Deferred, n as constructFrom, o as millisecondsInSecond, r as millisecondsInDay, s as millisecondsInWeek, t as toDate, u as appendQueryParams } from "./toDate-D1_ZulwM.js";
32
+ import { a as millisecondsInMinute, c as asRemoteURL, d as isUrl, f as require_cuid2, g as CircleQuestionMark, h as isWasm, i as millisecondsInHour, m as Deferred, n as constructFrom, o as millisecondsInSecond, r as millisecondsInDay, s as millisecondsInWeek, t as toDate, u as appendQueryParams } from "./toDate-D0QaHNwR.js";
33
33
  import { a as Plus, i as Trash, n as ErrorBoundary, o as Pencil, r as require_prop_types, t as BulkEdit } from "./types-D4-TD_m0.js";
34
34
  import { n as clsx_default } from "./clsx-yW_RAw0K.js";
35
35
  import { _ as Functions, c as Objects, g as Logger, h as Events, i as NOT_SET, l as useEventListener, m as useComposedRefs, n as buttonVariants, o as isPlatformMac, p as composeRefs, r as cva, t as Button, u as Slot$1, v as throwNotImplemented, y as cn } from "./button-DNlNlZY_.js";
@@ -56,7 +56,7 @@ import "./dist-Ci0CXEFt.js";
56
56
  import "./dist-DJ9F1eHs.js";
57
57
  import { a as parser, r as python } from "./dist-DAfcmt-d.js";
58
58
  import "./purify.es-hTCfRGdl.js";
59
- import { a as AlertTitle, i as AlertDescription, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-BvvMxigY.js";
59
+ import { a as AlertTitle, i as AlertDescription, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-CkSq3l3_.js";
60
60
  import { n as memoize$1, t as isPropValid } from "./emotion-is-prop-valid.esm-CJVjyntJ.js";
61
61
  import { n as formats } from "./vega-loader.browser-DqEcFOPD.js";
62
62
  import { a as getContainerWidth, n as vegaLoadData, o as getVegaFieldTypes, r as createBatchedLoader, s as tooltipHandler, t as parseCsvData } from "./loader-Bd1kgLn7.js";
@@ -37125,7 +37125,7 @@ ${E}`,
37125
37125
  };
37126
37126
  }
37127
37127
  };
37128
- var LazyChatbot = import_react.lazy(() => import("./chat-ui-YuHt7jfw.js").then((e) => ({
37128
+ var LazyChatbot = import_react.lazy(() => import("./chat-ui-C-3Lg9w8.js").then((e) => ({
37129
37129
  default: e.Chatbot
37130
37130
  }))), messageSchema = array(object({
37131
37131
  id: string(),
@@ -58611,7 +58611,7 @@ ${c}
58611
58611
  return true;
58612
58612
  }
58613
58613
  }
58614
- var LazyVegaComponent = import_react.lazy(() => import("./vega-component-DCmC_rsk.js")), VegaPlugin = class {
58614
+ var LazyVegaComponent = import_react.lazy(() => import("./vega-component-z4WGXPkf.js")), VegaPlugin = class {
58615
58615
  constructor() {
58616
58616
  __publicField(this, "tagName", "marimo-vega");
58617
58617
  __publicField(this, "validator", object({
@@ -65633,7 +65633,7 @@ ${c}
65633
65633
  return Logger.warn("Failed to get version from mount config"), null;
65634
65634
  }
65635
65635
  }
65636
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.5-dev19"), showCodeInRunModeAtom = atom(true);
65636
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.5-dev22"), showCodeInRunModeAtom = atom(true);
65637
65637
  atom(null);
65638
65638
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
65639
65639
  constructor() {
@@ -11,7 +11,7 @@ import { a as Type, c as Calendar, i as createReducerAndAtoms, o as ToggleLeft,
11
11
  import { t as Check } from "./check-Cex3x9fD.js";
12
12
  import { C as logNever, F as createCollection, I as X, N as usePrevious, P as useDirection, R as ChevronDown, S as assertNever, a as SelectContent, c as SelectLabel, d as SelectValue, i as Select, l as SelectSeparator, n as Strings, o as SelectGroup, s as SelectItem, u as SelectTrigger } from "./label-CIR53v8V.js";
13
13
  import { G as marked, W as useNonce, mt as $f6c31cce2adf654f$export$45712eceda6fad21, q as useDebouncedCallback } from "./input-SSWXiS6n.js";
14
- import { g as CircleQuestionMark, h as isWasm, l as getRuntimeManager, m as Deferred, p as waitForConnectionOpen, t as toDate } from "./toDate-D1_ZulwM.js";
14
+ import { g as CircleQuestionMark, h as isWasm, l as getRuntimeManager, m as Deferred, p as waitForConnectionOpen, t as toDate } from "./toDate-D0QaHNwR.js";
15
15
  import { c as Objects, d as createSlot, g as Logger, m as useComposedRefs, o as isPlatformMac, r as cva, t as Button, y as cn } from "./button-DNlNlZY_.js";
16
16
  import { t as require_react_dom } from "./react-dom-BSUuJjCR.js";
17
17
  import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
@@ -3976,7 +3976,7 @@ ${r.join("\n")}`;
3976
3976
  return t.length === 0 ? null : t;
3977
3977
  }
3978
3978
  filenameAtom = atom(getFilenameFromDOM());
3979
- atom(null), atom(void 0);
3979
+ atom(null), atom(null), atom(void 0);
3980
3980
  var InMemoryStorage = class {
3981
3981
  constructor() {
3982
3982
  __publicField(this, "store", /* @__PURE__ */ new Map());
@@ -498,7 +498,8 @@ var RuntimeManager = class {
498
498
  return g.pathname = `${g.pathname.replace(/\/$/, "")}/${e.replace(/^\//, "")}`, g.hash = "", g;
499
499
  }
500
500
  formatWsURL(e, m) {
501
- return asWsUrl(this.formatHttpURL(e, m, false).toString());
501
+ let h = this.formatHttpURL(e, m, false);
502
+ return !this.isSameOrigin && this.config.authToken && h.searchParams.set(KnownQueryParams.accessToken, this.config.authToken), asWsUrl(h.toString());
502
503
  }
503
504
  getWsURL(e) {
504
505
  let m = new URL(this.config.url), h = new URLSearchParams(m.search);
@@ -517,8 +518,8 @@ var RuntimeManager = class {
517
518
  }
518
519
  getLSPURL(e) {
519
520
  if (e === "copilot") {
520
- let m = this.formatWsURL(`/lsp/${e}`);
521
- return m.search = "", m;
521
+ let m = this.formatWsURL(`/lsp/${e}`), h = m.searchParams.get(KnownQueryParams.accessToken);
522
+ return m.search = "", h && m.searchParams.set(KnownQueryParams.accessToken, h), m;
522
523
  }
523
524
  return this.formatWsURL(`/lsp/${e}`);
524
525
  }
@@ -534,13 +535,13 @@ var RuntimeManager = class {
534
535
  let e = await fetch(this.healthURL().toString());
535
536
  if (e.redirected) {
536
537
  Logger.debug(`Runtime redirected to ${e.url}`);
537
- let m2 = e.url.replace(/\/health$/, "");
538
- this.config.url = m2;
538
+ let m2 = new URL(e.url);
539
+ m2.pathname = m2.pathname.replace(/\/health$/, ""), this.config.url = m2.toString();
539
540
  }
540
541
  let m = e.ok;
541
542
  return m && this.setDOMBaseUri(this.config.url), m;
542
- } catch {
543
- return false;
543
+ } catch (e) {
544
+ return Logger.error(`Failed to check health: ${e instanceof Error ? e.message : "Unknown error"}`, { cause: e }), false;
544
545
  }
545
546
  }
546
547
  setDOMBaseUri(e) {
@@ -1,7 +1,7 @@
1
1
  import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-Bs6Z0kvn.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
4
- import { t as toDate } from "./toDate-D1_ZulwM.js";
4
+ import { t as toDate } from "./toDate-D0QaHNwR.js";
5
5
  import { r as cva, y as cn } from "./button-DNlNlZY_.js";
6
6
  import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
7
7
  import { C as dequal } from "./useTheme-CxjbgkRc.js";
@@ -1,7 +1,7 @@
1
1
  import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-Bs6Z0kvn.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
4
- import { c as asRemoteURL, g as CircleQuestionMark } from "./toDate-D1_ZulwM.js";
4
+ import { c as asRemoteURL, g as CircleQuestionMark } from "./toDate-D0QaHNwR.js";
5
5
  import { c as Objects, g as Logger, h as Events, y as cn } from "./button-DNlNlZY_.js";
6
6
  import "./react-dom-BSUuJjCR.js";
7
7
  import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
@@ -11,7 +11,7 @@ import { t as Tooltip } from "./tooltip-B5EnNyok.js";
11
11
  import { i as debounce_default } from "./constants-CvyfaCvs.js";
12
12
  import { n as useTheme, w as useEvent_default } from "./useTheme-CxjbgkRc.js";
13
13
  import { s as uniq } from "./arrays-beUWo8RF.js";
14
- import { a as AlertTitle, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-BvvMxigY.js";
14
+ import { a as AlertTitle, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-CkSq3l3_.js";
15
15
  import { n as formats } from "./vega-loader.browser-DqEcFOPD.js";
16
16
  import { a as getContainerWidth, n as vegaLoadData, s as tooltipHandler } from "./loader-Bd1kgLn7.js";
17
17
  import { t as useAsyncData } from "./useAsyncData-BG3ULuDU.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.22.5-dev19",
3
+ "version": "0.22.5-dev22",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -86,6 +86,74 @@ describe("RuntimeManager", () => {
86
86
  });
87
87
  });
88
88
 
89
+ describe("cross-origin auth token in WS URLs", () => {
90
+ it("should add access_token to WS URL when cross-origin with authToken", () => {
91
+ // example.com is cross-origin relative to the test environment (localhost)
92
+ const runtime = new RuntimeManager(
93
+ {
94
+ url: "https://sandbox.example.com",
95
+ lazy: true,
96
+ authToken: "my-secret-token",
97
+ },
98
+ true,
99
+ );
100
+ const url = runtime.getWsURL("s_123" as SessionId);
101
+
102
+ expect(url.searchParams.get("access_token")).toBe("my-secret-token");
103
+ expect(url.searchParams.get("session_id")).toBe("s_123");
104
+ });
105
+
106
+ it("should not add access_token to WS URL when same-origin", () => {
107
+ const runtime = new RuntimeManager(
108
+ {
109
+ url: window.location.origin,
110
+ lazy: true,
111
+ authToken: "my-secret-token",
112
+ },
113
+ true,
114
+ );
115
+ const url = runtime.getWsURL("s_123" as SessionId);
116
+
117
+ expect(url.searchParams.get("access_token")).toBeNull();
118
+ });
119
+
120
+ it("should not add access_token when no authToken is configured", () => {
121
+ const runtime = new RuntimeManager(
122
+ {
123
+ url: "https://sandbox.example.com",
124
+ lazy: true,
125
+ },
126
+ true,
127
+ );
128
+ const url = runtime.getWsURL("s_123" as SessionId);
129
+
130
+ expect(url.searchParams.get("access_token")).toBeNull();
131
+ });
132
+
133
+ it("should add access_token to all WS URL types when cross-origin", () => {
134
+ const runtime = new RuntimeManager(
135
+ {
136
+ url: "https://sandbox.example.com",
137
+ lazy: true,
138
+ authToken: "my-secret-token",
139
+ },
140
+ true,
141
+ );
142
+
143
+ const wsUrl = runtime.getWsURL("s_123" as SessionId);
144
+ const wsSyncUrl = runtime.getWsSyncURL("s_123" as SessionId);
145
+ const terminalUrl = runtime.getTerminalWsURL();
146
+
147
+ expect(wsUrl.searchParams.get("access_token")).toBe("my-secret-token");
148
+ expect(wsSyncUrl.searchParams.get("access_token")).toBe(
149
+ "my-secret-token",
150
+ );
151
+ expect(terminalUrl.searchParams.get("access_token")).toBe(
152
+ "my-secret-token",
153
+ );
154
+ });
155
+ });
156
+
89
157
  describe("getWsSyncURL", () => {
90
158
  it("should return WebSocket Sync URL", () => {
91
159
  const runtime = new RuntimeManager(mockConfig);
@@ -117,12 +185,52 @@ describe("RuntimeManager", () => {
117
185
  expect(url.pathname).toBe("/lsp/pylsp");
118
186
  });
119
187
 
120
- it("should return copilot URL", () => {
121
- const runtime = new RuntimeManager(mockConfig);
188
+ it("should return copilot URL without non-auth query params", () => {
189
+ const runtime = new RuntimeManager({
190
+ url: "https://example.com?foo=bar&baz=qux",
191
+ lazy: true,
192
+ });
122
193
  const url = runtime.getLSPURL("copilot");
123
194
 
124
195
  expect(url.protocol).toBe("wss:");
125
196
  expect(url.pathname).toBe("/lsp/copilot");
197
+ expect(url.searchParams.get("foo")).toBeNull();
198
+ expect(url.searchParams.get("baz")).toBeNull();
199
+ });
200
+
201
+ it("should preserve access_token on copilot URL when cross-origin", () => {
202
+ const runtime = new RuntimeManager(
203
+ {
204
+ url: "https://sandbox.example.com?foo=bar",
205
+ lazy: true,
206
+ authToken: "my-secret-token",
207
+ },
208
+ true,
209
+ );
210
+ const url = runtime.getLSPURL("copilot");
211
+
212
+ expect(url.protocol).toBe("wss:");
213
+ expect(url.pathname).toBe("/lsp/copilot");
214
+ expect(url.searchParams.get("access_token")).toBe("my-secret-token");
215
+ // Other params should be stripped
216
+ expect(url.searchParams.get("foo")).toBeNull();
217
+ });
218
+
219
+ it("should not have access_token on copilot URL when same-origin", () => {
220
+ const runtime = new RuntimeManager(
221
+ {
222
+ url: window.location.origin,
223
+ lazy: true,
224
+ authToken: "my-secret-token",
225
+ },
226
+ true,
227
+ );
228
+ const url = runtime.getLSPURL("copilot");
229
+
230
+ expect(url.protocol).toBe("ws:");
231
+ expect(url.pathname).toBe("/lsp/copilot");
232
+ expect(url.searchParams.get("access_token")).toBeNull();
233
+ expect(url.search).toBe("");
126
234
  });
127
235
  });
128
236
 
@@ -200,6 +308,34 @@ describe("RuntimeManager", () => {
200
308
 
201
309
  expect(result).toBe(false);
202
310
  });
311
+
312
+ it("should update config.url on redirect, stripping /health from pathname", async () => {
313
+ global.fetch = vi.fn().mockResolvedValue({
314
+ ok: true,
315
+ redirected: true,
316
+ url: "https://sandbox.example.com/health?some_value=abc123",
317
+ });
318
+
319
+ const runtime = new RuntimeManager(
320
+ {
321
+ ...mockConfig,
322
+ url: "https://backend.example.com/lazy?some_value=abc123",
323
+ },
324
+ true, // lazy — don't call init() in constructor
325
+ );
326
+ const result = await runtime.isHealthy();
327
+
328
+ expect(result).toBe(true);
329
+ // Should strip /health from pathname but preserve query params
330
+ const wsUrl = runtime.getWsURL("s_test" as SessionId);
331
+ expect(wsUrl.pathname).toBe("/ws");
332
+ expect(wsUrl.hostname).toBe("sandbox.example.com");
333
+ expect(wsUrl.searchParams.get("some_value")).toBe("abc123");
334
+
335
+ // Clean up side effects
336
+ document.querySelectorAll("base").forEach((el) => el.remove());
337
+ global.fetch = vi.fn().mockResolvedValue({ ok: false });
338
+ });
203
339
  });
204
340
 
205
341
  describe("waitForHealthy", () => {
@@ -88,6 +88,15 @@ export class RuntimeManager {
88
88
  searchParams,
89
89
  /* restrictToKnownQueryParams =*/ false,
90
90
  );
91
+
92
+ // For cross-origin runtimes, pass the auth token as a query parameter.
93
+ // WebSocket connections cannot send custom headers (no Authorization
94
+ // header), and cross-origin cookies are blocked by browsers, so the
95
+ // access_token query param is the only way to authenticate.
96
+ if (!this.isSameOrigin && this.config.authToken) {
97
+ url.searchParams.set(KnownQueryParams.accessToken, this.config.authToken);
98
+ }
99
+
91
100
  return asWsUrl(url.toString());
92
101
  }
93
102
 
@@ -143,9 +152,15 @@ export class RuntimeManager {
143
152
  */
144
153
  getLSPURL(lsp: "pylsp" | "basedpyright" | "copilot" | "ty" | "pyrefly"): URL {
145
154
  if (lsp === "copilot") {
146
- // For copilot, don't include any query parameters
155
+ // For copilot, strip all query parameters except the auth token.
156
+ // Copilot doesn't understand arbitrary query params, but we still
157
+ // need access_token for cross-origin authentication.
147
158
  const url = this.formatWsURL(`/lsp/${lsp}`);
159
+ const accessToken = url.searchParams.get(KnownQueryParams.accessToken);
148
160
  url.search = "";
161
+ if (accessToken) {
162
+ url.searchParams.set(KnownQueryParams.accessToken, accessToken);
163
+ }
149
164
  return url;
150
165
  }
151
166
  return this.formatWsURL(`/lsp/${lsp}`);
@@ -173,9 +188,10 @@ export class RuntimeManager {
173
188
  // If there is a redirect, update the URL in the config
174
189
  if (response.redirected) {
175
190
  Logger.debug(`Runtime redirected to ${response.url}`);
176
- // strip /health from the URL
177
- const baseUrl = response.url.replace(/\/health$/, "");
178
- this.config.url = baseUrl;
191
+ // strip /health from the URL, using URL parsing to handle query params
192
+ const redirected = new URL(response.url);
193
+ redirected.pathname = redirected.pathname.replace(/\/health$/, "");
194
+ this.config.url = redirected.toString();
179
195
  }
180
196
 
181
197
  const success = response.ok;
@@ -183,7 +199,11 @@ export class RuntimeManager {
183
199
  this.setDOMBaseUri(this.config.url);
184
200
  }
185
201
  return success;
186
- } catch {
202
+ } catch (error) {
203
+ Logger.error(
204
+ `Failed to check health: ${error instanceof Error ? error.message : "Unknown error"}`,
205
+ { cause: error },
206
+ );
187
207
  return false;
188
208
  }
189
209
  }
@@ -16,6 +16,22 @@ export const filenameAtom = atom<string | null>(getFilenameFromDOM());
16
16
  */
17
17
  export const cwdAtom = atom<string | null>(null);
18
18
 
19
+ /**
20
+ * LSP workspace information from the backend.
21
+ * Contains the project root and the document's file URI.
22
+ */
23
+ export interface LspWorkspace {
24
+ rootUri: string;
25
+ documentUri: string;
26
+ }
27
+
28
+ /**
29
+ * Atom for storing the LSP workspace information.
30
+ * This is populated during active notebook sessions
31
+ * and null for other pages.
32
+ */
33
+ export const lspWorkspaceAtom = atom<LspWorkspace | null>(null);
34
+
19
35
  /**
20
36
  * Set for static notebooks.
21
37
  */
package/src/mount.tsx CHANGED
@@ -36,7 +36,12 @@ import {
36
36
  DEFAULT_RUNTIME_CONFIG,
37
37
  runtimeConfigAtom,
38
38
  } from "./core/runtime/config";
39
- import { codeAtom, cwdAtom, filenameAtom } from "./core/saving/file-state";
39
+ import {
40
+ codeAtom,
41
+ cwdAtom,
42
+ filenameAtom,
43
+ lspWorkspaceAtom,
44
+ } from "./core/saving/file-state";
40
45
  import { store } from "./core/state/jotai";
41
46
  import { patchFetch, patchVegaLoader } from "./core/static/files";
42
47
  import {
@@ -150,6 +155,16 @@ const mountOptionsSchema = z.object({
150
155
  * absolute working directory of the notebook
151
156
  */
152
157
  cwd: z.string().nullish().default(null),
158
+ /**
159
+ * LSP workspace information
160
+ */
161
+ lspWorkspace: z
162
+ .object({
163
+ rootUri: z.string(),
164
+ documentUri: z.string(),
165
+ })
166
+ .nullish()
167
+ .default(null),
153
168
  /**
154
169
  * notebook code
155
170
  */
@@ -287,6 +302,7 @@ function initStore(options: unknown) {
287
302
  // Files
288
303
  store.set(filenameAtom, parsedOptions.data.filename);
289
304
  store.set(cwdAtom, parsedOptions.data.cwd ?? null);
305
+ store.set(lspWorkspaceAtom, parsedOptions.data.lspWorkspace);
290
306
  store.set(codeAtom, parsedOptions.data.code);
291
307
  store.set(initialModeAtom, mode);
292
308