@marimo-team/islands 0.23.16-dev4 → 0.23.16-dev40
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-BhycUrBk.js} +3117 -3117
- package/dist/{check-Cs-KV5XY.js → check-DP7U0H0G.js} +1 -1
- package/dist/{code-visibility-Bmrvzgy9.js → common-B_9CCPru.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-YXcQTd1Y.js} +3 -3
- package/dist/{reveal-component-CdkMQff0.js → reveal-component-DFf0f6QX.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/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
- package/src/components/editor/actions/__tests__/pdf-export.test.ts +0 -4
- 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 +1 -4
- package/src/components/editor/actions/useNotebookActions.tsx +7 -13
- 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/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +50 -0
- package/src/components/editor/connections/storage/__tests__/as-code.test.ts +87 -8
- package/src/components/editor/connections/storage/as-code.ts +40 -21
- package/src/components/editor/connections/storage/schemas.ts +83 -42
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -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/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/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__/download.test.tsx +24 -1
- package/src/utils/download.ts +11 -6
- package/dist/toDate-B3IRfHhw.js +0 -692
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
downloadAsPDF,
|
|
9
9
|
downloadByURL,
|
|
10
10
|
downloadCellOutputAsImage,
|
|
11
|
+
downloadExportedFile,
|
|
11
12
|
downloadHTMLAsImage,
|
|
12
13
|
getImageDataUrlForCell,
|
|
13
14
|
withLoadingToast,
|
|
@@ -195,7 +196,6 @@ describe("downloadAsPDF", () => {
|
|
|
195
196
|
|
|
196
197
|
await expect(
|
|
197
198
|
downloadAsPDF({
|
|
198
|
-
filename: "path/to/notebook.py",
|
|
199
199
|
webpdf: false,
|
|
200
200
|
preset: "slides",
|
|
201
201
|
}),
|
|
@@ -572,6 +572,7 @@ describe("downloadByURL", () => {
|
|
|
572
572
|
|
|
573
573
|
afterEach(() => {
|
|
574
574
|
vi.restoreAllMocks();
|
|
575
|
+
vi.unstubAllGlobals();
|
|
575
576
|
});
|
|
576
577
|
|
|
577
578
|
it("should create anchor, set attributes, click, and remove", () => {
|
|
@@ -583,4 +584,26 @@ describe("downloadByURL", () => {
|
|
|
583
584
|
expect(mockAnchor.click).toHaveBeenCalled();
|
|
584
585
|
expect(mockAnchor.remove).toHaveBeenCalled();
|
|
585
586
|
});
|
|
587
|
+
|
|
588
|
+
it("downloads an exported file with its returned metadata", async () => {
|
|
589
|
+
let downloadedBlob: Blob | undefined;
|
|
590
|
+
vi.stubGlobal("URL", {
|
|
591
|
+
createObjectURL: vi.fn((blob: Blob) => {
|
|
592
|
+
downloadedBlob = blob;
|
|
593
|
+
return "blob:export";
|
|
594
|
+
}),
|
|
595
|
+
revokeObjectURL: vi.fn(),
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
downloadExportedFile({
|
|
599
|
+
contents: "notebook",
|
|
600
|
+
filename: "résumé.qmd",
|
|
601
|
+
mediaType: "text/plain; charset=utf-8",
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
expect(downloadedBlob?.type).toBe("text/plain; charset=utf-8");
|
|
605
|
+
expect(await downloadedBlob?.text()).toBe("notebook");
|
|
606
|
+
expect(mockAnchor.download).toBe("résumé.qmd");
|
|
607
|
+
expect(URL.revokeObjectURL).toHaveBeenCalledWith("blob:export");
|
|
608
|
+
});
|
|
586
609
|
});
|
package/src/utils/download.ts
CHANGED
|
@@ -4,8 +4,8 @@ import React from "react";
|
|
|
4
4
|
import { toast } from "@/components/ui/use-toast";
|
|
5
5
|
import { type CellId, CellOutputId } from "@/core/cells/ids";
|
|
6
6
|
import { getRequestClient } from "@/core/network/requests";
|
|
7
|
+
import type { ExportedFile } from "@/core/network/types";
|
|
7
8
|
import { Filenames } from "@/utils/filenames";
|
|
8
|
-
import { Paths } from "@/utils/paths";
|
|
9
9
|
import { prettyError } from "./errors";
|
|
10
10
|
import { toPng } from "./html-to-image";
|
|
11
11
|
import { captureExternalIframes } from "./iframe";
|
|
@@ -191,6 +191,14 @@ export function downloadBlob(blob: Blob, filename: string) {
|
|
|
191
191
|
URL.revokeObjectURL(url);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
export function downloadExportedFile({
|
|
195
|
+
contents,
|
|
196
|
+
filename,
|
|
197
|
+
mediaType,
|
|
198
|
+
}: ExportedFile) {
|
|
199
|
+
downloadBlob(new Blob([contents], { type: mediaType }), filename);
|
|
200
|
+
}
|
|
201
|
+
|
|
194
202
|
export type PDFExportPreset = "document" | "slides";
|
|
195
203
|
|
|
196
204
|
/**
|
|
@@ -200,7 +208,6 @@ export type PDFExportPreset = "document" | "slides";
|
|
|
200
208
|
* Standard PDF requires Pandoc & TeX (~few GBs) but is of higher quality.
|
|
201
209
|
*/
|
|
202
210
|
export async function downloadAsPDF(opts: {
|
|
203
|
-
filename: string;
|
|
204
211
|
webpdf: boolean;
|
|
205
212
|
preset?: PDFExportPreset;
|
|
206
213
|
includeInputs?: boolean;
|
|
@@ -210,7 +217,6 @@ export async function downloadAsPDF(opts: {
|
|
|
210
217
|
}) {
|
|
211
218
|
const client = getRequestClient();
|
|
212
219
|
const {
|
|
213
|
-
filename,
|
|
214
220
|
webpdf,
|
|
215
221
|
preset = "document",
|
|
216
222
|
includeInputs = true,
|
|
@@ -220,7 +226,7 @@ export async function downloadAsPDF(opts: {
|
|
|
220
226
|
} = opts;
|
|
221
227
|
|
|
222
228
|
try {
|
|
223
|
-
const
|
|
229
|
+
const exportedFile = await client.exportAsPDF({
|
|
224
230
|
webpdf,
|
|
225
231
|
preset,
|
|
226
232
|
includeInputs,
|
|
@@ -229,8 +235,7 @@ export async function downloadAsPDF(opts: {
|
|
|
229
235
|
rasterServer,
|
|
230
236
|
});
|
|
231
237
|
|
|
232
|
-
|
|
233
|
-
downloadBlob(pdfBlob, Filenames.toPDF(filenameWithoutPath));
|
|
238
|
+
downloadExportedFile(exportedFile);
|
|
234
239
|
} catch (error) {
|
|
235
240
|
toast({
|
|
236
241
|
title: "Failed to download",
|