@marimo-team/islands 0.23.17-dev1 → 0.23.17-dev4
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/{common-BGCQJb-W.js → common-BcQ4kHDP.js} +4 -4
- package/dist/main.js +2 -2
- package/dist/{reveal-component-NNi374so.js → reveal-component-9QGZq7uF.js} +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +1 -1
- package/src/components/editor/actions/export-dialog/__tests__/export-command.test.ts +115 -0
- package/src/components/editor/actions/export-dialog/__tests__/export-dialog.test.tsx +423 -0
- package/src/components/editor/actions/export-dialog/__tests__/export-notebook.test.ts +178 -0
- package/src/components/editor/actions/export-dialog/__tests__/state.test.ts +234 -0
- package/src/components/editor/actions/export-dialog/__tests__/use-export-dialog.test.tsx +287 -0
- package/src/components/editor/actions/export-dialog/export-command.ts +149 -0
- package/src/components/editor/actions/export-dialog/export-dialog.tsx +190 -0
- package/src/components/editor/actions/export-dialog/export-notebook.ts +98 -0
- package/src/components/editor/actions/export-dialog/format-notice.tsx +138 -0
- package/src/components/editor/actions/export-dialog/format-options.tsx +531 -0
- package/src/components/editor/actions/export-dialog/state.ts +321 -0
- package/src/components/editor/actions/export-dialog/use-export-dialog.ts +380 -0
- package/src/components/editor/actions/pair-with-agent-commands.ts +1 -21
- package/src/components/editor/actions/useNotebookActions.tsx +72 -170
- package/src/components/editor/connections/add-connection-dialog.tsx +1 -1
- package/src/components/editor/connections/quick-add-data-sources.tsx +14 -7
- package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +187 -0
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
- package/src/utils/__tests__/download.test.tsx +6 -4
- package/src/utils/download.ts +3 -1
- package/src/utils/shell.ts +17 -0
|
@@ -390,8 +390,9 @@ describe("downloadHTMLAsImage", () => {
|
|
|
390
390
|
it("should download image without prepare function", async () => {
|
|
391
391
|
vi.mocked(toPng).mockResolvedValue(mockDataUrl);
|
|
392
392
|
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
expect(
|
|
394
|
+
await downloadHTMLAsImage({ element: mockElement, filename: "test" }),
|
|
395
|
+
).toBe(true);
|
|
395
396
|
expect(toPng).toHaveBeenCalledWith(
|
|
396
397
|
mockElement,
|
|
397
398
|
expect.objectContaining({
|
|
@@ -452,8 +453,9 @@ describe("downloadHTMLAsImage", () => {
|
|
|
452
453
|
it("should show error toast on failure", async () => {
|
|
453
454
|
vi.mocked(toPng).mockRejectedValue(new Error("Failed"));
|
|
454
455
|
|
|
455
|
-
|
|
456
|
-
|
|
456
|
+
expect(
|
|
457
|
+
await downloadHTMLAsImage({ element: mockElement, filename: "test" }),
|
|
458
|
+
).toBe(false);
|
|
457
459
|
expect(toast).toHaveBeenCalledWith({
|
|
458
460
|
title: "Failed to download as PNG",
|
|
459
461
|
description: "Failed",
|
package/src/utils/download.ts
CHANGED
|
@@ -140,7 +140,7 @@ export async function downloadHTMLAsImage(opts: {
|
|
|
140
140
|
element: HTMLElement;
|
|
141
141
|
filename: string;
|
|
142
142
|
prepare?: (element: HTMLElement) => () => void;
|
|
143
|
-
}) {
|
|
143
|
+
}): Promise<boolean> {
|
|
144
144
|
const { element, filename, prepare } = opts;
|
|
145
145
|
|
|
146
146
|
// Capture current scroll position
|
|
@@ -156,6 +156,7 @@ export async function downloadHTMLAsImage(opts: {
|
|
|
156
156
|
// Get screenshot
|
|
157
157
|
const dataUrl = await toPng(element);
|
|
158
158
|
downloadByURL(dataUrl, Filenames.toPNG(filename));
|
|
159
|
+
return true;
|
|
159
160
|
} catch (error) {
|
|
160
161
|
Logger.error("Error downloading as PNG", error);
|
|
161
162
|
toast({
|
|
@@ -163,6 +164,7 @@ export async function downloadHTMLAsImage(opts: {
|
|
|
163
164
|
description: prettyError(error),
|
|
164
165
|
variant: "danger",
|
|
165
166
|
});
|
|
167
|
+
return false;
|
|
166
168
|
} finally {
|
|
167
169
|
cleanup?.();
|
|
168
170
|
if (document.body.classList.contains("printing")) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Quote one argument for a POSIX shell command.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors Python's `shlex.quote` so copied commands cannot interpret argument
|
|
7
|
+
* contents as shell syntax.
|
|
8
|
+
*/
|
|
9
|
+
export function shellQuote(value: string): string {
|
|
10
|
+
if (value === "") {
|
|
11
|
+
return "''";
|
|
12
|
+
}
|
|
13
|
+
if (/^[\w@%+=:,./-]+$/.test(value)) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
17
|
+
}
|