@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.
Files changed (27) hide show
  1. package/dist/{common-BGCQJb-W.js → common-BcQ4kHDP.js} +4 -4
  2. package/dist/main.js +2 -2
  3. package/dist/{reveal-component-NNi374so.js → reveal-component-9QGZq7uF.js} +1 -1
  4. package/dist/style.css +1 -1
  5. package/package.json +1 -1
  6. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +1 -1
  7. package/src/components/editor/actions/export-dialog/__tests__/export-command.test.ts +115 -0
  8. package/src/components/editor/actions/export-dialog/__tests__/export-dialog.test.tsx +423 -0
  9. package/src/components/editor/actions/export-dialog/__tests__/export-notebook.test.ts +178 -0
  10. package/src/components/editor/actions/export-dialog/__tests__/state.test.ts +234 -0
  11. package/src/components/editor/actions/export-dialog/__tests__/use-export-dialog.test.tsx +287 -0
  12. package/src/components/editor/actions/export-dialog/export-command.ts +149 -0
  13. package/src/components/editor/actions/export-dialog/export-dialog.tsx +190 -0
  14. package/src/components/editor/actions/export-dialog/export-notebook.ts +98 -0
  15. package/src/components/editor/actions/export-dialog/format-notice.tsx +138 -0
  16. package/src/components/editor/actions/export-dialog/format-options.tsx +531 -0
  17. package/src/components/editor/actions/export-dialog/state.ts +321 -0
  18. package/src/components/editor/actions/export-dialog/use-export-dialog.ts +380 -0
  19. package/src/components/editor/actions/pair-with-agent-commands.ts +1 -21
  20. package/src/components/editor/actions/useNotebookActions.tsx +72 -170
  21. package/src/components/editor/connections/add-connection-dialog.tsx +1 -1
  22. package/src/components/editor/connections/quick-add-data-sources.tsx +14 -7
  23. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +187 -0
  24. package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
  25. package/src/utils/__tests__/download.test.tsx +6 -4
  26. package/src/utils/download.ts +3 -1
  27. 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
- await downloadHTMLAsImage({ element: mockElement, filename: "test" });
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
- await downloadHTMLAsImage({ element: mockElement, filename: "test" });
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",
@@ -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
+ }