@marimo-team/frontend 0.23.6-dev8 → 0.23.6
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/assets/{CellStatus-BMPfzi2x.js → CellStatus-CO_unhk0.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-DNoHDaQW.js → ConnectedDataExplorerComponent-k8s9vETJ.js} +1 -1
- package/dist/assets/{JsonOutput-BPSeOpTI.js → JsonOutput-ugBhs7bt.js} +11 -11
- package/dist/assets/{MarimoErrorOutput-B-GOeJYT.js → MarimoErrorOutput-1q6qtvxi.js} +1 -1
- package/dist/assets/RenderHTML-DkEHxB1r.js +1 -0
- package/dist/assets/{RunButton-DHxYW_jZ.js → RunButton-CJsJsGj-.js} +1 -1
- package/dist/assets/__vite-browser-external-D0cSGXjR.js +1 -0
- package/dist/assets/__vite-browser-external-DQc2JVNq.js +1 -0
- package/dist/assets/{add-cell-with-ai-9Ppp-_FF.js → add-cell-with-ai-D5JeNTNV.js} +1 -1
- package/dist/assets/{add-connection-dialog-kqavGK36.js → add-connection-dialog-_nMyst1l.js} +1 -1
- package/dist/assets/{agent-panel-DHnLR7Mb.js → agent-panel-CBj2Q42_.js} +1 -1
- package/dist/assets/ai-model-dropdown-B-9yxYM4.js +5 -0
- package/dist/assets/{app-config-button-Fw8fiee0.js → app-config-button-BOc_z0uX.js} +1 -1
- package/dist/assets/{cell-editor-be6kORY7.js → cell-editor-C1BpIU12.js} +3 -3
- package/dist/assets/{cell-link-DVZ95RkH.js → cell-link-CC2MiW7a.js} +1 -1
- package/dist/assets/{cells-CLOYqHxK.js → cells-DAxz8J5R.js} +61 -61
- package/dist/assets/{chat-display-B7NtWxYv.js → chat-display-BiUNr6dU.js} +1 -1
- package/dist/assets/{chat-panel-CJ_Okp1l.js → chat-panel-BHsaaTzR.js} +1 -1
- package/dist/assets/{chat-ui-C__V3oej.js → chat-ui-CTYG4pnL.js} +1 -1
- package/dist/assets/{column-preview-BIefID4K.js → column-preview-DBPye87P.js} +1 -1
- package/dist/assets/{command-palette-DeWaheL9.js → command-palette-C3fn0qCr.js} +1 -1
- package/dist/assets/{common-BZYK-5sS.js → common-Qy2P7rii.js} +1 -1
- package/dist/assets/{components-CJRF32CP.js → components-CZy03693.js} +1 -1
- package/dist/assets/{components-BHnD7nvm.js → components-D9aJNSr-.js} +1 -1
- package/dist/assets/config-CPqw1wUv.js +1 -0
- package/dist/assets/{datasource-DuoPm5lj.js → datasource-C1JWjcmE.js} +1 -1
- package/dist/assets/{dependency-graph-panel-C4vc11ZO.js → dependency-graph-panel-DOHj-hNc.js} +1 -1
- package/dist/assets/{documentation-panel-NQil029H.js → documentation-panel-BM7hNnyp.js} +1 -1
- package/dist/assets/{download-Dxwqy2bA.js → download-CXTuIv7r.js} +1 -1
- package/dist/assets/{edit-page-BqY5D2fS.js → edit-page-Ct5Ke1wi.js} +6 -6
- package/dist/assets/{error-panel-BfzGOGJ7.js → error-panel-BN-anQD3.js} +1 -1
- package/dist/assets/{file-explorer-panel-BDGw5J4p.js → file-explorer-panel-D1O0vw5C.js} +3 -3
- package/dist/assets/{file-icons-DKgisbPy.js → file-icons-5G4ZC70N.js} +1 -1
- package/dist/assets/{floating-outline-CZmP89Pg.js → floating-outline-DHE0ukvC.js} +1 -1
- package/dist/assets/{focus-Db3BXXYF.js → focus-Crs_4nnQ.js} +1 -1
- package/dist/assets/{form-B9WdYAmJ.js → form-DRJZl2zK.js} +1 -1
- package/dist/assets/{glide-data-editor-CxV4Ph39.js → glide-data-editor-DqqLCmqF.js} +1 -1
- package/dist/assets/{globals-B-ZMi0ZU.js → globals-DUw71mRV.js} +1 -1
- package/dist/assets/{home-page-BRpdedat.js → home-page-BM_BZnw7.js} +1 -1
- package/dist/assets/{hooks-CAKD7YIk.js → hooks-CUEvgvEQ.js} +1 -1
- package/dist/assets/{html-to-image-UTuaZ3Zz.js → html-to-image-v-_444d3.js} +1 -1
- package/dist/assets/{index-Bi946suj.js → index-BMxMikGP.js} +7 -7
- package/dist/assets/{kiosk-mode-Wr118u5I.js → kiosk-mode-DKb6W1WN.js} +1 -1
- package/dist/assets/layout-Bp1vAdBy.js +9 -0
- package/dist/assets/{logs-panel-Cc7b3YCV.js → logs-panel-BWCDk8Zy.js} +1 -1
- package/dist/assets/{markdown-renderer-B99Mg_Az.js → markdown-renderer-CbuqHMPu.js} +1 -1
- package/dist/assets/{mermaid-CXmjgj4p.js → mermaid-BfdNvRSd.js} +1 -1
- package/dist/assets/{name-cell-input-NZ1j0909.js → name-cell-input-DoYtA-nF.js} +1 -1
- package/dist/assets/{outline-panel-DyEb1pWI.js → outline-panel-C5bTOsj4.js} +1 -1
- package/dist/assets/{packages-panel-2BYgP0xo.js → packages-panel-CHVjLKJK.js} +1 -1
- package/dist/assets/panels-GT2UyjFN.js +1 -0
- package/dist/assets/{process-output-Db5wB9rH.js → process-output-CKd9tbdL.js} +1 -1
- package/dist/assets/{radio-group-LGyqSUAb.js → radio-group-BI3wOhfc.js} +1 -1
- package/dist/assets/{readonly-python-code-CRxldrYi.js → readonly-python-code-CaKJ84fy.js} +1 -1
- package/dist/assets/{renderShortcut-DZpkrZaP.js → renderShortcut-Bfk4NjRL.js} +1 -1
- package/dist/assets/{reveal-component-Dg43hG-_.js → reveal-component-DC85rv-5.js} +1 -1
- package/dist/assets/run-page-CldmTgnu.js +1 -0
- package/dist/assets/{save-worker-CtJsIYIM.js → save-worker-CvbUHJh7.js} +3 -3
- package/dist/assets/{scratchpad-panel-Cu_yH_un.js → scratchpad-panel-C6QArhRa.js} +1 -1
- package/dist/assets/{session-panel-DT2e5nlN.js → session-panel-bu72cztx.js} +1 -1
- package/dist/assets/{snippets-panel-DsnrqLiK.js → snippets-panel-BvuRa1mc.js} +1 -1
- package/dist/assets/state-CjlRDG08.js +3 -0
- package/dist/assets/{state-BLtQJBam.js → state-DgRSUIT8.js} +1 -1
- package/dist/assets/{switch-ecwOrzz3.js → switch-BvybnC9P.js} +1 -1
- package/dist/assets/{terminal-CQZ69wrS.js → terminal-zehb39z5.js} +23 -23
- package/dist/assets/{textarea-D-NByOwX.js → textarea-GPxmW3rS.js} +1 -1
- package/dist/assets/{tracing-DiDuvHwg.js → tracing-CVQn241p.js} +1 -1
- package/dist/assets/{tracing-panel-Bst_Wxle.js → tracing-panel-TnogJs00.js} +2 -2
- package/dist/assets/{useBoolean-B_vDzBHf.js → useBoolean-xXcxYCaI.js} +1 -1
- package/dist/assets/{useCellActionButton-BbQwTv3c.js → useCellActionButton-C8PCItmw.js} +1 -1
- package/dist/assets/{useDeleteCell-fKdqtWys.js → useDeleteCell-DMZGFMOB.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-Dojskt3x.js → useDependencyPanelTab-Jnl7B-vS.js} +1 -1
- package/dist/assets/{useHotkey-Cm0DaHEJ.js → useHotkey-DccKPSPx.js} +1 -1
- package/dist/assets/useNotebookActions-U6kQhg4l.js +1 -0
- package/dist/assets/{useRunCells-CaQshiHD.js → useRunCells-BMgfN_OV.js} +1 -1
- package/dist/assets/{useSplitCell-A1c9VChO.js → useSplitCell-B5YK7yVe.js} +1 -1
- package/dist/assets/{useTheme-Cb4Wekek.js → useTheme-DFXuDFj9.js} +1 -1
- package/dist/assets/utils-BrXijSdZ.js +1 -0
- package/dist/assets/{vega-component-BDK4MwYT.js → vega-component-DOyQwlmD.js} +1 -1
- package/dist/assets/{worker-ztl1wuLb.js → worker-CF8V9c2V.js} +3 -3
- package/dist/index.html +29 -29
- package/package.json +5 -5
- package/src/components/ai/ai-provider-icon.tsx +1 -0
- package/src/components/ai/ai-utils.ts +1 -0
- package/src/components/app-config/ai-config.tsx +30 -0
- package/src/components/editor/chrome/wrapper/footer-items/pyodide-status.tsx +47 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
- package/src/components/editor/renderers/cell-array.tsx +14 -7
- package/src/components/slides/slide-form.tsx +43 -0
- package/src/components/terminal/terminal.tsx +16 -0
- package/src/components/ui/links.tsx +2 -1
- package/src/core/ai/ids/ids.ts +1 -0
- package/src/core/cells/__tests__/apply-transaction.test.ts +193 -27
- package/src/core/cells/__tests__/document-changes.test.ts +14 -0
- package/src/core/cells/document-changes.ts +17 -14
- package/src/core/codemirror/markdown/__tests__/commands.test.ts +36 -0
- package/src/core/codemirror/markdown/commands.ts +4 -1
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/edit-app.tsx +1 -0
- package/src/core/run-app.tsx +9 -2
- package/src/core/runtime/runtime.ts +3 -2
- package/src/core/static/static-state.ts +5 -1
- package/src/core/wasm/PyodideLoader.tsx +54 -16
- package/src/core/wasm/__tests__/PyodideLoader.test.ts +72 -0
- package/src/core/wasm/__tests__/bridge.test.ts +26 -1
- package/src/core/wasm/bridge.ts +24 -6
- package/src/core/wasm/state.ts +3 -0
- package/src/core/wasm/worker/getController.ts +7 -0
- package/src/core/wasm/worker/save-worker.ts +2 -1
- package/src/core/wasm/worker/worker.ts +2 -1
- package/src/plugins/core/RenderHTML.tsx +49 -3
- package/src/plugins/core/__test__/RenderHTML.test.ts +54 -0
- package/src/plugins/impl/common/labeled.tsx +1 -1
- package/dist/assets/RenderHTML-bITn6XSR.js +0 -1
- package/dist/assets/__vite-browser-external-D-ioOGDE.js +0 -1
- package/dist/assets/__vite-browser-external-DgbEhFq1.js +0 -1
- package/dist/assets/ai-model-dropdown-CzaMTKeD.js +0 -5
- package/dist/assets/config-DczIUz0b.js +0 -1
- package/dist/assets/layout-CxwlztmA.js +0 -9
- package/dist/assets/panels-DZsiUbce.js +0 -1
- package/dist/assets/run-page-BKk9AjkO.js +0 -1
- package/dist/assets/state-iwsjHbTq.js +0 -3
- package/dist/assets/useNotebookActions-DPff4LW-.js +0 -1
- package/dist/assets/utils-DIGrmLDO.js +0 -1
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CookieIcon,
|
|
9
9
|
PanelRightCloseIcon,
|
|
10
10
|
PanelRightOpenIcon,
|
|
11
|
+
KeyboardIcon,
|
|
11
12
|
} from "lucide-react";
|
|
12
13
|
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
|
13
14
|
import {
|
|
@@ -28,6 +29,7 @@ import type {
|
|
|
28
29
|
import { useState } from "react";
|
|
29
30
|
import { Tooltip } from "../ui/tooltip";
|
|
30
31
|
import { Button } from "../ui/button";
|
|
32
|
+
import { Kbd } from "../ui/kbd";
|
|
31
33
|
import type { RuntimeCell } from "@/core/cells/types";
|
|
32
34
|
|
|
33
35
|
export const DEFAULT_SLIDE_TYPE: SlideType = "slide";
|
|
@@ -132,10 +134,51 @@ const SlidesForm = ({
|
|
|
132
134
|
<TabsContent value="deck" className="mt-0 flex-1">
|
|
133
135
|
<DeckConfigForm layout={layout} setLayout={setLayout} />
|
|
134
136
|
</TabsContent>
|
|
137
|
+
<hr />
|
|
138
|
+
<KeyboardTips />
|
|
135
139
|
</Tabs>
|
|
136
140
|
);
|
|
137
141
|
};
|
|
138
142
|
|
|
143
|
+
const KEYBOARD_TIPS: { keys: string[]; description: string }[] = [
|
|
144
|
+
{ keys: ["F"], description: "Enter fullscreen" },
|
|
145
|
+
{ keys: ["C"], description: "Toggle code editor" },
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
const KEYBOARD_SHORTCUTS_URL =
|
|
149
|
+
"https://vlaaad.github.io/reveal/keyboard-shortcuts";
|
|
150
|
+
|
|
151
|
+
const KeyboardTips = () => {
|
|
152
|
+
return (
|
|
153
|
+
<div className="flex flex-col gap-2 text-xs text-muted-foreground">
|
|
154
|
+
<div className="flex items-center gap-1.5 font-medium text-foreground/80">
|
|
155
|
+
<KeyboardIcon className="h-3.5 w-3.5" />
|
|
156
|
+
<span>Shortcuts</span>
|
|
157
|
+
</div>
|
|
158
|
+
<ul className="flex flex-col gap-1.5">
|
|
159
|
+
{KEYBOARD_TIPS.map(({ keys, description }) => (
|
|
160
|
+
<li key={description} className="flex items-center justify-between">
|
|
161
|
+
<span>{description}</span>
|
|
162
|
+
<span className="flex gap-1">
|
|
163
|
+
{keys.map((key) => (
|
|
164
|
+
<Kbd key={key}>{key}</Kbd>
|
|
165
|
+
))}
|
|
166
|
+
</span>
|
|
167
|
+
</li>
|
|
168
|
+
))}
|
|
169
|
+
</ul>
|
|
170
|
+
<a
|
|
171
|
+
href={KEYBOARD_SHORTCUTS_URL}
|
|
172
|
+
target="_blank"
|
|
173
|
+
rel="noopener noreferrer"
|
|
174
|
+
className="text-link hover:underline"
|
|
175
|
+
>
|
|
176
|
+
See all shortcuts
|
|
177
|
+
</a>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
139
182
|
const SlideConfigForm = ({
|
|
140
183
|
layout,
|
|
141
184
|
setLayout,
|
|
@@ -270,6 +270,22 @@ const TerminalComponent: React.FC<TerminalComponentProps> = ({
|
|
|
270
270
|
|
|
271
271
|
const handleOpen = () => {
|
|
272
272
|
updateReadyState();
|
|
273
|
+
// Send initial dimensions: the mount-time fit() may have fired
|
|
274
|
+
// before the WS was OPEN, dropping the resize message and leaving
|
|
275
|
+
// the PTY at its default 0x0 winsize.
|
|
276
|
+
fitAddon.fit();
|
|
277
|
+
if (terminal.cols > 0 && terminal.rows > 0) {
|
|
278
|
+
socket.send(
|
|
279
|
+
JSON.stringify({
|
|
280
|
+
type: "resize",
|
|
281
|
+
cols: terminal.cols,
|
|
282
|
+
rows: terminal.rows,
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
// The fit() above may have triggered onResize → scheduled a
|
|
286
|
+
// debounced send. Cancel it; we just sent the same dims.
|
|
287
|
+
handleBackendResizeDebounced.cancel();
|
|
288
|
+
}
|
|
273
289
|
};
|
|
274
290
|
|
|
275
291
|
const handleDisconnect = () => {
|
|
@@ -15,7 +15,8 @@ export const ExternalLink = ({
|
|
|
15
15
|
| `https://marimo.io/${string}`
|
|
16
16
|
| `https://links.marimo.app/${string}`
|
|
17
17
|
| `https://wandb.ai/${string}`
|
|
18
|
-
| `https://portal.azure.com/${string}
|
|
18
|
+
| `https://portal.azure.com/${string}`
|
|
19
|
+
| `https://opencode.ai/${string}`;
|
|
19
20
|
children: React.ReactNode;
|
|
20
21
|
}) => {
|
|
21
22
|
return (
|
package/src/core/ai/ids/ids.ts
CHANGED
|
@@ -469,10 +469,34 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
469
469
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
470
470
|
apply([
|
|
471
471
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
472
|
-
{
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
472
|
+
{
|
|
473
|
+
type: "set-config",
|
|
474
|
+
cellId: a,
|
|
475
|
+
column: 0,
|
|
476
|
+
disabled: false,
|
|
477
|
+
hideCode: false,
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
type: "set-config",
|
|
481
|
+
cellId: b,
|
|
482
|
+
column: 1,
|
|
483
|
+
disabled: false,
|
|
484
|
+
hideCode: false,
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
type: "set-config",
|
|
488
|
+
cellId: c,
|
|
489
|
+
column: 0,
|
|
490
|
+
disabled: false,
|
|
491
|
+
hideCode: false,
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
type: "set-config",
|
|
495
|
+
cellId: d,
|
|
496
|
+
column: 1,
|
|
497
|
+
disabled: false,
|
|
498
|
+
hideCode: false,
|
|
499
|
+
},
|
|
476
500
|
]);
|
|
477
501
|
// a and c in col0; b and d in col1. Order within each column follows
|
|
478
502
|
// the reorder-cells order.
|
|
@@ -487,7 +511,15 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
487
511
|
it("set-config without reorder-cells moves the cell to the new column", () => {
|
|
488
512
|
setup("a", "b", "c");
|
|
489
513
|
const [, b] = state.cellIds.inOrderIds;
|
|
490
|
-
apply([
|
|
514
|
+
apply([
|
|
515
|
+
{
|
|
516
|
+
type: "set-config",
|
|
517
|
+
cellId: b,
|
|
518
|
+
column: 1,
|
|
519
|
+
disabled: false,
|
|
520
|
+
hideCode: false,
|
|
521
|
+
},
|
|
522
|
+
]);
|
|
491
523
|
// Without reorder-cells, the flat order comes from the current tree.
|
|
492
524
|
// b gets explicit col=1; a and c stay with default null → follow the
|
|
493
525
|
// previous cell's column (a → col0 because prev=0; c → col1 because
|
|
@@ -503,7 +535,15 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
503
535
|
it("no column change: set-config only touching other fields does not repartition", () => {
|
|
504
536
|
setup("a", "b", "c");
|
|
505
537
|
const [, b] = state.cellIds.inOrderIds;
|
|
506
|
-
apply([
|
|
538
|
+
apply([
|
|
539
|
+
{
|
|
540
|
+
type: "set-config",
|
|
541
|
+
cellId: b,
|
|
542
|
+
column: null,
|
|
543
|
+
disabled: false,
|
|
544
|
+
hideCode: true,
|
|
545
|
+
},
|
|
546
|
+
]);
|
|
507
547
|
// All three cells remain in a single column. No rebuild triggered.
|
|
508
548
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
509
549
|
"
|
|
@@ -525,8 +565,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
525
565
|
const [a, b] = state.cellIds.inOrderIds;
|
|
526
566
|
apply([
|
|
527
567
|
{ type: "reorder-cells", cellIds: [a, b] },
|
|
528
|
-
{
|
|
529
|
-
|
|
568
|
+
{
|
|
569
|
+
type: "set-config",
|
|
570
|
+
cellId: a,
|
|
571
|
+
column: 0,
|
|
572
|
+
disabled: false,
|
|
573
|
+
hideCode: false,
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
type: "set-config",
|
|
577
|
+
cellId: b,
|
|
578
|
+
column: 1,
|
|
579
|
+
disabled: false,
|
|
580
|
+
hideCode: false,
|
|
581
|
+
},
|
|
530
582
|
]);
|
|
531
583
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
532
584
|
"
|
|
@@ -550,8 +602,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
550
602
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
551
603
|
apply([
|
|
552
604
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
553
|
-
{
|
|
554
|
-
|
|
605
|
+
{
|
|
606
|
+
type: "set-config",
|
|
607
|
+
cellId: a,
|
|
608
|
+
column: 0,
|
|
609
|
+
disabled: false,
|
|
610
|
+
hideCode: false,
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
type: "set-config",
|
|
614
|
+
cellId: c,
|
|
615
|
+
column: 1,
|
|
616
|
+
disabled: false,
|
|
617
|
+
hideCode: false,
|
|
618
|
+
},
|
|
555
619
|
]);
|
|
556
620
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
557
621
|
"
|
|
@@ -562,8 +626,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
562
626
|
// Now merge everything back to col 0.
|
|
563
627
|
apply([
|
|
564
628
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
565
|
-
{
|
|
566
|
-
|
|
629
|
+
{
|
|
630
|
+
type: "set-config",
|
|
631
|
+
cellId: c,
|
|
632
|
+
column: 0,
|
|
633
|
+
disabled: false,
|
|
634
|
+
hideCode: false,
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
type: "set-config",
|
|
638
|
+
cellId: d,
|
|
639
|
+
column: 0,
|
|
640
|
+
disabled: false,
|
|
641
|
+
hideCode: false,
|
|
642
|
+
},
|
|
567
643
|
]);
|
|
568
644
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
569
645
|
"
|
|
@@ -609,8 +685,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
609
685
|
{ type: "reorder-cells", cellIds: [a, b, c] },
|
|
610
686
|
{ type: "set-code", cellId: a, code: "x = 1" },
|
|
611
687
|
{ type: "set-name", cellId: b, name: "middle" },
|
|
612
|
-
{
|
|
613
|
-
|
|
688
|
+
{
|
|
689
|
+
type: "set-config",
|
|
690
|
+
cellId: a,
|
|
691
|
+
column: 0,
|
|
692
|
+
disabled: false,
|
|
693
|
+
hideCode: false,
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
type: "set-config",
|
|
697
|
+
cellId: b,
|
|
698
|
+
column: 1,
|
|
699
|
+
disabled: false,
|
|
700
|
+
hideCode: false,
|
|
701
|
+
},
|
|
614
702
|
]);
|
|
615
703
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
616
704
|
"
|
|
@@ -658,8 +746,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
658
746
|
// Split into two columns. Only a and c are anchors.
|
|
659
747
|
apply([
|
|
660
748
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
661
|
-
{
|
|
662
|
-
|
|
749
|
+
{
|
|
750
|
+
type: "set-config",
|
|
751
|
+
cellId: a,
|
|
752
|
+
column: 0,
|
|
753
|
+
disabled: false,
|
|
754
|
+
hideCode: false,
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
type: "set-config",
|
|
758
|
+
cellId: c,
|
|
759
|
+
column: 1,
|
|
760
|
+
disabled: false,
|
|
761
|
+
hideCode: false,
|
|
762
|
+
},
|
|
663
763
|
]);
|
|
664
764
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
665
765
|
"
|
|
@@ -670,7 +770,13 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
670
770
|
// Move the c anchor to col 0. d has no explicit column so it follows c.
|
|
671
771
|
apply([
|
|
672
772
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
673
|
-
{
|
|
773
|
+
{
|
|
774
|
+
type: "set-config",
|
|
775
|
+
cellId: c,
|
|
776
|
+
column: 0,
|
|
777
|
+
disabled: false,
|
|
778
|
+
hideCode: false,
|
|
779
|
+
},
|
|
674
780
|
]);
|
|
675
781
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
676
782
|
"
|
|
@@ -686,9 +792,27 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
686
792
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
687
793
|
apply([
|
|
688
794
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
689
|
-
{
|
|
690
|
-
|
|
691
|
-
|
|
795
|
+
{
|
|
796
|
+
type: "set-config",
|
|
797
|
+
cellId: a,
|
|
798
|
+
column: 0,
|
|
799
|
+
disabled: false,
|
|
800
|
+
hideCode: false,
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
type: "set-config",
|
|
804
|
+
cellId: c,
|
|
805
|
+
column: 1,
|
|
806
|
+
disabled: false,
|
|
807
|
+
hideCode: false,
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
type: "set-config",
|
|
811
|
+
cellId: d,
|
|
812
|
+
column: 1,
|
|
813
|
+
disabled: false,
|
|
814
|
+
hideCode: false,
|
|
815
|
+
},
|
|
692
816
|
]);
|
|
693
817
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
694
818
|
"
|
|
@@ -700,7 +824,13 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
700
824
|
// does NOT follow c.
|
|
701
825
|
apply([
|
|
702
826
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
703
|
-
{
|
|
827
|
+
{
|
|
828
|
+
type: "set-config",
|
|
829
|
+
cellId: c,
|
|
830
|
+
column: 0,
|
|
831
|
+
disabled: false,
|
|
832
|
+
hideCode: false,
|
|
833
|
+
},
|
|
704
834
|
]);
|
|
705
835
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
706
836
|
"
|
|
@@ -719,8 +849,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
719
849
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
720
850
|
apply([
|
|
721
851
|
// set-config appears FIRST in the transaction.
|
|
722
|
-
{
|
|
723
|
-
|
|
852
|
+
{
|
|
853
|
+
type: "set-config",
|
|
854
|
+
cellId: a,
|
|
855
|
+
column: 0,
|
|
856
|
+
disabled: false,
|
|
857
|
+
hideCode: false,
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
type: "set-config",
|
|
861
|
+
cellId: c,
|
|
862
|
+
column: 1,
|
|
863
|
+
disabled: false,
|
|
864
|
+
hideCode: false,
|
|
865
|
+
},
|
|
724
866
|
// reorder-cells comes afterwards.
|
|
725
867
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
726
868
|
]);
|
|
@@ -741,9 +883,21 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
741
883
|
setup("a", "b", "c", "d");
|
|
742
884
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
743
885
|
apply([
|
|
744
|
-
{
|
|
886
|
+
{
|
|
887
|
+
type: "set-config",
|
|
888
|
+
cellId: a,
|
|
889
|
+
column: 0,
|
|
890
|
+
disabled: false,
|
|
891
|
+
hideCode: false,
|
|
892
|
+
},
|
|
745
893
|
{ type: "set-code", cellId: a, code: "x = 1" },
|
|
746
|
-
{
|
|
894
|
+
{
|
|
895
|
+
type: "set-config",
|
|
896
|
+
cellId: c,
|
|
897
|
+
column: 1,
|
|
898
|
+
disabled: false,
|
|
899
|
+
hideCode: false,
|
|
900
|
+
},
|
|
747
901
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
748
902
|
{ type: "set-name", cellId: d, name: "last" },
|
|
749
903
|
]);
|
|
@@ -769,8 +923,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
769
923
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
770
924
|
apply([
|
|
771
925
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
772
|
-
{
|
|
773
|
-
|
|
926
|
+
{
|
|
927
|
+
type: "set-config",
|
|
928
|
+
cellId: a,
|
|
929
|
+
column: 0,
|
|
930
|
+
disabled: false,
|
|
931
|
+
hideCode: false,
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
type: "set-config",
|
|
935
|
+
cellId: c,
|
|
936
|
+
column: 1,
|
|
937
|
+
disabled: false,
|
|
938
|
+
hideCode: false,
|
|
939
|
+
},
|
|
774
940
|
]);
|
|
775
941
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
776
942
|
"
|
|
@@ -203,6 +203,8 @@ describe("toDocumentChanges", () => {
|
|
|
203
203
|
[
|
|
204
204
|
{
|
|
205
205
|
"cellId": "0",
|
|
206
|
+
"column": null,
|
|
207
|
+
"disabled": false,
|
|
206
208
|
"hideCode": true,
|
|
207
209
|
"type": "set-config",
|
|
208
210
|
},
|
|
@@ -246,6 +248,8 @@ describe("toDocumentChanges", () => {
|
|
|
246
248
|
{
|
|
247
249
|
"cellId": "1",
|
|
248
250
|
"column": 1,
|
|
251
|
+
"disabled": false,
|
|
252
|
+
"hideCode": false,
|
|
249
253
|
"type": "set-config",
|
|
250
254
|
},
|
|
251
255
|
{
|
|
@@ -273,11 +277,15 @@ describe("toDocumentChanges", () => {
|
|
|
273
277
|
{
|
|
274
278
|
"cellId": "1",
|
|
275
279
|
"column": 1,
|
|
280
|
+
"disabled": false,
|
|
281
|
+
"hideCode": false,
|
|
276
282
|
"type": "set-config",
|
|
277
283
|
},
|
|
278
284
|
{
|
|
279
285
|
"cellId": "2",
|
|
280
286
|
"column": 1,
|
|
287
|
+
"disabled": false,
|
|
288
|
+
"hideCode": false,
|
|
281
289
|
"type": "set-config",
|
|
282
290
|
},
|
|
283
291
|
{
|
|
@@ -310,11 +318,15 @@ describe("toDocumentChanges", () => {
|
|
|
310
318
|
{
|
|
311
319
|
"cellId": "1",
|
|
312
320
|
"column": 0,
|
|
321
|
+
"disabled": false,
|
|
322
|
+
"hideCode": false,
|
|
313
323
|
"type": "set-config",
|
|
314
324
|
},
|
|
315
325
|
{
|
|
316
326
|
"cellId": "2",
|
|
317
327
|
"column": 0,
|
|
328
|
+
"disabled": false,
|
|
329
|
+
"hideCode": false,
|
|
318
330
|
"type": "set-config",
|
|
319
331
|
},
|
|
320
332
|
{
|
|
@@ -358,6 +370,8 @@ describe("toDocumentChanges", () => {
|
|
|
358
370
|
{
|
|
359
371
|
"cellId": "1",
|
|
360
372
|
"column": 1,
|
|
373
|
+
"disabled": false,
|
|
374
|
+
"hideCode": false,
|
|
361
375
|
"type": "set-config",
|
|
362
376
|
},
|
|
363
377
|
{
|
|
@@ -156,10 +156,13 @@ function columnChanges(
|
|
|
156
156
|
for (const [cellId, newCol] of newColumns) {
|
|
157
157
|
const prevCol = prevColumns.get(cellId);
|
|
158
158
|
if (prevCol !== newCol) {
|
|
159
|
+
const cell = getCell(cellId, newState);
|
|
159
160
|
changes.push({
|
|
160
161
|
type: "set-config",
|
|
161
162
|
cellId: cellId,
|
|
162
163
|
column: newCol,
|
|
164
|
+
disabled: cell?.config.disabled ?? false,
|
|
165
|
+
hideCode: cell?.config.hide_code ?? false,
|
|
163
166
|
});
|
|
164
167
|
}
|
|
165
168
|
}
|
|
@@ -257,18 +260,21 @@ export function toDocumentChanges(
|
|
|
257
260
|
}
|
|
258
261
|
|
|
259
262
|
// updateCellConfig → set-config
|
|
260
|
-
//
|
|
261
|
-
//
|
|
262
|
-
// (from the action payload, not the full cell config).
|
|
263
|
+
// SetConfig is full-replacement: emit the cell's complete config from
|
|
264
|
+
// newState (which already merged the action's partial payload).
|
|
263
265
|
case "updateCellConfig": {
|
|
264
|
-
const { cellId
|
|
266
|
+
const { cellId } = action.payload;
|
|
267
|
+
const cell = getCell(cellId, newState);
|
|
268
|
+
if (!cell) {
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
265
271
|
return [
|
|
266
272
|
{
|
|
267
273
|
type: "set-config",
|
|
268
274
|
cellId: cellId,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
column: cell.config.column ?? null,
|
|
276
|
+
disabled: cell.config.disabled ?? false,
|
|
277
|
+
hideCode: cell.config.hide_code ?? false,
|
|
272
278
|
},
|
|
273
279
|
];
|
|
274
280
|
}
|
|
@@ -538,18 +544,15 @@ export function fromDocumentChanges(
|
|
|
538
544
|
break;
|
|
539
545
|
|
|
540
546
|
// set-config → updateCellConfig
|
|
541
|
-
// Maps the change's camelCase hideCode back to CellConfig's snake_case
|
|
542
|
-
// hide_code. Only includes fields that are non-null (null means
|
|
543
|
-
// "not specified" on the wire, not "clear the value").
|
|
544
547
|
case "set-config":
|
|
545
548
|
actions.push({
|
|
546
549
|
type: "updateCellConfig",
|
|
547
550
|
payload: {
|
|
548
551
|
cellId: change.cellId,
|
|
549
552
|
config: {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
+
column: change.column,
|
|
554
|
+
disabled: change.disabled,
|
|
555
|
+
hide_code: change.hideCode,
|
|
553
556
|
},
|
|
554
557
|
},
|
|
555
558
|
});
|
|
@@ -650,7 +653,7 @@ export function applyTransactionChanges(
|
|
|
650
653
|
) {
|
|
651
654
|
continue;
|
|
652
655
|
}
|
|
653
|
-
if (change.type === "set-config"
|
|
656
|
+
if (change.type === "set-config") {
|
|
654
657
|
hasColumnChange = true;
|
|
655
658
|
}
|
|
656
659
|
if (change.type === "create-cell" && change.config?.column != null) {
|
|
@@ -385,6 +385,42 @@ describe("insertImage", () => {
|
|
|
385
385
|
);
|
|
386
386
|
});
|
|
387
387
|
|
|
388
|
+
test("normalizes Windows backslash paths to forward slashes in image URL", async () => {
|
|
389
|
+
view = createEditor("Hello, world!");
|
|
390
|
+
view.dispatch({
|
|
391
|
+
selection: { anchor: 7, head: 7 },
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
vi.spyOn(store, "get").mockImplementation((atom) => {
|
|
395
|
+
if (atom === filenameAtom) {
|
|
396
|
+
return "C:\\Users\\user\\project\\notebook.py";
|
|
397
|
+
}
|
|
398
|
+
if (atom === requestClientAtom) {
|
|
399
|
+
return mockRequestClient;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
mockRequestClient.sendCreateFileOrFolder.mockResolvedValueOnce({
|
|
404
|
+
success: true,
|
|
405
|
+
message: null,
|
|
406
|
+
info: {
|
|
407
|
+
path: "C:\\Users\\user\\project\\public\\hello.png",
|
|
408
|
+
name: "hello.png",
|
|
409
|
+
children: [],
|
|
410
|
+
id: "",
|
|
411
|
+
isDirectory: false,
|
|
412
|
+
isMarimoFile: false,
|
|
413
|
+
lastModified: null,
|
|
414
|
+
},
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
await insertImage(view, mockPngFile());
|
|
418
|
+
|
|
419
|
+
expect(view.state.doc.toString()).toMatchInlineSnapshot(
|
|
420
|
+
`"Hello, world!"`,
|
|
421
|
+
);
|
|
422
|
+
});
|
|
423
|
+
|
|
388
424
|
test("saves image as file different extension", async () => {
|
|
389
425
|
view = createEditor("Hello, world!");
|
|
390
426
|
view.dispatch({
|
|
@@ -360,7 +360,10 @@ export async function insertImage(view: EditorView, file: File) {
|
|
|
360
360
|
notebookDir &&
|
|
361
361
|
savedFilePath.startsWith(notebookDir)
|
|
362
362
|
) {
|
|
363
|
-
savedFilePath = Paths.rest(savedFilePath, notebookDir)
|
|
363
|
+
savedFilePath = Paths.rest(savedFilePath, notebookDir).replaceAll(
|
|
364
|
+
"\\",
|
|
365
|
+
"/",
|
|
366
|
+
);
|
|
364
367
|
}
|
|
365
368
|
|
|
366
369
|
toast({
|
|
@@ -166,6 +166,7 @@ export const UserConfigSchema = z
|
|
|
166
166
|
ollama: AiConfigSchema.optional(),
|
|
167
167
|
openrouter: AiConfigSchema.optional(),
|
|
168
168
|
wandb: AiConfigSchema.optional(),
|
|
169
|
+
opencode_go: AiConfigSchema.optional(),
|
|
169
170
|
open_ai_compatible: AiConfigSchema.optional(),
|
|
170
171
|
azure: AiConfigSchema.optional(),
|
|
171
172
|
bedrock: z
|
package/src/core/edit-app.tsx
CHANGED
package/src/core/run-app.tsx
CHANGED
|
@@ -10,7 +10,11 @@ import { buttonVariants } from "@/components/ui/button";
|
|
|
10
10
|
import { DelayMount } from "@/components/utils/delay-mount";
|
|
11
11
|
import { cn } from "@/utils/cn";
|
|
12
12
|
import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
hasCellsAtom,
|
|
15
|
+
notebookIsRunningAtom,
|
|
16
|
+
useCellActions,
|
|
17
|
+
} from "./cells/cells";
|
|
14
18
|
import type { AppConfig } from "./config/config-schema";
|
|
15
19
|
import { RuntimeState } from "./kernel/RuntimeState";
|
|
16
20
|
import { getSessionId } from "./kernel/session";
|
|
@@ -42,10 +46,13 @@ export const RunApp: React.FC<AppProps> = ({ appConfig }) => {
|
|
|
42
46
|
|
|
43
47
|
const isRunning = useAtomValue(notebookIsRunningAtom);
|
|
44
48
|
const isConnecting = isAppConnecting(connection.state);
|
|
49
|
+
// Skip the "Connecting..." gate when we already have cells to show — from
|
|
50
|
+
// an embedded snapshot or a prior connection.
|
|
51
|
+
const hasExistingCells = useAtomValue(hasCellsAtom);
|
|
45
52
|
|
|
46
53
|
const renderCells = () => {
|
|
47
54
|
// If we are connecting for more than 2 seconds, show a spinner
|
|
48
|
-
if (isConnecting) {
|
|
55
|
+
if (isConnecting && !hasExistingCells) {
|
|
49
56
|
return (
|
|
50
57
|
<DelayMount milliseconds={2000} fallback={null}>
|
|
51
58
|
<Spinner className="mx-auto" />
|
|
@@ -5,6 +5,7 @@ import { Logger } from "@/utils/Logger";
|
|
|
5
5
|
import { KnownQueryParams } from "../constants";
|
|
6
6
|
import { isIslands } from "../islands/utils";
|
|
7
7
|
import { getSessionId, type SessionId } from "../kernel/session";
|
|
8
|
+
import { isStaticNotebook } from "../static/static-state";
|
|
8
9
|
import { isWasm } from "../wasm/utils";
|
|
9
10
|
import type { RuntimeConfig } from "./types";
|
|
10
11
|
|
|
@@ -178,8 +179,8 @@ export class RuntimeManager {
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
async isHealthy(): Promise<boolean> {
|
|
181
|
-
// Always healthy if WASM
|
|
182
|
-
if (isWasm() || isIslands()) {
|
|
182
|
+
// Always healthy if WASM, Islands, or a static notebook (no server)
|
|
183
|
+
if (isWasm() || isIslands() || isStaticNotebook()) {
|
|
183
184
|
return true;
|
|
184
185
|
}
|
|
185
186
|
|