@cntrl-site/sdk-nextjs 1.8.11 → 1.8.12
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/LICENSE +21 -21
- package/README.md +4 -4
- package/TODO.md +1 -1
- package/cntrl-site-sdk-nextjs-1.8.12.tgz +0 -0
- package/cntrl-site-sdk-nextjs-1.8.13.tgz +0 -0
- package/eslint.config.mjs +35 -35
- package/jest.config.js +6 -6
- package/lib/common/useItemFXData.js +7 -7
- package/lib/common/useRegisterResize.js +2 -2
- package/lib/components/Article.js +5 -5
- package/lib/components/LayoutStyle.js +4 -4
- package/lib/components/Section/Section.js +43 -43
- package/lib/components/items/CodeEmbedItem/CodeEmbedItem.js +35 -35
- package/lib/components/items/ComponentItem/ComponentItem.js +16 -14
- package/lib/components/items/ComponentItem/useComponentItem.js +8 -1
- package/lib/components/items/CompoundItem/CompoundChild.js +20 -20
- package/lib/components/items/CompoundItem/CompoundItem.js +14 -14
- package/lib/components/items/CustomItem/CustomItem.js +9 -9
- package/lib/components/items/EmbedVideoItem/VimeoEmbed.js +23 -23
- package/lib/components/items/EmbedVideoItem/YoutubeEmbed.js +26 -26
- package/lib/components/items/FileItem/ImageItem.js +38 -38
- package/lib/components/items/FileItem/VideoItem.js +45 -45
- package/lib/components/items/GroupItem/GroupItem.js +13 -13
- package/lib/components/items/Item.js +30 -30
- package/lib/components/items/RectangleItem/RectangleItem.js +20 -20
- package/lib/components/items/RichTextItem/RichTextItem.js +21 -21
- package/lib/utils/RichTextConverter/RichTextConverter.js +21 -21
- package/package.json +57 -58
- package/src/common/useCurrentLayout.ts +52 -52
- package/src/common/useExemplary.ts +9 -9
- package/src/common/useItemFXData.ts +47 -47
- package/src/common/useKeyframeValue.ts +85 -85
- package/src/common/useRegisterResize.ts +16 -17
- package/src/components/Article.tsx +66 -66
- package/src/components/ArticleWrapper.tsx +21 -21
- package/src/components/Head.tsx +56 -56
- package/src/components/LayoutStyle.tsx +21 -21
- package/src/components/Page.tsx +33 -33
- package/src/components/ScrollPlaybackVideo.tsx +56 -56
- package/src/components/Section/Section.tsx +164 -164
- package/src/components/Section/useSectionColor.ts +19 -19
- package/src/components/Section/useSectionHeightMap.ts +19 -19
- package/src/components/items/CodeEmbedItem/CodeEmbedItem.tsx +137 -137
- package/src/components/items/CodeEmbedItem/useCodeEmbedItem.ts +36 -36
- package/src/components/items/ComponentItem/ComponentItem.tsx +65 -62
- package/src/components/items/ComponentItem/useComponentItem.ts +35 -23
- package/src/components/items/CompoundItem/CompoundChild.tsx +150 -150
- package/src/components/items/CompoundItem/CompoundItem.tsx +70 -70
- package/src/components/items/CompoundItem/useCompoundItem.ts +21 -21
- package/src/components/items/CustomItem/CustomItem.tsx +48 -48
- package/src/components/items/EmbedVideoItem/VimeoEmbed.tsx +202 -202
- package/src/components/items/EmbedVideoItem/YoutubeEmbed.tsx +187 -187
- package/src/components/items/EmbedVideoItem/useEmbedVideoItem.ts +46 -46
- package/src/components/items/FileItem/ImageItem.tsx +156 -156
- package/src/components/items/FileItem/VideoItem.tsx +185 -185
- package/src/components/items/FileItem/useFileItem.ts +73 -73
- package/src/components/items/GroupItem/GroupItem.tsx +79 -79
- package/src/components/items/GroupItem/useGroupItem.ts +34 -34
- package/src/components/items/Item.tsx +251 -251
- package/src/components/items/LinkWrapper.tsx +39 -39
- package/src/components/items/RectangleItem/RectangleItem.tsx +95 -95
- package/src/components/items/RectangleItem/useRectangleItem.ts +82 -82
- package/src/components/items/RichTextItem/RichTextItem.tsx +105 -105
- package/src/components/items/RichTextItem/useRichTextItem.ts +12 -12
- package/src/components/items/RichTextWrapper.tsx +15 -15
- package/src/components/items/itemsMap.ts +28 -28
- package/src/components/items/useDraggable.ts +252 -252
- package/src/components/items/useItemAngle.ts +13 -13
- package/src/components/items/useItemArea.ts +35 -35
- package/src/components/items/useItemPointerEvents.ts +23 -23
- package/src/components/items/useItemScale.ts +17 -17
- package/src/components/items/useItemTriggers.ts +15 -15
- package/src/components/items/useRichTextItemValues.ts +65 -65
- package/src/components/items/useSizing.ts +25 -25
- package/src/components/items/useStickyItemTop.ts +21 -21
- package/src/components/useLayoutContext.ts +7 -7
- package/src/index.ts +24 -24
- package/src/interactions/CSSPropertyNameMap.ts +38 -38
- package/src/interactions/InteractionsRegistry.ts +283 -283
- package/src/interactions/ItemInteractionCtrl.ts +77 -77
- package/src/interactions/getTransition.ts +27 -27
- package/src/interactions/types.ts +36 -36
- package/src/interactions/useItemInteractionCtrl.ts +18 -18
- package/src/provider/ArticleRectContext.ts +4 -4
- package/src/provider/CntrlContext.ts +5 -5
- package/src/provider/CntrlProvider.tsx +11 -11
- package/src/provider/CntrlSdkContext.ts +83 -83
- package/src/provider/CustomItemRegistry.ts +14 -14
- package/src/provider/CustomItemTypes.ts +3 -3
- package/src/provider/CustomSectionRegistry.ts +25 -25
- package/src/provider/InteractionsContext.old.tsx +66 -66
- package/src/provider/InteractionsContext.test.tsx +97 -97
- package/src/provider/InteractionsContext.tsx +28 -28
- package/src/provider/Keyframes.ts +11 -11
- package/src/provider/KeyframesContext.ts +5 -5
- package/src/provider/LayoutContext.ts +3 -3
- package/src/provider/defaultContext.ts +8 -8
- package/src/provider/useCntrlContext.ts +8 -8
- package/src/styled-jsx.d.ts +1 -1
- package/src/utils/Animator/Animator.ts +371 -371
- package/src/utils/ArticleRectManager/ArticleRectObserver.ts +93 -93
- package/src/utils/ArticleRectManager/useArticleRectObserver.ts +17 -17
- package/src/utils/ArticleRectManager/useSectionRegistry.ts +11 -11
- package/src/utils/EventEmitter.ts +41 -41
- package/src/utils/RichTextConverter/RichTextConverter.tsx +326 -326
- package/src/utils/ScaleAnchorMap.ts +13 -13
- package/src/utils/StickyManager/StickyManager.ts +23 -23
- package/src/utils/Youtube/YouTubeIframeApiLoader.ts +58 -58
- package/src/utils/Youtube/YoutubeIframeApi.ts +101 -101
- package/src/utils/Youtube/useYouTubeIframeApi.ts +12 -12
- package/src/utils/binSearchInsertAt.ts +33 -33
- package/src/utils/castObject.ts +10 -10
- package/src/utils/effects/useImageFx.ts +113 -113
- package/src/utils/effects/useVideoFx.ts +116 -116
- package/src/utils/getAnchoredItemTop.ts +12 -12
- package/src/utils/getCompoundBoundaryStyles.ts +60 -60
- package/src/utils/getFontFamilyValue.ts +3 -3
- package/src/utils/getInvertedRanges.ts +43 -43
- package/src/utils/getItemTopStyle.ts +14 -14
- package/src/utils/getStyleFromItemStateAndParams.ts +8 -8
- package/src/utils/getValidYoutubeUrl.ts +29 -29
- package/src/utils/isItemType.ts +5 -5
- package/src/utils/rangeMap.ts +13 -13
- package/src/utils/useElementRect.ts +23 -23
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 CNTRL
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 CNTRL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# sdk-nextjs
|
|
2
|
-
SDK is the code that transforms the raw data from the API
|
|
3
|
-
into React components. In Control this happens at build time,
|
|
4
|
-
when users hit the "Publish" button from the Project Dashboard.
|
|
1
|
+
# sdk-nextjs
|
|
2
|
+
SDK is the code that transforms the raw data from the API
|
|
3
|
+
into React components. In Control this happens at build time,
|
|
4
|
+
when users hit the "Publish" button from the Project Dashboard.
|
package/TODO.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1. Uninstall `@types/isomorphic-fetch` package and run `npm run build` - results in a TS compile error
|
|
1
|
+
1. Uninstall `@types/isomorphic-fetch` package and run `npm run build` - results in a TS compile error
|
|
Binary file
|
|
Binary file
|
package/eslint.config.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import antfu from '@antfu/eslint-config';
|
|
2
|
-
|
|
3
|
-
export default antfu(
|
|
4
|
-
{
|
|
5
|
-
ignores: [],
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
rules: {
|
|
9
|
-
'import/order': 'off',
|
|
10
|
-
'style/semi': 'off',
|
|
11
|
-
'antfu/if-newline': 'off',
|
|
12
|
-
'style/comma-dangle': 'off',
|
|
13
|
-
'style/member-delimiter-style': 'off',
|
|
14
|
-
'semi': ['error', 'always'],
|
|
15
|
-
'no-alert': 'off',
|
|
16
|
-
'ts/consistent-type-definitions': 'off',
|
|
17
|
-
'perfectionist/sort-imports': 'off',
|
|
18
|
-
'perfectionist/sort-named-imports': 'off',
|
|
19
|
-
'ts/consistent-type-imports': 'off',
|
|
20
|
-
'jsonc/sort-keys': 'off',
|
|
21
|
-
'node/prefer-global/process': 'off',
|
|
22
|
-
'style/arrow-parens': 'off',
|
|
23
|
-
'ts/method-signature-style': 'off',
|
|
24
|
-
'style/brace-style': 'off',
|
|
25
|
-
'style/jsx-one-expression-per-line': 'off',
|
|
26
|
-
'test/prefer-lowercase-title': 'off',
|
|
27
|
-
'perfectionist/sort-exports': 'off',
|
|
28
|
-
'no-extra-boolean-cast': 'off',
|
|
29
|
-
'prefer-promise-reject-errors': 'off',
|
|
30
|
-
'new-cap': 'off',
|
|
31
|
-
'perfectionist/sort-named-exports': 'off',
|
|
32
|
-
'style/multiline-ternary': 'off'
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
);
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
export default antfu(
|
|
4
|
+
{
|
|
5
|
+
ignores: [],
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
rules: {
|
|
9
|
+
'import/order': 'off',
|
|
10
|
+
'style/semi': 'off',
|
|
11
|
+
'antfu/if-newline': 'off',
|
|
12
|
+
'style/comma-dangle': 'off',
|
|
13
|
+
'style/member-delimiter-style': 'off',
|
|
14
|
+
'semi': ['error', 'always'],
|
|
15
|
+
'no-alert': 'off',
|
|
16
|
+
'ts/consistent-type-definitions': 'off',
|
|
17
|
+
'perfectionist/sort-imports': 'off',
|
|
18
|
+
'perfectionist/sort-named-imports': 'off',
|
|
19
|
+
'ts/consistent-type-imports': 'off',
|
|
20
|
+
'jsonc/sort-keys': 'off',
|
|
21
|
+
'node/prefer-global/process': 'off',
|
|
22
|
+
'style/arrow-parens': 'off',
|
|
23
|
+
'ts/method-signature-style': 'off',
|
|
24
|
+
'style/brace-style': 'off',
|
|
25
|
+
'style/jsx-one-expression-per-line': 'off',
|
|
26
|
+
'test/prefer-lowercase-title': 'off',
|
|
27
|
+
'perfectionist/sort-exports': 'off',
|
|
28
|
+
'no-extra-boolean-cast': 'off',
|
|
29
|
+
'prefer-promise-reject-errors': 'off',
|
|
30
|
+
'new-cap': 'off',
|
|
31
|
+
'perfectionist/sort-named-exports': 'off',
|
|
32
|
+
'style/multiline-ternary': 'off'
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
);
|
package/jest.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
testEnvironment: 'jsdom',
|
|
5
|
-
rootDir: './src'
|
|
6
|
-
};
|
|
1
|
+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
testEnvironment: 'jsdom',
|
|
5
|
+
rootDir: './src'
|
|
6
|
+
};
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useItemFXData = void 0;
|
|
4
4
|
const sdk_1 = require("@cntrl-site/sdk");
|
|
5
5
|
const useKeyframeValue_1 = require("./useKeyframeValue");
|
|
6
|
-
const baseVariables = `precision mediump float;
|
|
7
|
-
uniform sampler2D u_image;
|
|
8
|
-
uniform sampler2D u_pattern;
|
|
9
|
-
uniform vec2 u_imgDimensions;
|
|
10
|
-
uniform vec2 u_patternDimensions;
|
|
11
|
-
uniform float u_time;
|
|
12
|
-
uniform vec2 u_cursor;
|
|
6
|
+
const baseVariables = `precision mediump float;
|
|
7
|
+
uniform sampler2D u_image;
|
|
8
|
+
uniform sampler2D u_pattern;
|
|
9
|
+
uniform vec2 u_imgDimensions;
|
|
10
|
+
uniform vec2 u_patternDimensions;
|
|
11
|
+
uniform float u_time;
|
|
12
|
+
uniform vec2 u_cursor;
|
|
13
13
|
varying vec2 v_texCoord;`;
|
|
14
14
|
function useItemFXData(item, sectionId) {
|
|
15
15
|
const { fragmentShader: shaderBody, FXControls } = item.commonParams;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useRegisterResize = void 0;
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill"));
|
|
9
|
-
|
|
9
|
+
function useRegisterResize(ref, onResize) {
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
11
11
|
if (!ref || !onResize)
|
|
12
12
|
return;
|
|
@@ -19,5 +19,5 @@ const useRegisterResize = (ref, onResize) => {
|
|
|
19
19
|
observer.unobserve(ref);
|
|
20
20
|
};
|
|
21
21
|
}, [ref, onResize]);
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
exports.useRegisterResize = useRegisterResize;
|
|
@@ -28,11 +28,11 @@ const Article = ({ article, sectionData }) => {
|
|
|
28
28
|
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.jsx)("div", { className: "article", ref: articleRef, children: article.sections.map((section, i) => {
|
|
29
29
|
const data = section.name ? sectionData[section.name] : {};
|
|
30
30
|
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));
|
|
31
|
-
}) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
32
|
-
.article {
|
|
33
|
-
position: relative;
|
|
34
|
-
overflow: clip;
|
|
35
|
-
}
|
|
31
|
+
}) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
32
|
+
.article {
|
|
33
|
+
position: relative;
|
|
34
|
+
overflow: clip;
|
|
35
|
+
}
|
|
36
36
|
` })] }) }));
|
|
37
37
|
};
|
|
38
38
|
exports.Article = Article;
|
|
@@ -9,10 +9,10 @@ const sdk_1 = require("@cntrl-site/sdk");
|
|
|
9
9
|
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
10
10
|
const LayoutStyle = ({ id, layouts, layoutId, children }) => {
|
|
11
11
|
const layout = layouts.find(l => l.id === layoutId);
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
13
|
-
${(0, sdk_1.getLayoutMediaQuery)(layoutId, layouts)} {
|
|
14
|
-
${children === null || children === void 0 ? void 0 : children(layout)}
|
|
15
|
-
}
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
13
|
+
${(0, sdk_1.getLayoutMediaQuery)(layoutId, layouts)} {
|
|
14
|
+
${children === null || children === void 0 ? void 0 : children(layout)}
|
|
15
|
+
}
|
|
16
16
|
` }));
|
|
17
17
|
};
|
|
18
18
|
exports.LayoutStyle = LayoutStyle;
|
|
@@ -33,12 +33,12 @@ const Section = ({ section, data, children }) => {
|
|
|
33
33
|
.sort((a, b) => a.startsWith - b.startsWith)
|
|
34
34
|
.reduce((acc, layout) => {
|
|
35
35
|
const isHidden = section.hidden[layout.id];
|
|
36
|
-
return `
|
|
37
|
-
${acc}
|
|
38
|
-
${(0, sdk_1.getLayoutMediaQuery)(layout.id, layouts)} {
|
|
39
|
-
.section-${section.id} {
|
|
40
|
-
display: ${isHidden ? 'none' : 'block'};
|
|
41
|
-
}
|
|
36
|
+
return `
|
|
37
|
+
${acc}
|
|
38
|
+
${(0, sdk_1.getLayoutMediaQuery)(layout.id, layouts)} {
|
|
39
|
+
.section-${section.id} {
|
|
40
|
+
display: ${isHidden ? 'none' : 'block'};
|
|
41
|
+
}
|
|
42
42
|
}`;
|
|
43
43
|
}, '');
|
|
44
44
|
};
|
|
@@ -66,46 +66,46 @@ const Section = ({ section, data, children }) => {
|
|
|
66
66
|
}, [isVideo]);
|
|
67
67
|
if (SectionComponent)
|
|
68
68
|
return (0, jsx_runtime_1.jsx)("div", { ref: sectionRef, children: (0, jsx_runtime_1.jsx)(SectionComponent, { data: data, children: children }) });
|
|
69
|
-
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: [layout && ((_g = (_f = section.media) === null || _f === void 0 ? void 0 : _f[layout]) === null || _g === void 0 ? void 0 : _g.url) && ((_j = (_h = section.media) === null || _h === void 0 ? void 0 : _h[layout]) === null || _j === void 0 ? void 0 : _j.size) !== 'none' && sectionRef.current && ((0, jsx_runtime_1.jsx)("div", { className: `section-background-overlay-${section.id}`, children: (0, jsx_runtime_1.jsx)("div", { className: `section-background-wrapper-${section.id}`, children: isVideo ? ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, autoPlay: true, loop: true, muted: true, playsInline: true, preload: "auto", className: `video-background-${section.id}`, children: (0, jsx_runtime_1.jsx)("source", { src: (_m = (_l = (_k = section.media) === null || _k === void 0 ? void 0 : _k[layout]) === null || _l === void 0 ? void 0 : _l.url) !== null && _m !== void 0 ? _m : '' }) })) : ((0, jsx_runtime_1.jsx)("img", { src: (_q = (_p = (_o = section.media) === null || _o === void 0 ? void 0 : _o[layout]) === null || _p === void 0 ? void 0 : _p.url) !== null && _q !== void 0 ? _q : '', className: `image-background-${section.id}` })) }, `section-background-wrapper-${section.id}`) })), children] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
69
|
+
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: [layout && ((_g = (_f = section.media) === null || _f === void 0 ? void 0 : _f[layout]) === null || _g === void 0 ? void 0 : _g.url) && ((_j = (_h = section.media) === null || _h === void 0 ? void 0 : _h[layout]) === null || _j === void 0 ? void 0 : _j.size) !== 'none' && sectionRef.current && ((0, jsx_runtime_1.jsx)("div", { className: `section-background-overlay-${section.id}`, children: (0, jsx_runtime_1.jsx)("div", { className: `section-background-wrapper-${section.id}`, children: isVideo ? ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, autoPlay: true, loop: true, muted: true, playsInline: true, preload: "auto", className: `video-background-${section.id}`, children: (0, jsx_runtime_1.jsx)("source", { src: (_m = (_l = (_k = section.media) === null || _k === void 0 ? void 0 : _k[layout]) === null || _l === void 0 ? void 0 : _l.url) !== null && _m !== void 0 ? _m : '' }) })) : ((0, jsx_runtime_1.jsx)("img", { src: (_q = (_p = (_o = section.media) === null || _o === void 0 ? void 0 : _o[layout]) === null || _p === void 0 ? void 0 : _p.url) !== null && _q !== void 0 ? _q : '', className: `image-background-${section.id}` })) }, `section-background-wrapper-${section.id}`) })), children] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
70
70
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([height, color, media]) => {
|
|
71
71
|
var _a;
|
|
72
|
-
return (`
|
|
73
|
-
.section-${section.id} {
|
|
74
|
-
height: ${getSectionHeight(height)};
|
|
75
|
-
position: relative;
|
|
76
|
-
background-color: ${color_1.CntrlColor.parse(color !== null && color !== void 0 ? color : DEFAULT_COLOR).fmt('rgba')};
|
|
77
|
-
}
|
|
78
|
-
.section-background-overlay-${section.id} {
|
|
79
|
-
height: ${getSectionHeight(height)};
|
|
80
|
-
width: 100%;
|
|
81
|
-
position: relative;
|
|
82
|
-
overflow: clip;
|
|
83
|
-
}
|
|
84
|
-
.section-background-wrapper-${section.id} {
|
|
85
|
-
transform: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? 'translateY(-100vh)' : 'unset'};
|
|
86
|
-
position: relative;
|
|
87
|
-
height: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? `calc(${getSectionHeight(height)} + 200vh)` : getSectionHeight(height)};
|
|
88
|
-
width: 100%;
|
|
89
|
-
}
|
|
90
|
-
.video-background-${section.id} {
|
|
91
|
-
object-fit: ${(_a = media === null || media === void 0 ? void 0 : media.size) !== null && _a !== void 0 ? _a : 'cover'};
|
|
92
|
-
width: ${(media === null || media === void 0 ? void 0 : media.offsetX) === null || (media === null || media === void 0 ? void 0 : media.size) === 'cover' ? '100%' : 'auto'};
|
|
93
|
-
height: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : '100%'};
|
|
94
|
-
position: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? 'sticky' : 'relative'};
|
|
95
|
-
top: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : 'unset'};
|
|
96
|
-
${media && media.offsetX !== null && media.size !== 'cover' ? `margin-left: ${media.offsetX * 100}vw;` : ''}
|
|
97
|
-
}
|
|
98
|
-
.image-background-${section.id} {
|
|
99
|
-
object-fit: ${media === null || media === void 0 ? void 0 : media.size};
|
|
100
|
-
width: ${(media === null || media === void 0 ? void 0 : media.offsetX) === null ? '100%' : 'auto'};
|
|
101
|
-
height: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : '100%'};
|
|
102
|
-
position: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? 'sticky' : 'relative'};
|
|
103
|
-
top: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : 'unset'};
|
|
104
|
-
${media && media.offsetX !== null && media.size !== 'cover' ? `margin-left: ${media.offsetX * 100}vw;` : ''}
|
|
105
|
-
}
|
|
72
|
+
return (`
|
|
73
|
+
.section-${section.id} {
|
|
74
|
+
height: ${getSectionHeight(height)};
|
|
75
|
+
position: relative;
|
|
76
|
+
background-color: ${color_1.CntrlColor.parse(color !== null && color !== void 0 ? color : DEFAULT_COLOR).fmt('rgba')};
|
|
77
|
+
}
|
|
78
|
+
.section-background-overlay-${section.id} {
|
|
79
|
+
height: ${getSectionHeight(height)};
|
|
80
|
+
width: 100%;
|
|
81
|
+
position: relative;
|
|
82
|
+
overflow: clip;
|
|
83
|
+
}
|
|
84
|
+
.section-background-wrapper-${section.id} {
|
|
85
|
+
transform: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? 'translateY(-100vh)' : 'unset'};
|
|
86
|
+
position: relative;
|
|
87
|
+
height: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? `calc(${getSectionHeight(height)} + 200vh)` : getSectionHeight(height)};
|
|
88
|
+
width: 100%;
|
|
89
|
+
}
|
|
90
|
+
.video-background-${section.id} {
|
|
91
|
+
object-fit: ${(_a = media === null || media === void 0 ? void 0 : media.size) !== null && _a !== void 0 ? _a : 'cover'};
|
|
92
|
+
width: ${(media === null || media === void 0 ? void 0 : media.offsetX) === null || (media === null || media === void 0 ? void 0 : media.size) === 'cover' ? '100%' : 'auto'};
|
|
93
|
+
height: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : '100%'};
|
|
94
|
+
position: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? 'sticky' : 'relative'};
|
|
95
|
+
top: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : 'unset'};
|
|
96
|
+
${media && media.offsetX !== null && media.size !== 'cover' ? `margin-left: ${media.offsetX * 100}vw;` : ''}
|
|
97
|
+
}
|
|
98
|
+
.image-background-${section.id} {
|
|
99
|
+
object-fit: ${media === null || media === void 0 ? void 0 : media.size};
|
|
100
|
+
width: ${(media === null || media === void 0 ? void 0 : media.offsetX) === null ? '100%' : 'auto'};
|
|
101
|
+
height: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : '100%'};
|
|
102
|
+
position: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? 'sticky' : 'relative'};
|
|
103
|
+
top: ${(media === null || media === void 0 ? void 0 : media.position) === 'fixed' ? '100vh' : 'unset'};
|
|
104
|
+
${media && media.offsetX !== null && media.size !== 'cover' ? `margin-left: ${media.offsetX * 100}vw;` : ''}
|
|
105
|
+
}
|
|
106
106
|
`);
|
|
107
|
-
})}
|
|
108
|
-
${getSectionVisibilityStyles()}
|
|
107
|
+
})}
|
|
108
|
+
${getSectionVisibilityStyles()}
|
|
109
109
|
` })] }));
|
|
110
110
|
};
|
|
111
111
|
exports.Section = Section;
|
|
@@ -62,18 +62,18 @@ const CodeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
|
|
|
62
62
|
const iframe = ref.querySelector(`[data-embed="${item.id}"]`);
|
|
63
63
|
if (!iframe)
|
|
64
64
|
return;
|
|
65
|
-
const htmlWithStyles = `
|
|
66
|
-
${fontGoogleTags}
|
|
67
|
-
${fontAdobeTags}
|
|
68
|
-
<style>
|
|
69
|
-
${fontCustomTags}
|
|
70
|
-
html, body {
|
|
71
|
-
height: 100%;
|
|
72
|
-
margin: 0 !important;
|
|
73
|
-
padding: 0 !important;
|
|
74
|
-
}
|
|
75
|
-
</style>
|
|
76
|
-
${item.commonParams.html}
|
|
65
|
+
const htmlWithStyles = `
|
|
66
|
+
${fontGoogleTags}
|
|
67
|
+
${fontAdobeTags}
|
|
68
|
+
<style>
|
|
69
|
+
${fontCustomTags}
|
|
70
|
+
html, body {
|
|
71
|
+
height: 100%;
|
|
72
|
+
margin: 0 !important;
|
|
73
|
+
padding: 0 !important;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
${item.commonParams.html}
|
|
77
77
|
`;
|
|
78
78
|
iframe.srcdoc = htmlWithStyles;
|
|
79
79
|
}, [item.commonParams.html, item.commonParams.iframe, ref]);
|
|
@@ -81,31 +81,31 @@ const CodeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
|
|
|
81
81
|
(0, react_1.useEffect)(() => {
|
|
82
82
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
83
83
|
}, [isInteractive, onVisibilityChange]);
|
|
84
|
-
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_h = item.link) === null || _h === void 0 ? void 0 : _h.url, target: (_j = item.link) === null || _j === void 0 ? void 0 : _j.target, children: [(0, jsx_runtime_1.jsx)("div", { className: `embed-wrapper-${item.id}`, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (opacity !== undefined ? { opacity } : {})), { transition: (_k = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _k !== void 0 ? _k : 'none' }), ref: setRef, children: item.commonParams.iframe ? ((0, jsx_runtime_1.jsx)("iframe", { "data-embed": item.id, className: `embed-${item.id}`, style: Object.assign(Object.assign({}, pos), { border: 'unset' }) })) : ((0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, style: Object.assign({}, pos), dangerouslySetInnerHTML: { __html: html } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
85
|
-
.embed-wrapper-${item.id} {
|
|
86
|
-
position: absolute;
|
|
87
|
-
width: 100%;
|
|
88
|
-
height: 100%;
|
|
89
|
-
}
|
|
90
|
-
.embed-${item.id} {
|
|
91
|
-
transform: ${item.commonParams.scale ? 'scale(var(--layout-deviation))' : 'none'};
|
|
92
|
-
transform-origin: top left;
|
|
93
|
-
z-index: 1;
|
|
94
|
-
border: none;
|
|
95
|
-
}
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_h = item.link) === null || _h === void 0 ? void 0 : _h.url, target: (_j = item.link) === null || _j === void 0 ? void 0 : _j.target, children: [(0, jsx_runtime_1.jsx)("div", { className: `embed-wrapper-${item.id}`, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (opacity !== undefined ? { opacity } : {})), { transition: (_k = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _k !== void 0 ? _k : 'none' }), ref: setRef, children: item.commonParams.iframe ? ((0, jsx_runtime_1.jsx)("iframe", { "data-embed": item.id, className: `embed-${item.id}`, style: Object.assign(Object.assign({}, pos), { border: 'unset' }) })) : ((0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, style: Object.assign({}, pos), dangerouslySetInnerHTML: { __html: html } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
85
|
+
.embed-wrapper-${item.id} {
|
|
86
|
+
position: absolute;
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
}
|
|
90
|
+
.embed-${item.id} {
|
|
91
|
+
transform: ${item.commonParams.scale ? 'scale(var(--layout-deviation))' : 'none'};
|
|
92
|
+
transform-origin: top left;
|
|
93
|
+
z-index: 1;
|
|
94
|
+
border: none;
|
|
95
|
+
}
|
|
96
96
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams], exemplary) => {
|
|
97
|
-
return (`
|
|
98
|
-
.embed-wrapper-${item.id} {
|
|
99
|
-
opacity: ${layoutParams.opacity};
|
|
100
|
-
transform: rotate(${area.angle}deg);
|
|
101
|
-
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
102
|
-
}
|
|
103
|
-
.embed-${item.id} {
|
|
104
|
-
width: ${item.commonParams.scale ? `${area.width * exemplary}px` : '100%'};
|
|
105
|
-
height: ${item.commonParams.scale ? `${area.height * exemplary}px` : '100%'};
|
|
106
|
-
}
|
|
97
|
+
return (`
|
|
98
|
+
.embed-wrapper-${item.id} {
|
|
99
|
+
opacity: ${layoutParams.opacity};
|
|
100
|
+
transform: rotate(${area.angle}deg);
|
|
101
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
102
|
+
}
|
|
103
|
+
.embed-${item.id} {
|
|
104
|
+
width: ${item.commonParams.scale ? `${area.width * exemplary}px` : '100%'};
|
|
105
|
+
height: ${item.commonParams.scale ? `${area.height * exemplary}px` : '100%'};
|
|
106
|
+
}
|
|
107
107
|
`);
|
|
108
|
-
})}
|
|
108
|
+
})}
|
|
109
109
|
` })] }));
|
|
110
110
|
};
|
|
111
111
|
exports.CodeEmbedItem = CodeEmbedItem;
|
|
@@ -15,7 +15,7 @@ const useRegisterResize_1 = require("../../../common/useRegisterResize");
|
|
|
15
15
|
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
16
16
|
const useLayoutContext_1 = require("../../useLayoutContext");
|
|
17
17
|
const ComponentItem = ({ item, sectionId, onResize, interactionCtrl }) => {
|
|
18
|
-
var _a, _b, _c;
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
19
|
const sdk = (0, useCntrlContext_1.useCntrlContext)();
|
|
20
20
|
const { layouts } = sdk;
|
|
21
21
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
@@ -23,25 +23,27 @@ const ComponentItem = ({ item, sectionId, onResize, interactionCtrl }) => {
|
|
|
23
23
|
const layoutValues = [item.area, item.layoutParams];
|
|
24
24
|
const component = sdk.getComponent(item.commonParams.componentId);
|
|
25
25
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
26
|
-
const { opacity: itemOpacity } = (0, useComponentItem_1.useComponentItem)(item, sectionId);
|
|
26
|
+
const { opacity: itemOpacity, blur: itemBlur } = (0, useComponentItem_1.useComponentItem)(item, sectionId);
|
|
27
27
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
28
|
-
const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle']);
|
|
28
|
+
const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle, blur']);
|
|
29
29
|
const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_a = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _a === void 0 ? void 0 : _a.angle, itemAngle);
|
|
30
30
|
const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_b = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _b === void 0 ? void 0 : _b.opacity, itemOpacity);
|
|
31
|
+
const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _c === void 0 ? void 0 : _c.blur, itemBlur);
|
|
31
32
|
const Element = component ? component.element : undefined;
|
|
32
33
|
const parameters = layout ? item.layoutParams[layout].parameters : undefined;
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `custom-component-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (
|
|
34
|
-
.custom-component-${item.id} {
|
|
35
|
-
width: 100%;
|
|
36
|
-
height: 100%;
|
|
37
|
-
pointer-events: auto;
|
|
38
|
-
}
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `custom-component-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { transition: (_d = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _d !== void 0 ? _d : 'none' }), children: parameters && Element && ((0, jsx_runtime_1.jsx)(Element, Object.assign({ content: item.commonParams.content }, parameters))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: item.id, children: `
|
|
35
|
+
.custom-component-${item.id} {
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
pointer-events: auto;
|
|
39
|
+
}
|
|
39
40
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
|
|
40
|
-
return (`
|
|
41
|
-
.custom-component-${item.id} {
|
|
42
|
-
transform: rotate(${area.angle}deg);
|
|
43
|
-
opacity: ${layoutParams.opacity};
|
|
44
|
-
|
|
41
|
+
return (`
|
|
42
|
+
.custom-component-${item.id} {
|
|
43
|
+
transform: rotate(${area.angle}deg);
|
|
44
|
+
opacity: ${layoutParams.opacity};
|
|
45
|
+
filter: blur(${layoutParams.blur}vw);
|
|
46
|
+
}
|
|
45
47
|
`);
|
|
46
48
|
})}` })] }));
|
|
47
49
|
};
|
|
@@ -12,8 +12,15 @@ function useComponentItem(item, sectionId) {
|
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
13
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
14
14
|
}, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
15
|
+
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
16
|
+
if (!layoutId)
|
|
17
|
+
return;
|
|
18
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
19
|
+
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
20
|
+
}, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
15
21
|
return {
|
|
16
|
-
opacity
|
|
22
|
+
opacity,
|
|
23
|
+
blur
|
|
17
24
|
};
|
|
18
25
|
}
|
|
19
26
|
exports.useComponentItem = useComponentItem;
|
|
@@ -70,32 +70,32 @@ const CompoundChild = ({ item, sectionId, isParentVisible = true }) => {
|
|
|
70
70
|
? { height: `${sizingAxis.y === 'manual'
|
|
71
71
|
? (0, getCompoundBoundaryStyles_1.getCompoundHeight)(compoundSettings, height)
|
|
72
72
|
: 'unset'}` }
|
|
73
|
-
: {})), (compoundSettings ? { transform: `${(0, getCompoundBoundaryStyles_1.getCompoundTransform)(compoundSettings)}` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none', cursor: hasClickTriggers ? 'pointer' : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none' }) }, triggers, { children: [(0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: Object.assign({ transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none' }, (scale !== undefined ? { transform: `scale(${scale})` } : {})), children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, transformOrigin: transformOrigin, children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange, isInCompound: true }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
73
|
+
: {})), (compoundSettings ? { transform: `${(0, getCompoundBoundaryStyles_1.getCompoundTransform)(compoundSettings)}` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none', cursor: hasClickTriggers ? 'pointer' : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none' }) }, triggers, { children: [(0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: Object.assign({ transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none' }, (scale !== undefined ? { transform: `scale(${scale})` } : {})), children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, transformOrigin: transformOrigin, children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange, isInCompound: true }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
74
74
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, compoundSettings, layoutParams]) => {
|
|
75
75
|
const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
|
|
76
76
|
const scaleAnchor = area.scaleAnchor;
|
|
77
|
-
return (`
|
|
78
|
-
.item-${item.id}-inner {
|
|
79
|
-
width: 100%;
|
|
80
|
-
height: 100%;
|
|
81
|
-
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
82
|
-
transform: scale(${area.scale});
|
|
83
|
-
}
|
|
84
|
-
.item-${item.id} {
|
|
85
|
-
position: absolute;
|
|
86
|
-
top: ${(0, getCompoundBoundaryStyles_1.getCompoundTop)(compoundSettings, area.top)};
|
|
87
|
-
left: ${(0, getCompoundBoundaryStyles_1.getCompoundLeft)(compoundSettings, area.left)};
|
|
88
|
-
transition: opacity 0.2s linear 0.1s;
|
|
89
|
-
display: ${hidden ? 'none' : 'block'};
|
|
77
|
+
return (`
|
|
78
|
+
.item-${item.id}-inner {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
82
|
+
transform: scale(${area.scale});
|
|
83
|
+
}
|
|
84
|
+
.item-${item.id} {
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: ${(0, getCompoundBoundaryStyles_1.getCompoundTop)(compoundSettings, area.top)};
|
|
87
|
+
left: ${(0, getCompoundBoundaryStyles_1.getCompoundLeft)(compoundSettings, area.left)};
|
|
88
|
+
transition: opacity 0.2s linear 0.1s;
|
|
89
|
+
display: ${hidden ? 'none' : 'block'};
|
|
90
90
|
width: ${sizingAxis.x === 'manual'
|
|
91
91
|
? `${(0, getCompoundBoundaryStyles_1.getCompoundWidth)(compoundSettings, area.width, isRichText)}`
|
|
92
|
-
: 'max-content'};
|
|
93
|
-
height: ${sizingAxis.y === 'manual' ? `${(0, getCompoundBoundaryStyles_1.getCompoundHeight)(compoundSettings, area.height)}` : 'unset'};
|
|
94
|
-
transform: ${(0, getCompoundBoundaryStyles_1.getCompoundTransform)(compoundSettings)};
|
|
95
|
-
z-index: ${area.zIndex};
|
|
96
|
-
}
|
|
92
|
+
: 'max-content'};
|
|
93
|
+
height: ${sizingAxis.y === 'manual' ? `${(0, getCompoundBoundaryStyles_1.getCompoundHeight)(compoundSettings, area.height)}` : 'unset'};
|
|
94
|
+
transform: ${(0, getCompoundBoundaryStyles_1.getCompoundTransform)(compoundSettings)};
|
|
95
|
+
z-index: ${area.zIndex};
|
|
96
|
+
}
|
|
97
97
|
`);
|
|
98
|
-
})}
|
|
98
|
+
})}
|
|
99
99
|
` })] })));
|
|
100
100
|
};
|
|
101
101
|
exports.CompoundChild = CompoundChild;
|
|
@@ -32,22 +32,22 @@ const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
|
|
|
32
32
|
(0, react_1.useEffect)(() => {
|
|
33
33
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
34
34
|
}, [isInteractive, onVisibilityChange]);
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_c = item.link) === null || _c === void 0 ? void 0 : _c.url, target: (_d = item.link) === null || _d === void 0 ? void 0 : _d.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `compound-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_e = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _e !== void 0 ? _e : 'none' }), children: items && items.map(item => ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
36
|
-
.compound-${item.id} {
|
|
37
|
-
overflow: ${item.commonParams.overflow};
|
|
38
|
-
position: absolute;
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
}
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_c = item.link) === null || _c === void 0 ? void 0 : _c.url, target: (_d = item.link) === null || _d === void 0 ? void 0 : _d.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `compound-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_e = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _e !== void 0 ? _e : 'none' }), children: items && items.map(item => ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
36
|
+
.compound-${item.id} {
|
|
37
|
+
overflow: ${item.commonParams.overflow};
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
}
|
|
43
43
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
|
|
44
|
-
return (`
|
|
45
|
-
.compound-${item.id} {
|
|
46
|
-
opacity: ${layoutParams.opacity};
|
|
47
|
-
transform: rotate(${area.angle}deg);
|
|
48
|
-
}
|
|
44
|
+
return (`
|
|
45
|
+
.compound-${item.id} {
|
|
46
|
+
opacity: ${layoutParams.opacity};
|
|
47
|
+
transform: rotate(${area.angle}deg);
|
|
48
|
+
}
|
|
49
49
|
`);
|
|
50
|
-
})}
|
|
50
|
+
})}
|
|
51
51
|
` })] }) }));
|
|
52
52
|
};
|
|
53
53
|
exports.CompoundItem = CompoundItem;
|
|
@@ -25,15 +25,15 @@ const CustomItem = ({ item, onResize, sectionId, interactionCtrl }) => {
|
|
|
25
25
|
if (!component)
|
|
26
26
|
return null;
|
|
27
27
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `custom-component-${item.id}`, ref: setRef, style: Object.assign(Object.assign({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _c !== void 0 ? _c : 'none' }), children: component({}) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: item.id, children: `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area]) => {
|
|
28
|
-
return (`
|
|
29
|
-
.custom-component-${item.id} {
|
|
30
|
-
transform: rotate(${area.angle}deg);
|
|
31
|
-
height: 100%;
|
|
32
|
-
width: 100%;
|
|
33
|
-
position: absolute;
|
|
34
|
-
left: 0;
|
|
35
|
-
top: 0;
|
|
36
|
-
}
|
|
28
|
+
return (`
|
|
29
|
+
.custom-component-${item.id} {
|
|
30
|
+
transform: rotate(${area.angle}deg);
|
|
31
|
+
height: 100%;
|
|
32
|
+
width: 100%;
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: 0;
|
|
35
|
+
top: 0;
|
|
36
|
+
}
|
|
37
37
|
`);
|
|
38
38
|
})}` })] }));
|
|
39
39
|
};
|