@cntrl-site/sdk-nextjs 1.9.38 → 1.9.39

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
Binary file
@@ -28,9 +28,10 @@ const Article = ({ article, sectionData }) => {
28
28
  });
29
29
  }, [articleRectObserver]);
30
30
  const webglContextManager = (0, react_1.useMemo)(() => new effects_1.WebGLContextManager(), []);
31
+ const sectionsLength = article.sections.length;
31
32
  return ((0, jsx_runtime_1.jsx)(ArticleRectContext_1.ArticleRectContext.Provider, { value: articleRectObserver, children: (0, jsx_runtime_1.jsxs)(InteractionsContext_1.InteractionsProvider, { article: article, children: [(0, jsx_runtime_1.jsx)(ArticleWrapper_1.ArticleWrapper, { children: (0, jsx_runtime_1.jsxs)("div", { className: "article", ref: articleRef, children: [(0, jsx_runtime_1.jsx)(WebGLContextManagerContext_1.WebglContextManagerContext.Provider, { value: webglContextManager, children: article.sections.map((section, i) => {
32
33
  const data = section.name ? sectionData[section.name] : {};
33
- return ((0, jsx_runtime_1.jsx)(Section_1.Section, { section: section, data: data, children: article.sections[i].items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: section.id, articleHeight: articleHeight }, item.id))) }, section.id));
34
+ return ((0, jsx_runtime_1.jsx)(Section_1.Section, { section: section, data: data, zIndex: sectionsLength - i, children: article.sections[i].items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: section.id, articleHeight: articleHeight }, item.id))) }, section.id));
34
35
  }) }), (0, jsx_runtime_1.jsx)("div", { id: "component-portal" })] }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
35
36
  .article {
36
37
  position: relative;
@@ -16,7 +16,7 @@ const SectionVideo_1 = require("./SectionVideo");
16
16
  const SectionImage_1 = require("./SectionImage");
17
17
  const checkOverflowClipSupport_1 = require("../../utils/checkOverflowClipSupport");
18
18
  const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
19
- const Section = ({ section, data, children }) => {
19
+ const Section = ({ section, data, children, zIndex }) => {
20
20
  var _a;
21
21
  const id = (0, react_1.useId)();
22
22
  const sectionRef = (0, react_1.useRef)(null);
@@ -49,7 +49,7 @@ const Section = ({ section, data, children }) => {
49
49
  };
50
50
  if (SectionComponent)
51
51
  return (0, jsx_runtime_1.jsx)("div", { ref: sectionRef, children: (0, jsx_runtime_1.jsx)(SectionComponent, { data: data, children: 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: `
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, style: { zIndex }, 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: `
53
53
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([height, color, media]) => (`
54
54
  .section-${section.id} {
55
55
  height: ${getSectionHeight(height)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.9.38",
3
+ "version": "1.9.39",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@ export const Article: FC<Props> = ({ article, sectionData }) => {
29
29
  }, [articleRectObserver]);
30
30
 
31
31
  const webglContextManager = useMemo(() => new WebGLContextManager(), []);
32
+ const sectionsLength = article.sections.length;
32
33
 
33
34
  return (
34
35
  <ArticleRectContext.Provider value={articleRectObserver}>
@@ -43,6 +44,7 @@ export const Article: FC<Props> = ({ article, sectionData }) => {
43
44
  section={section}
44
45
  key={section.id}
45
46
  data={data}
47
+ zIndex={sectionsLength - i}
46
48
  >
47
49
  {article.sections[i].items.map(item => (
48
50
  <Item
@@ -21,10 +21,11 @@ const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
21
21
  interface Props {
22
22
  section: TSection;
23
23
  children: SectionChild[];
24
+ zIndex: number;
24
25
  data?: any;
25
26
  }
26
27
 
27
- export const Section: FC<Props> = ({ section, data, children }) => {
28
+ export const Section: FC<Props> = ({ section, data, children, zIndex }) => {
28
29
  const id = useId();
29
30
  const sectionRef = useRef<HTMLDivElement | null>(null);
30
31
  const { layouts, customSections } = useCntrlContext();
@@ -68,6 +69,7 @@ export const Section: FC<Props> = ({ section, data, children }) => {
68
69
  className={`section-${section.id}`}
69
70
  id={section.name}
70
71
  ref={sectionRef}
72
+ style={{ zIndex }}
71
73
  >
72
74
  {media && media.size !== 'none' && sectionRef.current && (
73
75
  <div className={`section-background-overlay-${section.id}`}>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
- </state>
5
- </component>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/sdk-nextjs.iml" filepath="$PROJECT_DIR$/.idea/sdk-nextjs.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>