@marimo-team/islands 0.25.3-dev209 → 0.25.3-dev210
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/{ConnectedDataExplorerComponent-ApTYh0V3.js → ConnectedDataExplorerComponent-D6RHJV8D.js} +114 -112
- package/dist/{ErrorBoundary-B1QlXN-y.js → ErrorBoundary-VruaQLnK.js} +10 -10
- package/dist/{abnfDiagram-VCTEODGH-uo9xhZY0.js → abnfDiagram-VCTEODGH-0q7Lbmii.js} +2 -2
- package/dist/{any-language-editor-BVFHDDQ3.js → any-language-editor-jGaR0EAo.js} +5 -5
- package/dist/{architectureDiagram-5GKGNRK7-Hz6eyeOD.js → architectureDiagram-5GKGNRK7-1PydKPmE.js} +1 -1
- package/dist/{button-BQRdqQi1.js → button-B6RjDKJx.js} +54 -51
- package/dist/{capabilities-C2QUNRXi.js → capabilities-CkVzWJEX.js} +1 -1
- package/dist/{chat-ui-BTA1I5i1.js → chat-ui-B5pH_aXk.js} +414 -413
- package/dist/{check-C9Mp9eCK.js → check-Z_vtI3OL.js} +1 -1
- package/dist/{chunk-IMKFNOWR-DBM2i23k.js → chunk-IMKFNOWR-DEzZZ1Zc.js} +1 -1
- package/dist/{chunk-SHT3W25Y-L8KQLLBy.js → chunk-SHT3W25Y-CuHj-hnn.js} +1 -1
- package/dist/{chunk-SVP7TREG-BOUJKJEP.js → chunk-SVP7TREG-BPiZK2bA.js} +1 -1
- package/dist/{chunk-TICWLB2K-DY3CzFjX.js → chunk-TICWLB2K-DF6XcIjM.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-s9iwW-q4.js → classDiagram-ZZMXUADV-CMdR-cP4.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-2GI5CjGB.js → classDiagram-v2-VYDZK3BY-DRvc3_7Y.js} +2 -2
- package/dist/{code-visibility-CCGlDSq4.js → code-visibility-BdFhHfIC.js} +28 -28
- package/dist/{common-C1PmVtVW.js → common-Ce1SgsX1.js} +8034 -8027
- package/dist/{toDate-BZZ64K_m.js → config-DbjzjwxX.js} +98 -164
- package/dist/{copy-icon-De584pZ4.js → copy-icon-CG57cxwb.js} +3 -3
- package/dist/createReducer-DePYJ0F3.js +63 -0
- package/dist/{cynefinDiagram-5FMLGOSQ-DOxnhBK2.js → cynefinDiagram-5FMLGOSQ-BkBjEY9l.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-D1AhEfpM.js → dagre-GXQ25YYZ-D-HEaW4I.js} +1 -1
- package/dist/{data-grid-overlay-editor-B3KXkZvo.js → data-grid-overlay-editor-Bps1p6jQ.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-DV_GebF_.js → diagram-S7CK7UJ4-Bn-oF-rB.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-6dNzGFfD.js → diagram-UQ7AKVKN-BpzzXWBj.js} +1 -1
- package/dist/{diagram-VX7I27RA-DUh9jsfi.js → diagram-VX7I27RA-COOtvfBP.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Cug-qcQ8.js → diagram-Z3DM3KII-K5cXvbrl.js} +1 -1
- package/dist/{dialog-DVRfQuhD.js → dialog-DsZ49mmU.js} +26 -26
- package/dist/{dist-BJtmSgcE.js → dist-11T5wq3_.js} +41 -40
- package/dist/{dist-B1M0bGO3.js → dist-17ugwGZc.js} +59 -58
- package/dist/{dist-D7mrh5sO.js → dist-7cRjf--y.js} +135 -134
- package/dist/{dist-Ck_C32ye.js → dist-B8pkfkzc.js} +31 -30
- package/dist/{dist-Ba2VIn1K.js → dist-B9UoM_wq.js} +54 -53
- package/dist/{dist-KN80qWCP.js → dist-BGuMTs1i.js} +118 -117
- package/dist/{dist-T5rh6JvL.js → dist-BHW11fni.js} +18 -17
- package/dist/dist-BLY4m1Wi.js +850 -0
- package/dist/{dist-Bj4bmwUm.js → dist-BNlcVoxs.js} +31 -30
- package/dist/{dist-BA13RJj5.js → dist-BQYe5Bju.js} +47 -46
- package/dist/{dist-OUle2RT7.js → dist-BX1mn8na.js} +297 -297
- package/dist/{dist-CTi5FTiV.js → dist-Bh0PTKUW.js} +108 -107
- package/dist/{dist-D9Q3xjiP.js → dist-CKaXK92p.js} +56 -55
- package/dist/{dist-DYXM73-k.js → dist-CLhwfhpJ.js} +58 -57
- package/dist/{dist-BmS-ZGjl.js → dist-CYeqK4Xw.js} +1854 -2702
- package/dist/{dist-D1fnFp1J.js → dist-Cxlp3WH6.js} +16 -15
- package/dist/{dist-DVVwOfrD.js → dist-DSJPGj42.js} +64 -63
- package/dist/{dist-Bzogh7CW.js → dist-DU9ICsWZ.js} +93 -92
- package/dist/{dist-DjeybPOb.js → dist-DWv0ALBi.js} +47 -46
- package/dist/{dist-D3x9__Fu.js → dist-DiBpWEsB.js} +39 -38
- package/dist/{dist-DtGn9N4h.js → dist-DiLFTlnl.js} +165 -165
- package/dist/{dist-DTv9KkpW.js → dist-cVDV5IuI.js} +26 -25
- package/dist/{dist-DP60Ubh8.js → dist-fRfaOoq8.js} +44 -43
- package/dist/{dist-O0qFpEJh.js → dist-gTTI-9Px.js} +66 -65
- package/dist/{dropdown-menu-dlEm41Bt.js → dropdown-menu-CSNdPSnS.js} +2886 -1529
- package/dist/{ebnfDiagram-PWID7BFC-d5LKx7Vb.js → ebnfDiagram-PWID7BFC-BI1ZmjVm.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-BwvlkcID.js → erDiagram-RLTQ6QDP-BtWjj9xy.js} +1 -1
- package/dist/{error-banner-DxJ3s8YO.js → error-banner-IsonnvA0.js} +47 -46
- package/dist/error-entries-CRPfxMqm.js +2505 -0
- package/dist/{esm-Bbw_Njjx.js → esm-BgKjMvWw.js} +389 -388
- package/dist/{esm-mDQNEFe_.js → esm-CHjVSexr.js} +305 -306
- package/dist/{feedback-button-UsovT9sL.js → feedback-button-2ycmR9GG.js} +112 -112
- package/dist/{flowDiagram-HODETNUW-CJcSoFer.js → flowDiagram-HODETNUW-DQvZh96A.js} +2 -2
- package/dist/{formats-Ry7c-aIV.js → formats-BK4VefeF.js} +6 -6
- package/dist/{glide-data-editor-CRd8kBSp.js → glide-data-editor-Buj2OZjL.js} +99 -99
- package/dist/{glide-utils-D98laidb.js → glide-utils-CQddGpa-.js} +3 -3
- package/dist/{globals-BDWrOstF.js → globals-B-14fUeb.js} +3 -3
- package/dist/{error-entries-CVUHA5r_.js → html-to-image-CgAnxFi8.js} +26314 -25474
- package/dist/{infoDiagram-27XIBGKW-Cezgppw3.js → infoDiagram-27XIBGKW-BdAObnc_.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-BahZQwJz.js → ishikawaDiagram-5VMMS53U-DP-jE8dw.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-Cvfn_Obm.js → kanban-definition-UXKFOSKX-BkMgPjfm.js} +1 -1
- package/dist/{loader-DOVB0Syl.js → loader-BisjOLiW.js} +1 -1
- package/dist/main.js +2996 -2992
- package/dist/{mermaid-BrdwbArF.js → mermaid-B-OFqheA.js} +36 -36
- package/dist/{mindmap-definition-YA3MSWOX-uB4B2d-J.js → mindmap-definition-YA3MSWOX-Du7toAZX.js} +1 -1
- package/dist/{number-overlay-editor-Bp9a4z5Q.js → number-overlay-editor-ZVFcJ7_u.js} +1 -1
- package/dist/{dist-CThPVKaP.js → objectWithoutPropertiesLoose-ai5NUqGa.js} +1139 -1120
- package/dist/{pegDiagram-XKGWAZYB-CYaIwAmH.js → pegDiagram-XKGWAZYB-CX_729j0.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-BJ1oUxVv.js → pieDiagram-E7YTZNPT-dtTFJcVI.js} +1 -1
- package/dist/{process-output-SjJxB1wh.js → process-output-Bmev5azU.js} +5 -5
- package/dist/{railroadDiagram-O6MQD6OU-BqKSaBux.js → railroadDiagram-O6MQD6OU-Dsc2Cf4c.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-DwFhgDhH.js → requirementDiagram-BXWQKSXE-D3g0c60I.js} +1 -1
- package/dist/{reveal-component-ov3pS-oO.js → reveal-component-BWz1KjWe.js} +725 -725
- package/dist/schemas-CdscWNy_.js +4747 -0
- package/dist/select-BSxlITBo.js +1200 -0
- package/dist/{sequenceDiagram-WJ2MYXX4-L7ENjfKF.js → sequenceDiagram-WJ2MYXX4-w1pWbIpk.js} +1 -1
- package/dist/{spec-BcJ9ncAY.js → spec-Dq8RNplp.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-CVf88u-p.js → stateDiagram-D77RDMKH-BCv7kP4H.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-DvpkQ1V6.js → stateDiagram-v2-MP3YSRHH-D1cTOt0x.js} +2 -2
- package/dist/static-state-BldGd99T.js +72 -0
- package/dist/strings-BGW-fXVJ.js +507 -0
- package/dist/{swimlanes-42K2YHIH-DIuFHbVE.js → swimlanes-42K2YHIH-DNO6jDnd.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-CAqHAziW.js → swimlanesDiagram-VR7AAH4N-CkSWsxYJ.js} +2 -2
- package/dist/{swiper-component-BVfnhbnt.js → swiper-component-Dir1o8ml.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-xO4EQqBm.js → timeline-definition-24CTP7MA-DQvqGFM9.js} +1 -1
- package/dist/toast-BWIPi3aF.js +491 -0
- package/dist/{tooltip-s4zZxwKe.js → tooltip-C3UnvsRe.js} +58 -58
- package/dist/use-restore-focus-BWO0z1lo.js +1672 -0
- package/dist/{useAsyncData-Dqw22wZQ.js → useAsyncData-DsZMvNXn.js} +1 -1
- package/dist/{useDateFormatter-D3Tkfzej.js → useDateFormatter-ChB4eyim.js} +2 -2
- package/dist/{useDeepCompareMemoize-D3gozcjJ.js → useDeepCompareMemoize-KMBBux8C.js} +1 -1
- package/dist/{useIframeCapabilities-6a_yDNXp.js → useIframeCapabilities-cMNQ80CK.js} +1 -1
- package/dist/useLifecycle-BquH9ET-.js +112 -0
- package/dist/useTheme-B9C1JIy9.js +307 -0
- package/dist/utils-DXkj82sK.js +813 -0
- package/dist/{vega-component-Blvspl7v.js → vega-component-9NOEITbg.js} +55 -54
- package/dist/{vennDiagram-4TSXK5OY-DzCi-lRh.js → vennDiagram-4TSXK5OY-BfzXp4SH.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-CW48xa0n.js → wardleyDiagram-VM6X3IG4-CiqEE8eq.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-UPxGGI2B.js → xychartDiagram-S5SC5T6Z-BTIHCVOI.js} +1 -1
- package/package.json +1 -1
- package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +1 -1
- package/src/components/editor/cell/code/cell-editor.tsx +13 -36
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +1 -1
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +11 -5
- package/src/components/editor/notebook-cell.tsx +0 -1
- package/src/components/scratchpad/scratchpad.test.tsx +3 -11
- package/src/components/scratchpad/scratchpad.tsx +24 -22
- package/src/components/scratchpad/state.ts +7 -0
- package/src/core/ai/__tests__/staged-cells.test.ts +6 -8
- package/src/core/ai/staged-cells.ts +4 -2
- package/src/core/cells/__tests__/cells.test.ts +44 -60
- package/src/core/cells/__tests__/document.test.ts +1 -139
- package/src/core/cells/__tests__/notebook-outline.test.ts +8 -6
- package/src/core/cells/actions.ts +39 -0
- package/src/core/cells/cells.ts +15 -35
- package/src/core/cells/document.ts +9 -84
- package/src/core/codemirror/__tests__/format.test.ts +0 -34
- package/src/core/codemirror/cells/extensions.ts +20 -18
- package/src/core/codemirror/cells/state.ts +0 -5
- package/src/core/codemirror/format.ts +1 -19
- package/src/core/codemirror/misc/__tests__/paste.test.ts +3 -1
- package/src/core/codemirror/misc/paste.ts +1 -1
- package/src/core/notebook/document/__tests__/codemirror.test.ts +172 -0
- package/src/stories/layout/vertical/one-column.stories.tsx +26 -18
- package/dist/html-to-image--E3uFbJ9.js +0 -3348
- package/dist/label-Qvw1E97W.js +0 -281
- package/dist/objectWithoutPropertiesLoose-BRDcTsfB.js +0 -23
- package/dist/select-2KOiReNY.js +0 -1423
- package/dist/toast-B5t9o6s_.js +0 -1848
- package/dist/use-restore-focus-BgDTd2tc.js +0 -6418
- package/dist/useLifecycle-CaZi4wTw.js +0 -172
- package/dist/useTheme-TzPgWXwB.js +0 -1114
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as t, g as n, h as r, m as i } from "./button-B6RjDKJx.js";
|
|
3
3
|
import { t as a } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as o } from "./compiler-runtime-CldRdSsv.js";
|
|
5
|
-
import { t as s } from "./tooltip-
|
|
6
|
-
import {
|
|
5
|
+
import { t as s } from "./tooltip-C3UnvsRe.js";
|
|
6
|
+
import { l as c, t as l } from "./config-DbjzjwxX.js";
|
|
7
7
|
import { t as u } from "./jsx-runtime-3BD1kT0s.js";
|
|
8
|
-
import { n as d } from "./error-banner-
|
|
8
|
+
import { n as d } from "./error-banner-IsonnvA0.js";
|
|
9
9
|
import { t as f } from "./debounce-C3jyATpc.js";
|
|
10
|
-
import {
|
|
10
|
+
import { n as p } from "./useTheme-B9C1JIy9.js";
|
|
11
|
+
import { D as ee } from "./utils-DXkj82sK.js";
|
|
11
12
|
import { t as te } from "./objects-DCmMvZtn.js";
|
|
12
|
-
import { a as
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
13
|
+
import { a as ne, i as re, n as ie, t as m } from "./formats-BK4VefeF.js";
|
|
14
|
+
import { a as h, t as g } from "./arrays-DoQ-AILx.js";
|
|
15
|
+
import { t as ae } from "./useAsyncData-DsZMvNXn.js";
|
|
15
16
|
import { t as _ } from "./semaphore-89jsoHtS.js";
|
|
16
17
|
import { D as oe, n as se } from "./vega-loader.browser-B9Pz0EGP.js";
|
|
17
18
|
import { t as ce } from "./react-vega-C4T9Rb_w.js";
|
|
18
|
-
import { a as le, n as v } from "./loader-
|
|
19
|
-
import { t as ue } from "./useDeepCompareMemoize-
|
|
19
|
+
import { a as le, n as v } from "./loader-BisjOLiW.js";
|
|
20
|
+
import { t as ue } from "./useDeepCompareMemoize-KMBBux8C.js";
|
|
20
21
|
import { t as de } from "./use-vega-container-remeasure-Bz4PZMtt.js";
|
|
21
22
|
//#region src/plugins/impl/vega/fix-relative-url.ts
|
|
22
23
|
var fe = /* @__PURE__ */ e(a(), 1), pe = o();
|
|
@@ -102,7 +103,7 @@ var y = {
|
|
|
102
103
|
}
|
|
103
104
|
};
|
|
104
105
|
function C() {
|
|
105
|
-
return
|
|
106
|
+
return t() ? "metaKey" : "ctrlKey";
|
|
106
107
|
}
|
|
107
108
|
var w = {
|
|
108
109
|
highlight() {
|
|
@@ -199,9 +200,9 @@ function T(e) {
|
|
|
199
200
|
function E(e) {
|
|
200
201
|
if ("params" in e && e.params && e.params.length > 0) {
|
|
201
202
|
let t = e.params.filter((e) => e != null && "select" in e && e.select !== void 0).map((e) => e.name);
|
|
202
|
-
return
|
|
203
|
+
return h(t);
|
|
203
204
|
}
|
|
204
|
-
return "layer" in e ?
|
|
205
|
+
return "layer" in e ? h(e.layer.flatMap(E)) : "vconcat" in e ? h(e.vconcat.flatMap(E)) : "hconcat" in e ? h(e.hconcat.flatMap(E)) : [];
|
|
205
206
|
}
|
|
206
207
|
function D(e) {
|
|
207
208
|
if (!e || !("mark" in e)) return;
|
|
@@ -378,7 +379,7 @@ function he(e, t) {
|
|
|
378
379
|
let t = e.params && e.params.length > 0, i = r !== !1 && !t, a = [];
|
|
379
380
|
if (i) {
|
|
380
381
|
let t = e.layer.flatMap((e) => "mark" in e ? k(e) : []);
|
|
381
|
-
a = [...new Set(t)], Array.isArray(r) && (a =
|
|
382
|
+
a = [...new Set(t)], Array.isArray(r) && (a = g.intersection(a, r));
|
|
382
383
|
}
|
|
383
384
|
let o = e.layer.map((e, t) => {
|
|
384
385
|
if (!("mark" in e)) return e;
|
|
@@ -404,7 +405,7 @@ function he(e, t) {
|
|
|
404
405
|
function R(e, t) {
|
|
405
406
|
if (t === !1) return e;
|
|
406
407
|
let n = k(e);
|
|
407
|
-
Array.isArray(t) && (n =
|
|
408
|
+
Array.isArray(t) && (n = g.intersection(n, t));
|
|
408
409
|
let r = n.map((e) => w.legend(e)), i = [...e.params || [], ...r];
|
|
409
410
|
return {
|
|
410
411
|
...e,
|
|
@@ -510,11 +511,11 @@ async function W(e) {
|
|
|
510
511
|
//#endregion
|
|
511
512
|
//#region src/plugins/impl/vega/vega-component.tsx
|
|
512
513
|
var G = u();
|
|
513
|
-
se("arrow",
|
|
514
|
+
se("arrow", m);
|
|
514
515
|
var K = (e) => {
|
|
515
516
|
let t = (0, pe.c)(12), { value: n, setValue: r, chartSelection: i, fieldSelection: a, spec: o, embedOptions: s } = e, c, l;
|
|
516
517
|
t[0] === o ? (c = t[1], l = t[2]) : (c = async () => W(o), l = [o], t[0] = o, t[1] = c, t[2] = l);
|
|
517
|
-
let { data: u, error: f } =
|
|
518
|
+
let { data: u, error: f } = ae(c, l);
|
|
518
519
|
if (f) {
|
|
519
520
|
let e;
|
|
520
521
|
return t[3] === f ? e = t[4] : (e = /* @__PURE__ */ (0, G.jsx)(d, { error: f }), t[3] = f, t[4] = e), e;
|
|
@@ -530,10 +531,10 @@ var K = (e) => {
|
|
|
530
531
|
embedOptions: s
|
|
531
532
|
}), t[5] = i, t[6] = s, t[7] = a, t[8] = u, t[9] = r, t[10] = n, t[11] = p) : p = t[11], p;
|
|
532
533
|
}, q = (e) => {
|
|
533
|
-
let a = (0, pe.c)(50), { value: o, setValue: l, chartSelection: u, fieldSelection: d, spec:
|
|
534
|
+
let a = (0, pe.c)(50), { value: o, setValue: l, chartSelection: u, fieldSelection: d, spec: ne, embedOptions: m } = e, { theme: h } = p(), g = (0, fe.useRef)(null), ae = (0, fe.useRef)(void 0), [_, se] = (0, fe.useState)(), v;
|
|
534
535
|
bb0: {
|
|
535
|
-
if (
|
|
536
|
-
v =
|
|
536
|
+
if (m && "actions" in m) {
|
|
537
|
+
v = m.actions;
|
|
537
538
|
break bb0;
|
|
538
539
|
}
|
|
539
540
|
let e;
|
|
@@ -542,7 +543,7 @@ var K = (e) => {
|
|
|
542
543
|
compiled: !1
|
|
543
544
|
}, a[0] = e) : e = a[0], v = e;
|
|
544
545
|
}
|
|
545
|
-
let y = v, b = ue(
|
|
546
|
+
let y = v, b = ue(ne), x;
|
|
546
547
|
a[1] !== u || a[2] !== d || a[3] !== b ? (x = he(me(b), {
|
|
547
548
|
chartSelection: u,
|
|
548
549
|
fieldSelection: d
|
|
@@ -556,10 +557,10 @@ var K = (e) => {
|
|
|
556
557
|
...e
|
|
557
558
|
});
|
|
558
559
|
}, a[7] = l, a[8] = o, a[9] = D) : D = a[9];
|
|
559
|
-
let O =
|
|
560
|
-
a[10] === O ? k = a[11] : (k = f((e,
|
|
561
|
-
|
|
562
|
-
let r = te.mapValues(
|
|
560
|
+
let O = ee(D), k;
|
|
561
|
+
a[10] === O ? k = a[11] : (k = f((e, t) => {
|
|
562
|
+
n.debug("[Vega signal]", e, t);
|
|
563
|
+
let r = te.mapValues(t, _e);
|
|
563
564
|
r = te.mapValues(r, ge), O({ [e]: r });
|
|
564
565
|
}, 100), a[10] = O, a[11] = k);
|
|
565
566
|
let A = k, j = ue(T), M;
|
|
@@ -572,18 +573,18 @@ var K = (e) => {
|
|
|
572
573
|
} else M = a[14];
|
|
573
574
|
let N = M, P;
|
|
574
575
|
a[17] === C ? P = a[18] : (P = (e) => {
|
|
575
|
-
|
|
576
|
+
n.error(e), n.debug(C), se(e);
|
|
576
577
|
}, a[17] = C, a[18] = P);
|
|
577
|
-
let F =
|
|
578
|
+
let F = ee(P), I;
|
|
578
579
|
a[19] === Symbol.for("react.memo_cache_sentinel") ? (I = (e) => {
|
|
579
|
-
|
|
580
|
+
n.debug("[Vega view] created", e), ae.current = e, se(void 0);
|
|
580
581
|
}, a[19] = I) : I = a[19];
|
|
581
|
-
let L =
|
|
582
|
+
let L = ee(I), R;
|
|
582
583
|
a[20] === T ? R = a[21] : (R = () => {
|
|
583
584
|
let e = [];
|
|
584
585
|
if (S.hasPoint(T) && e.push(["Point selection", "click to select a point; hold shift for multi-select"]), S.hasInterval(T) && e.push(["Interval selection", "click and drag to select an interval"]), S.hasLegend(T) && e.push(["Legend selection", "click to select a legend item; hold shift for multi-select"]), S.hasPanZoom(T)) {
|
|
585
|
-
let
|
|
586
|
-
e.push(["Pan", `hold the ${
|
|
586
|
+
let n = t() ? "⌘" : "ctrl";
|
|
587
|
+
e.push(["Pan", `hold the ${n} key and drag`], ["Zoom", `hold the ${n} key and scroll`]);
|
|
587
588
|
}
|
|
588
589
|
return e.length === 0 ? null : /* @__PURE__ */ (0, G.jsx)(s, {
|
|
589
590
|
delayDuration: 300,
|
|
@@ -595,7 +596,7 @@ var K = (e) => {
|
|
|
595
596
|
children: /* @__PURE__ */ (0, G.jsx)(c, { className: "absolute bottom-1 right-0 m-2 h-4 w-4 cursor-help text-muted-foreground hover:text-foreground" })
|
|
596
597
|
});
|
|
597
598
|
}, a[20] = T, a[21] = R);
|
|
598
|
-
let z = R, B =
|
|
599
|
+
let z = R, B = h === "dark" ? "dark" : void 0, V;
|
|
599
600
|
a[22] !== y || a[23] !== B ? (V = {
|
|
600
601
|
theme: B,
|
|
601
602
|
actions: y,
|
|
@@ -617,21 +618,21 @@ var K = (e) => {
|
|
|
617
618
|
de(g, K === "container");
|
|
618
619
|
let q, J;
|
|
619
620
|
a[32] !== U || a[33] !== N ? (q = () => (N.forEach((e) => {
|
|
620
|
-
let { signalName:
|
|
621
|
+
let { signalName: t, handler: r } = e;
|
|
621
622
|
try {
|
|
622
|
-
U?.view.addSignalListener(
|
|
623
|
+
U?.view.addSignalListener(t, r);
|
|
623
624
|
} catch (e) {
|
|
624
|
-
let
|
|
625
|
-
|
|
625
|
+
let t = e;
|
|
626
|
+
n.error(t);
|
|
626
627
|
}
|
|
627
628
|
}), () => {
|
|
628
629
|
N.forEach((e) => {
|
|
629
|
-
let { signalName:
|
|
630
|
+
let { signalName: t, handler: r } = e;
|
|
630
631
|
try {
|
|
631
|
-
U?.view.removeSignalListener(
|
|
632
|
+
U?.view.removeSignalListener(t, r);
|
|
632
633
|
} catch (e) {
|
|
633
|
-
let
|
|
634
|
-
|
|
634
|
+
let t = e;
|
|
635
|
+
n.error(t);
|
|
635
636
|
}
|
|
636
637
|
});
|
|
637
638
|
}), J = [U, N], a[32] = U, a[33] = N, a[34] = q, a[35] = J) : (q = a[34], J = a[35]), (0, fe.useEffect)(q, J);
|
|
@@ -643,29 +644,29 @@ var K = (e) => {
|
|
|
643
644
|
children: _.stack
|
|
644
645
|
})]
|
|
645
646
|
}), a[36] = _, a[37] = Y);
|
|
646
|
-
let
|
|
647
|
-
a[38] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
648
|
-
let
|
|
649
|
-
a[40] === K ?
|
|
647
|
+
let X, ye;
|
|
648
|
+
a[38] === Symbol.for("react.memo_cache_sentinel") ? (X = r("relative"), ye = i.stopPropagation(), a[38] = X, a[39] = ye) : (X = a[38], ye = a[39]);
|
|
649
|
+
let Z;
|
|
650
|
+
a[40] === K ? Z = a[41] : (Z = /* @__PURE__ */ (0, G.jsx)("div", {
|
|
650
651
|
ref: g,
|
|
651
652
|
"data-container-width": K
|
|
652
|
-
}), a[40] = K, a[41] =
|
|
653
|
-
let Z;
|
|
654
|
-
a[42] === z ? Z = a[43] : (Z = z(), a[42] = z, a[43] = Z);
|
|
653
|
+
}), a[40] = K, a[41] = Z);
|
|
655
654
|
let Q;
|
|
656
|
-
a[
|
|
657
|
-
className: ye,
|
|
658
|
-
onPointerDown: be,
|
|
659
|
-
children: [X, Z]
|
|
660
|
-
}), a[44] = X, a[45] = Z, a[46] = Q) : Q = a[46];
|
|
655
|
+
a[42] === z ? Q = a[43] : (Q = z(), a[42] = z, a[43] = Q);
|
|
661
656
|
let $;
|
|
662
|
-
|
|
657
|
+
a[44] !== Z || a[45] !== Q ? ($ = /* @__PURE__ */ (0, G.jsxs)("div", {
|
|
658
|
+
className: X,
|
|
659
|
+
onPointerDown: ye,
|
|
660
|
+
children: [Z, Q]
|
|
661
|
+
}), a[44] = Z, a[45] = Q, a[46] = $) : $ = a[46];
|
|
662
|
+
let be;
|
|
663
|
+
return a[47] !== Y || a[48] !== $ ? (be = /* @__PURE__ */ (0, G.jsxs)(G.Fragment, { children: [Y, $] }), a[47] = Y, a[48] = $, a[49] = be) : be = a[49], be;
|
|
663
664
|
};
|
|
664
665
|
function ge(e) {
|
|
665
666
|
return e instanceof Set ? [...e] : e;
|
|
666
667
|
}
|
|
667
668
|
function _e(e) {
|
|
668
|
-
return Array.isArray(e) ? e.map((e) => e instanceof Date &&
|
|
669
|
+
return Array.isArray(e) ? e.map((e) => e instanceof Date && ne(e) ? new Date(e).getTime() : e) : e;
|
|
669
670
|
}
|
|
670
671
|
function ve(e, t) {
|
|
671
672
|
return /* @__PURE__ */ (0, G.jsxs)("div", { children: [
|
|
@@ -3,7 +3,7 @@ import { t } from "./src-CA_m4ONl.js";
|
|
|
3
3
|
import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
4
4
|
import { $ as r, H as i, K as a, U as o, a as s, b as c, c as l, et as u, f as d, nt as f, tt as p, v as m, w as h, y as g } from "./chunk-DU6HZSFF-BwiyaNpg.js";
|
|
5
5
|
import { t as _ } from "./rough.esm-CtV9AnV1.js";
|
|
6
|
-
import { p as v } from "./mermaid-
|
|
6
|
+
import { p as v } from "./mermaid-B-OFqheA.js";
|
|
7
7
|
//#region ../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js
|
|
8
8
|
var y = (e, t) => p(e, "a", -t), b = 1e-10;
|
|
9
9
|
function x(e, t) {
|
|
@@ -2,7 +2,7 @@ import { i as e } from "./chunk-75Z2AOVW-D7gxIs2Q.js";
|
|
|
2
2
|
import { n as t } from "./src-CA_m4ONl.js";
|
|
3
3
|
import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
4
4
|
import { D as r, H as i, K as a, U as o, a as s, b as c, c as l, v as u, w as d, x as f, y as p } from "./chunk-DU6HZSFF-BwiyaNpg.js";
|
|
5
|
-
import { p as m } from "./mermaid-
|
|
5
|
+
import { p as m } from "./mermaid-B-OFqheA.js";
|
|
6
6
|
import { n as h } from "./mermaid-parser.core-DxuSfYwJ.js";
|
|
7
7
|
import { t as g } from "./chunk-JWPE2WC7-DJvv1t8U.js";
|
|
8
8
|
//#region ../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VM6X3IG4.mjs
|
|
@@ -9,7 +9,7 @@ import { n as s } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
|
9
9
|
import { D as c, H as l, K as u, U as d, a as f, b as p, c as m, f as h, v as g, w as _, y as v, z as y } from "./chunk-DU6HZSFF-BwiyaNpg.js";
|
|
10
10
|
import "./chunk-PWAF6VOD-CQw5qATZ.js";
|
|
11
11
|
import { t as b } from "./chunk-GMAD6QVW-BhaJx0X3.js";
|
|
12
|
-
import { p as x } from "./mermaid-
|
|
12
|
+
import { p as x } from "./mermaid-B-OFqheA.js";
|
|
13
13
|
//#region ../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
|
|
14
14
|
function S() {
|
|
15
15
|
var e = t().unknown(void 0), r = e.domain, i = e.range, o = 0, s = 1, c, l, u = !1, d = 0, f = 0, p = .5;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
import { historyField } from "@codemirror/commands";
|
|
3
|
-
import { EditorState, StateEffect } from "@codemirror/state";
|
|
3
|
+
import { EditorState, type Extension, StateEffect } from "@codemirror/state";
|
|
4
4
|
import { EditorView, ViewPlugin } from "@codemirror/view";
|
|
5
5
|
import { useIntersectionObserver } from "@uidotdev/usehooks";
|
|
6
6
|
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
@@ -8,18 +8,18 @@ import React, { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
|
8
8
|
import useEvent from "react-use-event-hook";
|
|
9
9
|
import { aiCompletionCellAtom } from "@/core/ai/state";
|
|
10
10
|
import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
|
|
11
|
-
import { getNotebook } from "@/core/cells/cells";
|
|
12
11
|
import { useCellActions } from "@/core/cells/actions";
|
|
13
12
|
import {
|
|
14
13
|
showHiddenCodeAtom,
|
|
15
14
|
takeRestoredEditorStateAtom,
|
|
16
15
|
useRestoredEditorState,
|
|
17
16
|
} from "@/core/cells/editor";
|
|
18
|
-
import {
|
|
19
|
-
|
|
17
|
+
import {
|
|
18
|
+
useNotebookCellCodeExtension,
|
|
19
|
+
useNotebookDocumentEdit,
|
|
20
|
+
} from "@/core/notebook/document";
|
|
20
21
|
import { usePendingDeleteService } from "@/core/cells/pending-delete-service";
|
|
21
22
|
import type { CellData, CellRuntimeState } from "@/core/cells/types";
|
|
22
|
-
import { notebookCellEditorViews } from "@/core/cells/utils";
|
|
23
23
|
import { setupCodeMirror } from "@/core/codemirror/cm";
|
|
24
24
|
import { acceptCompletionOnEnterAtom } from "@/core/codemirror/completion/accept-on-enter-atom";
|
|
25
25
|
import { editorMountScheduler } from "@/core/codemirror/editor-mount-scheduler";
|
|
@@ -29,8 +29,6 @@ import {
|
|
|
29
29
|
reconfigureLanguageEffect,
|
|
30
30
|
switchLanguage,
|
|
31
31
|
} from "@/core/codemirror/language/extension";
|
|
32
|
-
import { prepareCellCodeUpdate } from "@/core/codemirror/language/cell-code";
|
|
33
|
-
import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
|
|
34
32
|
import { MARKDOWN_INITIAL_HIDE_CODE } from "@/core/codemirror/language/languages/markdown";
|
|
35
33
|
import type { LanguageAdapterType } from "@/core/codemirror/language/types";
|
|
36
34
|
import { autoInstantiateAtom, isAiFeatureEnabled } from "@/core/config/config";
|
|
@@ -88,6 +86,8 @@ export interface CellEditorProps
|
|
|
88
86
|
* defaults to `#App`.
|
|
89
87
|
*/
|
|
90
88
|
tooltipParentSelector?: string;
|
|
89
|
+
/** Further editor extensions, for an editor outside the notebook. */
|
|
90
|
+
extensions?: Extension[];
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const CellEditorInternal = ({
|
|
@@ -111,6 +111,7 @@ const CellEditorInternal = ({
|
|
|
111
111
|
inlineAiTooltip,
|
|
112
112
|
outputArea,
|
|
113
113
|
tooltipParentSelector,
|
|
114
|
+
extensions: extraExtensions,
|
|
114
115
|
}: CellEditorProps) => {
|
|
115
116
|
const [aiCompletionCell, setAiCompletionCell] = useAtom(aiCompletionCellAtom);
|
|
116
117
|
const serializedEditorState = useRestoredEditorState(cellId);
|
|
@@ -120,6 +121,7 @@ const CellEditorInternal = ({
|
|
|
120
121
|
const { saveOrNameNotebook } = useSaveNotebook();
|
|
121
122
|
const pendingDeleteService = usePendingDeleteService();
|
|
122
123
|
const edit = useNotebookDocumentEdit();
|
|
124
|
+
const codeBinding = useNotebookCellCodeExtension(cellId);
|
|
123
125
|
|
|
124
126
|
const loading = status === "running" || status === "queued";
|
|
125
127
|
const cellActions = useCellActions();
|
|
@@ -209,35 +211,6 @@ const CellEditorInternal = ({
|
|
|
209
211
|
});
|
|
210
212
|
}
|
|
211
213
|
},
|
|
212
|
-
addOrAppendSetupCell: (code) => {
|
|
213
|
-
const notebook = getNotebook();
|
|
214
|
-
// No setup cell yet: create one with this code at the top.
|
|
215
|
-
if (!notebook.cellIds.includes(SETUP_CELL_ID)) {
|
|
216
|
-
cellActions.addSetupCell({ code });
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
// Setup cell exists: append the pasted code to it. Prefer updating
|
|
220
|
-
// the mounted editor (keeps the view and state in sync, like
|
|
221
|
-
// formatting does); fall back to a plain state update otherwise.
|
|
222
|
-
const view = notebookCellEditorViews(notebook)[SETUP_CELL_ID];
|
|
223
|
-
const existing = view
|
|
224
|
-
? getEditorCodeAsPython(view)
|
|
225
|
-
: notebook.cellData[SETUP_CELL_ID].code;
|
|
226
|
-
const merged = existing.trim()
|
|
227
|
-
? `${existing.trimEnd()}\n\n${code}`
|
|
228
|
-
: code;
|
|
229
|
-
if (view) {
|
|
230
|
-
const update = prepareCellCodeUpdate(view.state, merged);
|
|
231
|
-
if (update) {
|
|
232
|
-
view.dispatch(update);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
cellActions.updateCellCode({
|
|
236
|
-
cellId: SETUP_CELL_ID,
|
|
237
|
-
code: merged,
|
|
238
|
-
formattingChange: false,
|
|
239
|
-
});
|
|
240
|
-
},
|
|
241
214
|
splitCell,
|
|
242
215
|
toggleHideCode,
|
|
243
216
|
aiCellCompletion: () => {
|
|
@@ -270,6 +243,8 @@ const CellEditorInternal = ({
|
|
|
270
243
|
});
|
|
271
244
|
|
|
272
245
|
extensions.push(
|
|
246
|
+
codeBinding,
|
|
247
|
+
...(extraExtensions ?? []),
|
|
273
248
|
// Listen to code changes if we can use markdown
|
|
274
249
|
// Also update the language adapter
|
|
275
250
|
ViewPlugin.define((view) => {
|
|
@@ -309,6 +284,8 @@ const CellEditorInternal = ({
|
|
|
309
284
|
return extensions;
|
|
310
285
|
}, [
|
|
311
286
|
cellId,
|
|
287
|
+
codeBinding,
|
|
288
|
+
extraExtensions,
|
|
312
289
|
acceptCompletionOnEnter,
|
|
313
290
|
userConfig.keymap,
|
|
314
291
|
userConfig.completion,
|
|
@@ -422,11 +422,17 @@ describe("SendErrorReportButton", () => {
|
|
|
422
422
|
cellRuntime: { [CELL_ID]: { output } },
|
|
423
423
|
}),
|
|
424
424
|
);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
425
|
+
store.set(notebookAtom, (state) => ({
|
|
426
|
+
...state,
|
|
427
|
+
cellData: {
|
|
428
|
+
...state.cellData,
|
|
429
|
+
[CELL_ID]: {
|
|
430
|
+
...state.cellData[CELL_ID],
|
|
431
|
+
code: "print('edited')",
|
|
432
|
+
edited: true,
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
}));
|
|
430
436
|
if (queue) {
|
|
431
437
|
actions.prepareForRun({ cellId: CELL_ID });
|
|
432
438
|
actions.handleCellMessage({
|
|
@@ -7,26 +7,22 @@ import { type ComponentProps, useEffect, useRef } from "react";
|
|
|
7
7
|
import { expect, it, vi } from "vitest";
|
|
8
8
|
import type { CellEditor } from "@/components/editor/cell/code/cell-editor";
|
|
9
9
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
10
|
-
import { SCRATCH_CELL_ID } from "@/core/cells/ids";
|
|
11
10
|
import { ScratchPad } from "./scratchpad";
|
|
12
11
|
import {
|
|
13
12
|
historyVisibleAtom,
|
|
14
13
|
scratchpadHistoryAtom,
|
|
15
14
|
} from "./scratchpad-history";
|
|
15
|
+
import { scratchpadCodeAtom } from "./state";
|
|
16
16
|
|
|
17
17
|
const state = vi.hoisted(() => ({
|
|
18
18
|
editor: null as EditorView | null,
|
|
19
|
-
updateCellCode: vi.fn(),
|
|
20
19
|
}));
|
|
21
20
|
|
|
22
21
|
vi.mock("@/core/cells/cells", () => ({
|
|
23
22
|
useNotebook: () => ({ cellRuntime: {}, cellData: {} }),
|
|
24
23
|
}));
|
|
25
24
|
vi.mock("@/core/cells/actions", () => ({
|
|
26
|
-
useCellActions: () => ({
|
|
27
|
-
createCell: vi.fn(),
|
|
28
|
-
updateCellCode: state.updateCellCode,
|
|
29
|
-
}),
|
|
25
|
+
useCellActions: () => ({ createCell: vi.fn() }),
|
|
30
26
|
}));
|
|
31
27
|
vi.mock("@/core/cells/focus", () => ({ useLastFocusedCellId: () => null }));
|
|
32
28
|
vi.mock("@/core/network/requests", () => ({
|
|
@@ -89,9 +85,5 @@ it("focuses the editor after recalling history", () => {
|
|
|
89
85
|
screen.getByRole("textbox", { name: "Scratchpad editor" }),
|
|
90
86
|
).toHaveFocus();
|
|
91
87
|
expect(state.editor?.state.doc.toString()).toBe("print(42)");
|
|
92
|
-
expect(
|
|
93
|
-
cellId: SCRATCH_CELL_ID,
|
|
94
|
-
code: "print(42)",
|
|
95
|
-
formattingChange: false,
|
|
96
|
-
});
|
|
88
|
+
expect(store.get(scratchpadCodeAtom)).toBe("print(42)");
|
|
97
89
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { EditorView } from "@codemirror/view";
|
|
4
4
|
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
5
5
|
import {
|
|
6
6
|
BetweenHorizontalStartIcon,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
PlayIcon,
|
|
11
11
|
} from "lucide-react";
|
|
12
12
|
import type React from "react";
|
|
13
|
-
import { Suspense, useRef, useState } from "react";
|
|
13
|
+
import { Suspense, useMemo, useRef, useState } from "react";
|
|
14
14
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
15
15
|
import useEvent from "react-use-event-hook";
|
|
16
16
|
import { useNotebook } from "@/core/cells/cells";
|
|
@@ -19,6 +19,8 @@ import { useLastFocusedCellId } from "@/core/cells/focus";
|
|
|
19
19
|
import { HTMLCellId, SCRATCH_CELL_ID } from "@/core/cells/ids";
|
|
20
20
|
import { DEFAULT_CELL_NAME } from "@/core/cells/names";
|
|
21
21
|
import type { LanguageAdapterType } from "@/core/codemirror/language/types";
|
|
22
|
+
import { prepareCellCodeUpdate } from "@/core/codemirror/language/cell-code";
|
|
23
|
+
import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
|
|
22
24
|
import { useResolvedMarimoConfig } from "@/core/config/config";
|
|
23
25
|
import { CSSClasses } from "@/core/constants";
|
|
24
26
|
import { useRequestClient } from "@/core/network/requests";
|
|
@@ -44,6 +46,7 @@ import {
|
|
|
44
46
|
historyVisibleAtom,
|
|
45
47
|
scratchpadHistoryAtom,
|
|
46
48
|
} from "./scratchpad-history";
|
|
49
|
+
import { scratchpadCodeAtom } from "./state";
|
|
47
50
|
|
|
48
51
|
const scratchpadCellConfig: CellConfig = {
|
|
49
52
|
hide_code: false,
|
|
@@ -56,7 +59,7 @@ export const ScratchPad: React.FC = () => {
|
|
|
56
59
|
const { theme } = useTheme();
|
|
57
60
|
const ref = useRef<EditorView | null>(null);
|
|
58
61
|
const lastFocusedCellId = useLastFocusedCellId();
|
|
59
|
-
const {
|
|
62
|
+
const { createCell } = useCellActions();
|
|
60
63
|
const { sendRunScratchpad } = useRequestClient();
|
|
61
64
|
const orientation = usePanelOrientation();
|
|
62
65
|
const section = usePanelSection();
|
|
@@ -66,8 +69,17 @@ export const ScratchPad: React.FC = () => {
|
|
|
66
69
|
const output = cellRuntime?.output;
|
|
67
70
|
const status = cellRuntime?.status;
|
|
68
71
|
const consoleOutputs = cellRuntime?.consoleOutputs;
|
|
69
|
-
const
|
|
70
|
-
const
|
|
72
|
+
const [code, setCode] = useAtom(scratchpadCodeAtom);
|
|
73
|
+
const codeListener = useMemo(
|
|
74
|
+
() => [
|
|
75
|
+
EditorView.updateListener.of((update) => {
|
|
76
|
+
if (update.docChanged) {
|
|
77
|
+
setCode(getEditorCodeAsPython(update.view));
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
],
|
|
81
|
+
[setCode],
|
|
82
|
+
);
|
|
71
83
|
|
|
72
84
|
const addToHistory = useSetAtom(addToHistoryAtom);
|
|
73
85
|
const [historyVisible, setHistoryVisible] = useAtom(historyVisibleAtom);
|
|
@@ -86,11 +98,7 @@ export const ScratchPad: React.FC = () => {
|
|
|
86
98
|
});
|
|
87
99
|
|
|
88
100
|
const handleClearCode = useEvent(() => {
|
|
89
|
-
|
|
90
|
-
cellId,
|
|
91
|
-
code: "",
|
|
92
|
-
formattingChange: false,
|
|
93
|
-
});
|
|
101
|
+
setCode("");
|
|
94
102
|
void sendRunScratchpad({ code: "" });
|
|
95
103
|
const ev = ref.current;
|
|
96
104
|
if (ev) {
|
|
@@ -106,20 +114,13 @@ export const ScratchPad: React.FC = () => {
|
|
|
106
114
|
|
|
107
115
|
const handleSelectHistoryItem = useEvent((item: string) => {
|
|
108
116
|
setHistoryVisible(false);
|
|
109
|
-
|
|
110
|
-
cellId,
|
|
111
|
-
code: item,
|
|
112
|
-
formattingChange: false,
|
|
113
|
-
});
|
|
117
|
+
setCode(item);
|
|
114
118
|
const ev = ref.current;
|
|
115
119
|
if (ev) {
|
|
116
|
-
ev.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
insert: item,
|
|
121
|
-
},
|
|
122
|
-
});
|
|
120
|
+
const update = prepareCellCodeUpdate(ev.state, item);
|
|
121
|
+
if (update) {
|
|
122
|
+
ev.dispatch(update);
|
|
123
|
+
}
|
|
123
124
|
ev.focus();
|
|
124
125
|
}
|
|
125
126
|
});
|
|
@@ -269,6 +270,7 @@ export const ScratchPad: React.FC = () => {
|
|
|
269
270
|
showHiddenCode={Functions.NOOP}
|
|
270
271
|
languageAdapter={languageAdapter}
|
|
271
272
|
setLanguageAdapter={setLanguageAdapter}
|
|
273
|
+
extensions={codeListener}
|
|
272
274
|
/>
|
|
273
275
|
</div>
|
|
274
276
|
{renderHistory()}
|
|
@@ -22,7 +22,7 @@ const { stagedGenerationAtom, createActions, reducer, initialState } =
|
|
|
22
22
|
|
|
23
23
|
// Mock the dependencies
|
|
24
24
|
const mockCreateCell = vi.fn();
|
|
25
|
-
const
|
|
25
|
+
const mockSetCellCode = vi.fn();
|
|
26
26
|
const mockDeleteCellCallback = vi.fn();
|
|
27
27
|
|
|
28
28
|
// Mock cell handle with editor view
|
|
@@ -37,16 +37,13 @@ const mockCellHandle = {
|
|
|
37
37
|
vi.mock("../../cells/actions", () => ({
|
|
38
38
|
useCellActions: () => ({
|
|
39
39
|
createCell: mockCreateCell,
|
|
40
|
-
|
|
40
|
+
setCellCode: mockSetCellCode,
|
|
41
41
|
}),
|
|
42
42
|
}));
|
|
43
43
|
vi.mock("../../cells/cells", async () => {
|
|
44
44
|
const { atom } = await import("jotai");
|
|
45
45
|
return {
|
|
46
46
|
notebookAtom: atom({ cellData: {}, cellIds: [] }),
|
|
47
|
-
cellHandleAtom: vi.fn(() => ({
|
|
48
|
-
read: vi.fn(() => mockCellHandle),
|
|
49
|
-
})),
|
|
50
47
|
getCellEditorView: vi.fn(() => mockCellHandle.current.editorViewOrNull),
|
|
51
48
|
};
|
|
52
49
|
});
|
|
@@ -403,6 +400,7 @@ describe("staged cell generation", () => {
|
|
|
403
400
|
// No cell or cell update should have been called
|
|
404
401
|
expect(mockCreateCell).not.toHaveBeenCalled();
|
|
405
402
|
expect(prepareCellCodeUpdate).not.toHaveBeenCalled();
|
|
403
|
+
expect(mockSetCellCode).not.toHaveBeenCalled();
|
|
406
404
|
expect(store.get(stagedGenerationInProgressAtom)).toBe(true);
|
|
407
405
|
});
|
|
408
406
|
|
|
@@ -688,9 +686,10 @@ describe("staged cell generation", () => {
|
|
|
688
686
|
expect(
|
|
689
687
|
mockCellHandle.current.editorViewOrNull.dispatch,
|
|
690
688
|
).toHaveBeenCalledTimes(2);
|
|
689
|
+
expect(mockSetCellCode).not.toHaveBeenCalled();
|
|
691
690
|
});
|
|
692
691
|
|
|
693
|
-
it("
|
|
692
|
+
it("writes through the document when the cell editor is not mounted", () => {
|
|
694
693
|
const { result } = renderGenerationHook();
|
|
695
694
|
result.current.beginStagedCellGeneration();
|
|
696
695
|
|
|
@@ -710,10 +709,9 @@ describe("staged cell generation", () => {
|
|
|
710
709
|
},
|
|
711
710
|
});
|
|
712
711
|
|
|
713
|
-
expect(
|
|
712
|
+
expect(mockSetCellCode).toHaveBeenCalledWith({
|
|
714
713
|
cellId: cellId("unmounted-cell"),
|
|
715
714
|
code: "value = 1",
|
|
716
|
-
formattingChange: false,
|
|
717
715
|
});
|
|
718
716
|
});
|
|
719
717
|
|