@marimo-team/islands 0.21.2-dev58 → 0.21.2-dev59

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/main.js CHANGED
@@ -71107,7 +71107,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
71107
71107
  return Logger.warn("Failed to get version from mount config"), null;
71108
71108
  }
71109
71109
  }
71110
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.21.2-dev58"), showCodeInRunModeAtom = atom(true);
71110
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.21.2-dev59"), showCodeInRunModeAtom = atom(true);
71111
71111
  atom(null);
71112
71112
  var import_compiler_runtime$89 = require_compiler_runtime();
71113
71113
  function useKeydownOnElement(e, r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.21.2-dev58",
3
+ "version": "0.21.2-dev59",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -62,9 +62,11 @@ import type { FileInfo } from "@/core/network/types";
62
62
  import { isWasm } from "@/core/wasm/utils";
63
63
  import { useAsyncData } from "@/hooks/useAsyncData";
64
64
  import { ErrorBanner } from "@/plugins/impl/common/error-banner";
65
+ import { deserializeBlob } from "@/utils/blob";
65
66
  import { cn } from "@/utils/cn";
66
67
  import { copyToClipboard } from "@/utils/copy";
67
68
  import { downloadBlob } from "@/utils/download";
69
+ import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
68
70
  import { openNotebook } from "@/utils/links";
69
71
  import type { FilePath } from "@/utils/paths";
70
72
  import { fileSplit } from "@/utils/pathUtils";
@@ -650,8 +652,20 @@ const Node = ({ node, style, dragHandle }: NodeRendererProps<FileInfo>) => {
650
652
  <DropdownMenuItem
651
653
  onSelect={async () => {
652
654
  const details = await sendFileDetails({ path: node.data.path });
653
- const contents = details.contents || "";
654
- downloadBlob(new Blob([contents]), node.data.name);
655
+ if (details.isBase64 && details.contents) {
656
+ const blob = deserializeBlob(
657
+ base64ToDataURL(
658
+ details.contents as Base64String,
659
+ details.mimeType || "application/octet-stream",
660
+ ),
661
+ );
662
+ downloadBlob(blob, node.data.name);
663
+ } else {
664
+ downloadBlob(
665
+ new Blob([details.contents || ""]),
666
+ node.data.name,
667
+ );
668
+ }
655
669
  }}
656
670
  >
657
671
  <DownloadIcon className={ic} />
@@ -21,6 +21,7 @@ import { filenameAtom } from "@/core/saving/file-state";
21
21
  import { isWasm } from "@/core/wasm/utils";
22
22
  import { useAsyncData } from "@/hooks/useAsyncData";
23
23
  import { ErrorBanner } from "@/plugins/impl/common/error-banner";
24
+ import { deserializeBlob } from "@/utils/blob";
24
25
  import { copyToClipboard } from "@/utils/copy";
25
26
  import { downloadBlob, downloadByURL } from "@/utils/download";
26
27
  import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
@@ -121,9 +122,22 @@ export const FileViewer: React.FC<Props> = ({ file, onOpenNotebook }) => {
121
122
  }
122
123
 
123
124
  const handleDownload = () => {
124
- if (isMediaMime(mimeType)) {
125
- const dataURL = base64ToDataURL(data.contents as Base64String, mimeType);
126
- downloadByURL(dataURL, data.file.name);
125
+ if (data.isBase64 && data.contents) {
126
+ if (isMediaMime(mimeType)) {
127
+ const dataURL = base64ToDataURL(
128
+ data.contents as Base64String,
129
+ mimeType,
130
+ );
131
+ downloadByURL(dataURL, data.file.name);
132
+ } else {
133
+ const blob = deserializeBlob(
134
+ base64ToDataURL(
135
+ data.contents as Base64String,
136
+ data.mimeType || "application/octet-stream",
137
+ ),
138
+ );
139
+ downloadBlob(blob, data.file.name);
140
+ }
127
141
  return;
128
142
  }
129
143