@marimo-team/frontend 0.25.3-dev40 → 0.25.3-dev44
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-BGIWF94J.js → CellStatus-BpOBz-8m.js} +1 -1
- package/dist/assets/{ErrorBoundary-hliG40Pk.js → ErrorBoundary-DmXl4Nre.js} +2 -2
- package/dist/assets/{JsonOutput-9tmC-p6h.js → JsonOutput-DsMCKg5f.js} +2 -2
- package/dist/assets/{MarimoErrorOutput-BaHdbtck.js → MarimoErrorOutput-DVjK8RgY.js} +1 -1
- package/dist/assets/{RenderHTML-B1FzB5NY.js → RenderHTML-BFaztTR0.js} +1 -1
- package/dist/assets/{RunButton-DpGokdF1.js → RunButton-B44xE_d5.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BYWG0iKO.js → add-cell-with-ai-CkjslziO.js} +1 -1
- package/dist/assets/{add-connection-dialog-BWbUVPJk.js → add-connection-dialog-CWLLVKju.js} +1 -1
- package/dist/assets/{agent-panel-DKNiQrAl.js → agent-panel-DVUZ4l17.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CIg9eu47.js → ai-model-dropdown-F3mm17Wa.js} +1 -1
- package/dist/assets/{app-config-button-BvkL2eSY.js → app-config-button-D0uDs5nC.js} +1 -1
- package/dist/assets/{blob-BQfLiwKr.js → blob-BSfsdCNF.js} +1 -1
- package/dist/assets/{cell-editor-BKKUv4d5.js → cell-editor-BXMAe73i.js} +1 -1
- package/dist/assets/{cell-link-B_QkRkm-.js → cell-link-DFPHORAO.js} +1 -1
- package/dist/assets/{cells-CdH98VSn.js → cells-BdgzY0of.js} +1 -1
- package/dist/assets/{chat-display-CNbRSebo.js → chat-display-BrcwdhKJ.js} +1 -1
- package/dist/assets/{chat-panel-HbEKDf0c.js → chat-panel-C__3iSyI.js} +1 -1
- package/dist/assets/{chat-ui-BwMev8Bf.js → chat-ui-NlBK3kK6.js} +1 -1
- package/dist/assets/{code-visibility-sQ37CBNo.js → code-visibility-Cs-Vv3jV.js} +1 -1
- package/dist/assets/{column-preview-CsEBzIUE.js → column-preview-D-MQXrz3.js} +1 -1
- package/dist/assets/{command-palette-BzZ86pUz.js → command-palette-BbCoQAH7.js} +1 -1
- package/dist/assets/{common-S2v8dsEy.js → common-BcEY1yDS.js} +1 -1
- package/dist/assets/{components-D-TnFWjo.js → components-lkCfd2vy.js} +1 -1
- package/dist/assets/{config-CYsbZpwa.js → config-BwHT0yGp.js} +2 -2
- package/dist/assets/{config-BoBwH7CU.js → config-DXjnAwtL.js} +1 -1
- package/dist/assets/{datasource-BA7YF4eo.js → datasource-dKk3JHSQ.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DsjI61Qa.js → dependency-graph-panel-BaisS9Zt.js} +1 -1
- package/dist/assets/{documentation-panel-hk3IdeXy.js → documentation-panel-CpSUoM8r.js} +1 -1
- package/dist/assets/{download-CCZkq0y4.js → download-RV4i1fWI.js} +1 -1
- package/dist/assets/{edit-page-BgS6tjth.js → edit-page-OQUBqPxV.js} +4 -4
- package/dist/assets/{error-entries-BVXrGOTZ.js → error-entries-CJS0gOId.js} +1 -1
- package/dist/assets/{error-panel-DYethUUR.js → error-panel-BxCKpZtN.js} +1 -1
- package/dist/assets/feedback-button-BLvwvndE.js +1 -0
- package/dist/assets/{feedback-button-DaNc3uJa.js → feedback-button-DYjae3_b.js} +1 -1
- package/dist/assets/{file-explorer-panel-CqnzSSYc.js → file-explorer-panel-Cg48iuPg.js} +1 -1
- package/dist/assets/{file-name-input-D4AvwZV9.js → file-name-input-BpfSzvEB.js} +1 -1
- package/dist/assets/{floating-outline-CTy-Iakk.js → floating-outline-CrWdiNQ2.js} +1 -1
- package/dist/assets/{gallery-page-ByjlvM6k.js → gallery-page-W_b-XWq6.js} +1 -1
- package/dist/assets/{glide-data-editor-CABBj2b0.js → glide-data-editor-C_bIL30J.js} +1 -1
- package/dist/assets/{home-page-DejRSjeJ.js → home-page-D1teQDdF.js} +1 -1
- package/dist/assets/{hooks-BJgCcVXZ.js → hooks-B2jmXrjG.js} +1 -1
- package/dist/assets/{index-PDJQd7X6.js → index-CnvKSoR0.js} +5 -5
- package/dist/assets/index-evFWHKmM.css +2 -0
- package/dist/assets/{layout-Ct0rjb-5.js → layout-Ckm5arvO.js} +3 -3
- package/dist/assets/{logs-panel-TyeqEvOY.js → logs-panel-DVSgfMgv.js} +1 -1
- package/dist/assets/{markdown-renderer-BFyD6Jhs.js → markdown-renderer-DX2O5YiE.js} +1 -1
- package/dist/assets/{name-cell-input-D-0VF3qd.js → name-cell-input-DL1i8Mj0.js} +1 -1
- package/dist/assets/{outline-panel-DMTjk2WC.js → outline-panel-DPKPT2eg.js} +1 -1
- package/dist/assets/{packages-panel-DrT69k9L.js → packages-panel-CZZwD9YV.js} +1 -1
- package/dist/assets/{panel-accordion-state-Ban6j---.js → panel-accordion-state-C7vvsYz1.js} +1 -1
- package/dist/assets/panels-B2HvGLkD.js +4 -0
- package/dist/assets/{process-output-DzpQYlpY.js → process-output-BKhybJBb.js} +1 -1
- package/dist/assets/{readonly-code-display-Cyn3k5TX.js → readonly-code-display-9QrSm_7D.js} +1 -1
- package/dist/assets/{readonly-python-code-DrXDDAnA.js → readonly-python-code-BLotL3XP.js} +1 -1
- package/dist/assets/{reveal-component-_lKImPWP.js → reveal-component-CxQ9fVAB.js} +1 -1
- package/dist/assets/{run-page-7UNg--Rj.js → run-page-DtWhVRu3.js} +1 -1
- package/dist/assets/{runtime-details-state-CKOKhMhv.js → runtime-details-state-B25uM-Ps.js} +1 -1
- package/dist/assets/{scratchpad-panel-C7h4MgqN.js → scratchpad-panel-DsqDHGr7.js} +1 -1
- package/dist/assets/{session-panel-CLiWXc5y.js → session-panel-CjJ0nwoT.js} +1 -1
- package/dist/assets/{snippets-panel-Wrqaorxa.js → snippets-panel-IxIxfxNc.js} +1 -1
- package/dist/assets/{state-TVREh4u4.js → state-BHuYDaxs.js} +1 -1
- package/dist/assets/{state-_uXVmwuN.js → state-CVgqwwCU.js} +1 -1
- package/dist/assets/{terminal-Dp5gyJ7l.js → terminal-CjvCrRrA.js} +1 -1
- package/dist/assets/{tracing-fUNLyKuj.js → tracing-V5zejPsw.js} +1 -1
- package/dist/assets/{tracing-panel-Cx4OqOoP.js → tracing-panel-DLS3iwK6.js} +2 -2
- package/dist/assets/{tree-actions-B1vsdenY.js → tree-actions-Be_mzC1C.js} +1 -1
- package/dist/assets/{useAddCell-DZ-50qEG.js → useAddCell-DK79W1vA.js} +1 -1
- package/dist/assets/{useBoolean-5g-bBaYF.js → useBoolean-j0qHaJxu.js} +1 -1
- package/dist/assets/{useCellActionButton-DINnRstv.js → useCellActionButton-Cw9Ob12j.js} +1 -1
- package/dist/assets/{useDeleteCell-CREJXVNp.js → useDeleteCell-BNqX6PPu.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-Cw5VT16Q.js → useDependencyPanelTab-GnTnqKJo.js} +1 -1
- package/dist/assets/{useInstallPackage-Cw0dVELh.js → useInstallPackage-CVItDn1e.js} +1 -1
- package/dist/assets/{useNotebookActions-B4av4mLc.js → useNotebookActions-BTkKQpGk.js} +1 -1
- package/dist/assets/{useRunCells-BHBMk9zW.js → useRunCells-DP09DHT6.js} +1 -1
- package/dist/assets/{useSplitCell-DAgwZV0q.js → useSplitCell-IfumZ4sm.js} +1 -1
- package/dist/assets/{vega-component-pQE2mKc1.js → vega-component-CMn031HF.js} +1 -1
- package/dist/index.html +25 -25
- package/package.json +2 -4
- package/src/__tests__/host-imports.test.ts +1 -0
- package/src/components/data-table/__tests__/export-actions.test.tsx +88 -0
- package/src/components/data-table/export-actions.tsx +71 -45
- package/src/core/attachments/state.ts +2 -2
- package/src/core/host/AGENTS.md +6 -2
- package/src/core/host/__tests__/attachments.test.ts +9 -10
- package/src/core/host/__tests__/document.test.ts +18 -16
- package/src/core/host/__tests__/events.test.ts +5 -2
- package/src/core/host/__tests__/fixtures.ts +6 -4
- package/src/core/host/events.ts +18 -2
- package/src/core/host/notebook-client.ts +46 -13
- package/src/core/host/resources/attachments.ts +3 -3
- package/src/core/host/resources/document.ts +3 -3
- package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +1 -1
- package/dist/assets/feedback-button-DDzObtF2.js +0 -1
- package/dist/assets/index-ChfDZJzP.css +0 -2
- package/dist/assets/panels-BLYQRkEc.js +0 -4
- package/src/core/host/__tests__/protocol.test.ts +0 -229
- package/src/core/host/__tests__/stream.test.ts +0 -209
- package/src/core/host/protocol.ts +0 -1948
- package/src/core/host/resources/resource.ts +0 -47
- package/src/core/host/stream.ts +0 -211
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type * as Protocol from "../protocol";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Events the stream handles itself.
|
|
7
|
-
*
|
|
8
|
-
* They identify the notebook, discard state, or carry a native
|
|
9
|
-
* notification. Resources do not receive them.
|
|
10
|
-
*/
|
|
11
|
-
type StreamEventName = "reset" | "notebook" | "notebook.removed" | "marimo";
|
|
12
|
-
|
|
13
|
-
/** Events a resource may handle. `ready` marks the end of the snapshot. */
|
|
14
|
-
export type ResourceEvent = Exclude<
|
|
15
|
-
Protocol.EventOutput,
|
|
16
|
-
{ event: StreamEventName }
|
|
17
|
-
>;
|
|
18
|
-
|
|
19
|
-
/** What a handler may know about the stream beyond the event. */
|
|
20
|
-
export interface HandlerContext {
|
|
21
|
-
/** `snapshot` until `ready` arrives and `live` after it. */
|
|
22
|
-
readonly phase: "snapshot" | "live";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* A pure handler for each event the resource reads.
|
|
27
|
-
*
|
|
28
|
-
* A handler returns `state` when the event does not apply to it.
|
|
29
|
-
*/
|
|
30
|
-
type EventHandlers<State> = {
|
|
31
|
-
readonly [Name in ResourceEvent["event"]]?: (
|
|
32
|
-
state: State,
|
|
33
|
-
event: Extract<ResourceEvent, { event: Name }>,
|
|
34
|
-
context: HandlerContext,
|
|
35
|
-
) => State;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* One kind of object assembled from its events.
|
|
40
|
-
*
|
|
41
|
-
* The stream returns a resource to `initial` on `reset` and when the
|
|
42
|
-
* notebook is removed.
|
|
43
|
-
*/
|
|
44
|
-
export interface Resource<State> {
|
|
45
|
-
readonly initial: State;
|
|
46
|
-
readonly on: EventHandlers<State>;
|
|
47
|
-
}
|
package/src/core/host/stream.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
|
|
3
|
-
import type { NotebookEvent } from "./events";
|
|
4
|
-
import type * as Protocol from "./protocol";
|
|
5
|
-
import type {
|
|
6
|
-
HandlerContext,
|
|
7
|
-
Resource,
|
|
8
|
-
ResourceEvent,
|
|
9
|
-
} from "./resources/resource";
|
|
10
|
-
|
|
11
|
-
/** A resource for each entry of a state map under the same name. */
|
|
12
|
-
type Resources<States> = {
|
|
13
|
-
readonly [Name in keyof States]: Resource<States[Name]>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The state of one notebook stream.
|
|
18
|
-
*
|
|
19
|
-
* Holds the phase, the notebook identity, the resume cursor, and the state
|
|
20
|
-
* of each resource.
|
|
21
|
-
*/
|
|
22
|
-
interface StreamState<States> {
|
|
23
|
-
readonly phase: HandlerContext["phase"];
|
|
24
|
-
/**
|
|
25
|
-
* The notebook the stream describes.
|
|
26
|
-
*
|
|
27
|
-
* Retained across `reset`.
|
|
28
|
-
*/
|
|
29
|
-
readonly notebookId: Protocol.NotebookIdOutput | null;
|
|
30
|
-
/**
|
|
31
|
-
* The id of the last live event.
|
|
32
|
-
*
|
|
33
|
-
* Null before `ready` and after `reset`.
|
|
34
|
-
*/
|
|
35
|
-
readonly cursor: string | null;
|
|
36
|
-
/** The state of each resource by name. */
|
|
37
|
-
readonly resources: States;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** A reducer over the events of one notebook stream. */
|
|
41
|
-
interface Stream<States> {
|
|
42
|
-
readonly initial: StreamState<States>;
|
|
43
|
-
/**
|
|
44
|
-
* Apply one event.
|
|
45
|
-
*
|
|
46
|
-
* Throws on a live event without a cursor or on an object from another
|
|
47
|
-
* notebook.
|
|
48
|
-
*/
|
|
49
|
-
reduce(state: StreamState<States>, event: NotebookEvent): StreamState<States>;
|
|
50
|
-
/**
|
|
51
|
-
* The state to hold while reconnecting.
|
|
52
|
-
*
|
|
53
|
-
* A live stream keeps its state and resumes from `cursor`. An incomplete
|
|
54
|
-
* snapshot starts over.
|
|
55
|
-
*/
|
|
56
|
-
resume(state: StreamState<States>): StreamState<States>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** Events that may arrive without a cursor after `ready`. */
|
|
60
|
-
const UNCURSORED = new Set<NotebookEvent["event"]>([
|
|
61
|
-
"reset",
|
|
62
|
-
"marimo",
|
|
63
|
-
"unknown",
|
|
64
|
-
]);
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The notebook the event's object belongs to.
|
|
68
|
-
*
|
|
69
|
-
* Undefined for objects that do not name one.
|
|
70
|
-
*/
|
|
71
|
-
function notebookIdOf(
|
|
72
|
-
event: ResourceEvent,
|
|
73
|
-
): Protocol.NotebookIdOutput | undefined {
|
|
74
|
-
switch (event.event) {
|
|
75
|
-
case "document":
|
|
76
|
-
return event.data.document.notebook_id;
|
|
77
|
-
case "cell":
|
|
78
|
-
return event.data.cell.notebook_id;
|
|
79
|
-
case "analysis":
|
|
80
|
-
return event.data.analysis.notebook_id;
|
|
81
|
-
case "runtime":
|
|
82
|
-
return event.data.runtime.notebook_id;
|
|
83
|
-
case "attachment":
|
|
84
|
-
return event.data.attachment.notebook_id;
|
|
85
|
-
case "run":
|
|
86
|
-
return event.data.run.notebook_id;
|
|
87
|
-
default:
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** Compose resources into one stream. */
|
|
93
|
-
export function createStream<States extends object>(
|
|
94
|
-
resources: Resources<States>,
|
|
95
|
-
): Stream<States> {
|
|
96
|
-
const names = Object.keys(resources) as (keyof States & string)[];
|
|
97
|
-
const initialResources = Object.fromEntries(
|
|
98
|
-
names.map((name) => [name, resources[name].initial]),
|
|
99
|
-
) as States;
|
|
100
|
-
const initial: StreamState<States> = {
|
|
101
|
-
phase: "snapshot",
|
|
102
|
-
notebookId: null,
|
|
103
|
-
cursor: null,
|
|
104
|
-
resources: initialResources,
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
function identify(
|
|
108
|
-
state: StreamState<States>,
|
|
109
|
-
notebookId: Protocol.NotebookIdOutput,
|
|
110
|
-
): StreamState<States> {
|
|
111
|
-
if (state.notebookId === notebookId) {
|
|
112
|
-
return state;
|
|
113
|
-
}
|
|
114
|
-
if (state.notebookId !== null) {
|
|
115
|
-
throw new Error("Notebook stream changed identity");
|
|
116
|
-
}
|
|
117
|
-
return { ...state, notebookId };
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function clear(state: StreamState<States>): StreamState<States> {
|
|
121
|
-
return state.resources === initialResources
|
|
122
|
-
? state
|
|
123
|
-
: { ...state, resources: initialResources };
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function fanOut(
|
|
127
|
-
state: StreamState<States>,
|
|
128
|
-
event: ResourceEvent,
|
|
129
|
-
): StreamState<States> {
|
|
130
|
-
const context: HandlerContext = { phase: state.phase };
|
|
131
|
-
let next = state.resources;
|
|
132
|
-
for (const name of names) {
|
|
133
|
-
type State = States[typeof name];
|
|
134
|
-
// Handlers are keyed by the event name they accept.
|
|
135
|
-
const handler = resources[name].on[event.event] as
|
|
136
|
-
| ((
|
|
137
|
-
state: State,
|
|
138
|
-
event: Protocol.EventOutput,
|
|
139
|
-
context: HandlerContext,
|
|
140
|
-
) => State)
|
|
141
|
-
| undefined;
|
|
142
|
-
if (handler === undefined) {
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
const before = next[name];
|
|
146
|
-
const after = handler(before, event, context);
|
|
147
|
-
if (after !== before) {
|
|
148
|
-
next = { ...next, [name]: after };
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return next === state.resources ? state : { ...state, resources: next };
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** Record the position of a live event. */
|
|
155
|
-
function advance(
|
|
156
|
-
state: StreamState<States>,
|
|
157
|
-
id: string | undefined,
|
|
158
|
-
): StreamState<States> {
|
|
159
|
-
return state.phase === "live" && id !== undefined && id !== state.cursor
|
|
160
|
-
? { ...state, cursor: id }
|
|
161
|
-
: state;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
initial,
|
|
166
|
-
reduce(state, event) {
|
|
167
|
-
if (
|
|
168
|
-
state.phase === "live" &&
|
|
169
|
-
event.id === undefined &&
|
|
170
|
-
!UNCURSORED.has(event.event)
|
|
171
|
-
) {
|
|
172
|
-
throw new Error("Live notebook event is missing its cursor");
|
|
173
|
-
}
|
|
174
|
-
switch (event.event) {
|
|
175
|
-
case "marimo":
|
|
176
|
-
case "unknown":
|
|
177
|
-
return advance(state, event.id);
|
|
178
|
-
case "reset":
|
|
179
|
-
return { ...initial, notebookId: state.notebookId };
|
|
180
|
-
case "ready":
|
|
181
|
-
// Handlers see the phase that ended, so a snapshot's ready differs
|
|
182
|
-
// from one that ends a replay.
|
|
183
|
-
return { ...fanOut(state, event), phase: "live", cursor: event.id };
|
|
184
|
-
case "notebook":
|
|
185
|
-
return advance(identify(state, event.data.notebook.id), event.id);
|
|
186
|
-
case "notebook.removed":
|
|
187
|
-
return advance(
|
|
188
|
-
state.notebookId !== null && event.data.id !== state.notebookId
|
|
189
|
-
? state
|
|
190
|
-
: clear(state),
|
|
191
|
-
event.id,
|
|
192
|
-
);
|
|
193
|
-
default: {
|
|
194
|
-
const notebookId = notebookIdOf(event);
|
|
195
|
-
return advance(
|
|
196
|
-
fanOut(
|
|
197
|
-
notebookId === undefined ? state : identify(state, notebookId),
|
|
198
|
-
event,
|
|
199
|
-
),
|
|
200
|
-
event.id,
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
resume(state) {
|
|
206
|
-
return state.phase === "snapshot"
|
|
207
|
-
? { ...initial, notebookId: state.notebookId }
|
|
208
|
-
: state;
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
}
|