@marimo-team/islands 0.20.5-dev87 → 0.20.5-dev88

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.
@@ -2,7 +2,7 @@ import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-Bs6Z0kvn.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
4
4
  import { S as CircleQuestionMark, a as AlertTitle, m as asRemoteURL, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-DLS-bHHT.js";
5
- import { d as Objects, g as Logger, h as Events } from "./button-DQpBib29.js";
5
+ import { d as Objects, g as Logger, h as Events, y as cn } from "./button-DQpBib29.js";
6
6
  import "./Combination-Dk6JxauT.js";
7
7
  import { t as require_jsx_runtime } from "./jsx-runtime-CTBg5pdT.js";
8
8
  import "./react-dom-CqtLRVZP.js";
@@ -598,7 +598,7 @@ var VegaComponent = (e) => {
598
598
  children: B.stack
599
599
  })]
600
600
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
601
- className: "relative",
601
+ className: cn("relative", "width" in W && W.width === "container" && "vega-container-width"),
602
602
  onPointerDown: Events.stopPropagation(),
603
603
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: R }), Q()]
604
604
  })] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.20.5-dev87",
3
+ "version": "0.20.5-dev88",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -13,6 +13,7 @@ import { Tooltip } from "@/components/ui/tooltip";
13
13
  import { useAsyncData } from "@/hooks/useAsyncData";
14
14
  import { useOnMount } from "@/hooks/useLifecycle";
15
15
  import { type ResolvedTheme, useTheme } from "@/theme/useTheme";
16
+ import { cn } from "@/utils/cn";
16
17
  import { Objects } from "@/utils/objects";
17
18
  import { ErrorBanner } from "../common/error-banner";
18
19
  import { vegaLoadData } from "../vega/loader";
@@ -139,9 +140,15 @@ export const DataExplorerComponent = ({
139
140
  const responsiveSpec = makeResponsive(spec);
140
141
  // TODO: We can optimize by updating the data dynamically. https://github.com/vega/react-vega?tab=readme-ov-file#recipes
141
142
  const augmentedSpec = augmentSpecWithData(responsiveSpec, chartData);
143
+ const isContainerWidth = responsiveSpec.width === "container";
142
144
 
143
145
  return (
144
- <div className="flex overflow-y-auto justify-center items-center flex-1 w-[90%]">
146
+ <div
147
+ className={cn(
148
+ "flex overflow-y-auto justify-center items-center flex-1 w-[90%]",
149
+ isContainerWidth && "vega-container-width",
150
+ )}
151
+ >
145
152
  <VegaEmbed spec={augmentedSpec} options={chartOptions(theme)} />
146
153
  </div>
147
154
  );
@@ -16,6 +16,7 @@ import { Tooltip } from "@/components/ui/tooltip";
16
16
  import { useAsyncData } from "@/hooks/useAsyncData";
17
17
  import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
18
18
  import { useTheme } from "@/theme/useTheme";
19
+ import { cn } from "@/utils/cn";
19
20
  import { Events } from "@/utils/events";
20
21
  import { Logger } from "@/utils/Logger";
21
22
  import { Objects } from "@/utils/objects";
@@ -304,7 +305,12 @@ const LoadedVegaComponent = ({
304
305
  </Alert>
305
306
  )}
306
307
  <div
307
- className="relative"
308
+ className={cn(
309
+ "relative",
310
+ "width" in selectableSpec &&
311
+ selectableSpec.width === "container" &&
312
+ "vega-container-width",
313
+ )}
308
314
  // Capture the pointer down event to prevent the parent from handling it
309
315
  onPointerDown={Events.stopPropagation()}
310
316
  >
@@ -1,18 +1,11 @@
1
1
  @reference "../../../css/globals.css";
2
2
 
3
3
  .vega-embed {
4
- width: 100%;
5
- flex: 1;
6
- display: inline-block;
7
-
8
- @media (min-width: 500px) {
9
- min-width: 300px;
10
- }
4
+ max-width: 100%;
5
+ }
11
6
 
12
- /* For vega embeds in slots, reset the styles to let the user set the width */
13
- @container style(--slot: true) {
14
- min-width: unset;
15
- }
7
+ .vega-container-width .vega-embed {
8
+ width: 100%;
16
9
  }
17
10
 
18
11
  .vega-embed > .chart-wrapper {