@cntrl-site/sdk-nextjs 1.8.19-alpha.2 → 1.8.19-alpha.4

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.
Binary file
@@ -14,6 +14,7 @@ const color_1 = require("@cntrl-site/color");
14
14
  const useLayoutContext_1 = require("../useLayoutContext");
15
15
  const SectionVideo_1 = require("./SectionVideo");
16
16
  const SectionImage_1 = require("./SectionImage");
17
+ const checkOverflowClipSupport_1 = require("../../utils/checkOverflowClipSupport");
17
18
  const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
18
19
  const Section = ({ section, data, children }) => {
19
20
  var _a;
@@ -24,7 +25,14 @@ const Section = ({ section, data, children }) => {
24
25
  const layoutValues = [section.height, section.color, (_a = section.media) !== null && _a !== void 0 ? _a : {}];
25
26
  const SectionComponent = section.name ? customSections.getComponent(section.name) : undefined;
26
27
  (0, useSectionRegistry_1.useSectionRegistry)(section.id, sectionRef.current);
28
+ const sectionHeight = layout && section.height[layout] ? section.height[layout] : undefined;
27
29
  const layoutMedia = layout && section.media && section.media[layout] ? section.media[layout] : undefined;
30
+ const media = (0, react_1.useMemo)(() => {
31
+ if (layoutMedia && !(0, checkOverflowClipSupport_1.isOverflowClipSupported)()) {
32
+ return Object.assign(Object.assign({}, layoutMedia), { position: 'local' });
33
+ }
34
+ return layoutMedia;
35
+ }, [layoutMedia]);
28
36
  const getSectionVisibilityStyles = () => {
29
37
  return layouts
30
38
  .sort((a, b) => a.startsWith - b.startsWith)
@@ -41,7 +49,7 @@ const Section = ({ section, data, children }) => {
41
49
  };
42
50
  if (SectionComponent)
43
51
  return (0, jsx_runtime_1.jsx)("div", { ref: sectionRef, children: (0, jsx_runtime_1.jsx)(SectionComponent, { data: data, children: children }) });
44
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `section-${section.id}`, id: section.name, ref: sectionRef, children: [layoutMedia && layoutMedia.size !== 'none' && sectionRef.current && ((0, jsx_runtime_1.jsx)("div", { className: `section-background-overlay-${section.id}`, children: (0, jsx_runtime_1.jsxs)("div", { className: `section-background-wrapper-${section.id}`, children: [layoutMedia.type === 'video' && ((0, jsx_runtime_1.jsx)(SectionVideo_1.SectionVideo, { container: sectionRef.current, sectionId: section.id, media: layoutMedia })), layoutMedia.type === 'image' && ((0, jsx_runtime_1.jsx)(SectionImage_1.SectionImage, { media: layoutMedia, sectionId: section.id }))] }, `section-background-wrapper-${section.id}`) })), children] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
52
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `section-${section.id}`, id: section.name, ref: sectionRef, children: [media && media.size !== 'none' && sectionRef.current && ((0, jsx_runtime_1.jsx)("div", { className: `section-background-overlay-${section.id}`, children: (0, jsx_runtime_1.jsxs)("div", { className: `section-background-wrapper-${section.id}`, style: Object.assign({ transform: media.position === 'fixed' ? 'translateY(-100vh)' : 'unset' }, (sectionHeight && { height: media.position === 'fixed' ? `calc(${getSectionHeight(sectionHeight)} + 200vh)` : getSectionHeight(sectionHeight) })), children: [media.type === 'video' && ((0, jsx_runtime_1.jsx)(SectionVideo_1.SectionVideo, { container: sectionRef.current, sectionId: section.id, media: media })), media.type === 'image' && ((0, jsx_runtime_1.jsx)(SectionImage_1.SectionImage, { media: media, sectionId: section.id }))] }, `section-background-wrapper-${section.id}`) })), children] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
45
53
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([height, color, media]) => (`
46
54
  .section-${section.id} {
47
55
  height: ${getSectionHeight(height)};
@@ -12,15 +12,21 @@ const SectionImage = ({ media, sectionId }) => {
12
12
  const { url, size, position, offsetX } = media;
13
13
  const isContainHeight = size === 'contain-height';
14
14
  const hasOffsetX = offsetX !== null && size === 'contain';
15
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: url, className: `image-background-${sectionId}` }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
15
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `section-image-wrapper-${sectionId}`, children: (0, jsx_runtime_1.jsx)("img", { src: url, className: `image-background-${sectionId}` }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
16
+ .section-image-wrapper-${sectionId} {
17
+ position: ${position === 'fixed' ? 'sticky' : 'relative'};
18
+ height: ${position === 'fixed' ? '100vh' : '100%'};
19
+ top: ${position === 'fixed' ? '100vh' : '0'};
20
+ width: 100%;
21
+ overflow: hidden;
22
+ }
16
23
  .image-background-${sectionId} {
17
24
  object-fit: ${isContainHeight ? 'unset' : size !== null && size !== void 0 ? size : 'cover'};
18
25
  width: ${isContainHeight || hasOffsetX ? 'auto' : '100%'};
19
- height: ${position === 'fixed' ? '100vh' : '100%'};
20
26
  transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
21
- position: ${position === 'fixed' ? 'sticky' : 'relative'};
22
- top: ${position === 'fixed' ? '100vh' : 'unset'};
23
- margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
27
+ position: relative;
28
+ left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
29
+ height: 100%;
24
30
  ${offsetX ? 'max-width: 100vw;' : ''}
25
31
  }
26
32
  ` })] }));
@@ -12,39 +12,47 @@ const SectionVideo = ({ container, sectionId, media }) => {
12
12
  const { url, size, position, offsetX, coverUrl, play } = media;
13
13
  const id = (0, react_1.useId)();
14
14
  const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
15
+ const [userPaused, setUserPaused] = (0, react_1.useState)(false);
16
+ const [isClickedOnCover, setIsClickedOnCover] = (0, react_1.useState)(false);
15
17
  const handleCoverClick = () => {
16
18
  if (!video || play !== 'on-click')
17
19
  return;
20
+ setIsClickedOnCover(true);
18
21
  if (isPlaying) {
19
22
  video.pause();
23
+ setUserPaused(true);
20
24
  }
21
25
  else {
22
26
  video.play();
27
+ setUserPaused(false);
23
28
  }
24
29
  };
25
30
  (0, react_1.useEffect)(() => {
26
- if (!video || play !== 'auto')
31
+ if (!video || play !== 'on-click')
27
32
  return;
28
33
  const observer = new IntersectionObserver(([entry]) => {
34
+ if (userPaused || !isClickedOnCover)
35
+ return;
29
36
  if (entry.isIntersecting) {
30
- video.style.display = 'block';
31
- video.play().catch(() => { });
37
+ video.play();
32
38
  }
33
39
  else {
34
- video.style.display = 'none';
35
40
  video.pause();
36
41
  }
37
- }, {
38
- root: null,
39
- rootMargin: '50px',
40
- threshold: 0
41
42
  });
42
43
  observer.observe(container);
43
44
  return () => observer.disconnect();
44
- }, [container, play]);
45
+ }, [container, play, userPaused, isClickedOnCover]);
45
46
  const isContainHeight = size === 'contain-height';
46
47
  const hasOffsetX = offsetX !== null && size === 'contain';
47
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { ref: setVideo, autoPlay: play === 'auto', loop: true, style: { opacity: !isPlaying && play === 'on-click' && coverUrl ? 0 : 1 }, controls: false, muted: play === 'auto', playsInline: true, preload: "auto", className: `video-background-${sectionId}`, onPlay: () => setIsPlaying(true), onPause: () => setIsPlaying(false), children: (0, jsx_runtime_1.jsx)("source", { src: `${url}#t=0.001` }) }), (0, jsx_runtime_1.jsx)("div", { className: `video-background-${sectionId}-cover-container`, onClick: handleCoverClick, children: coverUrl && play === 'on-click' && ((0, jsx_runtime_1.jsx)("img", { src: coverUrl, alt: "Video cover", className: `video-background-${sectionId}-cover`, style: { opacity: isPlaying ? 0 : 1 } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
48
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `section-video-wrapper-${sectionId}`, children: [(0, jsx_runtime_1.jsx)("video", { ref: setVideo, autoPlay: play === 'auto', loop: true, style: { opacity: !isPlaying && play === 'on-click' && coverUrl ? 0 : 1 }, controls: false, muted: play === 'auto', playsInline: true, preload: "auto", className: `video-background-${sectionId}`, onPlay: () => setIsPlaying(true), onPause: () => setIsPlaying(false), children: (0, jsx_runtime_1.jsx)("source", { src: `${url}#t=0.001` }) }), (0, jsx_runtime_1.jsx)("div", { className: `video-background-${sectionId}-cover-container`, onClick: handleCoverClick, children: coverUrl && play === 'on-click' && ((0, jsx_runtime_1.jsx)("img", { src: coverUrl, alt: "Video cover", className: `video-background-${sectionId}-cover`, style: { opacity: isPlaying ? 0 : 1 } })) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
49
+ .section-video-wrapper-${sectionId} {
50
+ position: ${position === 'fixed' ? 'sticky' : 'relative'};
51
+ height: ${position === 'fixed' ? '100vh' : '100%'};
52
+ top: ${position === 'fixed' ? '100vh' : '0'};
53
+ width: 100%;
54
+ overflow: hidden;
55
+ }
48
56
  .video-background-${sectionId}-cover-container {
49
57
  position: absolute;
50
58
  pointer-events: ${play === 'on-click' ? 'auto' : 'none'};
@@ -54,24 +62,22 @@ const SectionVideo = ({ container, sectionId, media }) => {
54
62
  top: 0;
55
63
  }
56
64
  .video-background-${sectionId}-cover {
57
- position: ${position === 'fixed' ? 'sticky' : 'relative'};
58
- margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
65
+ position: relative;
66
+ left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
59
67
  width: ${isContainHeight ? 'auto' : '100%'};
60
- height: ${position === 'fixed' ? '100vh' : '100%'};
68
+ height: 100%;
61
69
  object-fit: ${isContainHeight ? 'unset' : size !== null && size !== void 0 ? size : 'cover'};
62
70
  transition: opacity 0.1s ease-in-out;
63
- top: ${position === 'fixed' ? '100vh' : '0'};
64
71
  transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
65
72
  ${hasOffsetX ? 'max-width: 100vw;' : ''}
66
73
  }
67
74
  .video-background-${sectionId} {
68
75
  object-fit: ${isContainHeight ? 'unset' : size !== null && size !== void 0 ? size : 'cover'};
69
76
  width: ${isContainHeight ? 'auto' : '100%'};
70
- height: ${position === 'fixed' ? '100vh' : '100%'};
77
+ height: 100%;
78
+ position: relative;
71
79
  transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
72
- position: ${position === 'fixed' ? 'sticky' : 'relative'};
73
- top: ${position === 'fixed' ? '100vh' : 'unset'};
74
- margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
80
+ left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
75
81
  }
76
82
  ` })] }));
77
83
  };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOverflowClipSupported = void 0;
4
+ function isOverflowClipSupported() {
5
+ if (typeof window === 'undefined')
6
+ return false;
7
+ if (typeof CSS !== 'undefined' && CSS.supports) {
8
+ return CSS.supports('overflow', 'clip');
9
+ }
10
+ try {
11
+ const testElement = document.createElement('div');
12
+ testElement.style.overflow = 'clip';
13
+ return testElement.style.overflow === 'clip';
14
+ }
15
+ catch (_a) {
16
+ return false;
17
+ }
18
+ }
19
+ exports.isOverflowClipSupported = isOverflowClipSupported;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.8.19-alpha.2",
3
+ "version": "1.8.19-alpha.4",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -4,7 +4,7 @@ import { LayoutContext } from '../provider/LayoutContext';
4
4
 
5
5
  export const ArticleWrapper: FC<PropsWithChildren<{}>> = ({ children }) => {
6
6
  const { layoutId, layoutDeviation } = useCurrentLayout();
7
- const layoutDeviationStyle = {'--layout-deviation': layoutDeviation} as CSSProperties;
7
+ const layoutDeviationStyle = { '--layout-deviation': layoutDeviation } as CSSProperties;
8
8
 
9
9
  return (
10
10
  <LayoutContext.Provider value={layoutId}>
@@ -1,4 +1,4 @@
1
- import { FC, ReactElement, useId, useRef } from 'react';
1
+ import React, { FC, ReactElement, useId, useRef, useMemo } from 'react';
2
2
  import JSXStyle from 'styled-jsx/style';
3
3
  import {
4
4
  getLayoutMediaQuery,
@@ -13,6 +13,7 @@ import { CntrlColor } from '@cntrl-site/color';
13
13
  import { useLayoutContext } from '../useLayoutContext';
14
14
  import { SectionVideo } from './SectionVideo';
15
15
  import { SectionImage } from './SectionImage';
16
+ import { isOverflowClipSupported } from '../../utils/checkOverflowClipSupport';
16
17
 
17
18
  type SectionChild = ReactElement<any, any>;
18
19
  const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
@@ -31,8 +32,19 @@ export const Section: FC<Props> = ({ section, data, children }) => {
31
32
  const layoutValues: Record<string, any>[] = [section.height, section.color, section.media ?? {}];
32
33
  const SectionComponent = section.name ? customSections.getComponent(section.name) : undefined;
33
34
  useSectionRegistry(section.id, sectionRef.current);
35
+ const sectionHeight = layout && section.height[layout] ? section.height[layout] : undefined;
34
36
  const layoutMedia = layout && section.media && section.media[layout] ? section.media[layout] : undefined;
35
37
 
38
+ const media = useMemo(() => {
39
+ if (layoutMedia && !isOverflowClipSupported()) {
40
+ return {
41
+ ...layoutMedia,
42
+ position: 'local'
43
+ };
44
+ }
45
+ return layoutMedia;
46
+ }, [layoutMedia]);
47
+
36
48
  const getSectionVisibilityStyles = () => {
37
49
  return layouts
38
50
  .sort((a, b) => a.startsWith - b.startsWith)
@@ -57,17 +69,21 @@ export const Section: FC<Props> = ({ section, data, children }) => {
57
69
  id={section.name}
58
70
  ref={sectionRef}
59
71
  >
60
- {layoutMedia && layoutMedia.size !== 'none' && sectionRef.current && (
72
+ {media && media.size !== 'none' && sectionRef.current && (
61
73
  <div className={`section-background-overlay-${section.id}`}>
62
74
  <div
63
75
  key={`section-background-wrapper-${section.id}`}
64
76
  className={`section-background-wrapper-${section.id}`}
77
+ style={{
78
+ transform: media.position === 'fixed' ? 'translateY(-100vh)' : 'unset',
79
+ ...(sectionHeight && { height: media.position === 'fixed' ? `calc(${getSectionHeight(sectionHeight)} + 200vh)` : getSectionHeight(sectionHeight) })
80
+ }}
65
81
  >
66
- {layoutMedia.type === 'video' && (
67
- <SectionVideo container={sectionRef.current} sectionId={section.id} media={layoutMedia} />
82
+ {media.type === 'video' && (
83
+ <SectionVideo container={sectionRef.current} sectionId={section.id} media={media} />
68
84
  )}
69
- {layoutMedia.type === 'image' && (
70
- <SectionImage media={layoutMedia} sectionId={section.id} />
85
+ {media.type === 'image' && (
86
+ <SectionImage media={media} sectionId={section.id} />
71
87
  )}
72
88
  </div>
73
89
  </div>
@@ -21,16 +21,24 @@ export const SectionImage: FC<Props> = ({ media, sectionId }) => {
21
21
  const hasOffsetX = offsetX !== null && size === 'contain';
22
22
  return (
23
23
  <>
24
- <img src={url} className={`image-background-${sectionId}`} />
24
+ <div className={`section-image-wrapper-${sectionId}`}>
25
+ <img src={url} className={`image-background-${sectionId}`} />
26
+ </div>
25
27
  <JSXStyle id={id}>{`
28
+ .section-image-wrapper-${sectionId} {
29
+ position: ${position === 'fixed' ? 'sticky' : 'relative'};
30
+ height: ${position === 'fixed' ? '100vh' : '100%'};
31
+ top: ${position === 'fixed' ? '100vh' : '0'};
32
+ width: 100%;
33
+ overflow: hidden;
34
+ }
26
35
  .image-background-${sectionId} {
27
36
  object-fit: ${isContainHeight ? 'unset' : size ?? 'cover'};
28
37
  width: ${isContainHeight || hasOffsetX ? 'auto' : '100%'};
29
- height: ${position === 'fixed' ? '100vh' : '100%'};
30
38
  transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
31
- position: ${position === 'fixed' ? 'sticky' : 'relative'};
32
- top: ${position === 'fixed' ? '100vh' : 'unset'};
33
- margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
39
+ position: relative;
40
+ left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
41
+ height: 100%;
34
42
  ${offsetX ? 'max-width: 100vw;' : ''}
35
43
  }
36
44
  `}
@@ -22,64 +22,72 @@ export const SectionVideo: FC<Props> = ({ container, sectionId, media }) => {
22
22
  const { url, size, position, offsetX, coverUrl, play } = media;
23
23
  const id = useId();
24
24
  const [isPlaying, setIsPlaying] = useState(false);
25
+ const [userPaused, setUserPaused] = useState(false);
26
+ const [isClickedOnCover, setIsClickedOnCover] = useState(false);
25
27
 
26
28
  const handleCoverClick = () => {
27
29
  if (!video || play !== 'on-click') return;
30
+ setIsClickedOnCover(true);
28
31
  if (isPlaying) {
29
32
  video.pause();
33
+ setUserPaused(true);
30
34
  } else {
31
35
  video.play();
36
+ setUserPaused(false);
32
37
  }
33
38
  };
34
39
 
35
40
  useEffect(() => {
36
- if (!video || play !== 'auto') return;
41
+ if (!video || play !== 'on-click') return;
37
42
  const observer = new IntersectionObserver(
38
43
  ([entry]) => {
44
+ if (userPaused || !isClickedOnCover) return;
39
45
  if (entry.isIntersecting) {
40
- video.style.display = 'block';
41
- video.play().catch(() => {});
46
+ video.play();
42
47
  } else {
43
- video.style.display = 'none';
44
48
  video.pause();
45
49
  }
46
- },
47
- {
48
- root: null,
49
- rootMargin: '50px',
50
- threshold: 0
51
50
  }
52
51
  );
53
52
  observer.observe(container);
54
53
  return () => observer.disconnect();
55
- }, [container, play]);
54
+ }, [container, play, userPaused, isClickedOnCover]);
56
55
 
57
56
  const isContainHeight = size === 'contain-height';
58
57
  const hasOffsetX = offsetX !== null && size === 'contain';
59
58
 
60
59
  return (
61
60
  <>
62
- <video
63
- ref={setVideo}
64
- autoPlay={play === 'auto'}
65
- loop
66
- style={{ opacity: !isPlaying && play === 'on-click' && coverUrl ? 0 : 1 }}
67
- controls={false}
68
- muted={play === 'auto'}
69
- playsInline
70
- preload="auto"
71
- className={`video-background-${sectionId}`}
72
- onPlay={() => setIsPlaying(true)}
73
- onPause={() => setIsPlaying(false)}
74
- >
75
- <source src={`${url}#t=0.001`} />
76
- </video>
77
- <div className={`video-background-${sectionId}-cover-container`} onClick={handleCoverClick}>
78
- {coverUrl && play === 'on-click' && (
79
- <img src={coverUrl} alt="Video cover" className={`video-background-${sectionId}-cover`} style={{ opacity: isPlaying ? 0 : 1 }} />
80
- )}
61
+ <div className={`section-video-wrapper-${sectionId}`}>
62
+ <video
63
+ ref={setVideo}
64
+ autoPlay={play === 'auto'}
65
+ loop
66
+ style={{ opacity: !isPlaying && play === 'on-click' && coverUrl ? 0 : 1 }}
67
+ controls={false}
68
+ muted={play === 'auto'}
69
+ playsInline
70
+ preload="auto"
71
+ className={`video-background-${sectionId}`}
72
+ onPlay={() => setIsPlaying(true)}
73
+ onPause={() => setIsPlaying(false)}
74
+ >
75
+ <source src={`${url}#t=0.001`} />
76
+ </video>
77
+ <div className={`video-background-${sectionId}-cover-container`} onClick={handleCoverClick}>
78
+ {coverUrl && play === 'on-click' && (
79
+ <img src={coverUrl} alt="Video cover" className={`video-background-${sectionId}-cover`} style={{ opacity: isPlaying ? 0 : 1 }} />
80
+ )}
81
+ </div>
81
82
  </div>
82
83
  <JSXStyle id={id}>{`
84
+ .section-video-wrapper-${sectionId} {
85
+ position: ${position === 'fixed' ? 'sticky' : 'relative'};
86
+ height: ${position === 'fixed' ? '100vh' : '100%'};
87
+ top: ${position === 'fixed' ? '100vh' : '0'};
88
+ width: 100%;
89
+ overflow: hidden;
90
+ }
83
91
  .video-background-${sectionId}-cover-container {
84
92
  position: absolute;
85
93
  pointer-events: ${play === 'on-click' ? 'auto' : 'none'};
@@ -89,24 +97,22 @@ export const SectionVideo: FC<Props> = ({ container, sectionId, media }) => {
89
97
  top: 0;
90
98
  }
91
99
  .video-background-${sectionId}-cover {
92
- position: ${position === 'fixed' ? 'sticky' : 'relative'};
93
- margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
100
+ position: relative;
101
+ left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
94
102
  width: ${isContainHeight ? 'auto' : '100%'};
95
- height: ${position === 'fixed' ? '100vh' : '100%'};
103
+ height: 100%;
96
104
  object-fit: ${isContainHeight ? 'unset' : size ?? 'cover'};
97
105
  transition: opacity 0.1s ease-in-out;
98
- top: ${position === 'fixed' ? '100vh' : '0'};
99
106
  transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
100
107
  ${hasOffsetX ? 'max-width: 100vw;' : ''}
101
108
  }
102
109
  .video-background-${sectionId} {
103
110
  object-fit: ${isContainHeight ? 'unset' : size ?? 'cover'};
104
111
  width: ${isContainHeight ? 'auto' : '100%'};
105
- height: ${position === 'fixed' ? '100vh' : '100%'};
112
+ height: 100%;
113
+ position: relative;
106
114
  transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
107
- position: ${position === 'fixed' ? 'sticky' : 'relative'};
108
- top: ${position === 'fixed' ? '100vh' : 'unset'};
109
- margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
115
+ left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
110
116
  }
111
117
  `}
112
118
  </JSXStyle>
@@ -0,0 +1,13 @@
1
+ export function isOverflowClipSupported(): boolean {
2
+ if (typeof window === 'undefined') return false;
3
+ if (typeof CSS !== 'undefined' && CSS.supports) {
4
+ return CSS.supports('overflow', 'clip');
5
+ }
6
+ try {
7
+ const testElement = document.createElement('div');
8
+ testElement.style.overflow = 'clip';
9
+ return testElement.style.overflow === 'clip';
10
+ } catch {
11
+ return false;
12
+ }
13
+ }