@marimo-team/islands 0.18.5-dev181 → 0.18.5-dev183

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
@@ -94118,10 +94118,11 @@ ${c}
94118
94118
  render(e) {
94119
94119
  return (0, import_jsx_runtime.jsx)(LazySlidesComponent$1, {
94120
94120
  ...e.data,
94121
+ wrapAround: true,
94121
94122
  children: e.children
94122
94123
  });
94123
94124
  }
94124
- }, LazySlidesComponent$1 = import_react.lazy(() => import("./slides-component-BNbVrOMb.js"));
94125
+ }, LazySlidesComponent$1 = import_react.lazy(() => import("./slides-component-CJJp5XN4.js"));
94125
94126
  const DownloadPlugin = createPlugin("marimo-download").withData(object$1({
94126
94127
  data: string$2(),
94127
94128
  disabled: boolean$2().default(false),
@@ -100562,7 +100563,7 @@ Defaulting to \`null\`.`;
100562
100563
  cells: []
100563
100564
  })
100564
100565
  };
100565
- var import_compiler_runtime$8 = require_compiler_runtime(), LazySlidesComponent = import_react.lazy(() => import("./slides-component-BNbVrOMb.js"));
100566
+ var import_compiler_runtime$8 = require_compiler_runtime(), LazySlidesComponent = import_react.lazy(() => import("./slides-component-CJJp5XN4.js"));
100566
100567
  const SlidesLayoutRenderer = (e) => {
100567
100568
  let r = (0, import_compiler_runtime$8.c)(11), { cells: c, mode: d } = e, f = d === "read", h;
100568
100569
  if (r[0] !== c || r[1] !== d) {
@@ -101060,7 +101061,7 @@ Defaulting to \`null\`.`;
101060
101061
  return Logger.warn("Failed to get version from mount config"), null;
101061
101062
  }
101062
101063
  }
101063
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.5-dev181"), showCodeInRunModeAtom = atom(true);
101064
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.5-dev183"), showCodeInRunModeAtom = atom(true);
101064
101065
  atom(null);
101065
101066
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
101066
101067
  constructor() {
@@ -2960,71 +2960,79 @@ var SwiperSlide = /* @__PURE__ */ (0, import_react.forwardRef)(function(t2, d) {
2960
2960
  });
2961
2961
  SwiperSlide.displayName = "SwiperSlide";
2962
2962
  var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1), slides_component_default = (t2) => {
2963
- let d = (0, import_compiler_runtime.c)(26), { className: f, children: g, height: b, forceKeyboardNavigation: x } = t2, S = x === void 0 ? false : x, C = import_react.useRef(null), [w, T] = import_react.useState(false), { hasFullscreen: E } = useIframeCapabilities(), D;
2964
- d[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = () => {
2963
+ let d = (0, import_compiler_runtime.c)(30), { className: f, children: g, height: b, forceKeyboardNavigation: x, wrapAround: S } = t2, C = x === void 0 ? false : x, w = S === void 0 ? false : S, T = import_react.useRef(null), [E, D] = import_react.useState(false), { hasFullscreen: O } = useIframeCapabilities(), k;
2964
+ d[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = () => {
2965
2965
  var _a, _b;
2966
- document.fullscreenElement ? (_a = C.current) == null ? void 0 : _a.swiper.keyboard.enable() : (_b = C.current) == null ? void 0 : _b.swiper.keyboard.disable(), T(!!document.fullscreenElement);
2967
- }, d[0] = D) : D = d[0], useEventListener(document, "fullscreenchange", D);
2968
- let O;
2969
- d[1] === w ? O = d[2] : (O = [w], d[1] = w, d[2] = O), (0, import_react.useEffect)(_temp2, O);
2970
- let k;
2971
- d[3] === f ? k = d[4] : (k = cn("relative w-full border rounded bg-background mo-slides-theme prose-slides", f), d[3] = f, d[4] = k);
2972
- let A = w ? "100%" : b || "550px", j;
2973
- d[5] === A ? j = d[6] : (j = { height: A }, d[5] = A, d[6] = j);
2974
- let M, N;
2975
- d[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = [
2966
+ document.fullscreenElement ? (_a = T.current) == null ? void 0 : _a.swiper.keyboard.enable() : (_b = T.current) == null ? void 0 : _b.swiper.keyboard.disable(), D(!!document.fullscreenElement);
2967
+ }, d[0] = k) : k = d[0], useEventListener(document, "fullscreenchange", k);
2968
+ let A;
2969
+ d[1] === E ? A = d[2] : (A = [E], d[1] = E, d[2] = A), (0, import_react.useEffect)(_temp2, A);
2970
+ let j;
2971
+ d[3] === w ? j = d[4] : (j = w ? [
2972
+ Keyboard,
2973
+ Pagination,
2974
+ Zoom,
2975
+ Navigation
2976
+ ] : [
2976
2977
  Virtual,
2977
2978
  Keyboard,
2978
2979
  Pagination,
2979
2980
  Zoom,
2980
2981
  Navigation
2981
- ], N = { maxRatio: 5 }, d[7] = M, d[8] = N) : (M = d[7], N = d[8]);
2982
- let P = w || S, F;
2983
- d[9] === P ? F = d[10] : (F = { enabled: P }, d[9] = P, d[10] = F);
2982
+ ], d[3] = w, d[4] = j);
2983
+ let M = j, N;
2984
+ d[5] === f ? N = d[6] : (N = cn("relative w-full border rounded bg-background mo-slides-theme prose-slides", f), d[5] = f, d[6] = N);
2985
+ let P = E ? "100%" : b || "550px", F;
2986
+ d[7] === P ? F = d[8] : (F = { height: P }, d[7] = P, d[8] = F);
2984
2987
  let I;
2985
- d[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = { clickable: true }, d[11] = I) : I = d[11];
2986
- let L;
2987
- if (d[12] !== g || d[13] !== w) {
2988
+ d[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = { maxRatio: 5 }, d[9] = I) : I = d[9];
2989
+ let L = E || C, R;
2990
+ d[10] === L ? R = d[11] : (R = { enabled: L }, d[10] = L, d[11] = R);
2991
+ let z;
2992
+ d[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = { clickable: true }, d[12] = z) : z = d[12];
2993
+ let B = !w, V;
2994
+ if (d[13] !== g || d[14] !== E) {
2988
2995
  let t3;
2989
- d[15] === w ? t3 = d[16] : (t3 = (t4, d2) => t4 == null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SwiperSlide, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2996
+ d[16] === E ? t3 = d[17] : (t3 = (t4, d2) => t4 == null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SwiperSlide, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2990
2997
  onKeyDown: _temp3,
2991
- className: cn("h-full w-full flex box-border overflow-y-auto overflow-x-hidden", w ? "p-20" : "p-6 pb-12"),
2998
+ className: cn("h-full w-full flex box-border overflow-y-auto overflow-x-hidden", E ? "p-20" : "p-6 pb-12"),
2992
2999
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2993
3000
  className: "mo-slide-content",
2994
3001
  children: t4
2995
3002
  })
2996
- }) }, d2), d[15] = w, d[16] = t3), L = import_react.Children.map(g, t3), d[12] = g, d[13] = w, d[14] = L;
2997
- } else L = d[14];
2998
- let R;
2999
- d[17] !== E || d[18] !== w ? (R = E && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
3003
+ }) }, d2), d[16] = E, d[17] = t3), V = import_react.Children.map(g, t3), d[13] = g, d[14] = E, d[15] = V;
3004
+ } else V = d[15];
3005
+ let H;
3006
+ d[18] !== O || d[19] !== E ? (H = O && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
3000
3007
  variant: "link",
3001
3008
  size: "sm",
3002
3009
  "data-testid": "marimo-plugin-slides-fullscreen",
3003
3010
  onClick: async () => {
3004
- if (!C.current) return;
3005
- let t3 = C.current;
3006
- document.fullscreenElement ? (await document.exitFullscreen(), T(false)) : (await t3.requestFullscreen(), T(true));
3011
+ if (!T.current) return;
3012
+ let t3 = T.current;
3013
+ document.fullscreenElement ? (await document.exitFullscreen(), D(false)) : (await t3.requestFullscreen(), D(true));
3007
3014
  },
3008
3015
  className: "absolute bottom-0 right-0 z-10 mx-1 mb-0",
3009
- children: w ? "Exit Fullscreen" : "Fullscreen"
3010
- }), d[17] = E, d[18] = w, d[19] = R) : R = d[19];
3011
- let z;
3012
- return d[20] !== F || d[21] !== L || d[22] !== R || d[23] !== k || d[24] !== j ? (z = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Swiper, {
3013
- ref: C,
3014
- className: k,
3016
+ children: E ? "Exit Fullscreen" : "Fullscreen"
3017
+ }), d[18] = O, d[19] = E, d[20] = H) : H = d[20];
3018
+ let U;
3019
+ return d[21] !== M || d[22] !== R || d[23] !== B || d[24] !== V || d[25] !== H || d[26] !== N || d[27] !== F || d[28] !== w ? (U = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Swiper, {
3020
+ ref: T,
3021
+ className: N,
3015
3022
  spaceBetween: 50,
3016
- style: j,
3023
+ style: F,
3017
3024
  slidesPerView: 1,
3018
3025
  modules: M,
3019
- zoom: N,
3026
+ zoom: I,
3020
3027
  simulateTouch: false,
3021
- keyboard: F,
3028
+ keyboard: R,
3022
3029
  navigation: true,
3023
- pagination: I,
3024
- virtual: true,
3030
+ pagination: z,
3031
+ virtual: B,
3025
3032
  speed: 1,
3026
- children: [L, R]
3027
- }), d[20] = F, d[21] = L, d[22] = R, d[23] = k, d[24] = j, d[25] = z) : z = d[25], z;
3033
+ loop: w,
3034
+ children: [V, H]
3035
+ }), d[21] = M, d[22] = R, d[23] = B, d[24] = V, d[25] = H, d[26] = N, d[27] = F, d[28] = w, d[29] = U) : U = d[29], U;
3028
3036
  };
3029
3037
  function _temp() {
3030
3038
  window.dispatchEvent(new Event("resize"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.18.5-dev181",
3
+ "version": "0.18.5-dev183",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -21,6 +21,7 @@ interface SlidesComponentProps {
21
21
  forceKeyboardNavigation?: boolean;
22
22
  index?: string | null;
23
23
  height?: string | number | null;
24
+ wrapAround?: boolean;
24
25
  }
25
26
 
26
27
  const SlidesComponent = ({
@@ -28,6 +29,7 @@ const SlidesComponent = ({
28
29
  children,
29
30
  height,
30
31
  forceKeyboardNavigation = false,
32
+ wrapAround = false,
31
33
  }: PropsWithChildren<SlidesComponentProps>): JSX.Element => {
32
34
  const el = React.useRef<SwiperRef>(null);
33
35
  const [isFullscreen, setIsFullscreen] = React.useState(false);
@@ -48,6 +50,10 @@ const SlidesComponent = ({
48
50
  });
49
51
  }, [isFullscreen]);
50
52
 
53
+ const modules = wrapAround // virtual is incompatible with loop
54
+ ? [Keyboard, Pagination, Zoom, Navigation]
55
+ : [Virtual, Keyboard, Pagination, Zoom, Navigation];
56
+
51
57
  return (
52
58
  <Swiper
53
59
  ref={el}
@@ -60,7 +66,7 @@ const SlidesComponent = ({
60
66
  height: isFullscreen ? "100%" : height || "550px",
61
67
  }}
62
68
  slidesPerView={1}
63
- modules={[Virtual, Keyboard, Pagination, Zoom, Navigation]}
69
+ modules={modules}
64
70
  zoom={{
65
71
  maxRatio: 5,
66
72
  }}
@@ -74,10 +80,11 @@ const SlidesComponent = ({
74
80
  pagination={{
75
81
  clickable: true,
76
82
  }}
77
- virtual={true}
83
+ virtual={!wrapAround} // virtual is incompatible with loop, turn off if loop is on
78
84
  // Instant swipes, which make sequences of slides
79
85
  // that overlay content more legible
80
86
  speed={1}
87
+ loop={wrapAround}
81
88
  >
82
89
  {React.Children.map(children, (child, index) => {
83
90
  if (child == null) {
@@ -36,7 +36,7 @@ export class CarouselPlugin implements IStatelessPlugin<Data> {
36
36
 
37
37
  render(props: IStatelessPluginProps<Data>): JSX.Element {
38
38
  return (
39
- <LazySlidesComponent {...props.data}>
39
+ <LazySlidesComponent {...props.data} wrapAround={true}>
40
40
  {props.children}
41
41
  </LazySlidesComponent>
42
42
  );