@marimo-team/islands 0.23.16-dev5 → 0.23.16-dev50
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-CJaUI-S-.js → ConnectedDataExplorerComponent-f9vLjQiF.js} +13 -13
- package/dist/{ErrorBoundary-DXlxsrTF.js → ErrorBoundary-DhLqwSWA.js} +3 -3
- package/dist/{any-language-editor-P9tjkj4n.js → any-language-editor-DifE-fl7.js} +5 -5
- package/dist/{button-BcSml68y.js → button-BSm8IXRU.js} +2 -4
- package/dist/{capabilities-BYLFYTYv.js → capabilities-C6OQ5YBO.js} +1 -1
- package/dist/{chat-ui-BdSDiVjk.js → chat-ui-1e7PcW56.js} +3117 -3120
- package/dist/{check-Cs-KV5XY.js → check-DP7U0H0G.js} +1 -1
- package/dist/{code-visibility-C4wLKnSb.js → common-BcbT1FqC.js} +1046 -1014
- package/dist/{copy-Cs3yt6Vt.js → copy-DNq8q3zw.js} +2 -2
- package/dist/{dist-B96tMAst.js → dist-DIlxLFXG.js} +2 -2
- package/dist/{error-banner-DR7o3CbX.js → error-banner-B_GQfxxD.js} +2 -2
- package/dist/{esm-k8PIvuZW.js → esm-DzZVaNH4.js} +1 -1
- package/dist/{extends-Cq2JYHKy.js → extends-w2_S44bV.js} +4 -4
- package/dist/{formats-BFhkZJwd.js → formats-Dwq1THhr.js} +3 -3
- package/dist/{glide-data-editor--CaN-f27.js → glide-data-editor-B9K6-MJe.js} +9 -9
- package/dist/{html-to-image-DDENewl2.js → html-to-image-3w0AakWW.js} +7164 -6240
- package/dist/{input-DStQIuqD.js → input-C5K4VBvB.js} +7 -7
- package/dist/{label-DIk0QoFe.js → label-DjoYwqmj.js} +2 -2
- package/dist/{loader-CTHCI-qe.js → loader-DX-IDS7n.js} +1 -1
- package/dist/main.js +1010 -1019
- package/dist/{mermaid-CdSvixW2.js → mermaid-hv6IckVw.js} +5 -5
- package/dist/{node-sql-parser-DLl_zNw0.js → node-sql-parser-v1Vi-Fft.js} +16867 -16665
- package/dist/{process-output-2QPcgBQg.js → process-output-BRwR4QGs.js} +32 -28
- package/dist/{reveal-component-BSD4w8YU.js → reveal-component-D7xmRQQ_.js} +725 -643
- package/dist/{spec-CnaxwDqy.js → spec-CQKL_D3i.js} +4 -4
- package/dist/{strings-BYAhZnQi.js → strings-DIy9NAmg.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/{swiper-component-DE94711u.js → swiper-component-CEdAYjb7.js} +2 -2
- package/dist/toDate-CqhBWjvO.js +713 -0
- package/dist/{tooltip-B-qh7UPB.js → tooltip-f-qR0iUx.js} +3 -3
- package/dist/{types-DQl7jVYK.js → types-DicH9Oi0.js} +1 -1
- package/dist/{useAsyncData-CvO8WUy3.js → useAsyncData-CYOQb1EW.js} +1 -1
- package/dist/{useDateFormatter-BSoGim-G.js → useDateFormatter-Bt2qr_XS.js} +2 -2
- package/dist/{useDeepCompareMemoize-J3MKRdA4.js → useDeepCompareMemoize-CSHQeQEI.js} +1 -1
- package/dist/{useIframeCapabilities-POcFXHbw.js → useIframeCapabilities-kA09ykNq.js} +1 -1
- package/dist/{useLifecycle-DqPxHgAN.js → useLifecycle-CMJGqBaY.js} +3 -3
- package/dist/{useTheme-XMq9mNf_.js → useTheme-DYfby65G.js} +2 -2
- package/dist/{vega-component-CrFoZT1S.js → vega-component-C7nO5zcf.js} +10 -10
- package/dist/{zod-D0yOqoGe.js → zod-BUcyXSdR.js} +1 -1
- package/package.json +3 -4
- package/src/__mocks__/requests.ts +45 -4
- package/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap +174 -21
- package/src/components/data-table/__tests__/chart-spec-model.test.ts +102 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +163 -103
- package/src/components/data-table/column-summary/legacy-chart-spec.ts +15 -7
- package/src/components/data-table/column-summary/utils.ts +26 -7
- package/src/components/data-table/types.ts +1 -1
- package/src/components/editor/__tests__/viewer-banner.test.tsx +14 -0
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
- package/src/components/editor/actions/__tests__/pdf-export.test.ts +32 -13
- package/src/components/editor/actions/pair-with-agent-commands.ts +21 -10
- package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
- package/src/components/editor/actions/pdf-export.ts +11 -14
- package/src/components/editor/actions/useNotebookActions.tsx +18 -18
- package/src/components/editor/cell/code/__tests__/cell-editor-activity-lifecycle.test.ts +250 -0
- package/src/components/editor/cell/code/cell-editor.tsx +13 -7
- package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +25 -0
- package/src/components/editor/chrome/panels/logs-panel.tsx +12 -2
- package/src/components/editor/chrome/panels/write-secret-modal.tsx +40 -12
- package/src/components/editor/connections/__tests__/json-credentials.test.ts +114 -0
- package/src/components/editor/connections/__tests__/paths.test.ts +39 -0
- package/src/components/editor/connections/components.tsx +6 -2
- package/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap +21 -5
- package/src/components/editor/connections/database/__tests__/as-code.test.ts +17 -0
- package/src/components/editor/connections/database/as-code.ts +16 -2
- package/src/components/editor/connections/database/schemas.ts +6 -5
- package/src/components/editor/connections/form-renderers.tsx +99 -1
- package/src/components/editor/connections/json-credentials.ts +57 -0
- package/src/components/editor/connections/paths.ts +21 -0
- package/src/components/editor/connections/secret-combobox.tsx +41 -20
- package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +88 -2
- package/src/components/editor/connections/storage/__tests__/as-code.test.ts +128 -8
- package/src/components/editor/connections/storage/as-code.ts +79 -36
- package/src/components/editor/connections/storage/schemas.ts +85 -44
- package/src/components/editor/file-tree/__tests__/renderers.test.ts +31 -0
- package/src/components/editor/file-tree/file-viewer.tsx +11 -7
- package/src/components/editor/file-tree/renderers.tsx +21 -0
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
- package/src/components/editor/viewer-banner.tsx +4 -1
- package/src/components/forms/options.ts +2 -1
- package/src/components/slides/__tests__/cell-output-block.test.tsx +40 -0
- package/src/components/slides/__tests__/slide-cell-view.test.tsx +33 -0
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +198 -0
- package/src/components/slides/reveal-component.tsx +25 -19
- package/src/components/slides/slide-cell-view.tsx +1 -1
- package/src/components/slides/slide-scroll-hint.tsx +161 -0
- package/src/components/slides/slides.css +4 -2
- package/src/components/static-html/share-modal.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/core/ai/context/providers/file.ts +8 -29
- package/src/core/cells/__tests__/cells.test.ts +12 -2
- package/src/core/cells/__tests__/logs.test.ts +5 -5
- package/src/core/cells/cells.ts +17 -4
- package/src/core/cells/document-changes.ts +1 -0
- package/src/core/cells/logs.ts +14 -4
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +396 -100
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +128 -540
- package/src/core/codemirror/copilot/language-server.ts +182 -70
- package/src/core/codemirror/copilot/transport.ts +15 -207
- package/src/core/codemirror/copilot/types.ts +9 -2
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -30
- package/src/core/codemirror/find-replace/navigate.ts +2 -0
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +24 -3
- package/src/core/codemirror/go-to-definition/commands.ts +3 -0
- package/src/core/codemirror/keymaps/__tests__/keymaps.test.ts +31 -2
- package/src/core/codemirror/keymaps/keymaps.ts +12 -0
- package/src/core/codemirror/language/__tests__/sql.test.ts +443 -61
- package/src/core/codemirror/language/languages/python.ts +23 -11
- package/src/core/codemirror/language/languages/sql/completion-store.ts +5 -1
- package/src/core/codemirror/language/languages/sql/sql.ts +210 -3
- package/src/core/codemirror/lsp/__tests__/federated-lsp.test.ts +161 -0
- package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +53 -0
- package/src/core/codemirror/lsp/__tests__/normalize-markdown-math.test.ts +25 -0
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +598 -156
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +112 -0
- package/src/core/codemirror/lsp/federated-lsp.ts +76 -23
- package/src/core/codemirror/lsp/log-messages.ts +37 -0
- package/src/core/codemirror/lsp/normalize-markdown-math.ts +8 -4
- package/src/core/codemirror/lsp/notebook-lsp.ts +220 -56
- package/src/core/codemirror/lsp/transports.ts +8 -1
- package/src/core/codemirror/lsp/types.ts +68 -8
- package/src/core/codemirror/lsp/utils.ts +14 -0
- package/src/core/codemirror/utils.ts +28 -0
- package/src/core/edit-app.tsx +1 -2
- package/src/core/export/__tests__/hooks.test.ts +2 -4
- package/src/core/export/hooks.ts +4 -3
- package/src/core/hotkeys/hotkeys.ts +0 -2
- package/src/core/islands/__tests__/bridge.test.ts +107 -0
- package/src/core/islands/bridge.ts +16 -0
- package/src/core/lsp/__tests__/transport.test.ts +509 -337
- package/src/core/lsp/transport.ts +304 -132
- package/src/core/mode.ts +10 -0
- package/src/core/network/__tests__/api.test.ts +42 -0
- package/src/core/network/__tests__/connection.test.ts +45 -0
- package/src/core/network/__tests__/requests-lazy.test.ts +32 -1
- package/src/core/network/__tests__/requests-network.test.ts +21 -0
- package/src/core/network/api.ts +27 -0
- package/src/core/network/connection.ts +15 -0
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +14 -8
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +22 -6
- package/src/core/rtc/state.ts +9 -0
- package/src/core/static/download-html.ts +5 -14
- package/src/core/wasm/bridge.ts +4 -2
- package/src/core/wasm/worker/types.ts +5 -2
- package/src/css/app/codemirror.css +16 -2
- package/src/plugins/impl/FormPlugin.tsx +1 -1
- package/src/plugins/impl/__tests__/FormPlugin.test.tsx +162 -0
- package/src/stories/log-viewer.stories.tsx +12 -6
- package/src/utils/__tests__/blob.test.ts +27 -1
- package/src/utils/__tests__/download.test.tsx +44 -4
- package/src/utils/blob.ts +24 -1
- package/src/utils/download.ts +14 -15
- package/dist/toDate-B3IRfHhw.js +0 -692
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "@/__tests__/branded";
|
|
11
11
|
import { notebookAtom } from "@/core/cells/cells";
|
|
12
12
|
import { islandsPendingInitialRunsAtom } from "@/core/islands/state";
|
|
13
|
+
import type { IslandsKernelMessage } from "../worker/worker";
|
|
13
14
|
|
|
14
15
|
type Base64String = components["schemas"]["Base64String"];
|
|
15
16
|
interface TestIslandApp {
|
|
@@ -173,6 +174,19 @@ describe("IslandsPyodideBridge", () => {
|
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
function sendKernelMessage(sessionGeneration: number) {
|
|
178
|
+
const listener = mockMessageListeners.get("kernelMessage");
|
|
179
|
+
if (!listener) {
|
|
180
|
+
throw new Error("Missing kernel message listener");
|
|
181
|
+
}
|
|
182
|
+
const message = {
|
|
183
|
+
message: "" as IslandsKernelMessage["message"],
|
|
184
|
+
sessionGeneration,
|
|
185
|
+
};
|
|
186
|
+
listener(message as never);
|
|
187
|
+
return message;
|
|
188
|
+
}
|
|
189
|
+
|
|
176
190
|
async function initializeSingleApp() {
|
|
177
191
|
mockSingleApp();
|
|
178
192
|
await bridge.initializeApps();
|
|
@@ -281,6 +295,99 @@ describe("IslandsPyodideBridge", () => {
|
|
|
281
295
|
});
|
|
282
296
|
|
|
283
297
|
describe("app lifecycle", () => {
|
|
298
|
+
it("ignores messages after a session yields ownership", async () => {
|
|
299
|
+
const consumeMessage = vi.fn();
|
|
300
|
+
bridge.consumeMessages(consumeMessage);
|
|
301
|
+
mockSingleApp();
|
|
302
|
+
await bridge.initializeApps();
|
|
303
|
+
|
|
304
|
+
const firstMessage = sendKernelMessage(1);
|
|
305
|
+
let finishReplacement!: () => void;
|
|
306
|
+
mockReplaceSessionRequest.mockReturnValueOnce(
|
|
307
|
+
new Promise<void>((resolve) => {
|
|
308
|
+
finishReplacement = resolve;
|
|
309
|
+
}),
|
|
310
|
+
);
|
|
311
|
+
setSingleApp("generated app 2");
|
|
312
|
+
const replacement = bridge.initializeApps();
|
|
313
|
+
await vi.waitFor(() =>
|
|
314
|
+
expect(mockReplaceSessionRequest).toHaveBeenCalledOnce(),
|
|
315
|
+
);
|
|
316
|
+
sendKernelMessage(1);
|
|
317
|
+
const currentMessage = sendKernelMessage(2);
|
|
318
|
+
|
|
319
|
+
expect(consumeMessage.mock.calls).toEqual([
|
|
320
|
+
[firstMessage],
|
|
321
|
+
[currentMessage],
|
|
322
|
+
]);
|
|
323
|
+
|
|
324
|
+
finishReplacement();
|
|
325
|
+
await replacement;
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it("restores message ownership when replacement fails", async () => {
|
|
329
|
+
const consumeMessage = vi.fn();
|
|
330
|
+
bridge.consumeMessages(consumeMessage);
|
|
331
|
+
mockSingleApp();
|
|
332
|
+
await bridge.initializeApps();
|
|
333
|
+
mockReplaceSessionRequest.mockRejectedValueOnce(
|
|
334
|
+
new Error("replacement failed"),
|
|
335
|
+
);
|
|
336
|
+
setSingleApp("generated app 2");
|
|
337
|
+
|
|
338
|
+
await expect(bridge.initializeApps()).rejects.toThrow(
|
|
339
|
+
"replacement failed",
|
|
340
|
+
);
|
|
341
|
+
const previousMessage = sendKernelMessage(1);
|
|
342
|
+
sendKernelMessage(2);
|
|
343
|
+
|
|
344
|
+
expect(consumeMessage.mock.calls).toEqual([[previousMessage]]);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
it("ignores messages while their session is stopping", async () => {
|
|
348
|
+
const consumeMessage = vi.fn();
|
|
349
|
+
bridge.consumeMessages(consumeMessage);
|
|
350
|
+
mockSingleApp();
|
|
351
|
+
await bridge.initializeApps();
|
|
352
|
+
let finishStop!: () => void;
|
|
353
|
+
mockStopSessionRequest.mockReturnValueOnce(
|
|
354
|
+
new Promise<void>((resolve) => {
|
|
355
|
+
finishStop = resolve;
|
|
356
|
+
}),
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
const stop = bridge.stopSession();
|
|
360
|
+
await vi.waitFor(() =>
|
|
361
|
+
expect(mockStopSessionRequest).toHaveBeenCalledOnce(),
|
|
362
|
+
);
|
|
363
|
+
sendKernelMessage(1);
|
|
364
|
+
|
|
365
|
+
expect(consumeMessage).not.toHaveBeenCalled();
|
|
366
|
+
|
|
367
|
+
finishStop();
|
|
368
|
+
await stop;
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it("forwards messages from every app in a multi-app document", async () => {
|
|
372
|
+
const consumeMessage = vi.fn();
|
|
373
|
+
bridge.consumeMessages(consumeMessage);
|
|
374
|
+
mockParseMarimoIslandApps.mockReturnValue([app(), app("app-2")]);
|
|
375
|
+
mockCreateMarimoFile
|
|
376
|
+
.mockReturnValueOnce("generated app 1")
|
|
377
|
+
.mockReturnValueOnce("generated app 2");
|
|
378
|
+
signalWorkerReady();
|
|
379
|
+
|
|
380
|
+
await bridge.initializeApps();
|
|
381
|
+
const firstMessage = sendKernelMessage(1);
|
|
382
|
+
const secondMessage = sendKernelMessage(2);
|
|
383
|
+
sendKernelMessage(3);
|
|
384
|
+
|
|
385
|
+
expect(consumeMessage.mock.calls).toEqual([
|
|
386
|
+
[firstMessage],
|
|
387
|
+
[secondMessage],
|
|
388
|
+
]);
|
|
389
|
+
});
|
|
390
|
+
|
|
284
391
|
it("holds controls until the first app session is ready", async () => {
|
|
285
392
|
setSingleApp();
|
|
286
393
|
|
|
@@ -66,6 +66,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
66
66
|
private session: AppSession | undefined;
|
|
67
67
|
private sessionReady = new Deferred<AppSession>();
|
|
68
68
|
private nextSessionGeneration = 0;
|
|
69
|
+
private readonly activeSessionGenerations = new Set<number>();
|
|
69
70
|
private appTransition = Promise.resolve();
|
|
70
71
|
private workerReady = new Deferred<void>();
|
|
71
72
|
|
|
@@ -110,6 +111,11 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
110
111
|
);
|
|
111
112
|
|
|
112
113
|
this.rpc.addMessageListener("kernelMessage", (message) => {
|
|
114
|
+
// A stopped session can still have messages in transit after the next
|
|
115
|
+
// app takes ownership of the shared frontend state.
|
|
116
|
+
if (!this.activeSessionGenerations.has(message.sessionGeneration)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
113
119
|
this.messageConsumer?.(message);
|
|
114
120
|
});
|
|
115
121
|
}
|
|
@@ -149,6 +155,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
149
155
|
return;
|
|
150
156
|
}
|
|
151
157
|
if (apps.length > 0) {
|
|
158
|
+
this.activeSessionGenerations.clear();
|
|
152
159
|
this.store.set(
|
|
153
160
|
islandsPendingInitialRunsAtom,
|
|
154
161
|
new Set(apps.map((_, index) => this.nextSessionGeneration + index + 1)),
|
|
@@ -165,6 +172,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
165
172
|
};
|
|
166
173
|
const previousSession = this.session;
|
|
167
174
|
const replacesSession = managesSingleApp && previousSession !== undefined;
|
|
175
|
+
this.activeSessionGenerations.add(request.sessionGeneration);
|
|
168
176
|
if (replacesSession) {
|
|
169
177
|
this.store.set(notebookAtom, initialNotebookState());
|
|
170
178
|
}
|
|
@@ -186,8 +194,14 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
186
194
|
this.sessionReady.resolve(this.session);
|
|
187
195
|
}
|
|
188
196
|
} catch (error) {
|
|
197
|
+
this.activeSessionGenerations.delete(request.sessionGeneration);
|
|
189
198
|
if (this.session?.sessionGeneration === request.sessionGeneration) {
|
|
190
199
|
this.session = previousSession;
|
|
200
|
+
if (previousSession) {
|
|
201
|
+
this.activeSessionGenerations.add(
|
|
202
|
+
previousSession.sessionGeneration,
|
|
203
|
+
);
|
|
204
|
+
}
|
|
191
205
|
}
|
|
192
206
|
Logger.error(`Failed to start session for app ${app.id}:`, error);
|
|
193
207
|
if (managesSingleApp) {
|
|
@@ -203,6 +217,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
203
217
|
if (session?.code === undefined || (appId && session.appId !== appId)) {
|
|
204
218
|
return;
|
|
205
219
|
}
|
|
220
|
+
this.activeSessionGenerations.delete(session.sessionGeneration);
|
|
206
221
|
await this.rpc.proxy.request.stopSession({
|
|
207
222
|
appId: session.appId,
|
|
208
223
|
sessionGeneration: session.sessionGeneration,
|
|
@@ -339,6 +354,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
339
354
|
sendUpdateFile = throwNotImplemented;
|
|
340
355
|
sendFileDetails = throwNotImplemented;
|
|
341
356
|
openTutorial = throwNotImplemented;
|
|
357
|
+
getExportAvailability = throwNotImplemented;
|
|
342
358
|
exportAsHTML = throwNotImplemented;
|
|
343
359
|
exportAsIPYNB = throwNotImplemented;
|
|
344
360
|
exportAsMarkdown = throwNotImplemented;
|