@marimo-team/islands 0.25.3-dev192 → 0.25.3-dev196
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-BBbOElk3.js → ConnectedDataExplorerComponent-BRuwLOIx.js} +9 -9
- package/dist/{ErrorBoundary-Dw6uRKVk.js → ErrorBoundary-C3Xv3yzV.js} +2 -2
- package/dist/{abnfDiagram-VCTEODGH-DhMT6Uhd.js → abnfDiagram-VCTEODGH-LlJTOOU_.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-BVbEiJLq.js → architectureDiagram-5GKGNRK7-9PQtGLLZ.js} +1 -1
- package/dist/{arrays-R6JsImiT.js → arrays-DA6KkLfq.js} +6 -12
- package/dist/assets/__vite-browser-external-BCJsx8QS.js +1 -0
- package/dist/assets/{worker-C6e9ERyd.js → worker-DodjWT_Z.js} +2 -2
- package/dist/{capabilities-CI4xUPsp.js → capabilities-CvWU-ey_.js} +1 -1
- package/dist/{chat-ui-BguxTQEL.js → chat-ui-Bl2euMBD.js} +93 -93
- package/dist/{chunk-IMKFNOWR-By5hSbJJ.js → chunk-IMKFNOWR-DcXv-BD5.js} +1 -1
- package/dist/{chunk-SHT3W25Y-DFrEYG54.js → chunk-SHT3W25Y-VwnELN23.js} +1 -1
- package/dist/{chunk-SVP7TREG-DFXGc9ew.js → chunk-SVP7TREG-DgQpI5Zi.js} +1 -1
- package/dist/{chunk-TICWLB2K-DZdNIpoZ.js → chunk-TICWLB2K-CTg6VTJT.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-Cgj_eEQA.js → classDiagram-ZZMXUADV-UzmcFrnW.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-DLAUrSqj.js → classDiagram-v2-VYDZK3BY-DhjiI6IQ.js} +2 -2
- package/dist/{code-visibility-v_7ijLtx.js → code-visibility-BCcqmP58.js} +38 -42
- package/dist/{common-BUwWHpnK.js → common-DrNB2bY2.js} +849 -849
- package/dist/{cynefinDiagram-5FMLGOSQ-Cikf9AKa.js → cynefinDiagram-5FMLGOSQ-O4ShIbJX.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-C5KEi5_l.js → dagre-GXQ25YYZ-dtHhhcPu.js} +1 -1
- package/dist/{data-grid-overlay-editor-4IZymnXZ.js → data-grid-overlay-editor-TGXV_Hf4.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-BaoBTQjR.js → diagram-S7CK7UJ4-ppPYVZ6W.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DDufBsUA.js → diagram-UQ7AKVKN-CMZDf--k.js} +1 -1
- package/dist/{diagram-VX7I27RA-CY6RALJ8.js → diagram-VX7I27RA-CFvJdx-C.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Bc-LHsD6.js → diagram-Z3DM3KII-Dt6_uFbv.js} +1 -1
- package/dist/{dropdown-menu-drDjxJyV.js → dropdown-menu-CeaOsjWZ.js} +2 -2
- package/dist/{ebnfDiagram-PWID7BFC-Cz0J-tcC.js → ebnfDiagram-PWID7BFC-DpRFrKK-.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-DTXTDgFu.js → erDiagram-RLTQ6QDP-CqAU4b0u.js} +1 -1
- package/dist/{error-entries-CZ1NQ6Kv.js → error-entries-CYGwr5-O.js} +5596 -6012
- package/dist/feedback-button-PTiPn2GP.js +374 -0
- package/dist/{flowDiagram-HODETNUW-RbwWf2zc.js → flowDiagram-HODETNUW-i8-Gw8HO.js} +2 -2
- package/dist/{formats-DbXnijtH.js → formats-BtoHHy42.js} +1 -1
- package/dist/{glide-data-editor-DU8_EDG5.js → glide-data-editor-BSyexjkB.js} +5 -5
- package/dist/{globals-BeBDOk22.js → globals-B7gkJAxm.js} +2 -2
- package/dist/{html-to-image-D_4_hQ8U.js → html-to-image-Cy5UDpQJ.js} +56 -56
- package/dist/{infoDiagram-27XIBGKW-DlmzZjmI.js → infoDiagram-27XIBGKW-DpfOKdLL.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-EN3TYP_q.js → ishikawaDiagram-5VMMS53U-Dg7mrMG7.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CK_-Ru7Q.js → kanban-definition-UXKFOSKX-QB6e3Jrj.js} +1 -1
- package/dist/main.js +5875 -5876
- package/dist/{mermaid-DU9ZRmkG.js → mermaid-CeWG4Egr.js} +48 -48
- package/dist/{mindmap-definition-YA3MSWOX-C-hqgUvF.js → mindmap-definition-YA3MSWOX-BTz3uTGe.js} +1 -1
- package/dist/{number-overlay-editor-BoIkyh6H.js → number-overlay-editor-Bb91yQ46.js} +1 -1
- package/dist/{once-eG8Vmvjd.js → once-DWGO2mQ2.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-BiMejYPB.js → pegDiagram-XKGWAZYB-3ZIEa3mB.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-B1zCZ1eq.js → pieDiagram-E7YTZNPT-BJAlk046.js} +1 -1
- package/dist/{process-output-DxSCHBWp.js → process-output-q9MTAIMX.js} +2 -2
- package/dist/{railroadDiagram-O6MQD6OU-BLcfaASl.js → railroadDiagram-O6MQD6OU-Dn3bsSRa.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-DtBOf52-.js → requirementDiagram-BXWQKSXE-wcOmQQCL.js} +1 -1
- package/dist/{reveal-component-5M3a2rpj.js → reveal-component-vTdjiyDv.js} +17 -17
- package/dist/{sequenceDiagram-WJ2MYXX4-DIwF19_n.js → sequenceDiagram-WJ2MYXX4-DSh_qxoF.js} +1 -1
- package/dist/{spec-DZDnnlgT.js → spec-C7Fos-If.js} +1 -1
- package/dist/{stateDiagram-D77RDMKH-sWk1AdYL.js → stateDiagram-D77RDMKH-DH_H8NMH.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-CiNo-OI7.js → stateDiagram-v2-MP3YSRHH-D_JM7MEK.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-Bj3hiOY5.js → swimlanes-42K2YHIH-CfoTJO-9.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-BzEo2r_N.js → swimlanesDiagram-VR7AAH4N-Z_QhvK0G.js} +2 -2
- package/dist/{swiper-component-BkCm-kLg.js → swiper-component-D2geL1Ku.js} +1 -1
- package/dist/{timeline-definition-24CTP7MA-CrPQk42H.js → timeline-definition-24CTP7MA-BFtdScaL.js} +1 -1
- package/dist/{toDate-Cu2pIZcC.js → toDate-CQAFSwos.js} +24 -24
- package/dist/{useAsyncData-DEhLdRIu.js → useAsyncData-BeyZyjso.js} +1 -1
- package/dist/{useDeepCompareMemoize-RjZGVhBV.js → useDeepCompareMemoize-DOQgae0W.js} +1 -1
- package/dist/{useIframeCapabilities-CSdWn6NP.js → useIframeCapabilities-DNvaj9wM.js} +1 -1
- package/dist/{useLifecycle-DtcB2s1z.js → useLifecycle-n2lnCFS8.js} +1 -1
- package/dist/{useTheme-CoEtr4mK.js → useTheme-CY777LXN.js} +303 -99
- package/dist/{vega-component-BhjTrP9-.js → vega-component-0nQzA-I8.js} +6 -6
- package/dist/{vennDiagram-4TSXK5OY-BaYMoIpj.js → vennDiagram-4TSXK5OY-BXY8IGCA.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-DjHeuj8p.js → wardleyDiagram-VM6X3IG4-D0tFe6eC.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-Bc_hcuXS.js → xychartDiagram-S5SC5T6Z-Dx8wFM-y.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/notebook.ts +0 -1
- package/src/__mocks__/partial.ts +26 -0
- package/src/__tests__/main.test.tsx +24 -1
- package/src/components/app-config/app-config-form.tsx +5 -9
- package/src/components/editor/__tests__/data-attributes.test.tsx +0 -1
- package/src/components/editor/__tests__/output-persistence.test.tsx +0 -1
- package/src/components/editor/actions/useCellActionButton.tsx +6 -5
- package/src/components/editor/actions/useConfigActions.tsx +3 -4
- package/src/components/editor/actions/useNotebookActions.tsx +5 -4
- package/src/components/editor/cell/code/cell-editor.tsx +13 -6
- package/src/components/editor/cell/collapse.tsx +6 -1
- package/src/components/editor/chrome/components/feedback-button.tsx +1 -7
- package/src/components/editor/controls/Controls.tsx +1 -1
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +8 -6
- package/src/components/editor/navigation/__tests__/navigation.test.ts +15 -15
- package/src/components/editor/navigation/__tests__/selection.test.ts +44 -21
- package/src/components/editor/navigation/focus-utils.ts +19 -0
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +6 -13
- package/src/components/editor/navigation/navigation.ts +52 -43
- package/src/components/editor/navigation/selection.ts +30 -29
- package/src/components/editor/notebook-cell.tsx +10 -18
- package/src/components/editor/renderers/cell-array.tsx +6 -5
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -1
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
- package/src/components/pages/edit-page.tsx +0 -13
- package/src/components/scratchpad/scratchpad.tsx +0 -1
- package/src/components/slides/reveal-component.tsx +1 -1
- package/src/components/slides/slide-cell-view.tsx +0 -1
- package/src/components/sort/SortableCellsProvider.tsx +6 -5
- package/src/core/MarimoApp.tsx +1 -1
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -37
- package/src/core/cells/__tests__/actions.test.ts +190 -80
- package/src/core/cells/__tests__/arrange.test.ts +263 -0
- package/src/core/cells/__tests__/cells.test.ts +11 -1101
- package/src/core/cells/__tests__/document.test.ts +3 -32
- package/src/core/cells/__tests__/editor.test.ts +57 -0
- package/src/core/cells/__tests__/harness.ts +82 -0
- package/src/core/cells/__tests__/layout.test.ts +189 -0
- package/src/core/cells/__tests__/notebook-outline.test.ts +7 -1
- package/src/core/cells/__tests__/session.test.ts +329 -174
- package/src/core/cells/__tests__/utils.test.ts +0 -1
- package/src/core/cells/actions.ts +247 -82
- package/src/core/cells/arrange.ts +341 -0
- package/src/core/cells/cells.ts +27 -516
- package/src/core/cells/document.ts +6 -5
- package/src/core/cells/edit.ts +30 -0
- package/src/core/cells/editor.ts +82 -0
- package/src/core/cells/layout.ts +152 -0
- package/src/core/cells/session.ts +75 -52
- package/src/core/cells/types.ts +0 -5
- package/src/core/cells/utils.ts +6 -4
- package/src/core/config/__tests__/app-config.test.ts +64 -0
- package/src/core/config/__tests__/config-schema.test.ts +1 -1
- package/src/core/config/config-schema.ts +6 -2
- package/src/core/config/config.ts +26 -12
- package/src/core/islands/bootstrap.ts +0 -1
- package/src/core/kernel/handlers.ts +1 -13
- package/src/core/meta/__tests__/code-visibility.test.tsx +78 -70
- package/src/core/meta/code-visibility.ts +18 -9
- package/src/core/notebook/__tests__/operations.test.ts +51 -0
- package/src/core/notebook/document/__tests__/codemirror.test.ts +33 -7
- package/src/core/notebook/index.ts +2 -1
- package/src/core/notebook/operations.ts +30 -0
- package/src/core/saving/__tests__/state.test.ts +111 -0
- package/src/core/saving/save-component.tsx +19 -33
- package/src/core/saving/state.ts +38 -39
- package/src/core/saving/useAutoSave.ts +8 -35
- package/src/core/session/__tests__/backend.test.ts +1 -0
- package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +1 -0
- package/src/core/session/active-notebook.ts +11 -0
- package/src/core/session/backend.ts +17 -19
- package/src/core/session/embedded.ts +7 -0
- package/src/core/session/useNotebookReplica.ts +3 -1
- package/src/core/session/useNotebookSession.tsx +7 -8
- package/src/core/transports/__tests__/static.test.ts +139 -8
- package/src/core/transports/static.ts +98 -16
- package/src/core/wasm/__tests__/bridge.test.ts +1 -0
- package/src/mount.tsx +19 -10
- package/src/stories/cell.stories.tsx +0 -2
- package/src/stories/layout/vertical/one-column.stories.tsx +0 -2
- package/src/utils/__tests__/id-tree.test.ts +20 -1548
- package/src/utils/id-tree.tsx +12 -537
- package/dist/assets/__vite-browser-external-C8gQho07.js +0 -1
- package/dist/feedback-button-MpeoIn1D.js +0 -379
- package/src/components/editor/navigation/__tests__/state.test.ts +0 -81
- package/src/components/editor/navigation/state.ts +0 -65
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/** A backend that serves a document snapshot without a host. */
|
|
4
4
|
|
|
5
|
-
import type { NotebookClient
|
|
5
|
+
import type { NotebookClient } from "@marimo-team/client";
|
|
6
6
|
import type * as Protocol from "@marimo-team/client/protocol";
|
|
7
7
|
import type { NotebookBackend } from "../notebook/replica";
|
|
8
8
|
|
|
@@ -13,14 +13,9 @@ export interface StaticNotebookSnapshot {
|
|
|
13
13
|
readonly cells: readonly Protocol.Cell[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export function createStaticNotebookBackend(
|
|
21
|
-
snapshot: StaticNotebookSnapshot,
|
|
22
|
-
): NotebookBackend {
|
|
23
|
-
const frames: Protocol.Event[] = [
|
|
16
|
+
/** The events that describe a snapshot, in the order a host sends them. */
|
|
17
|
+
function snapshotFrames(snapshot: StaticNotebookSnapshot): Protocol.Event[] {
|
|
18
|
+
return [
|
|
24
19
|
{
|
|
25
20
|
event: "notebook",
|
|
26
21
|
data: { notebook: { ...snapshot.notebook, operations: [] } },
|
|
@@ -30,6 +25,100 @@ export function createStaticNotebookBackend(
|
|
|
30
25
|
data: { cell },
|
|
31
26
|
})),
|
|
32
27
|
{ event: "document", data: { document: snapshot.document } },
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A snapshot of a notebook with no cells. */
|
|
32
|
+
export function emptySnapshot(notebookId: string): StaticNotebookSnapshot {
|
|
33
|
+
return {
|
|
34
|
+
notebook: {
|
|
35
|
+
id: notebookId,
|
|
36
|
+
project_id: notebookId,
|
|
37
|
+
path: null,
|
|
38
|
+
name: "",
|
|
39
|
+
updated_at: null,
|
|
40
|
+
},
|
|
41
|
+
document: {
|
|
42
|
+
notebook_id: notebookId,
|
|
43
|
+
order: [],
|
|
44
|
+
app_config: {},
|
|
45
|
+
etag: `${notebookId}:document`,
|
|
46
|
+
saved_etag: `${notebookId}:document`,
|
|
47
|
+
order_etag: `${notebookId}:order`,
|
|
48
|
+
app_config_etag: `${notebookId}:app_config`,
|
|
49
|
+
version: 1,
|
|
50
|
+
},
|
|
51
|
+
cells: [],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Show a snapshot until `live` answers.
|
|
57
|
+
*
|
|
58
|
+
* The page carries the notebook it was served with, so cells appear before
|
|
59
|
+
* the host connects. The snapshot ends in a `ready` of its own, like a
|
|
60
|
+
* static notebook's, so the replica publishes it. At the host's first sign
|
|
61
|
+
* of life a `reset` discards it, and the host's snapshot takes over. A
|
|
62
|
+
* connection that resumes from a host cursor skips the snapshot; one that
|
|
63
|
+
* resumes from the snapshot's cursor starts the host connection fresh,
|
|
64
|
+
* since the host never issued it.
|
|
65
|
+
*/
|
|
66
|
+
export function startWithSnapshot(
|
|
67
|
+
snapshot: StaticNotebookSnapshot,
|
|
68
|
+
live: NotebookBackend,
|
|
69
|
+
): NotebookBackend {
|
|
70
|
+
const cursor = `${snapshot.notebook.id}:snapshot`;
|
|
71
|
+
return {
|
|
72
|
+
...live,
|
|
73
|
+
transport: (attempt, handlers) => {
|
|
74
|
+
if (attempt.cursor !== null && attempt.cursor !== cursor) {
|
|
75
|
+
return live.transport(attempt, handlers);
|
|
76
|
+
}
|
|
77
|
+
if (attempt.cursor === null) {
|
|
78
|
+
for (const frame of snapshotFrames(snapshot)) {
|
|
79
|
+
if (attempt.signal.aborted) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
handlers.message(frame);
|
|
83
|
+
}
|
|
84
|
+
if (attempt.signal.aborted) {
|
|
85
|
+
return Promise.resolve();
|
|
86
|
+
}
|
|
87
|
+
handlers.message({ event: "ready", id: cursor, data: {} });
|
|
88
|
+
}
|
|
89
|
+
let shown = true;
|
|
90
|
+
const discard = () => {
|
|
91
|
+
if (shown) {
|
|
92
|
+
shown = false;
|
|
93
|
+
handlers.message({ event: "reset", data: {} });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return live.transport(
|
|
97
|
+
{ ...attempt, cursor: null },
|
|
98
|
+
{
|
|
99
|
+
open: () => {
|
|
100
|
+
discard();
|
|
101
|
+
handlers.open();
|
|
102
|
+
},
|
|
103
|
+
message: (frame) => {
|
|
104
|
+
discard();
|
|
105
|
+
handlers.message(frame);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Serve a document without a server, runtime, or mutation operations.
|
|
115
|
+
* Callers and readers must treat the snapshot records as immutable.
|
|
116
|
+
*/
|
|
117
|
+
export function createStaticNotebookBackend(
|
|
118
|
+
snapshot: StaticNotebookSnapshot,
|
|
119
|
+
): NotebookBackend {
|
|
120
|
+
const frames: Protocol.Event[] = [
|
|
121
|
+
...snapshotFrames(snapshot),
|
|
33
122
|
{ event: "ready", id: "static", data: {} },
|
|
34
123
|
];
|
|
35
124
|
|
|
@@ -75,10 +164,3 @@ export function createStaticNotebookBackend(
|
|
|
75
164
|
},
|
|
76
165
|
};
|
|
77
166
|
}
|
|
78
|
-
|
|
79
|
-
/** A connection that opens and delivers nothing, for static notebooks. */
|
|
80
|
-
export const idle: NotebookTransport = ({ signal }, { open }) =>
|
|
81
|
-
new Promise((settle) => {
|
|
82
|
-
open();
|
|
83
|
-
signal.addEventListener("abort", () => settle(), { once: true });
|
|
84
|
-
});
|
|
@@ -235,6 +235,7 @@ describe("PyodideBridge.sendSave", () => {
|
|
|
235
235
|
store.set(activeNotebookReplicaAtom, replica);
|
|
236
236
|
const backend = createEditorBackend({
|
|
237
237
|
static: false,
|
|
238
|
+
snapshot: null,
|
|
238
239
|
transportType: "sse",
|
|
239
240
|
url: () => "http://localhost/",
|
|
240
241
|
headers: () => ({}),
|
package/src/mount.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import { Provider } from "jotai";
|
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import {
|
|
8
|
-
appConfigAtom,
|
|
9
8
|
configOverridesAtom,
|
|
9
|
+
pageAppConfigAtom,
|
|
10
10
|
userConfigAtom,
|
|
11
11
|
} from "@/core/config/config";
|
|
12
12
|
import { KnownQueryParams } from "@/core/constants";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import { Logger } from "@/utils/Logger";
|
|
22
22
|
import { ErrorBoundary } from "./components/editor/boundary/ErrorBoundary";
|
|
23
23
|
import { notebookAtom } from "./core/cells/cells";
|
|
24
|
-
import {
|
|
24
|
+
import { readExport } from "./core/cells/session";
|
|
25
25
|
import {
|
|
26
26
|
parseAppConfig,
|
|
27
27
|
parseConfigOverrides,
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
import { maybeRegisterVSCodeBindings } from "./core/vscode/vscode-bindings";
|
|
63
63
|
import type { FileStore } from "./core/wasm/store";
|
|
64
64
|
import { notebookFileStore } from "./core/wasm/store";
|
|
65
|
+
import { embeddedSnapshotAtom } from "./core/session/embedded";
|
|
65
66
|
import { ConnectionState } from "./core/session/types";
|
|
66
67
|
import {
|
|
67
68
|
handleWidgetMessage,
|
|
@@ -346,7 +347,8 @@ function initStore(options: unknown) {
|
|
|
346
347
|
parseConfigOverrides(parsedOptions.data.configOverrides),
|
|
347
348
|
);
|
|
348
349
|
store.set(userConfigAtom, parseUserConfig(parsedOptions.data.config));
|
|
349
|
-
store.set(
|
|
350
|
+
store.set(pageAppConfigAtom, parsedOptions.data.appConfig);
|
|
351
|
+
const appConfig = parseAppConfig(parsedOptions.data.appConfig);
|
|
350
352
|
store.set(pairConfigAtom, parsedOptions.data.pairConfig);
|
|
351
353
|
|
|
352
354
|
// Runtime config
|
|
@@ -369,14 +371,21 @@ function initStore(options: unknown) {
|
|
|
369
371
|
});
|
|
370
372
|
}
|
|
371
373
|
|
|
372
|
-
//
|
|
373
|
-
const
|
|
374
|
-
parsedOptions.data.session,
|
|
375
|
-
parsedOptions.data.notebook,
|
|
376
|
-
|
|
374
|
+
// The notebook the page was served with shows until the host answers.
|
|
375
|
+
const { snapshot, cellRuntime } = readExport({
|
|
376
|
+
session: parsedOptions.data.session,
|
|
377
|
+
notebook: parsedOptions.data.notebook,
|
|
378
|
+
filename: parsedOptions.data.filename,
|
|
379
|
+
appConfig,
|
|
380
|
+
});
|
|
381
|
+
store.set(embeddedSnapshotAtom, snapshot);
|
|
377
382
|
store.set(layoutStateAtom, initialLayoutState(parsedOptions.data.layout));
|
|
378
|
-
if (
|
|
379
|
-
|
|
383
|
+
if (snapshot !== null) {
|
|
384
|
+
// The scratch cell keeps its own runtime; the snapshot has none for it.
|
|
385
|
+
store.set(notebookAtom, (state) => ({
|
|
386
|
+
...state,
|
|
387
|
+
cellRuntime: { ...state.cellRuntime, ...cellRuntime },
|
|
388
|
+
}));
|
|
380
389
|
}
|
|
381
390
|
}
|
|
382
391
|
|
|
@@ -46,7 +46,6 @@ const Cell: React.FC<{
|
|
|
46
46
|
name: "cell_1",
|
|
47
47
|
code: "import marimo as mo",
|
|
48
48
|
edited: overrides.edited ?? false,
|
|
49
|
-
serializedEditorState: null,
|
|
50
49
|
config: {
|
|
51
50
|
hide_code: overrides.config?.hide_code ?? false,
|
|
52
51
|
disabled: overrides.config?.disabled ?? false,
|
|
@@ -79,7 +78,6 @@ const Cell: React.FC<{
|
|
|
79
78
|
cellLogs: [],
|
|
80
79
|
history: [],
|
|
81
80
|
scrollKey: null,
|
|
82
|
-
untouchedNewCells: new Set(),
|
|
83
81
|
};
|
|
84
82
|
|
|
85
83
|
const store = createStore();
|
|
@@ -36,7 +36,6 @@ const createLongReprNotebook = (
|
|
|
36
36
|
print('hello')
|
|
37
37
|
LongReprA()`,
|
|
38
38
|
edited: false,
|
|
39
|
-
serializedEditorState: null,
|
|
40
39
|
config: {
|
|
41
40
|
hide_code: hideCode,
|
|
42
41
|
disabled: false,
|
|
@@ -88,7 +87,6 @@ LongReprA()`,
|
|
|
88
87
|
cellLogs: [],
|
|
89
88
|
history: [],
|
|
90
89
|
scrollKey: null,
|
|
91
|
-
untouchedNewCells: new Set(),
|
|
92
90
|
});
|
|
93
91
|
|
|
94
92
|
export default {
|