@cntrl-site/sdk-nextjs 0.29.7 → 0.30.1
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/cntrl-site-sdk-nextjs-0.30.0.tgz +0 -0
- package/cntrl-site-sdk-nextjs-0.30.1.tgz +0 -0
- package/lib/common/useKeyframeValue.js +2 -2
- package/lib/components/ArticleWrapper.js +1 -25
- package/lib/components/Item.js +27 -25
- package/lib/components/Section.js +6 -6
- package/lib/components/items/CodeEmbedItem.js +67 -0
- package/lib/components/items/CustomItem.js +8 -2
- package/lib/components/items/GroupItem.js +6 -3
- package/lib/components/items/ImageItem.js +18 -12
- package/lib/components/items/RectangleItem.js +15 -12
- package/lib/components/items/RichTextItem.js +22 -22
- package/lib/components/items/VideoItem.js +17 -26
- package/lib/components/items/VimeoEmbed.js +7 -2
- package/lib/components/items/YoutubeEmbed.js +9 -4
- package/lib/components/items/useCodeEmbedItem.js +24 -0
- package/lib/components/items/useEmbedVideoItem.js +4 -3
- package/lib/components/items/useFileItem.js +11 -10
- package/lib/components/items/useGroupItem.js +4 -3
- package/lib/components/items/useRectangleItem.js +7 -6
- package/lib/components/items/useRichTextItemValues.js +6 -6
- package/lib/components/items/useStickyItemTop.js +5 -3
- package/lib/components/useItemAngle.js +2 -1
- package/lib/components/useItemDimensions.js +3 -10
- package/lib/components/useItemPosition.js +8 -8
- package/lib/components/useItemScale.js +2 -3
- package/lib/utils/ScaleAnchorMap.js +9 -9
- package/lib/utils/effects/useImageFx.js +2 -2
- package/package.json +2 -2
- package/src/common/useKeyframeValue.ts +3 -2
- package/src/components/ArticleWrapper.tsx +0 -21
- package/src/components/Item.tsx +44 -31
- package/src/components/Section.tsx +5 -6
- package/src/components/items/CodeEmbedItem.tsx +73 -0
- package/src/components/items/CustomItem.tsx +15 -3
- package/src/components/items/GroupItem.tsx +6 -3
- package/src/components/items/ImageItem.tsx +19 -13
- package/src/components/items/RectangleItem.tsx +17 -13
- package/src/components/items/RichTextItem.tsx +22 -23
- package/src/components/items/VideoItem.tsx +33 -45
- package/src/components/items/VimeoEmbed.tsx +7 -2
- package/src/components/items/YoutubeEmbed.tsx +11 -4
- package/src/components/items/useCodeEmbedItem.ts +36 -0
- package/src/components/items/useEmbedVideoItem.ts +4 -1
- package/src/components/items/useFileItem.ts +11 -7
- package/src/components/items/useGroupItem.ts +4 -3
- package/src/components/items/useRectangleItem.ts +7 -1
- package/src/components/items/useRichTextItemValues.ts +6 -9
- package/src/components/items/useStickyItemTop.ts +7 -5
- package/src/components/useItemAngle.ts +5 -4
- package/src/components/useItemDimensions.ts +6 -14
- package/src/components/useItemPosition.ts +10 -9
- package/src/components/useItemScale.ts +6 -6
- package/src/utils/ScaleAnchorMap.ts +1 -1
- package/src/utils/effects/useImageFx.ts +2 -2
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -15
- package/cntrl-site-sdk-nextjs-0.29.6.tgz +0 -0
- package/cntrl-site-sdk-nextjs-0.29.8.tgz +0 -0
- package/lib/components/useSectionColor.js +0 -19
|
Binary file
|
|
Binary file
|
|
@@ -11,7 +11,7 @@ const KeyframesContext_1 = require("../provider/KeyframesContext");
|
|
|
11
11
|
const Animator_1 = require("../utils/Animator/Animator");
|
|
12
12
|
const useLayoutContext_1 = require("../components/useLayoutContext");
|
|
13
13
|
const emptyDeps = [];
|
|
14
|
-
const useKeyframeValue = (item, itemParamsGetter, animatorGetter, sectionId, deps = emptyDeps) => {
|
|
14
|
+
const useKeyframeValue = (item, type, itemParamsGetter, animatorGetter, sectionId, deps = emptyDeps) => {
|
|
15
15
|
const animatorGetterRef = (0, react_1.useRef)(animatorGetter);
|
|
16
16
|
const itemParamsGetterRef = (0, react_1.useRef)(itemParamsGetter);
|
|
17
17
|
animatorGetterRef.current = animatorGetter;
|
|
@@ -19,7 +19,7 @@ const useKeyframeValue = (item, itemParamsGetter, animatorGetter, sectionId, dep
|
|
|
19
19
|
const articleRectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
|
|
20
20
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
21
21
|
const keyframesRepo = (0, react_1.useContext)(KeyframesContext_1.KeyframesContext);
|
|
22
|
-
const keyframes = (0, react_1.useMemo)(() => keyframesRepo.getItemKeyframes(item.id), [item.id, keyframesRepo]);
|
|
22
|
+
const keyframes = (0, react_1.useMemo)(() => keyframesRepo.getItemKeyframes(item.id).filter(kf => kf.type === type), [item.id, keyframesRepo, type]);
|
|
23
23
|
const paramValue = (0, react_1.useMemo)(() => {
|
|
24
24
|
return itemParamsGetterRef.current(item, layoutId);
|
|
25
25
|
}, [item, layoutId, ...deps]);
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ArticleWrapper = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
10
5
|
const useCurrentLayout_1 = require("../common/useCurrentLayout");
|
|
11
6
|
const LayoutContext_1 = require("../provider/LayoutContext");
|
|
12
7
|
const ArticleWrapper = ({ children }) => {
|
|
13
|
-
const id = (0, react_1.useId)();
|
|
14
|
-
const [isPageLoaded, setIsPageLoaded] = (0, react_1.useState)(false);
|
|
15
8
|
const { layoutId, layoutDeviation } = (0, useCurrentLayout_1.useCurrentLayout)();
|
|
16
|
-
(0, react_1.useEffect)(() => {
|
|
17
|
-
const onPageLoad = () => {
|
|
18
|
-
setIsPageLoaded(true);
|
|
19
|
-
};
|
|
20
|
-
if (document.readyState === 'loading') {
|
|
21
|
-
window.addEventListener('DOMContentLoaded', onPageLoad);
|
|
22
|
-
return () => window.removeEventListener('DOMContentLoaded', onPageLoad);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
onPageLoad();
|
|
26
|
-
}
|
|
27
|
-
}, []);
|
|
28
9
|
const layoutDeviationStyle = { '--layout-deviation': layoutDeviation };
|
|
29
|
-
return ((0, jsx_runtime_1.
|
|
30
|
-
.article-wrapper {
|
|
31
|
-
opacity: 1;
|
|
32
|
-
transition: opacity 0.2s ease;
|
|
33
|
-
}
|
|
34
|
-
` })] }));
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(LayoutContext_1.LayoutContext.Provider, { value: layoutId, children: (0, jsx_runtime_1.jsx)("div", { className: "article-wrapper", style: Object.assign({}, layoutDeviationStyle), children: children }) }));
|
|
35
11
|
};
|
|
36
12
|
exports.ArticleWrapper = ArticleWrapper;
|
package/lib/components/Item.js
CHANGED
|
@@ -29,6 +29,8 @@ const useLayoutContext_1 = require("./useLayoutContext");
|
|
|
29
29
|
const ArticleRectContext_1 = require("../provider/ArticleRectContext");
|
|
30
30
|
const useExemplary_1 = require("../common/useExemplary");
|
|
31
31
|
const GroupItem_1 = require("./items/GroupItem");
|
|
32
|
+
const CodeEmbedItem_1 = require("./items/CodeEmbedItem");
|
|
33
|
+
const KeyframesContext_1 = require("../provider/KeyframesContext");
|
|
32
34
|
const itemsMap = {
|
|
33
35
|
[sdk_1.ArticleItemType.Rectangle]: RectangleItem_1.RectangleItem,
|
|
34
36
|
[sdk_1.ArticleItemType.Image]: ImageItem_1.ImageItem,
|
|
@@ -37,7 +39,8 @@ const itemsMap = {
|
|
|
37
39
|
[sdk_1.ArticleItemType.YoutubeEmbed]: YoutubeEmbed_1.YoutubeEmbedItem,
|
|
38
40
|
[sdk_1.ArticleItemType.VimeoEmbed]: VimeoEmbed_1.VimeoEmbedItem,
|
|
39
41
|
[sdk_1.ArticleItemType.Custom]: CustomItem_1.CustomItem,
|
|
40
|
-
[sdk_1.ArticleItemType.Group]: GroupItem_1.GroupItem
|
|
42
|
+
[sdk_1.ArticleItemType.Group]: GroupItem_1.GroupItem,
|
|
43
|
+
[sdk_1.ArticleItemType.CodeEmbed]: CodeEmbedItem_1.CodeEmbedItem
|
|
41
44
|
};
|
|
42
45
|
const stickyFix = `
|
|
43
46
|
-webkit-transform: translate3d(0, 0, 0);
|
|
@@ -52,17 +55,19 @@ const noop = () => null;
|
|
|
52
55
|
const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
53
56
|
const itemWrapperRef = (0, react_1.useRef)(null);
|
|
54
57
|
const rectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
|
|
58
|
+
const keyframesRepo = (0, react_1.useContext)(KeyframesContext_1.KeyframesContext);
|
|
55
59
|
const id = (0, react_1.useId)();
|
|
60
|
+
const keyframes = (0, react_1.useMemo)(() => keyframesRepo.getItemKeyframes(item.id), [keyframesRepo, item.id]);
|
|
56
61
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
57
62
|
const layout = (0, useLayoutContext_1.useLayoutContext)();
|
|
58
63
|
const exemplary = (0, useExemplary_1.useExemplary)();
|
|
59
64
|
const [wrapperHeight, setWrapperHeight] = (0, react_1.useState)(undefined);
|
|
60
65
|
const [itemHeight, setItemHeight] = (0, react_1.useState)(undefined);
|
|
61
|
-
const
|
|
62
|
-
const
|
|
66
|
+
const scale = (0, useItemScale_1.useItemScale)(item, sectionId);
|
|
67
|
+
const position = (0, useItemPosition_1.useItemPosition)(item, sectionId);
|
|
63
68
|
const sectionHeight = (0, useSectionHeightMap_1.useSectionHeightData)(sectionId);
|
|
64
69
|
const stickyTop = (0, useStickyItemTop_1.useStickyItemTop)(item, sectionHeight, sectionId);
|
|
65
|
-
const
|
|
70
|
+
const dimensions = (0, useItemDimensions_1.useItemDimensions)(item, sectionId);
|
|
66
71
|
const layoutValues = [item.area, item.hidden, item.state.hover];
|
|
67
72
|
const isInitialRef = (0, react_1.useRef)(true);
|
|
68
73
|
layoutValues.push(item.sticky);
|
|
@@ -80,7 +85,7 @@ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
|
80
85
|
if (!layout)
|
|
81
86
|
return;
|
|
82
87
|
const sticky = item.sticky[layout];
|
|
83
|
-
if (!sticky) {
|
|
88
|
+
if (!sticky || stickyTop === undefined) {
|
|
84
89
|
setWrapperHeight(undefined);
|
|
85
90
|
return;
|
|
86
91
|
}
|
|
@@ -97,40 +102,37 @@ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
|
97
102
|
isInitialRef.current = false;
|
|
98
103
|
}, []);
|
|
99
104
|
const isRichText = isItemType(item, sdk_1.ArticleItemType.RichText);
|
|
100
|
-
|
|
101
|
-
return null;
|
|
102
|
-
const styles = {
|
|
103
|
-
top: `${stickyTop * 100}vw`,
|
|
104
|
-
height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset'
|
|
105
|
-
};
|
|
106
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `item-wrapper-${item.id}`, ref: itemWrapperRef, style: isInitialRef.current ? {} : Object.assign({ top, left, bottom }, (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: isInitialRef.current ? {} : styles, children: (0, jsx_runtime_1.jsx)(RichTextWrapper, { isRichText: isRichText, children: (0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: {
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `item-wrapper-${item.id}`, ref: itemWrapperRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (position ? { top: position.top } : {})), (position ? { left: position.left } : {})), (position ? { bottom: position.bottom } : {})), (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: Object.assign({ opacity: (keyframes.length !== 0 && !layout) ? 0 : 1, top: `${stickyTop * 100}vw`, height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset' }, (scale !== undefined ? { transform: `scale(${scale}) translateZ(0)`, '-webkit-transform': `scale(${scale}) translateZ(0)` } : {})), children: (0, jsx_runtime_1.jsx)(RichTextWrapper, { isRichText: isRichText, children: (0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: Object.assign({}, (dimensions ? {
|
|
107
106
|
width: `${sizingAxis.x === 'manual'
|
|
108
107
|
? isRichText
|
|
109
|
-
? `${width * exemplary}px`
|
|
110
|
-
: `${width * 100}vw`
|
|
108
|
+
? `${dimensions.width * exemplary}px`
|
|
109
|
+
: `${dimensions.width * 100}vw`
|
|
111
110
|
: 'max-content'}`,
|
|
112
|
-
height: `${sizingAxis.y === 'manual' ? `${height * 100}vw` : 'unset'}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}, children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight }) }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
116
|
-
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, hoverParams, sticky, sectionHeight, layoutParams]) => {
|
|
111
|
+
height: `${sizingAxis.y === 'manual' ? `${dimensions.height * 100}vw` : 'unset'}`
|
|
112
|
+
} : {})), children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight }) }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
113
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, hoverParams, sticky, sectionHeight, layoutParams], exemplary) => {
|
|
117
114
|
const sizingAxis = parseSizing(layoutParams.sizing);
|
|
118
115
|
const isScreenBasedBottom = area.positionType === sdk_1.PositionType.ScreenBased && area.anchorSide === sdk_1.AnchorSide.Bottom;
|
|
116
|
+
const scaleAnchor = area.scaleAnchor;
|
|
119
117
|
return (`
|
|
120
118
|
.item-${item.id} {
|
|
121
119
|
position: ${sticky ? 'sticky' : 'absolute'};
|
|
122
120
|
top: ${sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(area.top - sticky.from, sectionHeight, area.anchorSide)}` : 0};
|
|
123
121
|
pointer-events: auto;
|
|
122
|
+
transition: opacity 0.1s linear;
|
|
124
123
|
display: ${hidden ? 'none' : 'block'};
|
|
125
124
|
height: fit-content;
|
|
125
|
+
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
126
|
+
transform: scale(${area.scale});
|
|
126
127
|
}
|
|
127
128
|
.item-${item.id}-inner {
|
|
128
129
|
transition: ${(0, HoverStyles_1.getTransitions)(['width', 'height', 'scale'], hoverParams)};
|
|
129
|
-
width: ${sizingAxis.x === 'manual'
|
|
130
|
+
width: ${sizingAxis.x === 'manual'
|
|
131
|
+
? isRichText
|
|
132
|
+
? `${area.width * exemplary}px`
|
|
133
|
+
: `${area.width * 100}vw`
|
|
134
|
+
: 'max-content'};
|
|
130
135
|
height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
|
|
131
|
-
transform: scale(${scale});
|
|
132
|
-
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
133
|
-
--webkit-backface-visibility: hidden;
|
|
134
136
|
}
|
|
135
137
|
.item-wrapper-${item.id} {
|
|
136
138
|
position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
|
|
@@ -143,10 +145,10 @@ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
|
143
145
|
transition: ${(0, HoverStyles_1.getTransitions)(['left', 'top'], hoverParams)};
|
|
144
146
|
}
|
|
145
147
|
.item-${item.id}-inner:hover {
|
|
146
|
-
${(0, HoverStyles_1.getHoverStyles)(['width', 'height', 'scale'], hoverParams)}
|
|
148
|
+
${(0, HoverStyles_1.getHoverStyles)(['width', 'height', 'scale'], hoverParams)};
|
|
147
149
|
}
|
|
148
150
|
.item-wrapper-${item.id}:hover {
|
|
149
|
-
${(0, HoverStyles_1.getHoverStyles)(['left', 'top'], hoverParams, area.anchorSide)}
|
|
151
|
+
${(0, HoverStyles_1.getHoverStyles)(['left', 'top'], hoverParams, area.anchorSide)};
|
|
150
152
|
}
|
|
151
153
|
`);
|
|
152
154
|
})}
|
|
@@ -9,13 +9,14 @@ const react_1 = require("react");
|
|
|
9
9
|
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
10
10
|
const sdk_1 = require("@cntrl-site/sdk");
|
|
11
11
|
const useCntrlContext_1 = require("../provider/useCntrlContext");
|
|
12
|
-
const useSectionColor_1 = require("./useSectionColor");
|
|
13
12
|
const useSectionRegistry_1 = require("../utils/ArticleRectManager/useSectionRegistry");
|
|
13
|
+
const color_1 = require("@cntrl-site/color");
|
|
14
|
+
const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
|
|
14
15
|
const Section = ({ section, data, children }) => {
|
|
15
16
|
const id = (0, react_1.useId)();
|
|
16
17
|
const sectionRef = (0, react_1.useRef)(null);
|
|
17
18
|
const { layouts, customSections } = (0, useCntrlContext_1.useCntrlContext)();
|
|
18
|
-
const
|
|
19
|
+
const layoutValues = [section.height, section.color];
|
|
19
20
|
const SectionComponent = section.name ? customSections.getComponent(section.name) : undefined;
|
|
20
21
|
(0, useSectionRegistry_1.useSectionRegistry)(section.id, sectionRef.current);
|
|
21
22
|
const getSectionVisibilityStyles = () => {
|
|
@@ -34,13 +35,12 @@ const Section = ({ section, data, children }) => {
|
|
|
34
35
|
};
|
|
35
36
|
if (SectionComponent)
|
|
36
37
|
return (0, jsx_runtime_1.jsx)("div", { ref: sectionRef, children: (0, jsx_runtime_1.jsx)(SectionComponent, { data: data, children: children }) });
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `section-${section.id}`, id: section.name,
|
|
38
|
-
|
|
39
|
-
}, ref: sectionRef, children: children }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
40
|
-
${(0, sdk_1.getLayoutStyles)(layouts, [section.height], ([height]) => (`
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `section-${section.id}`, id: section.name, ref: sectionRef, children: children }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
39
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([height, color]) => (`
|
|
41
40
|
.section-${section.id} {
|
|
42
41
|
height: ${getSectionHeight(height)};
|
|
43
42
|
position: relative;
|
|
43
|
+
background-color: ${color_1.CntrlColor.parse(color !== null && color !== void 0 ? color : DEFAULT_COLOR).fmt('rgba')};
|
|
44
44
|
}`))}
|
|
45
45
|
${getSectionVisibilityStyles()}
|
|
46
46
|
` })] }));
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CodeEmbedItem = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const sdk_1 = require("@cntrl-site/sdk");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const useCntrlContext_1 = require("../../provider/useCntrlContext");
|
|
11
|
+
const HoverStyles_1 = require("../../utils/HoverStyles/HoverStyles");
|
|
12
|
+
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
13
|
+
const useRegisterResize_1 = require("../../common/useRegisterResize");
|
|
14
|
+
const useItemAngle_1 = require("../useItemAngle");
|
|
15
|
+
const LinkWrapper_1 = require("../LinkWrapper");
|
|
16
|
+
const useCodeEmbedItem_1 = require("./useCodeEmbedItem");
|
|
17
|
+
const stylesMap = {
|
|
18
|
+
[sdk_1.AreaAnchor.TopLeft]: {},
|
|
19
|
+
[sdk_1.AreaAnchor.TopCenter]: { justifyContent: 'center' },
|
|
20
|
+
[sdk_1.AreaAnchor.TopRight]: { justifyContent: 'flex-end' },
|
|
21
|
+
[sdk_1.AreaAnchor.MiddleLeft]: { alignItems: 'center' },
|
|
22
|
+
[sdk_1.AreaAnchor.MiddleCenter]: { justifyContent: 'center', alignItems: 'center' },
|
|
23
|
+
[sdk_1.AreaAnchor.MiddleRight]: { justifyContent: 'flex-end', alignItems: 'center' },
|
|
24
|
+
[sdk_1.AreaAnchor.BottomLeft]: { alignItems: 'flex-end' },
|
|
25
|
+
[sdk_1.AreaAnchor.BottomCenter]: { justifyContent: 'center', alignItems: 'flex-end' },
|
|
26
|
+
[sdk_1.AreaAnchor.BottomRight]: { justifyContent: 'flex-end', alignItems: 'flex-end' }
|
|
27
|
+
};
|
|
28
|
+
const CodeEmbedItem = ({ item, sectionId, onResize }) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const id = (0, react_1.useId)();
|
|
31
|
+
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
32
|
+
const { anchor, blur, opacity } = (0, useCodeEmbedItem_1.useCodeEmbedItem)(item, sectionId);
|
|
33
|
+
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
34
|
+
const { html } = item.commonParams;
|
|
35
|
+
const [ref, setRef] = (0, react_1.useState)(null);
|
|
36
|
+
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
37
|
+
const pos = stylesMap[anchor];
|
|
38
|
+
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: [(0, jsx_runtime_1.jsx)("div", { className: `embed-wrapper-${item.id}`, style: Object.assign({ opacity: `${opacity}`, transform: `rotate(${angle}deg)`, filter: `blur(${blur * 100}vw)` }, pos), ref: setRef, children: (0, jsx_runtime_1.jsx)("div", { className: "embed", dangerouslySetInnerHTML: { __html: html } }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
40
|
+
.embed -wrapper-${item.id} {
|
|
41
|
+
position: absolute;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
}
|
|
45
|
+
.embed {
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
z-index: 1;
|
|
49
|
+
border: none;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams]) => {
|
|
53
|
+
return (`
|
|
54
|
+
.embed-wrapper-${item.id} {
|
|
55
|
+
opacity: ${layoutParams.opacity};
|
|
56
|
+
transform: rotate(${area.angle}deg);
|
|
57
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
58
|
+
transition: ${(0, HoverStyles_1.getTransitions)(['angle', 'blur', 'opacity'], hoverParams)};
|
|
59
|
+
}
|
|
60
|
+
.embed-wrapper-${item.id}:hover {
|
|
61
|
+
${(0, HoverStyles_1.getHoverStyles)(['angle', 'blur', 'opacity'], hoverParams)}
|
|
62
|
+
}
|
|
63
|
+
`);
|
|
64
|
+
})}
|
|
65
|
+
` })] }));
|
|
66
|
+
};
|
|
67
|
+
exports.CodeEmbedItem = CodeEmbedItem;
|
|
@@ -11,17 +11,23 @@ const useCntrlContext_1 = require("../../provider/useCntrlContext");
|
|
|
11
11
|
const HoverStyles_1 = require("../../utils/HoverStyles/HoverStyles");
|
|
12
12
|
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
13
13
|
const useRegisterResize_1 = require("../../common/useRegisterResize");
|
|
14
|
-
const
|
|
14
|
+
const useItemAngle_1 = require("../useItemAngle");
|
|
15
|
+
const CustomItem = ({ item, onResize, sectionId }) => {
|
|
15
16
|
const sdk = (0, useCntrlContext_1.useCntrlContext)();
|
|
16
17
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
18
|
+
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
17
19
|
const component = sdk.customItems.get(item.commonParams.name);
|
|
20
|
+
const layoutValues = [item.area, item.state.hover];
|
|
18
21
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
19
22
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
20
23
|
if (!component)
|
|
21
24
|
return null;
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `custom-component-${item.id}`, ref: setRef,
|
|
25
|
+
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: {
|
|
26
|
+
transform: `rotate(${angle}deg)`,
|
|
27
|
+
}, children: component({}) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: item.id, children: `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hoverParams]) => {
|
|
23
28
|
return (`
|
|
24
29
|
.custom-component-${item.id} {
|
|
30
|
+
transform: rotate(${area.angle}deg);
|
|
25
31
|
transition: ${(0, HoverStyles_1.getTransitions)(['angle'], hoverParams)};
|
|
26
32
|
height: 100%;
|
|
27
33
|
width: 100%;
|
|
@@ -22,6 +22,7 @@ const GroupItem = ({ item, sectionId, onResize, articleHeight }) => {
|
|
|
22
22
|
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
23
23
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
24
24
|
const { opacity } = (0, useGroupItem_1.useGroupItem)(item, sectionId);
|
|
25
|
+
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
25
26
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
26
27
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
27
28
|
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `group-${item.id}`, ref: setRef, style: {
|
|
@@ -34,13 +35,15 @@ const GroupItem = ({ item, sectionId, onResize, articleHeight }) => {
|
|
|
34
35
|
height: 100%;
|
|
35
36
|
box-sizing: border-box;
|
|
36
37
|
}
|
|
37
|
-
${(0, sdk_1.getLayoutStyles)(layouts,
|
|
38
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams]) => {
|
|
38
39
|
return (`
|
|
39
40
|
.group-${item.id} {
|
|
40
|
-
|
|
41
|
+
opacity: ${layoutParams.opacity};
|
|
42
|
+
transform: rotate(${area.angle}deg);
|
|
43
|
+
transition: ${(0, HoverStyles_1.getTransitions)(['opacity', 'angle'], hoverParams)};
|
|
41
44
|
}
|
|
42
45
|
.group-${item.id}:hover {
|
|
43
|
-
${(0, HoverStyles_1.getHoverStyles)(['opacity'], hoverParams)}
|
|
46
|
+
${(0, HoverStyles_1.getHoverStyles)(['opacity', 'angle'], hoverParams)};
|
|
44
47
|
}
|
|
45
48
|
`);
|
|
46
49
|
})}
|
|
@@ -38,6 +38,7 @@ const ImageItem = ({ item, sectionId, onResize }) => {
|
|
|
38
38
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
39
39
|
const { url, hasGLEffect, fragmentShader } = item.commonParams;
|
|
40
40
|
const fxCanvas = (0, react_1.useRef)(null);
|
|
41
|
+
const isInitialRef = (0, react_1.useRef)(true);
|
|
41
42
|
const controls = (_a = item.commonParams.FXControls) !== null && _a !== void 0 ? _a : [];
|
|
42
43
|
const controlsVariables = controls.map((c) => `uniform ${c.type} ${c.shaderParam};`)
|
|
43
44
|
.join('\n');
|
|
@@ -45,12 +46,16 @@ const ImageItem = ({ item, sectionId, onResize }) => {
|
|
|
45
46
|
acc[control.shaderParam] = control.value;
|
|
46
47
|
return acc;
|
|
47
48
|
}, {});
|
|
49
|
+
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
48
50
|
const fullShaderCode = `${baseVariables}\n${controlsVariables}\n${fragmentShader}`;
|
|
49
51
|
const area = layoutId ? item.area[layoutId] : null;
|
|
50
52
|
const exemplary = (_b = layouts === null || layouts === void 0 ? void 0 : layouts.find(l => l.id === layoutId)) === null || _b === void 0 ? void 0 : _b.exemplary;
|
|
51
53
|
const width = area && exemplary ? area.width * exemplary : 0;
|
|
52
54
|
const height = area && exemplary ? area.height * exemplary : 0;
|
|
53
|
-
(0,
|
|
55
|
+
(0, react_1.useEffect)(() => {
|
|
56
|
+
isInitialRef.current = false;
|
|
57
|
+
}, []);
|
|
58
|
+
(0, useImageFx_1.useImageFx)(fxCanvas.current, !!(hasGLEffect && !isInitialRef.current), {
|
|
54
59
|
imageUrl: url,
|
|
55
60
|
fragmentShader: fullShaderCode,
|
|
56
61
|
cursor: item.commonParams.FXCursor,
|
|
@@ -62,18 +67,13 @@ const ImageItem = ({ item, sectionId, onResize }) => {
|
|
|
62
67
|
const inlineStyles = {
|
|
63
68
|
borderRadius: `${radius * 100}vw`,
|
|
64
69
|
borderWidth: `${strokeWidth * 100}vw`,
|
|
65
|
-
borderColor: `${borderColor.
|
|
70
|
+
borderColor: `${borderColor.fmt('rgba')}`
|
|
66
71
|
};
|
|
67
72
|
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_e = item.link) === null || _e === void 0 ? void 0 : _e.url, target: (_f = item.link) === null || _f === void 0 ? void 0 : _f.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `image-wrapper-${item.id}`, ref: setRef, style: {
|
|
68
73
|
opacity: `${opacity}`,
|
|
69
74
|
transform: `rotate(${angle}deg)`,
|
|
70
75
|
filter: `blur(${blur * 100}vw)`
|
|
71
|
-
}, children: item.commonParams.hasGLEffect ? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className:
|
|
72
|
-
@supports not (color: oklch(42% 0.3 90 / 1)) {
|
|
73
|
-
.image-${item.id} {
|
|
74
|
-
border-color: ${borderColor.fmt('rgba')};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
76
|
+
}, children: item.commonParams.hasGLEffect ? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `img-canvas image-${item.id}`, width: rectWidth, height: rectHeight })) : ((0, jsx_runtime_1.jsx)("img", { alt: "", className: `image image-${item.id}`, style: inlineStyles, src: item.commonParams.url })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
77
77
|
.image-wrapper-${item.id} {
|
|
78
78
|
position: absolute;
|
|
79
79
|
width: 100%;
|
|
@@ -99,19 +99,25 @@ const ImageItem = ({ item, sectionId, onResize }) => {
|
|
|
99
99
|
border-width: 0;
|
|
100
100
|
box-sizing: border-box;
|
|
101
101
|
}
|
|
102
|
-
${(0, sdk_1.getLayoutStyles)(layouts,
|
|
102
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams]) => {
|
|
103
103
|
return (`
|
|
104
104
|
.image-wrapper-${item.id} {
|
|
105
|
+
opacity: ${layoutParams.opacity};
|
|
106
|
+
transform: rotate(${area.angle}deg);
|
|
107
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
105
108
|
transition: ${(0, HoverStyles_1.getTransitions)(['angle', 'opacity', 'blur'], hoverParams)};
|
|
106
109
|
}
|
|
107
110
|
.image-wrapper-${item.id}:hover {
|
|
108
|
-
${(0, HoverStyles_1.getHoverStyles)(['angle', 'opacity', 'blur'], hoverParams)}
|
|
111
|
+
${(0, HoverStyles_1.getHoverStyles)(['angle', 'opacity', 'blur'], hoverParams)};
|
|
109
112
|
}
|
|
110
113
|
.image-${item.id} {
|
|
114
|
+
border-color: ${color_1.CntrlColor.parse(layoutParams.strokeColor).fmt('rgba')};
|
|
115
|
+
border-radius: ${layoutParams.radius * 100}vw;
|
|
116
|
+
border-width: ${layoutParams.strokeWidth * 100}vw;
|
|
111
117
|
transition: ${(0, HoverStyles_1.getTransitions)(['strokeWidth', 'radius', 'strokeColor'], hoverParams)};
|
|
112
118
|
}
|
|
113
|
-
.image-wrapper-${item.id}:hover .image {
|
|
114
|
-
${(0, HoverStyles_1.getHoverStyles)(['strokeWidth', 'radius', 'strokeColor'], hoverParams)}
|
|
119
|
+
.image-wrapper-${item.id}:hover .image, .image-wrapper-${item.id}:hover .img-canvas {
|
|
120
|
+
${(0, HoverStyles_1.getHoverStyles)(['strokeWidth', 'radius', 'strokeColor'], hoverParams)};
|
|
115
121
|
}
|
|
116
122
|
`);
|
|
117
123
|
})}
|
|
@@ -23,25 +23,20 @@ const RectangleItem = ({ item, sectionId, onResize }) => {
|
|
|
23
23
|
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
24
24
|
const backgroundColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(fillColor), [fillColor]);
|
|
25
25
|
const borderColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(strokeColor), [strokeColor]);
|
|
26
|
+
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
26
27
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
27
28
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
28
|
-
const backdropFilterValue = backdropBlur
|
|
29
|
+
const backdropFilterValue = backdropBlur ? `blur(${backdropBlur * 100}vw)` : undefined;
|
|
29
30
|
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `rectangle-${item.id}`, ref: setRef, style: {
|
|
30
|
-
backgroundColor: `${backgroundColor.
|
|
31
|
+
backgroundColor: `${backgroundColor.fmt('rgba')}`,
|
|
31
32
|
borderRadius: `${radius * 100}vw`,
|
|
32
33
|
borderWidth: `${strokeWidth * 100}vw`,
|
|
33
34
|
borderColor: `${borderColor.toCss()}`,
|
|
34
35
|
transform: `rotate(${angle}deg)`,
|
|
35
|
-
filter:
|
|
36
|
+
filter: `blur(${blur * 100}vw)`,
|
|
36
37
|
backdropFilter: backdropFilterValue,
|
|
37
|
-
WebkitBackdropFilter: backdropFilterValue
|
|
38
|
+
WebkitBackdropFilter: backdropFilterValue
|
|
38
39
|
} }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
39
|
-
@supports not (color: oklch(42% 0.3 90 / 1)) {
|
|
40
|
-
.rectangle-${item.id} {
|
|
41
|
-
background-color: ${backgroundColor.fmt('rgba')};
|
|
42
|
-
border-color: ${borderColor.fmt('rgba')};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
40
|
.rectangle-${item.id} {
|
|
46
41
|
position: absolute;
|
|
47
42
|
width: 100%;
|
|
@@ -49,13 +44,21 @@ const RectangleItem = ({ item, sectionId, onResize }) => {
|
|
|
49
44
|
border-style: solid;
|
|
50
45
|
box-sizing: border-box;
|
|
51
46
|
}
|
|
52
|
-
${(0, sdk_1.getLayoutStyles)(layouts,
|
|
47
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams]) => {
|
|
53
48
|
return (`
|
|
54
49
|
.rectangle-${item.id} {
|
|
50
|
+
background-color: ${color_1.CntrlColor.parse(layoutParams.fillColor).fmt('rgba')};
|
|
51
|
+
border-color: ${color_1.CntrlColor.parse(layoutParams.strokeColor).fmt('rgba')};
|
|
52
|
+
border-radius: ${layoutParams.radius * 100}vw;
|
|
53
|
+
border-width: ${layoutParams.strokeWidth * 100}vw;
|
|
54
|
+
transform: rotate(${area.angle}deg);
|
|
55
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
56
|
+
backdrop-filter: ${layoutParams.backdropFilter !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
57
|
+
-webkit-backdrop-filter: ${layoutParams.backdropFilter !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
55
58
|
transition: ${(0, HoverStyles_1.getTransitions)(['angle', 'fillColor', 'strokeWidth', 'radius', 'strokeColor', 'blur', 'backdropBlur'], hoverParams)};
|
|
56
59
|
}
|
|
57
60
|
.rectangle-${item.id}:hover {
|
|
58
|
-
${(0, HoverStyles_1.getHoverStyles)(['angle', 'fillColor', 'strokeWidth', 'radius', 'strokeColor', 'blur', 'backdropBlur'], hoverParams)}
|
|
61
|
+
${(0, HoverStyles_1.getHoverStyles)(['angle', 'fillColor', 'strokeWidth', 'radius', 'strokeColor', 'blur', 'backdropBlur'], hoverParams)};
|
|
59
62
|
}
|
|
60
63
|
`);
|
|
61
64
|
})}
|
|
@@ -16,13 +16,16 @@ const useRichTextItemValues_1 = require("./useRichTextItemValues");
|
|
|
16
16
|
const useRegisterResize_1 = require("../../common/useRegisterResize");
|
|
17
17
|
const getFontFamilyValue_1 = require("../../utils/getFontFamilyValue");
|
|
18
18
|
const useExemplary_1 = require("../../common/useExemplary");
|
|
19
|
+
const useItemAngle_1 = require("../useItemAngle");
|
|
19
20
|
const RichTextItem = ({ item, sectionId, onResize }) => {
|
|
20
21
|
const [content, styles] = (0, useRichTextItem_1.useRichTextItem)(item);
|
|
21
22
|
const id = (0, react_1.useId)();
|
|
22
23
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
23
24
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
24
|
-
const
|
|
25
|
+
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
26
|
+
const { blur, wordSpacing, letterSpacing, color } = (0, useRichTextItemValues_1.useRichTextItemValues)(item, sectionId);
|
|
25
27
|
const textColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(color), [color]);
|
|
28
|
+
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
26
29
|
const exemplary = (0, useExemplary_1.useExemplary)();
|
|
27
30
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
28
31
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { ref: setRef, className: `rich-text-wrapper-${item.id}`, style: {
|
|
@@ -30,38 +33,35 @@ const RichTextItem = ({ item, sectionId, onResize }) => {
|
|
|
30
33
|
filter: `blur(${blur * exemplary}px)`,
|
|
31
34
|
letterSpacing: `${letterSpacing * exemplary}px`,
|
|
32
35
|
wordSpacing: `${wordSpacing * exemplary}px`,
|
|
33
|
-
color: `${textColor.
|
|
34
|
-
}, children: content }), (0, jsx_runtime_1.jsxs)(style_1.default, { id: id, children: [styles, `${(0, sdk_1.getLayoutStyles)(layouts,
|
|
36
|
+
color: `${textColor.fmt('rgba')}`
|
|
37
|
+
}, children: content }), (0, jsx_runtime_1.jsxs)(style_1.default, { id: id, children: [styles, `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams], exemplary) => {
|
|
38
|
+
const color = color_1.CntrlColor.parse(layoutParams.color);
|
|
35
39
|
return (`
|
|
36
40
|
.rich-text-wrapper-${item.id} {
|
|
41
|
+
font-size: ${Math.round(layoutParams.fontSize * exemplary)}px;
|
|
42
|
+
line-height: ${layoutParams.lineHeight * exemplary}px;
|
|
43
|
+
letter-spacing: ${layoutParams.letterSpacing * exemplary}px;
|
|
44
|
+
word-spacing: ${layoutParams.wordSpacing * exemplary}px;
|
|
45
|
+
font-family: ${(0, getFontFamilyValue_1.getFontFamilyValue)(layoutParams.typeFace)};
|
|
46
|
+
font-weight: ${layoutParams.fontWeight};
|
|
47
|
+
font-style: ${layoutParams.fontStyle ? layoutParams.fontStyle : 'normal'};
|
|
48
|
+
vertical-align: ${layoutParams.verticalAlign};
|
|
49
|
+
font-variant: ${layoutParams.fontVariant};
|
|
50
|
+
color: ${color.fmt('rgba')};
|
|
51
|
+
transform: rotate(${area.angle}deg);
|
|
52
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * exemplary}px)` : 'unset'};
|
|
53
|
+
text-transform: ${layoutParams.textTransform};
|
|
37
54
|
transition: ${(0, HoverStyles_1.getTransitions)(['angle', 'blur', 'letterSpacing', 'wordSpacing', 'color'], hoverParams)};
|
|
38
55
|
}
|
|
39
56
|
.rich-text-wrapper-${item.id}:hover {
|
|
40
|
-
${(0, HoverStyles_1.getHoverStyles)(['angle', 'blur', 'letterSpacing', 'wordSpacing', 'color'], hoverParams)}
|
|
41
|
-
}
|
|
42
|
-
`);
|
|
43
|
-
})}`, `${(0, sdk_1.getLayoutStyles)(layouts, [item.layoutParams], ([layoutParams], exemplary) => {
|
|
44
|
-
const color = color_1.CntrlColor.parse(layoutParams.color);
|
|
45
|
-
return (`
|
|
46
|
-
.rich-text-wrapper-${item.id} {
|
|
47
|
-
font-size: ${Math.round(layoutParams.fontSize * exemplary)}px;
|
|
48
|
-
line-height: ${layoutParams.lineHeight * exemplary}px;
|
|
49
|
-
letter-spacing: ${layoutParams.letterSpacing * exemplary}px;
|
|
50
|
-
word-spacing: ${layoutParams.wordSpacing * exemplary}px;
|
|
51
|
-
font-family: ${(0, getFontFamilyValue_1.getFontFamilyValue)(layoutParams.typeFace)};
|
|
52
|
-
font-weight: ${layoutParams.fontWeight};
|
|
53
|
-
font-style: ${layoutParams.fontStyle ? layoutParams.fontStyle : 'normal'};
|
|
54
|
-
vertical-align: ${layoutParams.verticalAlign};
|
|
55
|
-
font-variant: ${layoutParams.fontVariant};
|
|
56
|
-
color: ${color.toCss()};
|
|
57
|
-
text-transform: ${layoutParams.textTransform};
|
|
57
|
+
${(0, HoverStyles_1.getHoverStyles)(['angle', 'blur', 'letterSpacing', 'wordSpacing', 'color'], hoverParams)};
|
|
58
58
|
}
|
|
59
59
|
@supports not (color: oklch(42% 0.3 90 / 1)) {
|
|
60
60
|
.rich-text-wrapper-${item.id} {
|
|
61
61
|
color: ${color.fmt('rgba')};
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
`);
|
|
65
65
|
})}`] })] }));
|
|
66
66
|
};
|
|
67
67
|
exports.RichTextItem = RichTextItem;
|
|
@@ -23,38 +23,23 @@ const VideoItem = ({ item, sectionId, onResize }) => {
|
|
|
23
23
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
24
24
|
const { radius, strokeWidth, strokeColor, opacity, blur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
25
25
|
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
26
|
-
const borderColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(strokeColor), [strokeColor]);
|
|
26
|
+
const borderColor = (0, react_1.useMemo)(() => strokeColor ? color_1.CntrlColor.parse(strokeColor) : undefined, [strokeColor]);
|
|
27
27
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
28
28
|
const videoRef = (0, react_1.useRef)(null);
|
|
29
29
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
30
|
-
const scrollPlayback = item.layoutParams[layoutId].scrollPlayback;
|
|
30
|
+
const scrollPlayback = layoutId ? item.layoutParams[layoutId].scrollPlayback : null;
|
|
31
|
+
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
31
32
|
const hasScrollPlayback = scrollPlayback !== null;
|
|
32
33
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
const inlineStyles = Object.assign(Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), (borderColor ? { borderColor: `${borderColor.toCss()}` } : {}));
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: [(0, jsx_runtime_1.jsx)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: {
|
|
36
|
+
opacity,
|
|
35
37
|
transform: `rotate(${angle}deg)`,
|
|
36
38
|
filter: `blur(${blur * 100}vw)`,
|
|
37
|
-
|
|
38
|
-
}, children: (0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.commonParams.url, playbackParams: scrollPlayback, style: {
|
|
39
|
-
borderRadius: `${radius * 100}vw`,
|
|
40
|
-
borderWidth: `${strokeWidth * 100}vw`,
|
|
41
|
-
borderColor: `${borderColor.toCss()}`
|
|
42
|
-
}, className: `video video-playback-wrapper video-${item.id}` }) })) : ((0, jsx_runtime_1.jsx)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: {
|
|
43
|
-
opacity: `${opacity}`,
|
|
44
|
-
transform: `rotate(${angle}deg)`,
|
|
45
|
-
filter: `blur(${blur * 100}vw)`
|
|
46
|
-
}, children: (0, jsx_runtime_1.jsx)("video", { ref: videoRef, autoPlay: true, muted: true, loop: true, playsInline: true, className: `video video-${item.id}`, style: {
|
|
47
|
-
borderRadius: `${radius * 100}vw`,
|
|
48
|
-
borderWidth: `${strokeWidth * 100}vw`,
|
|
49
|
-
borderColor: `${borderColor.toCss()}`
|
|
50
|
-
}, children: (0, jsx_runtime_1.jsx)("source", { src: item.commonParams.url }) }) })), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
51
|
-
@supports not (color: oklch(42% 0.3 90 / 1)) {
|
|
52
|
-
.video-${item.id} {
|
|
53
|
-
border-color: ${borderColor.fmt('rgba')};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
39
|
+
}, children: hasScrollPlayback ? ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.commonParams.url, playbackParams: scrollPlayback, style: inlineStyles, className: `video video-playback-wrapper video-${item.id}` })) : ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, autoPlay: true, muted: true, loop: true, playsInline: true, className: `video video-${item.id}`, style: inlineStyles, children: (0, jsx_runtime_1.jsx)("source", { src: item.commonParams.url }) })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
56
40
|
.video-wrapper-${item.id} {
|
|
57
41
|
position: absolute;
|
|
42
|
+
overflow: hidden;
|
|
58
43
|
width: 100%;
|
|
59
44
|
height: 100%;
|
|
60
45
|
box-sizing: border-box;
|
|
@@ -76,19 +61,25 @@ const VideoItem = ({ item, sectionId, onResize }) => {
|
|
|
76
61
|
display: flex;
|
|
77
62
|
justify-content: center;
|
|
78
63
|
}
|
|
79
|
-
${(0, sdk_1.getLayoutStyles)(layouts,
|
|
64
|
+
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams]) => {
|
|
80
65
|
return (`
|
|
81
66
|
.video-wrapper-${item.id} {
|
|
67
|
+
opacity: ${layoutParams.opacity};
|
|
68
|
+
transform: rotate(${area.angle}deg);
|
|
69
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
82
70
|
transition: ${(0, HoverStyles_1.getTransitions)(['angle', 'opacity', 'blur'], hoverParams)};
|
|
83
71
|
}
|
|
84
72
|
.video-wrapper-${item.id}:hover {
|
|
85
|
-
${(0, HoverStyles_1.getHoverStyles)(['angle', 'opacity', 'blur'], hoverParams)}
|
|
73
|
+
${(0, HoverStyles_1.getHoverStyles)(['angle', 'opacity', 'blur'], hoverParams)};
|
|
86
74
|
}
|
|
87
75
|
.video-${item.id} {
|
|
76
|
+
border-color: ${color_1.CntrlColor.parse(layoutParams.strokeColor).fmt('rgba')};
|
|
77
|
+
border-radius: ${layoutParams.radius * 100}vw;
|
|
78
|
+
border-width: ${layoutParams.strokeWidth * 100}vw;
|
|
88
79
|
transition: ${(0, HoverStyles_1.getTransitions)(['strokeWidth', 'radius', 'strokeColor'], hoverParams)};
|
|
89
80
|
}
|
|
90
81
|
.video-wrapper-${item.id}:hover .video {
|
|
91
|
-
${(0, HoverStyles_1.getHoverStyles)(['strokeWidth', 'radius', 'strokeColor'], hoverParams)}
|
|
82
|
+
${(0, HoverStyles_1.getHoverStyles)(['strokeWidth', 'radius', 'strokeColor'], hoverParams)};
|
|
92
83
|
}
|
|
93
84
|
`);
|
|
94
85
|
})}
|