@marimo-team/islands 0.23.7-dev76 → 0.23.7-dev78

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.
@@ -32990,7 +32990,7 @@ Database schema: ${n}`), (_a3 = t2.aiFix) == null ? void 0 : _a3.setAiCompletion
32990
32990
  };
32991
32991
  downloadByURL = function(e, t) {
32992
32992
  let n = document.createElement("a");
32993
- n.href = e, n.download = t, n.click(), n.remove();
32993
+ n.href = e, t && (n.download = t), n.click(), n.remove();
32994
32994
  };
32995
32995
  downloadBlob = function(e, t) {
32996
32996
  let n = URL.createObjectURL(e);
@@ -35172,7 +35172,7 @@ ${_}`,
35172
35172
  return Logger.warn("Failed to get version from mount config"), null;
35173
35173
  }
35174
35174
  }
35175
- marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.7-dev76");
35175
+ marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.7-dev78");
35176
35176
  showCodeInRunModeAtom = atom(true);
35177
35177
  atom(null);
35178
35178
  var import_compiler_runtime = require_compiler_runtime();
package/dist/main.js CHANGED
@@ -26,7 +26,7 @@ import { $ as useCellActions, At as DeferredRequestRegistry, B as safeExtractSet
26
26
  import { __tla as __tla_1 } from "./chunk-5FQGJX7Z-BOg95xG5.js";
27
27
  import { o as useSize, s as Root$2, u as createLucideIcon } from "./dist-D3ZI9nhS.js";
28
28
  import { A as SquareFunction, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE_DESCRIPTIONS, E as EMPTY_VALUE$1, O as TIME_UNIT_DESCRIPTIONS, S as DEFAULT_AGGREGATION, T as DEFAULT_TIME_UNIT, _ as AGGREGATION_TYPE_DESCRIPTIONS, a as AGGREGATION_FNS$1, b as COLOR_SCHEMES, c as COLOR_BY_FIELDS, d as NONE_VALUE, f as SELECTABLE_DATA_TYPES, g as TIME_UNITS, h as STRING_AGGREGATION_FNS, i as convertDataTypeToSelectable, j as ChartColumn, k as escapeFieldName, l as COMBINED_TIME_UNITS, m as SORT_TYPES, n as createSpecWithoutData, o as BIN_AGGREGATION, p as SINGLE_TIME_UNITS, r as isFieldSet, s as CHART_TYPES, t as augmentSpecWithData, u as ChartType, v as AGGREGATION_TYPE_ICON, w as DEFAULT_MAX_BINS_FACET, x as COUNT_FIELD, y as CHART_TYPE_ICON } from "./spec-hVaaZsY5.js";
29
- import { $ as DelayMount, A as contextAwarePanelOwner, At as Kbd, B as Provider$1, Bt as Ellipsis, C as prettifyRowCount, Ct as TabsTrigger, D as ContextAwarePanelItem, Dt as LazyVegaEmbed, E as ComboboxItem, Et as ChartLoadingState, F as Toggle, Ft as TextWrap, G as TableHeader, Gt as ChevronsLeft, H as TableBody, Ht as Code, It as GripHorizontal, J as generateColumns, Jt as ArrowDownWideNarrow, K as TableRow, Kt as ChevronsDownUp, Lt as Funnel, M as isCellAwareAtom, Mt as EmotionCacheProvider, N as SlotNames, Nt as $fae977aafc393c5c$export$588937bcd60ade55, O as PANEL_TYPES, Ot as useOverflowDetection, P as slotsController, Pt as $fae977aafc393c5c$export$6b862160d295c8e, Q as ColumnChartSpecModel, Rt as EyeOff, S as prettifyRowColumnCount, St as TabsList, T as Combobox, Tt as ChartInfoState, U as TableCell, Ut as ChevronsUpDown, V as Table, Vt as Download, W as TableHead, Wt as ChevronsRight, X as renderCellValue, Y as inferFieldTypes, Z as ColumnChartContext, _ as downloadBlob, _t as CommandList, at as getPageIndexForRow, b as Progress, bt as Tabs, c as Slide, ct as INDEX_COLUMN_NAME, d as JsonOutput, dt as toFieldTypes, et as useIntersectionObserver, f as OutputArea, ft as getMimeValues, g as ADD_PRINTING_CLASS, gt as CommandItem, h as InstallPackageButton, ht as CommandInput, it as filtersToFilterGroup, j as contextAwarePanelType, jt as HtmlOutput, k as contextAwarePanelOpen, kt as RenderTextWithLinks, l as RadioGroup, lt as SELECT_COLUMN_ID, m as DataTable, mt as CommandEmpty, n as marimoVersionAtom, nt as DatePicker, o as SLIDE_TYPE_OPTIONS_BY_VALUE, ot as loadTableAndRawData, p as OutputRenderer, pt as Command, q as NAMELESS_COLUMN_PREFIX, qt as ChevronLeft, r as showCodeInRunModeAtom, rt as DateRangePicker, st as loadTableData, t as useNotebookCodeAvailable, tt as usePrevious$1, u as RadioGroupItem, ut as TOO_MANY_ROWS, v as downloadByURL, vt as CommandSeparator, w as useInternalStateWithSync, wt as ChartErrorState, x as Filenames, xt as TabsContent, y as downloadHTMLAsImage, yt as Maps, z as Fill, __tla as __tla_2 } from "./code-visibility-DntMVdEI.js";
29
+ import { $ as DelayMount, A as contextAwarePanelOwner, At as Kbd, B as Provider$1, Bt as Ellipsis, C as prettifyRowCount, Ct as TabsTrigger, D as ContextAwarePanelItem, Dt as LazyVegaEmbed, E as ComboboxItem, Et as ChartLoadingState, F as Toggle, Ft as TextWrap, G as TableHeader, Gt as ChevronsLeft, H as TableBody, Ht as Code, It as GripHorizontal, J as generateColumns, Jt as ArrowDownWideNarrow, K as TableRow, Kt as ChevronsDownUp, Lt as Funnel, M as isCellAwareAtom, Mt as EmotionCacheProvider, N as SlotNames, Nt as $fae977aafc393c5c$export$588937bcd60ade55, O as PANEL_TYPES, Ot as useOverflowDetection, P as slotsController, Pt as $fae977aafc393c5c$export$6b862160d295c8e, Q as ColumnChartSpecModel, Rt as EyeOff, S as prettifyRowColumnCount, St as TabsList, T as Combobox, Tt as ChartInfoState, U as TableCell, Ut as ChevronsUpDown, V as Table, Vt as Download, W as TableHead, Wt as ChevronsRight, X as renderCellValue, Y as inferFieldTypes, Z as ColumnChartContext, _ as downloadBlob, _t as CommandList, at as getPageIndexForRow, b as Progress, bt as Tabs, c as Slide, ct as INDEX_COLUMN_NAME, d as JsonOutput, dt as toFieldTypes, et as useIntersectionObserver, f as OutputArea, ft as getMimeValues, g as ADD_PRINTING_CLASS, gt as CommandItem, h as InstallPackageButton, ht as CommandInput, it as filtersToFilterGroup, j as contextAwarePanelType, jt as HtmlOutput, k as contextAwarePanelOpen, kt as RenderTextWithLinks, l as RadioGroup, lt as SELECT_COLUMN_ID, m as DataTable, mt as CommandEmpty, n as marimoVersionAtom, nt as DatePicker, o as SLIDE_TYPE_OPTIONS_BY_VALUE, ot as loadTableAndRawData, p as OutputRenderer, pt as Command, q as NAMELESS_COLUMN_PREFIX, qt as ChevronLeft, r as showCodeInRunModeAtom, rt as DateRangePicker, st as loadTableData, t as useNotebookCodeAvailable, tt as usePrevious$1, u as RadioGroupItem, ut as TOO_MANY_ROWS, v as downloadByURL, vt as CommandSeparator, w as useInternalStateWithSync, wt as ChartErrorState, x as Filenames, xt as TabsContent, y as downloadHTMLAsImage, yt as Maps, z as Fill, __tla as __tla_2 } from "./code-visibility-yHhPjulC.js";
30
30
  import { c as Calendar, i as createReducerAndAtoms, n as useOnUnmount, o as ToggleLeft, t as useOnMount } from "./useLifecycle-BF6-z62y.js";
31
31
  import { t as Check } from "./check-BcUIXnUT.js";
32
32
  import { A as Trigger$1, C as $a916eb452884faea$export$b7a616150fdb9f44, E as $18f2051aff69b9bf$export$a54013f0d02a8f82, F as X, L as ChevronDown, M as usePrevious$2, N as useDirection, P as createCollection, S as logNever, T as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, a as SelectGroup, c as SelectSeparator, d as NativeSelect, i as SelectContent, j as clamp$2, k as Icon, l as SelectTrigger, n as capitalize, o as SelectItem, r as Select, s as SelectLabel, t as Strings, u as SelectValue, x as assertNever } from "./strings-BiIhGaI8.js";
@@ -26558,28 +26558,32 @@ ${c}
26558
26558
  }));
26559
26559
  var DownloadButton = ({ data: e, load: r }) => {
26560
26560
  let [c, l] = (0, import_react.useState)(false), u = async (c2) => {
26561
- if (e.lazy && !e.disabled) {
26562
- c2.preventDefault(), l(true);
26563
- try {
26564
- let c3 = await r({});
26565
- downloadByURL(c3.data, c3.filename || e.filename || "download");
26566
- } catch (e2) {
26567
- toast({
26568
- title: "Failed to download",
26569
- description: "Please try again."
26570
- }), Logger.error("Failed to download:", e2);
26571
- } finally {
26572
- l(false);
26573
- }
26561
+ if (e.disabled) {
26562
+ c2.preventDefault(), c2.stopPropagation();
26563
+ return;
26564
+ }
26565
+ if (c2.preventDefault(), !e.lazy) {
26566
+ downloadByURL(e.data, e.filename ?? void 0);
26567
+ return;
26568
+ }
26569
+ l(true);
26570
+ try {
26571
+ let c3 = await r({});
26572
+ downloadByURL(c3.data, c3.filename ?? e.filename ?? void 0);
26573
+ } catch (e2) {
26574
+ toast({
26575
+ title: "Failed to download",
26576
+ description: "Please try again."
26577
+ }), Logger.error("Failed to download:", e2);
26578
+ } finally {
26579
+ l(false);
26574
26580
  }
26575
26581
  }, f = c ? LoaderCircle : Download, m = e.label ? renderHTML({
26576
26582
  html: e.label
26577
26583
  }) : "Download";
26578
26584
  return (0, import_jsx_runtime.jsxs)("a", {
26579
26585
  href: e.data,
26580
- download: e.filename || true,
26581
- target: "_blank",
26582
- rel: "noopener noreferrer",
26586
+ download: e.filename ?? "",
26583
26587
  onClick: u,
26584
26588
  className: buttonVariants({
26585
26589
  variant: "secondary",
@@ -35970,7 +35974,7 @@ ${c}
35970
35974
  if (l && l !== "slide") return l;
35971
35975
  if (c == null ? void 0 : c.has(e)) return "skip";
35972
35976
  }
35973
- var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-nUaHolo7.js"));
35977
+ var LazySlidesComponent = import_react.lazy(() => import("./reveal-component-DixmqICj.js"));
35974
35978
  const SlidesLayoutRenderer = ({ layout: e, setLayout: r, cells: c, mode: l }) => {
35975
35979
  var _a3;
35976
35980
  let u = useAtomValue(kioskModeAtom), d = l === "read" || u, f = useAtomValue(numColumnsAtom) > 1, [p, m] = (0, import_react.useState)(null), { cellsWithOutput: h, skippedIds: g, slideTypes: _, startCellIndex: v } = (0, import_react.useMemo)(() => computeSlideCellsInfo(c, e), [
@@ -9,7 +9,7 @@ import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
9
9
  import { ct as kioskModeAtom } from "./html-to-image-CpggM7u1.js";
10
10
  import "./chunk-5FQGJX7Z-BOg95xG5.js";
11
11
  import { u as createLucideIcon } from "./dist-D3ZI9nhS.js";
12
- import { Ht as Code, I as Panel, L as PanelGroup, R as PanelResizeHandle, Rt as EyeOff, a as DEFAULT_SLIDE_TYPE, c as Slide, i as DEFAULT_DECK_TRANSITION, s as SlideSidebar, t as useNotebookCodeAvailable, zt as Expand } from "./code-visibility-DntMVdEI.js";
12
+ import { Ht as Code, I as Panel, L as PanelGroup, R as PanelResizeHandle, Rt as EyeOff, a as DEFAULT_SLIDE_TYPE, c as Slide, i as DEFAULT_DECK_TRANSITION, s as SlideSidebar, t as useNotebookCodeAvailable, zt as Expand } from "./code-visibility-yHhPjulC.js";
13
13
  import { q as useDebouncedCallback } from "./input-D4kjoQUB.js";
14
14
  import "./toDate-CIpC_34u.js";
15
15
  import "./react-dom-BWRJ_g_k.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.23.7-dev76",
3
+ "version": "0.23.7-dev78",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -80,22 +80,26 @@ const DownloadButton = ({
80
80
  const [isLoading, setIsLoading] = useState(false);
81
81
 
82
82
  const handleClick = async (e: React.MouseEvent) => {
83
- if (!data.lazy) {
83
+ if (data.disabled) {
84
+ e.preventDefault();
85
+ e.stopPropagation();
84
86
  return;
85
87
  }
86
88
 
87
- if (data.disabled) {
89
+ e.preventDefault();
90
+
91
+ if (!data.lazy) {
92
+ downloadByURL(data.data, data.filename ?? undefined);
88
93
  return;
89
94
  }
90
95
 
91
- e.preventDefault();
92
96
  setIsLoading(true);
93
97
 
94
98
  try {
95
99
  const loadedData = await load({});
96
100
  downloadByURL(
97
101
  loadedData.data,
98
- loadedData.filename || data.filename || "download",
102
+ loadedData.filename ?? data.filename ?? undefined,
99
103
  );
100
104
  } catch (error) {
101
105
  toast({
@@ -114,9 +118,7 @@ const DownloadButton = ({
114
118
  return (
115
119
  <a
116
120
  href={data.data}
117
- download={data.filename || true}
118
- target="_blank"
119
- rel="noopener noreferrer"
121
+ download={data.filename ?? ""}
120
122
  onClick={handleClick}
121
123
  className={buttonVariants({
122
124
  variant: "secondary",
@@ -175,10 +175,12 @@ export async function downloadHTMLAsImage(opts: {
175
175
  }
176
176
  }
177
177
 
178
- export function downloadByURL(url: string, filename: string) {
178
+ export function downloadByURL(url: string, filename?: string) {
179
179
  const a = document.createElement("a");
180
180
  a.href = url;
181
- a.download = filename;
181
+ if (filename) {
182
+ a.download = filename;
183
+ }
182
184
  a.click();
183
185
  a.remove();
184
186
  }