@marimo-team/islands 0.25.2-dev106 → 0.25.2-dev109
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.
- package/dist/{ErrorBoundary-DrWVvMqC.js → ErrorBoundary-BqyKvcCy.js} +1 -1
- package/dist/{cells-CvBCD5iu.js → cells-CnomFgoS.js} +2948 -2928
- package/dist/{chat-ui-h9kErePX.js → chat-ui-DIoRDU4g.js} +4 -4
- package/dist/{code-visibility-DdgAmJmC.js → code-visibility-5NC1aIxF.js} +2 -2
- package/dist/{common-DGkl4Eds.js → common-B6A_WCjp.js} +3 -3
- package/dist/{data-grid-overlay-editor-i49eMiEh.js → data-grid-overlay-editor-D-TLNXor.js} +1 -1
- package/dist/{error-entries-CfSQn4ZJ.js → error-entries-uqmpke4z.js} +1 -1
- package/dist/{feedback-button-A2AHC02G.js → feedback-button-Bu8T_1Jx.js} +4 -4
- package/dist/{glide-data-editor-C_Y83eDT.js → glide-data-editor-DSIJAiQj.js} +3 -3
- package/dist/{globals-C8J09ZJ3.js → globals-CC5F6u7e.js} +1 -1
- package/dist/{html-to-image-ASL72siI.js → html-to-image-utL-jAuh.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/{number-overlay-editor-Cp9NfidD.js → number-overlay-editor-BVm0umyX.js} +1 -1
- package/dist/{process-output-sgQSi4QO.js → process-output-tkY7JSAu.js} +2 -2
- package/dist/{reveal-component-CBoV9nSd.js → reveal-component-b9kFH1m4.js} +3 -3
- package/package.json +1 -1
- package/src/core/cells/__tests__/document-roundtrip.test.ts +16 -0
- package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +138 -26
- package/src/core/codemirror/language/embedded/embedded-python.ts +47 -13
- package/src/core/codemirror/language/embedded/latex.ts +20 -13
|
@@ -3,13 +3,13 @@ import { c as n, g as r, h as i, t as a } from "./button-CvjkwdSk.js";
|
|
|
3
3
|
import { t as o } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as c, t as l } from "./copy-icon-Ft7t9bqz.js";
|
|
6
|
-
import { F as u, H as d, U as f, V as p, X as m, Y as h, Z as g, _, a as v, c as y, d as b, f as x, g as S, h as C, l as w, m as T, n as E, p as D, r as O, t as k, v as A, x as ee, y as j, z as te } from "./html-to-image-
|
|
6
|
+
import { F as u, H as d, U as f, V as p, X as m, Y as h, Z as g, _, a as v, c as y, d as b, f as x, g as S, h as C, l as w, m as T, n as E, p as D, r as O, t as k, v as A, x as ee, y as j, z as te } from "./html-to-image-utL-jAuh.js";
|
|
7
7
|
import { h as M, t as ne } from "./tooltip-BO1REbqs.js";
|
|
8
|
-
import { $ as re, $t as ie, It as ae, K as oe, Mt as se, N as ce, St as le, Vt as ue, X as de, _t as fe, b as pe, cn as me, d as he, it as ge, pn as _e, rt as ve, sn as ye, un as be, ut as xe, vt as Se, yt as Ce } from "./cells-
|
|
8
|
+
import { $ as re, $t as ie, It as ae, K as oe, Mt as se, N as ce, St as le, Vt as ue, X as de, _t as fe, b as pe, cn as me, d as he, it as ge, pn as _e, rt as ve, sn as ye, un as be, ut as xe, vt as Se, yt as Ce } from "./cells-CnomFgoS.js";
|
|
9
9
|
import { A as we, C as Te, M as Ee, b as De } from "./select-BButFi-d.js";
|
|
10
10
|
import { _ as Oe, f as ke, h as Ae, i as je, n as Me, t as Ne } from "./dropdown-menu-CP_qCYHC.js";
|
|
11
11
|
import { T as Pe, p as Fe } from "./toDate-Dwcg_x_5.js";
|
|
12
|
-
import { d as Ie, f as Le, i as Re, n as ze, t as Be, u as Ve } from "./process-output-
|
|
12
|
+
import { d as Ie, f as Le, i as Re, n as ze, t as Be, u as Ve } from "./process-output-tkY7JSAu.js";
|
|
13
13
|
import { t as He } from "./jsx-runtime-3BD1kT0s.js";
|
|
14
14
|
import { A as Ue, C as We, D as Ge, E as Ke, F as qe, L as Je, M as Ye, O as Xe, P as Ze, R as Qe, S as $e, T as et, V as tt, b as nt, j as rt, v as it, w as at, x as ot, y as st, z as ct } from "./use-restore-focus-BEM7sFWl.js";
|
|
15
15
|
import { n as lt } from "./error-banner-Da600cwz.js";
|
|
@@ -22,7 +22,7 @@ import { n as Ot, o as kt, r as At } from "./dist-CkTTIdBe.js";
|
|
|
22
22
|
import { n as jt } from "./dist-CrSP_H1M.js";
|
|
23
23
|
import { n as Mt, t as Nt } from "./esm-AMFssoNp.js";
|
|
24
24
|
import { t as Pt } from "./useAsyncData-Deh5kszT.js";
|
|
25
|
-
import { i as Ft, r as It, t as Lt } from "./error-entries-
|
|
25
|
+
import { i as Ft, r as It, t as Lt } from "./error-entries-uqmpke4z.js";
|
|
26
26
|
var Rt = M("ban", [["circle", {
|
|
27
27
|
cx: "12",
|
|
28
28
|
cy: "12",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as e } from "./button-CvjkwdSk.js";
|
|
2
2
|
import { t } from "./compiler-runtime-CldRdSsv.js";
|
|
3
|
-
import { H as n, V as r } from "./cells-
|
|
3
|
+
import { H as n, V as r } from "./cells-CnomFgoS.js";
|
|
4
4
|
import { C as i } from "./select-BButFi-d.js";
|
|
5
5
|
import { C as a, d as o, x as s, y as c } from "./toDate-Dwcg_x_5.js";
|
|
6
6
|
import { C as l, E as u, a as d, b as f } from "./useTheme-CRnjkku0.js";
|
|
@@ -18,7 +18,7 @@ function x() {
|
|
|
18
18
|
return e.warn("Failed to get version from mount config"), null;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
var S = x() || "0.25.2-
|
|
21
|
+
var S = x() || "0.25.2-dev109", C = u(S), w = u(!0);
|
|
22
22
|
u(null);
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/core/wasm/state.ts
|
|
@@ -3,16 +3,16 @@ import { _ as t, c as n, f as r, g as i, h as a, m as o, n as s, p as c, r as l,
|
|
|
3
3
|
import { t as d } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as f } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as p, n as m, r as h, t as g } from "./copy-icon-Ft7t9bqz.js";
|
|
6
|
-
import { $ as _, A as v, B as y, D as b, E as x, F as S, H as C, M as w, N as T, Q as E, S as D, T as O, V as k, W as A, X as j, Y as M, Z as N, _ as P, g as F, n as I, r as L, s as R, t as z, u as ee, v as te, w as B, y as ne, z as re } from "./html-to-image-
|
|
6
|
+
import { $ as _, A as v, B as y, D as b, E as x, F as S, H as C, M as w, N as T, Q as E, S as D, T as O, V as k, W as A, X as j, Y as M, Z as N, _ as P, g as F, n as I, r as L, s as R, t as z, u as ee, v as te, w as B, y as ne, z as re } from "./html-to-image-utL-jAuh.js";
|
|
7
7
|
import { a as ie, d as ae, h as V, n as oe, o as se, r as ce, t as H } from "./tooltip-BO1REbqs.js";
|
|
8
|
-
import { $t as le, C as ue, E as de, H as fe, Ht as pe, Jt as me, L as he, Lt as ge, M as _e, N as ve, St as ye, V as be, Vt as xe, W as Se, Xt as Ce, Y as we, Yt as Te, _ as Ee, a as De, an as Oe, at as ke, cn as Ae, d as je, ft as Me, g as Ne, h as Pe, hn as Fe, i as Ie, in as Le, j as Re, ln as ze, mn as Be, mt as Ve, nn as He, nt as Ue, pn as We, pt as Ge, rt as Ke, sn as qe, tt as Je, un as Ye, ut as Xe, wt as Ze, x as Qe } from "./cells-
|
|
8
|
+
import { $t as le, C as ue, E as de, H as fe, Ht as pe, Jt as me, L as he, Lt as ge, M as _e, N as ve, St as ye, V as be, Vt as xe, W as Se, Xt as Ce, Y as we, Yt as Te, _ as Ee, a as De, an as Oe, at as ke, cn as Ae, d as je, ft as Me, g as Ne, h as Pe, hn as Fe, i as Ie, in as Le, j as Re, ln as ze, mn as Be, mt as Ve, nn as He, nt as Ue, pn as We, pt as Ge, rt as Ke, sn as qe, tt as Je, un as Ye, ut as Xe, wt as Ze, x as Qe } from "./cells-CnomFgoS.js";
|
|
9
9
|
import { c as $e, i as et, r as tt } from "./useLifecycle-j7D9uD1o.js";
|
|
10
10
|
import { a as nt, i as rt, n as it, o as at, r as ot, t as st } from "./useDateFormatter-D8XruNGG.js";
|
|
11
11
|
import { t as ct } from "./check-EDwSwP89.js";
|
|
12
12
|
import { A as lt, C as ut, M as dt, O as ft, S as pt, _ as mt, b as ht, c as gt, d as _t, g as vt, h as yt, i as bt, l as xt, m as St, n as Ct, p as wt, s as Tt, t as Et, u as Dt, v as Ot, y as kt } from "./select-BButFi-d.js";
|
|
13
13
|
import { $ as At, $t as jt, A as Mt, At as Nt, B as Pt, Bt as Ft, Ct as It, D as Lt, Dt as Rt, E as zt, Et as Bt, F as Vt, Ft as Ht, G as Ut, Gt as Wt, H as Gt, Ht as Kt, I as qt, It as Jt, J as Yt, Jt as Xt, Kt as Zt, L as Qt, Lt as $t, M as en, Mt as tn, N as nn, Nt as rn, O as an, Ot as on, P as sn, Pt as cn, Q as ln, Qt as un, R as dn, Rt as fn, S as pn, St as mn, T as hn, Tt as gn, U as _n, Ut as vn, V as yn, Vt as bn, W as xn, Wt as Sn, X as Cn, Xt as wn, Y as Tn, Yt as En, Z as Dn, Zt as On, _ as kn, _n as An, _t as jn, a as Mn, at as Nn, b as Pn, bt as Fn, cn as In, ct as Ln, d as Rn, dn as zn, dt as Bn, et as Vn, f as Hn, fn as Un, ft as Wn, gn as Gn, gt as Kn, h as qn, hn as Jn, ht as Yn, i as Xn, in as Zn, it as Qn, j as $n, jt as er, k as tr, kt as nr, l as rr, lt as ir, mn as ar, mt as or, n as sr, nn as cr, nt as lr, o as ur, on as dr, ot as fr, pn as pr, pt as mr, qt as hr, rn as gr, rt as _r, s as vr, sn as yr, st as br, t as xr, tn as Sr, tt as Cr, u as wr, un as Tr, vn as Er, vt as Dr, w as Or, wt as kr, x as Ar, xt as jr, y as Mr, yt as Nr, z as Pr, zt as Fr } from "./dropdown-menu-CP_qCYHC.js";
|
|
14
14
|
import { C as Ir, a as Lr, b as Rr, c as zr, d as Br, i as Vr, n as Hr, o as Ur, p as Wr, r as Gr, s as Kr, t as qr, x as Jr } from "./toDate-Dwcg_x_5.js";
|
|
15
|
-
import { n as Yr, t as Xr } from "./ErrorBoundary-
|
|
15
|
+
import { n as Yr, t as Xr } from "./ErrorBoundary-BqyKvcCy.js";
|
|
16
16
|
import { t as Zr } from "./clsx-CoeGtWvn.js";
|
|
17
17
|
import { t as Qr } from "./react-dom-DUmH0GXv.js";
|
|
18
18
|
import { t as $r } from "./jsx-runtime-3BD1kT0s.js";
|
|
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
|
2
2
|
import { t } from "./react-sHtZdjeP.js";
|
|
3
3
|
import { t as n } from "./react-dom-DUmH0GXv.js";
|
|
4
4
|
import { c as r, l as i, u as a } from "./data-grid-types-BH_r7g7l.js";
|
|
5
|
-
import { a as o, i as s, n as c, r as l } from "./glide-data-editor-
|
|
5
|
+
import { a as o, i as s, n as c, r as l } from "./glide-data-editor-DSIJAiQj.js";
|
|
6
6
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/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",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as e, N as t, b as n, d as r, jt as i, kt as a } from "./cells-
|
|
1
|
+
import { At as e, N as t, b as n, d as r, jt as i, kt as a } from "./cells-CnomFgoS.js";
|
|
2
2
|
import { C as o } from "./select-BButFi-d.js";
|
|
3
3
|
//#region src/core/errors/error-entries.ts
|
|
4
4
|
function s(t) {
|
|
@@ -3,15 +3,15 @@ import { h as t, t as n } from "./button-CvjkwdSk.js";
|
|
|
3
3
|
import { t as r } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as i } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { t as a } from "./copy-icon-Ft7t9bqz.js";
|
|
6
|
-
import { Ct as o, Ft as s, H as c, L as l, Lt as u, V as d, d as f, un as p } from "./cells-
|
|
6
|
+
import { Ct as o, Ft as s, H as c, L as l, Lt as u, V as d, d as f, un as p } from "./cells-CnomFgoS.js";
|
|
7
7
|
import { b as m } from "./select-BButFi-d.js";
|
|
8
|
-
import { n as h, t as ee } from "./globals-
|
|
8
|
+
import { n as h, t as ee } from "./globals-CC5F6u7e.js";
|
|
9
9
|
import { t as g } from "./jsx-runtime-3BD1kT0s.js";
|
|
10
10
|
import { C as _, _ as te, i as v } from "./useTheme-CRnjkku0.js";
|
|
11
11
|
import { a as ne, i as re, n as ie, r as ae } from "./dialog-CEBFZNyc.js";
|
|
12
12
|
import { t as oe } from "./useAsyncData-Deh5kszT.js";
|
|
13
|
-
import { t as se } from "./code-visibility-
|
|
14
|
-
import { i as ce, n as le } from "./error-entries-
|
|
13
|
+
import { t as se } from "./code-visibility-5NC1aIxF.js";
|
|
14
|
+
import { i as ce, n as le } from "./error-entries-uqmpke4z.js";
|
|
15
15
|
//#region src/components/ui/skeleton.tsx
|
|
16
16
|
var y = /* @__PURE__ */ e(r(), 1), b = i(), x = g(), ue = (e) => {
|
|
17
17
|
let n = (0, b.c)(8), r, i;
|
|
@@ -6,7 +6,7 @@ import { i as s, n as c, r as l } from "./copy-icon-Ft7t9bqz.js";
|
|
|
6
6
|
import { C as u, c as d, i as f, n as p, s as m, t as h, x as g } from "./select-BButFi-d.js";
|
|
7
7
|
import { d as _, h as v, i as y, l as b, n as x, o as S, s as C, t as w, u as T } from "./dropdown-menu-CP_qCYHC.js";
|
|
8
8
|
import { c as E, d as D, l as O, n as k, o as A, s as ee, t as j, u as te } from "./glide-utils-DJyqh0EM.js";
|
|
9
|
-
import { n as ne, t as re } from "./ErrorBoundary-
|
|
9
|
+
import { n as ne, t as re } from "./ErrorBoundary-BqyKvcCy.js";
|
|
10
10
|
import { t as M } from "./react-dom-DUmH0GXv.js";
|
|
11
11
|
import { t as N } from "./jsx-runtime-3BD1kT0s.js";
|
|
12
12
|
import { t as ie } from "./label-BDKF3Afc.js";
|
|
@@ -7062,7 +7062,7 @@ function rs(e, t, n, r, i) {
|
|
|
7062
7062
|
}
|
|
7063
7063
|
//#endregion
|
|
7064
7064
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/node_modules/@glideapps/glide-data-grid/dist/esm/data-editor/data-editor.js
|
|
7065
|
-
var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-
|
|
7065
|
+
var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-D-TLNXor.js")), ss = 0;
|
|
7066
7066
|
function cs(e) {
|
|
7067
7067
|
return (0, is.default)((0, as.default)((0, as.default)(e).filter((e) => e.span !== void 0).map((e) => (0, Za.default)((e.span?.[0] ?? 0) + 1, (e.span?.[1] ?? 0) + 1))));
|
|
7068
7068
|
}
|
|
@@ -9293,7 +9293,7 @@ function Vs(e, t, n, r, i) {
|
|
|
9293
9293
|
}
|
|
9294
9294
|
//#endregion
|
|
9295
9295
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/node_modules/@glideapps/glide-data-grid/dist/esm/cells/number-cell.js
|
|
9296
|
-
var Hs = K.lazy(async () => await import("./number-overlay-editor-
|
|
9296
|
+
var Hs = K.lazy(async () => await import("./number-overlay-editor-BVm0umyX.js")), Us = {
|
|
9297
9297
|
getAccessibilityString: (e) => e.data?.toString() ?? "",
|
|
9298
9298
|
kind: W.Number,
|
|
9299
9299
|
needsHover: (e) => e.hoverEffect === !0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h as e } from "./tooltip-BO1REbqs.js";
|
|
2
2
|
import { _ as t } from "./useTheme-CRnjkku0.js";
|
|
3
|
-
import { r as n } from "./code-visibility-
|
|
3
|
+
import { r as n } from "./code-visibility-5NC1aIxF.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",
|
|
@@ -5,7 +5,7 @@ import { t as l } from "./compiler-runtime-CldRdSsv.js";
|
|
|
5
5
|
import { n as u, t as d } from "./copy-icon-Ft7t9bqz.js";
|
|
6
6
|
import { a as f, c as p, l as m, s as h, t as g } from "./chunk-YOKDWASO-DPZk8vhS.js";
|
|
7
7
|
import { c as _, h as v, l as y, s as b, t as x, u as ee } from "./tooltip-BO1REbqs.js";
|
|
8
|
-
import { A as te, E as ne, G as re, Nt as ie, O as ae, R as oe, St as se, Z as ce, Zt as le, _t as ue, en as de, et as fe, gt as pe, h as me, ht as he, lt as ge, s as _e, t as ve, vt as ye, xt as be, yt as xe, z as Se } from "./cells-
|
|
8
|
+
import { A as te, E as ne, G as re, Nt as ie, O as ae, R as oe, St as se, Z as ce, Zt as le, _t as ue, en as de, et as fe, gt as pe, h as me, ht as he, lt as ge, s as _e, t as ve, vt as ye, xt as be, yt as xe, z as Se } from "./cells-CnomFgoS.js";
|
|
9
9
|
import { M as Ce, O as we, k as Te } from "./select-BButFi-d.js";
|
|
10
10
|
import { dt as Ee, q as De } from "./dropdown-menu-CP_qCYHC.js";
|
|
11
11
|
import { g as Oe, x as ke } from "./toDate-Dwcg_x_5.js";
|
package/dist/main.js
CHANGED
|
@@ -3,20 +3,20 @@ import { _ as a, c as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p,
|
|
|
3
3
|
import { t as v } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as y } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as b, n as x, r as S, t as C } from "./copy-icon-Ft7t9bqz.js";
|
|
6
|
-
import { C as w, F as T, G as E, I as D, J as O, K as k, L as A, P as j, R as M, X as N, Z as P, _ as F, a as I, b as L, g as R, i as z, j as B, k as ee, n as te, o as ne, q as re, v as ie, y as ae } from "./html-to-image-
|
|
6
|
+
import { C as w, F as T, G as E, I as D, J as O, K as k, L as A, P as j, R as M, X as N, Z as P, _ as F, a as I, b as L, g as R, i as z, j as B, k as ee, n as te, o as ne, q as re, v as ie, y as ae } from "./html-to-image-utL-jAuh.js";
|
|
7
7
|
import { a as oe, d as se, f as ce, h as V, i as le, n as ue, o as de, r as fe, t as pe } from "./tooltip-BO1REbqs.js";
|
|
8
|
-
import { $ as me, $t as he, B as ge, Bt as _e, C as ve, Ct as ye, D as be, Dt as xe, Et as Se, F as Ce, G as we, Gt as Te, Ht as Ee, I as De, J as Oe, Jt as ke, Kt as Ae, L as je, O as Me, Ot as Ne, P as Pe, Pt as Fe, Q as Ie, Qt as Le, Rt as Re, S as ze, St as Be, T as Ve, Tt as He, U as Ue, W as We, Wt as Ge, bt as Ke, c as qe, cn as Je, ct as Ye, d as Xe, dn as Ze, dt as Qe, en as $e, f as et, fn as tt, ft as nt, g as rt, gt as it, h as at, hn as ot, k as st, l as ct, ln as lt, m as ut, mn as dt, n as ft, o as pt, on as mt, ot as ht, p as gt, q as _t, qt as vt, r as yt, rn as bt, rt as xt, sn as St, st as Ct, tn as wt, u as Tt, v as Et, w as Dt, wt as Ot, zt as kt } from "./cells-
|
|
8
|
+
import { $ as me, $t as he, B as ge, Bt as _e, C as ve, Ct as ye, D as be, Dt as xe, Et as Se, F as Ce, G as we, Gt as Te, Ht as Ee, I as De, J as Oe, Jt as ke, Kt as Ae, L as je, O as Me, Ot as Ne, P as Pe, Pt as Fe, Q as Ie, Qt as Le, Rt as Re, S as ze, St as Be, T as Ve, Tt as He, U as Ue, W as We, Wt as Ge, bt as Ke, c as qe, cn as Je, ct as Ye, d as Xe, dn as Ze, dt as Qe, en as $e, f as et, fn as tt, ft as nt, g as rt, gt as it, h as at, hn as ot, k as st, l as ct, ln as lt, m as ut, mn as dt, n as ft, o as pt, on as mt, ot as ht, p as gt, q as _t, qt as vt, r as yt, rn as bt, rt as xt, sn as St, st as Ct, tn as wt, u as Tt, v as Et, w as Dt, wt as Ot, zt as kt } from "./cells-CnomFgoS.js";
|
|
9
9
|
import { D as At, E as jt, O as Mt, S as Nt, T as Pt, _ as Ft, a as It, c as Lt, d as Rt, f as zt, g as Bt, h as Vt, i as Ht, l as Ut, m as Wt, n as Gt, o as Kt, p as qt, r as Jt, s as Yt, t as Xt, u as Zt, v as Qt, w as $t, x as en, y as tn } from "./spec-BwarBpUJ.js";
|
|
10
|
-
import { $t as nn, A as rn, At as an, B as on, Bt as sn, C as cn, Ct as ln, D as un, Dt as dn, E as fn, Et as pn, F as mn, Ft as hn, G as gn, Gt as _n, H as vn, Ht as yn, I as bn, It as xn, J as Sn, Jt as Cn, K as wn, Kt as Tn, L as En, Lt as Dn, M as On, Mt as kn, N as An, Nt as jn, O as Mn, Ot as Nn, P as Pn, Pt as Fn, Qt as In, R as Ln, Rt as Rn, S as zn, St as Bn, T as Vn, Tt as Hn, U as Un, Ut as Wn, V as Gn, Vt as Kn, W as qn, Wt as Jn, X as Yn, Xt as Xn, Y as Zn, Yt as Qn, Zt as $n, _ as er, _t as tr, an as nr, at as rr, b as ir, c as ar, cn as or, ct as sr, d as cr, dn as lr, dt as ur, en as dr, et as fr, f as pr, fn as mr, ft as hr, g as gr, gt as _r, h as vr, hn as yr, ht as br, in as xr, it as Sr, j as Cr, jt as wr, k as Tr, kt as Er, ln as Dr, lt as Or, m as kr, mn as Ar, mt as jr, nn as Mr, nt as Nr, ot as Pr, p as Fr, pn as Ir, pt as Lr, q as Rr, qt as zr, r as Br, rn as Vr, rt as Hr, sn as Ur, st as Wr, t as Gr, tn as Kr, tt as qr, u as Jr, un as Yr, ut as Xr, v as Zr, vt as Qr, w as $r, wt as ei, x as ti, y as ni, yt as ri, z as ii, zt as ai } from "./common-
|
|
10
|
+
import { $t as nn, A as rn, At as an, B as on, Bt as sn, C as cn, Ct as ln, D as un, Dt as dn, E as fn, Et as pn, F as mn, Ft as hn, G as gn, Gt as _n, H as vn, Ht as yn, I as bn, It as xn, J as Sn, Jt as Cn, K as wn, Kt as Tn, L as En, Lt as Dn, M as On, Mt as kn, N as An, Nt as jn, O as Mn, Ot as Nn, P as Pn, Pt as Fn, Qt as In, R as Ln, Rt as Rn, S as zn, St as Bn, T as Vn, Tt as Hn, U as Un, Ut as Wn, V as Gn, Vt as Kn, W as qn, Wt as Jn, X as Yn, Xt as Xn, Y as Zn, Yt as Qn, Zt as $n, _ as er, _t as tr, an as nr, at as rr, b as ir, c as ar, cn as or, ct as sr, d as cr, dn as lr, dt as ur, en as dr, et as fr, f as pr, fn as mr, ft as hr, g as gr, gt as _r, h as vr, hn as yr, ht as br, in as xr, it as Sr, j as Cr, jt as wr, k as Tr, kt as Er, ln as Dr, lt as Or, m as kr, mn as Ar, mt as jr, nn as Mr, nt as Nr, ot as Pr, p as Fr, pn as Ir, pt as Lr, q as Rr, qt as zr, r as Br, rn as Vr, rt as Hr, sn as Ur, st as Wr, t as Gr, tn as Kr, tt as qr, u as Jr, un as Yr, ut as Xr, v as Zr, vt as Qr, w as $r, wt as ei, x as ti, y as ni, yt as ri, z as ii, zt as ai } from "./common-B6A_WCjp.js";
|
|
11
11
|
import { c as oi, i as si, n as ci, o as li, t as ui } from "./useLifecycle-j7D9uD1o.js";
|
|
12
12
|
import { t as di } from "./check-EDwSwP89.js";
|
|
13
13
|
import { A as fi, C as pi, D as mi, E as hi, M as gi, O as _i, S as vi, T as yi, a as bi, b as xi, c as Si, i as Ci, k as wi, l as Ti, n as Ei, o as Di, r as Oi, s as ki, t as Ai, w as ji, x as Mi } from "./select-BButFi-d.js";
|
|
14
14
|
import { $ as Ni, C as Pi, Et as Fi, J as Ii, K as Li, R as Ri, S as zi, U as Bi, Y as Vi, _ as Hi, _n as Ui, a as Wi, c as Gi, f as Ki, g as qi, h as Ji, i as Yi, kt as Xi, m as Zi, mt as Qi, n as $i, p as ea, q as ta, r as na, s as ra, t as ia, ut as aa, v as oa, vn as sa, x as ca, z as la } from "./dropdown-menu-CP_qCYHC.js";
|
|
15
15
|
import { C as ua, S as da, T as fa, _ as pa, c as ma, d as ha, f as ga, g as _a, h as va, m as ya, u as ba, x as xa, y as Sa } from "./toDate-Dwcg_x_5.js";
|
|
16
|
-
import { a as Ca, c as wa, d as Ta, f as Ea, i as Da, l as Oa, n as ka, o as Aa, r as ja, s as Ma, t as Na } from "./process-output-
|
|
16
|
+
import { a as Ca, c as wa, d as Ta, f as Ea, i as Da, l as Oa, n as ka, o as Aa, r as ja, s as Ma, t as Na } from "./process-output-tkY7JSAu.js";
|
|
17
17
|
import { a as Pa, c as Fa, d as Ia, i as La, l as Ra, r as za, u as Ba } from "./glide-utils-DJyqh0EM.js";
|
|
18
|
-
import { n as Va, t as Ha } from "./ErrorBoundary-
|
|
19
|
-
import { n as Ua, t as Wa } from "./globals-
|
|
18
|
+
import { n as Va, t as Ha } from "./ErrorBoundary-BqyKvcCy.js";
|
|
19
|
+
import { n as Ua, t as Wa } from "./globals-CC5F6u7e.js";
|
|
20
20
|
import { t as Ga } from "./react-dom-DUmH0GXv.js";
|
|
21
21
|
import { t as Ka } from "./jsx-runtime-3BD1kT0s.js";
|
|
22
22
|
import { B as qa, C as H, Ct as Ja, D as Ya, E as Xa, F as U, G as Za, H as Qa, I as $a, L as eo, M as W, N as to, O as no, P as ro, Q as io, R as ao, S as G, St as oo, Tt as so, U as co, W as lo, Y as uo, Z as fo, _ as po, _t as mo, a as ho, b as go, bt as _o, c as vo, d as yo, f as bo, g as xo, h as So, ht as Co, i as wo, j as K, k as To, l as Eo, m as Do, n as Oo, o as ko, p as Ao, r as jo, s as Mo, u as No, ut as Po, v as Fo, vt as Io, w as Lo, wt as Ro, x as zo, xt as Bo, y as Vo, yt as Ho } from "./use-restore-focus-BEM7sFWl.js";
|
|
@@ -39,7 +39,7 @@ import { t as Ms } from "./useAsyncData-Deh5kszT.js";
|
|
|
39
39
|
import { i as Ns, n as Ps, r as Fs } from "./formats-DLtvJPnj.js";
|
|
40
40
|
import { M as Is, N as Ls } from "./vega-loader.browser-DNST6uVf.js";
|
|
41
41
|
import { a as Rs, n as zs } from "./loader-BQOfjTIJ.js";
|
|
42
|
-
import { c as Bs, d as Vs, i as Hs, l as Us, o as Ws, s as Gs, t as Ks, u as qs } from "./code-visibility-
|
|
42
|
+
import { c as Bs, d as Vs, i as Hs, l as Us, o as Ws, s as Gs, t as Ks, u as qs } from "./code-visibility-5NC1aIxF.js";
|
|
43
43
|
import { t as Js } from "./useDeepCompareMemoize-DXwzRINI.js";
|
|
44
44
|
import { t as Ys } from "./esm-D2gTsXEV.js";
|
|
45
45
|
//#region ../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
|
|
@@ -10067,7 +10067,7 @@ var LS = (e) => {
|
|
|
10067
10067
|
output: t
|
|
10068
10068
|
};
|
|
10069
10069
|
} };
|
|
10070
|
-
} }, US = J.lazy(() => import("./chat-ui-
|
|
10070
|
+
} }, US = J.lazy(() => import("./chat-ui-DIoRDU4g.js").then((e) => ({ default: e.Chatbot }))), WS = G(W({
|
|
10071
10071
|
id: U(),
|
|
10072
10072
|
role: Fo([
|
|
10073
10073
|
"system",
|
|
@@ -10533,7 +10533,7 @@ function VC(e, t) {
|
|
|
10533
10533
|
}
|
|
10534
10534
|
//#endregion
|
|
10535
10535
|
//#region src/plugins/impl/DataEditorPlugin.tsx
|
|
10536
|
-
var HC = J.lazy(() => import("./glide-data-editor-
|
|
10536
|
+
var HC = J.lazy(() => import("./glide-data-editor-DSIJAiQj.js").then((e) => e.t)), UC = wS("marimo-data-editor", { cssStyles: [qS] }).withData(W({
|
|
10537
10537
|
initialValue: W({ edits: G(W({
|
|
10538
10538
|
rowIdx: K(),
|
|
10539
10539
|
columnId: U(),
|
|
@@ -30099,7 +30099,7 @@ function OR(e) {
|
|
|
30099
30099
|
}
|
|
30100
30100
|
//#endregion
|
|
30101
30101
|
//#region src/components/editor/renderers/slides-layout/slides-layout.tsx
|
|
30102
|
-
var kR = J.lazy(() => import("./reveal-component-
|
|
30102
|
+
var kR = J.lazy(() => import("./reveal-component-b9kFH1m4.js")), AR = (e) => {
|
|
30103
30103
|
let t = (0, X.c)(33), { layout: n, setLayout: r, cells: i, mode: a } = e, o = ns(Sa), s = a === "read" || o, c = ns(gt) > 1, [l, u] = (0, J.useState)(null), d;
|
|
30104
30104
|
t[0] !== i || t[1] !== n ? (d = EP(i, n), t[0] = i, t[1] = n, t[2] = d) : d = t[2];
|
|
30105
30105
|
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-Cb76FRpK.js";
|
|
2
2
|
import { t } from "./react-sHtZdjeP.js";
|
|
3
|
-
import { a as n } from "./glide-data-editor-
|
|
3
|
+
import { a as n } from "./glide-data-editor-DSIJAiQj.js";
|
|
4
4
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_aca11a353ce3b112922852200b9c160f/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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as e } from "./html-to-image-
|
|
1
|
+
import { O as e } from "./html-to-image-utL-jAuh.js";
|
|
2
2
|
import { h as t } from "./tooltip-BO1REbqs.js";
|
|
3
|
-
import { b as n, y as r } from "./cells-
|
|
3
|
+
import { b as n, y as r } from "./cells-CnomFgoS.js";
|
|
4
4
|
import { b as i } from "./select-BButFi-d.js";
|
|
5
5
|
import { n as a } from "./semaphore-89jsoHtS.js";
|
|
6
6
|
var o = t("file", [["path", {
|
|
@@ -3,15 +3,15 @@ import { c as t, g as n, h as r, m as i, t as a } from "./button-CvjkwdSk.js";
|
|
|
3
3
|
import { t as o } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { h as c, t as l } from "./tooltip-BO1REbqs.js";
|
|
6
|
-
import { w as u } from "./cells-
|
|
7
|
-
import { $ as d, Q as f, Z as p, an as m, i as h, l as g, ln as _, n as v, on as y, r as b, t as x, u as S } from "./common-
|
|
6
|
+
import { w as u } from "./cells-CnomFgoS.js";
|
|
7
|
+
import { $ as d, Q as f, Z as p, an as m, i as h, l as g, ln as _, n as v, on as y, r as b, t as x, u as S } from "./common-B6A_WCjp.js";
|
|
8
8
|
import { M as C } from "./select-BButFi-d.js";
|
|
9
9
|
import { q as ee } from "./dropdown-menu-CP_qCYHC.js";
|
|
10
10
|
import { y as w } from "./toDate-Dwcg_x_5.js";
|
|
11
11
|
import { t as T } from "./jsx-runtime-3BD1kT0s.js";
|
|
12
12
|
import { q as E } from "./use-restore-focus-BEM7sFWl.js";
|
|
13
13
|
import { A as D, C as O, b as k } from "./useTheme-CRnjkku0.js";
|
|
14
|
-
import { a as A, n as te, t as ne } from "./code-visibility-
|
|
14
|
+
import { a as A, n as te, t as ne } from "./code-visibility-5NC1aIxF.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
var j = c("sticky-note", [["path", {
|
|
17
17
|
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
|
@@ -178,6 +178,22 @@ function documentSnapshot(state: NotebookState) {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
describe("document round-trip", () => {
|
|
181
|
+
it("applies a server transaction that deletes every cell", () => {
|
|
182
|
+
setup("a", "b");
|
|
183
|
+
applyTransactionChanges(
|
|
184
|
+
[
|
|
185
|
+
...replica.cellIds.inOrderIds.map((cellId) => ({
|
|
186
|
+
type: "delete-cell" as const,
|
|
187
|
+
cellId,
|
|
188
|
+
})),
|
|
189
|
+
{ type: "reorder-cells", cellIds: [] },
|
|
190
|
+
],
|
|
191
|
+
replicaActions,
|
|
192
|
+
() => replica.cellIds.inOrderIds,
|
|
193
|
+
);
|
|
194
|
+
expect(documentSnapshot(replica)).toEqual([]);
|
|
195
|
+
});
|
|
196
|
+
|
|
181
197
|
it("initial setup converges", () => {
|
|
182
198
|
setup("a", "b", "c");
|
|
183
199
|
expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import type { CompletionContext } from "@codemirror/autocomplete";
|
|
4
4
|
import { python } from "@codemirror/lang-python";
|
|
5
|
+
import { StreamLanguage } from "@codemirror/language";
|
|
6
|
+
import { stexMath } from "@codemirror/legacy-modes/mode/stex";
|
|
5
7
|
import { EditorState } from "@codemirror/state";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
+
import { classHighlighter, highlightTree } from "@lezer/highlight";
|
|
9
|
+
import { parser as markdownParser } from "@lezer/markdown";
|
|
10
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
8
11
|
import { cellId, variableName } from "@/__tests__/branded";
|
|
9
12
|
import { store } from "@/core/state/jotai";
|
|
10
13
|
import { variablesAtom } from "@/core/variables/state";
|
|
11
14
|
import { parsePython, variableCompletionSource } from "../embedded-python";
|
|
15
|
+
import { parseLatex } from "../latex";
|
|
12
16
|
|
|
13
17
|
const IS_ACTIVE = () => true;
|
|
14
18
|
|
|
@@ -23,25 +27,133 @@ describe("parsePython", () => {
|
|
|
23
27
|
]);
|
|
24
28
|
});
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
const cases = [
|
|
31
|
+
"{math.exp(3)}",
|
|
32
|
+
'${math.exp(3) + len("$}")} $',
|
|
33
|
+
"${math.exp(3)} + {math.sin(3)}$",
|
|
34
|
+
"${math.exp(3)}$",
|
|
35
|
+
"$$ {math.exp(3)} $$",
|
|
36
|
+
String.raw`\({math.exp(3)}\)`,
|
|
37
|
+
String.raw`\[{math.exp(3)}\]`,
|
|
38
|
+
String.raw`\\({math.exp(3)}\\)`,
|
|
39
|
+
String.raw`\\[{math.exp(3)}\\]`,
|
|
40
|
+
String.raw`$\frac{{{math.exp(3)}}}{{2}}$`,
|
|
41
|
+
String.raw`$\{math.exp(3)}$`,
|
|
42
|
+
'${ {"}": math.exp(3)} }$',
|
|
43
|
+
"${math.exp(3):{width}.{precision}f}$",
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
function highlightedProperties(doc: string, prefix: string) {
|
|
47
|
+
const parser = markdownParser.configure([
|
|
48
|
+
parseLatex(StreamLanguage.define(stexMath).parser),
|
|
49
|
+
parsePython(python().language.parser, () => prefix.includes("f")),
|
|
50
|
+
]);
|
|
51
|
+
const properties: string[] = [];
|
|
52
|
+
highlightTree(parser.parse(doc), classHighlighter, (from, to, classes) => {
|
|
53
|
+
if (classes.split(" ").includes("tok-propertyName")) {
|
|
54
|
+
properties.push(doc.slice(from, to));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return properties;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
it.each(["f", "rf", "fr"])(
|
|
61
|
+
"highlights interpolation with %s strings",
|
|
62
|
+
(prefix) => {
|
|
63
|
+
for (const doc of cases) {
|
|
64
|
+
expect(highlightedProperties(doc, prefix)).toEqual(
|
|
65
|
+
doc.includes("math.sin") ? ["exp", "sin"] : ["exp"],
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
it.each(["", "r"])("does not interpolate %s strings", (prefix) => {
|
|
72
|
+
for (const doc of cases) {
|
|
73
|
+
expect(highlightedProperties(doc, prefix)).toEqual([]);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("parses replacement boundaries once for a paragraph with many interpolations", () => {
|
|
27
78
|
const pythonParser = python().language.parser;
|
|
28
|
-
const
|
|
79
|
+
const parse = vi.spyOn(pythonParser, "parse");
|
|
80
|
+
try {
|
|
81
|
+
const doc = "{math.exp(3)} ".repeat(1000);
|
|
82
|
+
const parser = markdownParser.configure([
|
|
83
|
+
parseLatex(StreamLanguage.define(stexMath).parser),
|
|
84
|
+
parsePython(pythonParser, IS_ACTIVE),
|
|
85
|
+
]);
|
|
86
|
+
const properties: string[] = [];
|
|
87
|
+
highlightTree(
|
|
88
|
+
parser.parse(doc),
|
|
89
|
+
classHighlighter,
|
|
90
|
+
(from, to, classes) => {
|
|
91
|
+
if (classes.split(" ").includes("tok-propertyName")) {
|
|
92
|
+
properties.push(doc.slice(from, to));
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
expect(properties).toEqual(Array.from({ length: 1000 }, () => "exp"));
|
|
97
|
+
expect(parse).toHaveBeenCalledTimes(1);
|
|
98
|
+
} finally {
|
|
99
|
+
parse.mockRestore();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
29
102
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
103
|
+
it("preserves raw backslashes between replacements", () => {
|
|
104
|
+
expect(
|
|
105
|
+
highlightedProperties(String.raw`{math.exp(3)} \N{math.sin(3)}`, "rf"),
|
|
106
|
+
).toEqual(["exp", "sin"]);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("finds replacements after triple quotes in markdown text", () => {
|
|
110
|
+
expect(
|
|
111
|
+
highlightedProperties('{math.exp(3)} """ {math.sin(3)}', "f"),
|
|
112
|
+
).toEqual(["exp", "sin"]);
|
|
113
|
+
});
|
|
40
114
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
115
|
+
it("keeps replacement positions local to each paragraph", () => {
|
|
116
|
+
expect(
|
|
117
|
+
highlightedProperties("${math.exp(3)}$\n\n${math.sin(3)}$", "rf"),
|
|
118
|
+
).toEqual(["exp", "sin"]);
|
|
44
119
|
});
|
|
120
|
+
|
|
121
|
+
it("preserves LaTeX highlighting around Python replacements", () => {
|
|
122
|
+
const doc = String.raw`$\frac{{{math.exp(3)}}}{{2}} + \alpha$`;
|
|
123
|
+
const parser = markdownParser.configure([
|
|
124
|
+
parseLatex(StreamLanguage.define(stexMath).parser),
|
|
125
|
+
parsePython(python().language.parser, IS_ACTIVE),
|
|
126
|
+
]);
|
|
127
|
+
const highlighted: string[] = [];
|
|
128
|
+
highlightTree(parser.parse(doc), classHighlighter, (from, to) => {
|
|
129
|
+
highlighted.push(doc.slice(from, to));
|
|
130
|
+
});
|
|
131
|
+
expect(highlighted).toEqual(
|
|
132
|
+
expect.arrayContaining(["\\frac", "exp", "\\alpha"]),
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it.each(["${math.exp(3)$", "${math.exp(3)", "${{math.exp(3)}$"])(
|
|
137
|
+
"does not treat incomplete or escaped braces as replacements: %s",
|
|
138
|
+
(doc) => {
|
|
139
|
+
expect(highlightedProperties(doc, "f")).toEqual([]);
|
|
140
|
+
},
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
it.each(["f", "rf", "fr"])(
|
|
144
|
+
"keeps doubled braces literal in %s strings",
|
|
145
|
+
(prefix) => {
|
|
146
|
+
for (const doc of [
|
|
147
|
+
"{{math.exp(3)}}",
|
|
148
|
+
"${{math.exp(3)}}$",
|
|
149
|
+
"$ {{{{math.exp(3)}}}} $",
|
|
150
|
+
String.raw`$\{{math.exp(3)}}$`,
|
|
151
|
+
String.raw`$\frac{{1}}{{2}}$`,
|
|
152
|
+
]) {
|
|
153
|
+
expect(highlightedProperties(doc, prefix)).toEqual([]);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
);
|
|
45
157
|
});
|
|
46
158
|
|
|
47
159
|
describe("variableCompletionSource", () => {
|
|
@@ -72,10 +184,10 @@ describe("variableCompletionSource", () => {
|
|
|
72
184
|
const context: Partial<CompletionContext> = {
|
|
73
185
|
pos: 8,
|
|
74
186
|
explicit: false,
|
|
75
|
-
matchBefore: (
|
|
187
|
+
matchBefore: (_expr: RegExp) => ({ from: 7, to: 8, text: "v" }),
|
|
76
188
|
state,
|
|
77
189
|
aborted: false,
|
|
78
|
-
tokenBefore: (
|
|
190
|
+
tokenBefore: (_types: readonly string[]) => null,
|
|
79
191
|
};
|
|
80
192
|
|
|
81
193
|
const result = variableCompletionSource(context as CompletionContext);
|
|
@@ -92,10 +204,10 @@ describe("variableCompletionSource", () => {
|
|
|
92
204
|
const context: Partial<CompletionContext> = {
|
|
93
205
|
pos: 7,
|
|
94
206
|
explicit: false,
|
|
95
|
-
matchBefore: (
|
|
207
|
+
matchBefore: (_expr: RegExp) => ({ from: 6, to: 7, text: "v" }),
|
|
96
208
|
state,
|
|
97
209
|
aborted: false,
|
|
98
|
-
tokenBefore: (
|
|
210
|
+
tokenBefore: (_types: readonly string[]) => null,
|
|
99
211
|
};
|
|
100
212
|
|
|
101
213
|
const result = variableCompletionSource(context as CompletionContext);
|
|
@@ -110,10 +222,10 @@ describe("variableCompletionSource", () => {
|
|
|
110
222
|
const context: Partial<CompletionContext> = {
|
|
111
223
|
pos: 13,
|
|
112
224
|
explicit: false,
|
|
113
|
-
matchBefore: (
|
|
225
|
+
matchBefore: (_expr: RegExp) => ({ from: 12, to: 13, text: "v" }),
|
|
114
226
|
state,
|
|
115
227
|
aborted: false,
|
|
116
|
-
tokenBefore: (
|
|
228
|
+
tokenBefore: (_types: readonly string[]) => null,
|
|
117
229
|
};
|
|
118
230
|
|
|
119
231
|
const result = variableCompletionSource(context as CompletionContext);
|
|
@@ -131,7 +243,7 @@ describe("variableCompletionSource", () => {
|
|
|
131
243
|
matchBefore: () => null,
|
|
132
244
|
state,
|
|
133
245
|
aborted: false,
|
|
134
|
-
tokenBefore: (
|
|
246
|
+
tokenBefore: (_types: readonly string[]) => null,
|
|
135
247
|
};
|
|
136
248
|
|
|
137
249
|
const result = variableCompletionSource(context as CompletionContext);
|
|
@@ -146,10 +258,10 @@ describe("variableCompletionSource", () => {
|
|
|
146
258
|
const context: Partial<CompletionContext> = {
|
|
147
259
|
pos: 9,
|
|
148
260
|
explicit: false,
|
|
149
|
-
matchBefore: (
|
|
261
|
+
matchBefore: (_expr: RegExp) => ({ from: 8, to: 9, text: "v" }),
|
|
150
262
|
state,
|
|
151
263
|
aborted: false,
|
|
152
|
-
tokenBefore: (
|
|
264
|
+
tokenBefore: (_types: readonly string[]) => null,
|
|
153
265
|
};
|
|
154
266
|
|
|
155
267
|
const result = variableCompletionSource(context as CompletionContext);
|
|
@@ -16,11 +16,8 @@ import { getVariableCompletions } from "../../completion/variable-completions";
|
|
|
16
16
|
const PYTHON = "Python";
|
|
17
17
|
|
|
18
18
|
const OPEN_BRACE = 123; // {
|
|
19
|
-
const CLOSE_BRACE = 125; // }
|
|
20
19
|
const DELIMITER_LENGTH = 1;
|
|
21
20
|
|
|
22
|
-
const MARK = { mark: `${PYTHON}Mark`, resolve: PYTHON };
|
|
23
|
-
|
|
24
21
|
/**
|
|
25
22
|
* Define a Python code block parser for Markdown.
|
|
26
23
|
*
|
|
@@ -31,6 +28,11 @@ export function parsePython(
|
|
|
31
28
|
pythonParser: Parser,
|
|
32
29
|
isActivated: () => boolean,
|
|
33
30
|
): MarkdownConfig {
|
|
31
|
+
const replacements = new WeakMap<
|
|
32
|
+
InlineContext,
|
|
33
|
+
{ ends: Map<number, number>; parsedTo: number }
|
|
34
|
+
>();
|
|
35
|
+
|
|
34
36
|
const defineNodes = [
|
|
35
37
|
{ name: PYTHON, style: tags.emphasis },
|
|
36
38
|
{ name: `${PYTHON}Mark`, style: tags.processingInstruction },
|
|
@@ -41,26 +43,58 @@ export function parsePython(
|
|
|
41
43
|
parseInline: [
|
|
42
44
|
{
|
|
43
45
|
name: PYTHON,
|
|
46
|
+
before: "Escape",
|
|
44
47
|
parse(cx: InlineContext, next: number, pos: number): number {
|
|
45
48
|
if (!isActivated()) {
|
|
46
49
|
return -1;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
// A backslash does not escape a brace in Python f-strings.
|
|
53
|
+
if (next === 92 && cx.char(pos + 1) === OPEN_BRACE) {
|
|
54
|
+
return pos + 1;
|
|
55
|
+
}
|
|
56
|
+
if (next !== OPEN_BRACE) {
|
|
50
57
|
return -1;
|
|
51
58
|
}
|
|
59
|
+
if (cx.char(pos + 1) === OPEN_BRACE) {
|
|
60
|
+
return pos + 2;
|
|
61
|
+
}
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
if (
|
|
63
|
+
let cached = replacements.get(cx);
|
|
64
|
+
if (!cached || pos >= cached.parsedTo) {
|
|
65
|
+
// Cache all replacements so each brace does not reparse the paragraph.
|
|
66
|
+
// Keep Markdown backslashes from consuming braces as Python escapes.
|
|
67
|
+
const prefix = 'rf"""';
|
|
68
|
+
const tree = pythonParser.parse(
|
|
69
|
+
`${prefix}${cx.slice(pos, cx.end)}\n"""`,
|
|
70
|
+
);
|
|
71
|
+
const formatString = tree.topNode
|
|
72
|
+
.getChild("ExpressionStatement")
|
|
73
|
+
?.getChild("FormatString");
|
|
74
|
+
const offset = pos - prefix.length;
|
|
75
|
+
const ends = new Map<number, number>();
|
|
76
|
+
for (const replacement of formatString?.getChildren(
|
|
77
|
+
"FormatReplacement",
|
|
78
|
+
) ?? []) {
|
|
79
|
+
if (replacement.lastChild?.name === "}") {
|
|
80
|
+
ends.set(offset + replacement.from, offset + replacement.to);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
cached = {
|
|
84
|
+
ends,
|
|
85
|
+
parsedTo: formatString ? offset + formatString.to : cx.end,
|
|
86
|
+
};
|
|
87
|
+
replacements.set(cx, cached);
|
|
88
|
+
}
|
|
89
|
+
const end = cached.ends.get(pos);
|
|
90
|
+
if (end === undefined) {
|
|
55
91
|
return -1;
|
|
56
92
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
next === OPEN_BRACE,
|
|
63
|
-
next === CLOSE_BRACE,
|
|
93
|
+
return cx.addElement(
|
|
94
|
+
cx.elt(PYTHON, pos, end, [
|
|
95
|
+
cx.elt(`${PYTHON}Mark`, pos, pos + 1),
|
|
96
|
+
cx.elt(`${PYTHON}Mark`, end - 1, end),
|
|
97
|
+
]),
|
|
64
98
|
);
|
|
65
99
|
},
|
|
66
100
|
},
|