@marimo-team/islands 0.26.1-dev102 → 0.26.1-dev103

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.
@@ -148,7 +148,7 @@ function L(e) {
148
148
  }
149
149
  //#endregion
150
150
  //#region src/components/editor/boundary/ErrorBoundary.tsx
151
- var R = (0, T.lazy)(() => import("./feedback-button-B8h11wos.js").then((e) => ({ default: e.FeedbackModal }))), z = (e) => {
151
+ var R = (0, T.lazy)(() => import("./feedback-button-DdJjyfKE.js").then((e) => ({ default: e.FeedbackModal }))), z = (e) => {
152
152
  let t = (0, w.c)(2), n;
153
153
  return t[0] === e.children ? n = t[1] : (n = /* @__PURE__ */ (0, N.jsx)(O, {
154
154
  FallbackComponent: B,
@@ -14,7 +14,7 @@ function y() {
14
14
  return e.warn("Failed to get version from mount config"), null;
15
15
  }
16
16
  }
17
- var b = y() || "0.26.1-dev102", x = a(b), S = a(!0);
17
+ var b = y() || "0.26.1-dev103", x = a(b), S = a(!0);
18
18
  a(null);
19
19
  //#endregion
20
20
  //#region src/core/wasm/state.ts
@@ -35,7 +35,7 @@ import { o as Ta } from "./dist-BG-7Qpaj.js";
35
35
  import { t as Ea } from "./useAsyncData-P5-Oovhq.js";
36
36
  import { i as Da, n as Oa, o as ka, r as Aa } from "./loader-CGrYn73j.js";
37
37
  import { n as W, t as G } from "./objectWithoutPropertiesLoose-BRDcTsfB.js";
38
- import { n as ja, t as Ma } from "./ErrorBoundary-BKEnwpNS.js";
38
+ import { n as ja, t as Ma } from "./ErrorBoundary-B5MVsi73.js";
39
39
  import { W as Na, n as Pa } from "./vega-loader.browser-Co9gYE8Z.js";
40
40
  import { t as Fa } from "./useIframeCapabilities-_0KX0nu_.js";
41
41
  var Ia = H("arrow-down-wide-narrow", [
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
3
  import { t as n } from "./react-dom-DdqGVp5N.js";
4
4
  import { c as r, l as i, u as a } from "./data-grid-types-DBNnjiYJ.js";
5
- import { a as o, i as s, n as c, r as l } from "./glide-data-editor-DTYsy8_7.js";
5
+ import { a as o, i as s, n as c, r as l } from "./glide-data-editor-wPYhuqFs.js";
6
6
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.18.1_marked@15.0.12_react-dom@19.3.1__a94b4518d090e84da26f3a68e82f2953/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/data-grid-overlay-editor-style.js
7
7
  var u = /* @__PURE__ */ e(t(), 1), d = /* @__PURE__ */ e(n(), 1), f = /*#__PURE__*/ o("div")({
8
8
  name: "DataGridOverlayEditorStyle",
@@ -4,13 +4,13 @@ import { t as r } from "./react-Bgs_wQh3.js";
4
4
  import { t as i } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { t as a } from "./copy-icon-CmNLxT5_.js";
6
6
  import { A as o, L as s, Y as c, i as l, j as u, n as d, on as f, tn as p, z as m } from "./error-entries-DhZotdzQ.js";
7
- import { n as h, t as ee } from "./globals-EZS7lTul.js";
7
+ import { n as h, t as ee } from "./globals-DyJvKfkF.js";
8
8
  import { r as g } from "./assertNever-5vhHGKOK.js";
9
9
  import { t as _ } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Ct as te, Ut as v, m as y } from "./use-restore-focus-DJ_-uSn_.js";
11
11
  import { a as ne, i as re, n as ie, r as ae } from "./dialog-BvjfalZ9.js";
12
12
  import { t as oe } from "./useAsyncData-P5-Oovhq.js";
13
- import { t as se } from "./code-visibility-C0y2uQ5I.js";
13
+ import { t as se } from "./code-visibility-DLPZ_eYq.js";
14
14
  //#region src/components/ui/skeleton.tsx
15
15
  var b = /* @__PURE__ */ e(r(), 1), x = i(), S = _(), ce = (e) => {
16
16
  let n = (0, x.c)(8), r, i;
@@ -14,7 +14,7 @@ import { t as F } from "./jsx-runtime-D8btoEHk.js";
14
14
  import { d as ae, r as I } from "./use-restore-focus-DJ_-uSn_.js";
15
15
  import { t as oe } from "./useEvent-BoN7U38T.js";
16
16
  import { n as L, t as se } from "./objectWithoutPropertiesLoose-BRDcTsfB.js";
17
- import { t as ce } from "./ErrorBoundary-BKEnwpNS.js";
17
+ import { t as ce } from "./ErrorBoundary-B5MVsi73.js";
18
18
  import { A as le, C as ue, D as de, E as fe, F as pe, I as me, L as he, M as ge, N as R, O as z, P as _e, R as ve, S as ye, T as be, _ as xe, a as Se, b as B, c as Ce, d as we, f as V, g as Te, h as Ee, i as De, j as H, k as Oe, l as ke, m as Ae, n as je, o as Me, p as Ne, r as U, s as Pe, t as Fe, u as Ie, v as Le, w as Re, x as ze, y as Be, z as Ve } from "./data-grid-types-DBNnjiYJ.js";
19
19
  //#region ../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
20
20
  function He(e) {
@@ -7061,7 +7061,7 @@ function ds(e, t, n, r, i) {
7061
7061
  }
7062
7062
  //#endregion
7063
7063
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.18.1_marked@15.0.12_react-dom@19.3.1__a94b4518d090e84da26f3a68e82f2953/node_modules/@glideapps/glide-data-grid/dist/esm/data-editor/data-editor.js
7064
- var fs = /* @__PURE__ */ e(Tr(), 1), ps = /* @__PURE__ */ e(kr(), 1), ms = W.lazy(async () => await import("./data-grid-overlay-editor-_toXAWar.js")), hs = 0;
7064
+ var fs = /* @__PURE__ */ e(Tr(), 1), ps = /* @__PURE__ */ e(kr(), 1), ms = W.lazy(async () => await import("./data-grid-overlay-editor-1bQ1lRk0.js")), hs = 0;
7065
7065
  function gs(e) {
7066
7066
  return (0, fs.default)((0, ps.default)((0, ps.default)(e).filter((e) => e.span !== void 0).map((e) => (0, ao.default)((e.span?.[0] ?? 0) + 1, (e.span?.[1] ?? 0) + 1))));
7067
7067
  }
@@ -9284,7 +9284,7 @@ function Ys(e, t, n, r, i) {
9284
9284
  }
9285
9285
  //#endregion
9286
9286
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.18.1_marked@15.0.12_react-dom@19.3.1__a94b4518d090e84da26f3a68e82f2953/node_modules/@glideapps/glide-data-grid/dist/esm/cells/number-cell.js
9287
- var Xs = W.lazy(async () => await import("./number-overlay-editor-DK1pWbJu.js")), Zs = {
9287
+ var Xs = W.lazy(async () => await import("./number-overlay-editor-BPSNY0UK.js")), Zs = {
9288
9288
  getAccessibilityString: (e) => e.data?.toString() ?? "",
9289
9289
  kind: U.Number,
9290
9290
  needsHover: (e) => e.hoverEffect === !0,
@@ -1,6 +1,6 @@
1
1
  import { h as e } from "./tooltip-DyLdBIM4.js";
2
2
  import { Ct as t } from "./use-restore-focus-DJ_-uSn_.js";
3
- import { r as n } from "./code-visibility-C0y2uQ5I.js";
3
+ import { r as n } from "./code-visibility-DLPZ_eYq.js";
4
4
  var r = e("triangle-alert", [
5
5
  ["path", {
6
6
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
package/dist/main.js CHANGED
@@ -6,7 +6,7 @@ import { i as x, n as S, r as C, t as w } from "./copy-icon-CmNLxT5_.js";
6
6
  import { $ as T, Bt as E, E as D, Et as O, F as k, Ft as A, G as j, I as M, It as N, K as P, L as F, Lt as I, M as L, Mt as R, Nt as z, O as B, P as ee, Pt as te, Q as ne, Rt as re, Tt as ie, Vt as ae, _ as oe, _t as se, a as ce, at as le, b as ue, bt as de, c as fe, dt as pe, ft as me, ht as he, i as ge, j as _e, kt as ve, lt as ye, n as be, nt as xe, o as Se, ot as Ce, rt as we, st as Te, tt as Ee, ut as De, yt as Oe } from "./html-to-image-B8erjaaD.js";
7
7
  import { a as ke, f as Ae, h as je, i as Me, m as Ne, n as Pe, o as Fe, r as Ie, t as Le } from "./tooltip-DyLdBIM4.js";
8
8
  import { D as Re, E as ze, S as Be, T as Ve, _ as He, a as Ue, c as We, d as Ge, f as Ke, g as qe, h as Je, i as Ye, l as Xe, m as Ze, n as Qe, o as $e, p as et, r as tt, s as nt, t as rt, u as it, v as at, w as ot, x as st, y as ct } from "./spec-Dz-Avv1m.js";
9
- import { $ as lt, $t as ut, A as dt, An as ft, At as pt, B as mt, Bt as ht, C as gt, D as _t, Dn as vt, Dt as yt, E as bt, En as xt, Et as St, F as Ct, Ft as wt, G as Tt, Gt as Et, H as Dt, Ht as Ot, I as kt, It as At, J as jt, Jt as Mt, K as Nt, Kt as Pt, L as Ft, Lt as It, M as Lt, Mn as Rt, Mt as zt, N as Bt, Nt as Vt, O as Ht, On as Ut, Ot as Wt, P as Gt, Pt as Kt, Q as qt, Qt as Jt, R as Yt, Rt as Xt, S as Zt, Sn as Qt, St as $t, T as en, Tn as tn, Tt as nn, U as rn, Ut as an, V as on, Vt as sn, W as cn, Wt as ln, X as un, Xt as dn, Y as fn, Yt as pn, Z as mn, Zt as hn, _ as gn, _n, _t as vn, an as yn, at as bn, b as xn, bn as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dn as On, dt as kn, en as An, f as jn, fn as Mn, ft as Nn, g as Pn, gn as Fn, gt as In, h as Ln, hn as Rn, ht as zn, in as Bn, it as Vn, j as Hn, jn as Un, jt as Wn, k as Gn, kn as Kn, kt as qn, ln as Jn, lt as Yn, m as Xn, mn as Zn, mt as Qn, nn as $n, on as er, ot as tr, p as nr, pn as rr, pt as ir, q as ar, qt as or, r as sr, rn as cr, rt as lr, sn as ur, st as dr, t as fr, tn as pr, u as mr, un as hr, ut as gr, v as _r, vn as vr, vt as yr, w as br, wn as xr, x as Sr, xn as Cr, xt as wr, y as Tr, yn as Er, yt as Dr, z as Or, zt as kr } from "./common-umUW2Aaj.js";
9
+ import { $ as lt, $t as ut, A as dt, An as ft, At as pt, B as mt, Bt as ht, C as gt, D as _t, Dn as vt, Dt as yt, E as bt, En as xt, Et as St, F as Ct, Ft as wt, G as Tt, Gt as Et, H as Dt, Ht as Ot, I as kt, It as At, J as jt, Jt as Mt, K as Nt, Kt as Pt, L as Ft, Lt as It, M as Lt, Mn as Rt, Mt as zt, N as Bt, Nt as Vt, O as Ht, On as Ut, Ot as Wt, P as Gt, Pt as Kt, Q as qt, Qt as Jt, R as Yt, Rt as Xt, S as Zt, Sn as Qt, St as $t, T as en, Tn as tn, Tt as nn, U as rn, Ut as an, V as on, Vt as sn, W as cn, Wt as ln, X as un, Xt as dn, Y as fn, Yt as pn, Z as mn, Zt as hn, _ as gn, _n, _t as vn, an as yn, at as bn, b as xn, bn as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dn as On, dt as kn, en as An, f as jn, fn as Mn, ft as Nn, g as Pn, gn as Fn, gt as In, h as Ln, hn as Rn, ht as zn, in as Bn, it as Vn, j as Hn, jn as Un, jt as Wn, k as Gn, kn as Kn, kt as qn, ln as Jn, lt as Yn, m as Xn, mn as Zn, mt as Qn, nn as $n, on as er, ot as tr, p as nr, pn as rr, pt as ir, q as ar, qt as or, r as sr, rn as cr, rt as lr, sn as ur, st as dr, t as fr, tn as pr, u as mr, un as hr, ut as gr, v as _r, vn as vr, vt as yr, w as br, wn as xr, x as Sr, xn as Cr, xt as wr, y as Tr, yn as Er, yt as Dr, z as Or, zt as kr } from "./common-B2K9WgcL.js";
10
10
  import { a as Ar, n as jr, s as Mr, t as Nr } from "./useLifecycle-tPpAt-OE.js";
11
11
  import { t as Pr } from "./check-DUIc04aK.js";
12
12
  import { A as Fr, C as Ir, D as Lr, M as Rr, O as zr, a as Br, c as Vr, d as Hr, i as Ur, k as Wr, l as Gr, n as Kr, o as qr, r as Jr, s as Yr, t as Xr, w as Zr, x as Qr } from "./select-CEnB18uc.js";
@@ -16,7 +16,7 @@ import { $t as Fi, A as Ii, At as Li, Bt as Ri, C as zi, Ct as Bi, Dt as Vi, Ft
16
16
  import { a as Ta, d as Ea, i as Da, n as Oa, o as ka, r as Aa, s as ja, t as Ma, u as Na } from "./process-output-C-2_O5Ry.js";
17
17
  import { t as Pa } from "./pencil-CxMgOe04.js";
18
18
  import { a as Fa, c as Ia, d as La, f as Ra, i as za, l as Ba, r as Va } from "./glide-utils-CD8BaFTm.js";
19
- import { n as Ha, t as Ua } from "./globals-EZS7lTul.js";
19
+ import { n as Ha, t as Ua } from "./globals-DyJvKfkF.js";
20
20
  import { a as Wa, i as Ga, n as Ka, r as qa, s as Ja, t as Ya } from "./assertNever-5vhHGKOK.js";
21
21
  import { t as Xa } from "./react-dom-DdqGVp5N.js";
22
22
  import { t as Za } from "./jsx-runtime-D8btoEHk.js";
@@ -42,9 +42,9 @@ import { p as ic } from "./dist-BidYR5m4.js";
42
42
  import { t as ac } from "./useAsyncData-P5-Oovhq.js";
43
43
  import { n as oc, r as sc, t as cc } from "./useDeepCompareMemoize-CHx-NxMl.js";
44
44
  import { o as lc, r as uc, s as dc } from "./loader-CGrYn73j.js";
45
- import { t as fc } from "./ErrorBoundary-BKEnwpNS.js";
45
+ import { t as fc } from "./ErrorBoundary-B5MVsi73.js";
46
46
  import { G as pc, W as mc } from "./vega-loader.browser-Co9gYE8Z.js";
47
- import { a as hc, c as gc, i as _c, l as vc, o as yc, s as bc, t as xc } from "./code-visibility-C0y2uQ5I.js";
47
+ import { a as hc, c as gc, i as _c, l as vc, o as yc, s as bc, t as xc } from "./code-visibility-DLPZ_eYq.js";
48
48
  import { t as Sc } from "./esm-DY8dGAjJ.js";
49
49
  //#region ../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
50
50
  var Cc = Object.freeze({
@@ -13098,7 +13098,7 @@ function KO(e, t) {
13098
13098
  }
13099
13099
  //#endregion
13100
13100
  //#region src/plugins/impl/DataEditorPlugin.tsx
13101
- var qO = J.lazy(() => import("./glide-data-editor-DTYsy8_7.js").then((e) => e.t)), JO = OD("marimo-data-editor", { cssStyles: [ZD, QD] }).withData(G({
13101
+ var qO = J.lazy(() => import("./glide-data-editor-wPYhuqFs.js").then((e) => e.t)), JO = OD("marimo-data-editor", { cssStyles: [ZD, QD] }).withData(G({
13102
13102
  initialValue: G({ edits: V(G({
13103
13103
  rowIdx: W(),
13104
13104
  columnId: K(),
@@ -32903,7 +32903,7 @@ function uW(e) {
32903
32903
  }
32904
32904
  //#endregion
32905
32905
  //#region src/components/editor/renderers/slides-layout/slides-layout.tsx
32906
- var dW = J.lazy(() => import("./reveal-component-BRoxPCNK.js")), fW = (e) => {
32906
+ var dW = J.lazy(() => import("./reveal-component-CX1LQkT7.js")), fW = (e) => {
32907
32907
  let t = (0, X.c)(33), { layout: n, setLayout: r, cells: i, mode: a } = e, o = Ao(Bs), s = a === "read" || o, c = Ao(ha) > 1, [l, u] = (0, J.useState)(null), d;
32908
32908
  t[0] !== i || t[1] !== n ? (d = cB(i, n), t[0] = i, t[1] = n, t[2] = d) : d = t[2];
32909
32909
  let { slideCells: f, skippedIds: p, noOutputIds: m, slideTypes: h, startCellIndex: g } = d, _;
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { a as n } from "./glide-data-editor-DTYsy8_7.js";
3
+ import { a as n } from "./glide-data-editor-wPYhuqFs.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.18.1_marked@15.0.12_react-dom@19.3.1__a94b4518d090e84da26f3a68e82f2953/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
5
5
  var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
6
6
  name: "NumberOverlayEditorStyle",
@@ -3,14 +3,14 @@ import { g as t, h as n, m as r, r as i, t as a } from "./button-Z2R2272J.js";
3
3
  import { t as o } from "./react-Bgs_wQh3.js";
4
4
  import { t as s } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { h as c, t as l } from "./tooltip-DyLdBIM4.js";
6
- import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-umUW2Aaj.js";
6
+ import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-B2K9WgcL.js";
7
7
  import { M as w } from "./select-CEnB18uc.js";
8
8
  import { X as T } from "./dropdown-menu-D0DeN-aL.js";
9
9
  import { t as E } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Kt as D, Ut as O, f as k, i as ee } from "./use-restore-focus-DJ_-uSn_.js";
11
11
  import { t as A } from "./useEvent-BoN7U38T.js";
12
12
  import { o as te } from "./static-state-iw0PrHK4.js";
13
- import { n as ne, t as re } from "./code-visibility-C0y2uQ5I.js";
13
+ import { n as ne, t as re } from "./code-visibility-DLPZ_eYq.js";
14
14
  /* empty css */
15
15
  var j = c("sticky-note", [["path", {
16
16
  d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.26.1-dev102",
3
+ "version": "0.26.1-dev103",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -5,13 +5,13 @@ import { CodePlaceholder } from "../code-placeholder";
5
5
 
6
6
  afterEach(cleanup);
7
7
 
8
- it("keeps every line searchable, highlighted, and escaped without an editor", () => {
8
+ it("renders searchable, escaped text without token spans or an editor", () => {
9
9
  const code = Array.from({ length: 100 }, (_, i) => `x${i} = "<script>"`).join(
10
10
  "\n",
11
11
  );
12
12
  const { container } = render(<CodePlaceholder code={code} />);
13
13
  expect(container.textContent).toBe(code);
14
- expect(container.querySelector(".tok-string")).not.toBeNull();
14
+ expect(container.querySelector("span")).toBeNull();
15
15
  expect(container.querySelector("script")).toBeNull();
16
16
  expect(container.querySelector(".cm-editor")).toBeNull();
17
17
  });
@@ -45,6 +45,7 @@ import { invariant } from "@/utils/invariant";
45
45
  import { mergeRefs } from "@/utils/mergeRefs";
46
46
  import { useAskAiAboutCell } from "../../chrome/wrapper/useAskAiAboutCell";
47
47
  import { AiCompletionEditor } from "../../ai/ai-completion-editor";
48
+ import { focusEditor } from "../../navigation/focus-utils";
48
49
  import {
49
50
  closeSignatureHelp,
50
51
  useCellEditorNavigationProps,
@@ -434,7 +435,21 @@ const CellEditorInternal = ({
434
435
  className="relative w-full"
435
436
  ref={intersectionRef}
436
437
  {...navigationProps}
437
- onPointerDownCapture={promote}
438
+ onPointerDownCapture={(event) => {
439
+ promote();
440
+ if (
441
+ !isEditorMounted &&
442
+ event.button === 0 &&
443
+ event.pointerType === "mouse" &&
444
+ event.target instanceof Element &&
445
+ event.target.closest(".mo-code-placeholder") &&
446
+ editorViewRef.current
447
+ ) {
448
+ // Mounting replaces the pointer target before the browser can focus it.
449
+ event.preventDefault();
450
+ focusEditor(editorViewRef.current);
451
+ }
452
+ }}
438
453
  onFocusCapture={promote}
439
454
  onDoubleClick={(e) => {
440
455
  if (hidden) {
@@ -1,7 +1,5 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- /* Colors mirror core/codemirror/theme/{light,dark}.ts so building the editor does not recolor the code. */
4
-
5
3
  /* The editor's line-number gutter pushes its text right; leave the same room so the code does not jump. */
6
4
  .mo-code-placeholder {
7
5
  --mo-gutter-digits: 2;
@@ -9,8 +7,8 @@
9
7
  cursor: text;
10
8
  padding: 8px 29px 8px
11
9
  calc(
12
- 53.5px + min(var(--mo-gutter-digits) - 1, 1) * 3.1px + max(var(--mo-gutter-digits) - 2, 0) *
13
- 7.56px
10
+ 53.5px + min(var(--mo-gutter-digits) - 1, 1) * 3.1px +
11
+ max(var(--mo-gutter-digits) - 2, 0) * 7.56px
14
12
  );
15
13
  font-size: var(--marimo-code-editor-font-size, 0.9rem);
16
14
  font-family: var(--monospace-font);
@@ -26,43 +24,3 @@
26
24
  var(--mo-hidden-lines) * 1.4 * var(--marimo-code-editor-font-size, 0.9rem)
27
25
  );
28
26
  }
29
-
30
- .mo-code-placeholder .tok-keyword {
31
- color: light-dark(#708, #c678dd);
32
- font-weight: 500;
33
- }
34
-
35
- .mo-code-placeholder .tok-string,
36
- .mo-code-placeholder .tok-string2 {
37
- color: light-dark(#a11, #98c379);
38
- }
39
-
40
- .mo-code-placeholder .tok-number {
41
- color: light-dark(#164, #d19a66);
42
- }
43
-
44
- .mo-code-placeholder .tok-bool,
45
- .mo-code-placeholder .tok-atom {
46
- color: light-dark(#219, #d19a66);
47
- }
48
-
49
- .mo-code-placeholder .tok-operator {
50
- color: light-dark(#a2f, #56b6c2);
51
- font-weight: 500;
52
- }
53
-
54
- .mo-code-placeholder .tok-className {
55
- color: light-dark(#00f, #61afef);
56
- }
57
-
58
- .mo-code-placeholder .tok-typeName {
59
- color: light-dark(#085, #56b6c2);
60
- }
61
-
62
- .mo-code-placeholder .tok-propertyName {
63
- color: light-dark(#05a, #e5c07b);
64
- }
65
-
66
- .mo-code-placeholder .tok-comment {
67
- color: var(--cm-comment);
68
- }
@@ -1,10 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import "./code-placeholder.css";
3
- import { markdownLanguage } from "@codemirror/lang-markdown";
4
- import { pythonLanguage } from "@codemirror/lang-python";
5
- import { SQLDialect } from "@codemirror/lang-sql";
6
- import { classHighlighter, highlightTree } from "@lezer/highlight";
7
- import { type CSSProperties, type ReactNode, useMemo } from "react";
3
+ import { type CSSProperties, useMemo } from "react";
8
4
  import { parseCellCode } from "@/core/codemirror/language/cell-code";
9
5
  import { cn } from "@/utils/cn";
10
6
 
@@ -13,43 +9,18 @@ interface CodePlaceholderProps {
13
9
  className?: string;
14
10
  }
15
11
 
16
- const parsers = {
17
- python: pythonLanguage.parser,
18
- markdown: markdownLanguage.parser,
19
- sql: SQLDialect.define({}).language.parser,
20
- };
21
-
22
12
  // Rendering every line of every offscreen cell is unbounded work. The rest of a
23
13
  // long cell is a spacer, so the layout still matches the editor.
24
14
  const MAX_RENDERED_LINES = 200;
25
15
 
26
16
  export const CodePlaceholder = ({ code, className }: CodePlaceholderProps) => {
27
- const { content, gutterDigits, hiddenLines } = useMemo(() => {
28
- const { adapter, text: fullText } = parseCellCode(code);
17
+ const { text, gutterDigits, hiddenLines } = useMemo(() => {
18
+ const { text: fullText } = parseCellCode(code);
29
19
  const lines = fullText.split("\n");
30
20
  const text = lines.slice(0, MAX_RENDERED_LINES).join("\n");
31
21
  const hiddenLines = Math.max(0, lines.length - MAX_RENDERED_LINES);
32
- const parser = parsers[adapter.type];
33
- const nodes: ReactNode[] = [];
34
- let position = 0;
35
- highlightTree(parser.parse(text), classHighlighter, (from, to, classes) => {
36
- if (from > position) {
37
- nodes.push(text.slice(position, from));
38
- }
39
- nodes.push(
40
- <span key={from} className={classes}>
41
- {text.slice(from, to)}
42
- </span>,
43
- );
44
- position = to;
45
- });
46
- nodes.push(text.slice(position));
47
- // A final newline needs a following character to occupy its own line.
48
- if (!text || text.endsWith("\n")) {
49
- nodes.push("\u200b");
50
- }
51
22
  return {
52
- content: nodes,
23
+ text,
53
24
  gutterDigits: String(lines.length).length,
54
25
  hiddenLines,
55
26
  };
@@ -65,7 +36,9 @@ export const CodePlaceholder = ({ code, className }: CodePlaceholderProps) => {
65
36
  } as CSSProperties
66
37
  }
67
38
  >
68
- {content}
39
+ {text}
40
+ {/* A final newline needs a following character to occupy its own line. */}
41
+ {(!text || text.endsWith("\n")) && "\u200b"}
69
42
  {hiddenLines > 0 && <div className="mo-code-placeholder-rest" />}
70
43
  </div>
71
44
  );