@cntrl-site/sdk-nextjs 1.0.2 → 1.0.3
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-1.0.3.tgz +0 -0
- package/lib/components/Item.js +1 -1
- package/lib/components/items/CodeEmbedItem.js +1 -1
- package/lib/components/items/CustomItem.js +1 -3
- package/lib/components/items/GroupItem.js +1 -4
- package/lib/components/items/ImageItem.js +3 -11
- package/lib/components/items/RectangleItem.js +5 -12
- package/lib/components/items/RichTextItem.js +2 -2
- package/lib/components/items/VideoItem.js +1 -5
- package/lib/components/items/VimeoEmbed.js +2 -8
- package/lib/components/items/YoutubeEmbed.js +1 -5
- package/lib/components/items/useCodeEmbedItem.js +4 -4
- package/lib/components/items/useEmbedVideoItem.js +6 -6
- package/lib/components/items/useFileItem.js +10 -10
- package/lib/components/items/useGroupItem.js +2 -2
- package/lib/components/items/useRectangleItem.js +12 -12
- package/lib/components/items/useRichTextItemValues.js +4 -4
- package/lib/components/useItemAngle.js +1 -1
- package/package.json +1 -1
- package/src/components/Item.tsx +1 -1
- package/src/components/items/CodeEmbedItem.tsx +5 -1
- package/src/components/items/CustomItem.tsx +1 -1
- package/src/components/items/GroupItem.tsx +2 -2
- package/src/components/items/ImageItem.tsx +7 -7
- package/src/components/items/RectangleItem.tsx +12 -10
- package/src/components/items/RichTextItem.tsx +4 -4
- package/src/components/items/VideoItem.tsx +3 -3
- package/src/components/items/VimeoEmbed.tsx +4 -4
- package/src/components/items/YoutubeEmbed.tsx +3 -3
- package/src/components/items/useCodeEmbedItem.ts +4 -4
- package/src/components/items/useEmbedVideoItem.ts +7 -7
- package/src/components/items/useFileItem.ts +14 -12
- package/src/components/items/useGroupItem.ts +2 -2
- package/src/components/items/useRectangleItem.ts +12 -12
- package/src/components/items/useRichTextItemValues.ts +4 -4
- package/src/components/useItemAngle.ts +2 -2
- package/cntrl-site-sdk-nextjs-1.0.1.tgz +0 -0
|
Binary file
|
package/lib/components/Item.js
CHANGED
|
@@ -102,7 +102,7 @@ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
|
102
102
|
isInitialRef.current = false;
|
|
103
103
|
}, []);
|
|
104
104
|
const isRichText = isItemType(item, sdk_1.ArticleItemType.RichText);
|
|
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)`, '
|
|
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)`, 'WebkitTransform': `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 ? {
|
|
106
106
|
width: `${sizingAxis.x === 'manual'
|
|
107
107
|
? isRichText
|
|
108
108
|
? `${dimensions.width * exemplary}px`
|
|
@@ -58,7 +58,7 @@ const CodeEmbedItem = ({ item, sectionId, onResize }) => {
|
|
|
58
58
|
return;
|
|
59
59
|
iframe.srcdoc = item.commonParams.html;
|
|
60
60
|
}, [item.commonParams.html, item.commonParams.iframe, ref]);
|
|
61
|
-
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: {
|
|
61
|
+
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(Object.assign(Object.assign({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (opacity !== undefined ? { opacity } : {})), 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: `
|
|
62
62
|
.embed-wrapper-${item.id} {
|
|
63
63
|
position: absolute;
|
|
64
64
|
width: 100%;
|
|
@@ -22,9 +22,7 @@ const CustomItem = ({ item, onResize, sectionId }) => {
|
|
|
22
22
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
23
23
|
if (!component)
|
|
24
24
|
return null;
|
|
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]) => {
|
|
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: Object.assign({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), children: component({}) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: item.id, children: `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hoverParams]) => {
|
|
28
26
|
return (`
|
|
29
27
|
.custom-component-${item.id} {
|
|
30
28
|
transform: rotate(${area.angle}deg);
|
|
@@ -25,10 +25,7 @@ const GroupItem = ({ item, sectionId, onResize, articleHeight }) => {
|
|
|
25
25
|
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
26
26
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
27
27
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
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: {
|
|
29
|
-
opacity,
|
|
30
|
-
transform: `rotate(${angle}deg)`,
|
|
31
|
-
}, children: items && items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, articleHeight: articleHeight, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
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: Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), children: items && items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, articleHeight: articleHeight, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
32
29
|
.group-${item.id} {
|
|
33
30
|
position: absolute;
|
|
34
31
|
width: 100%;
|
|
@@ -33,7 +33,7 @@ const ImageItem = ({ item, sectionId, onResize }) => {
|
|
|
33
33
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
34
34
|
const { radius, strokeWidth, opacity, strokeColor, blur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
35
35
|
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
36
|
-
const borderColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(strokeColor), [strokeColor]);
|
|
36
|
+
const borderColor = (0, react_1.useMemo)(() => strokeColor ? color_1.CntrlColor.parse(strokeColor) : undefined, [strokeColor]);
|
|
37
37
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
38
38
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
39
39
|
const { url, hasGLEffect, fragmentShader } = item.commonParams;
|
|
@@ -64,16 +64,8 @@ const ImageItem = ({ item, sectionId, onResize }) => {
|
|
|
64
64
|
const rect = (0, useElementRect_1.useElementRect)(ref);
|
|
65
65
|
const rectWidth = Math.floor((_c = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _c !== void 0 ? _c : 0);
|
|
66
66
|
const rectHeight = Math.floor((_d = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _d !== void 0 ? _d : 0);
|
|
67
|
-
const inlineStyles = {
|
|
68
|
-
|
|
69
|
-
borderWidth: `${strokeWidth * 100}vw`,
|
|
70
|
-
borderColor: `${borderColor.fmt('rgba')}`
|
|
71
|
-
};
|
|
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: {
|
|
73
|
-
opacity: `${opacity}`,
|
|
74
|
-
transform: `rotate(${angle}deg)`,
|
|
75
|
-
filter: `blur(${blur * 100}vw)`
|
|
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: `
|
|
67
|
+
const inlineStyles = Object.assign(Object.assign(Object.assign({}, (borderColor ? { borderColor: `${borderColor.fmt('rgba')}` } : {})), (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {}));
|
|
68
|
+
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: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), 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
69
|
.image-wrapper-${item.id} {
|
|
78
70
|
position: absolute;
|
|
79
71
|
width: 100%;
|
|
@@ -21,22 +21,15 @@ const RectangleItem = ({ item, sectionId, onResize }) => {
|
|
|
21
21
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
22
22
|
const { fillColor, radius, strokeWidth, strokeColor, blur, backdropBlur } = (0, useRectangleItem_1.useRectangleItem)(item, sectionId);
|
|
23
23
|
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
24
|
-
const backgroundColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(fillColor), [fillColor]);
|
|
25
|
-
const borderColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(strokeColor), [strokeColor]);
|
|
24
|
+
const backgroundColor = (0, react_1.useMemo)(() => fillColor ? color_1.CntrlColor.parse(fillColor) : undefined, [fillColor]);
|
|
25
|
+
const borderColor = (0, react_1.useMemo)(() => strokeColor ? color_1.CntrlColor.parse(strokeColor) : undefined, [strokeColor]);
|
|
26
26
|
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
27
27
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
28
28
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
29
29
|
const backdropFilterValue = backdropBlur ? `blur(${backdropBlur * 100}vw)` : undefined;
|
|
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: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
borderWidth: `${strokeWidth * 100}vw`,
|
|
34
|
-
borderColor: `${borderColor.toCss()}`,
|
|
35
|
-
transform: `rotate(${angle}deg)`,
|
|
36
|
-
filter: `blur(${blur * 100}vw)`,
|
|
37
|
-
backdropFilter: backdropFilterValue,
|
|
38
|
-
WebkitBackdropFilter: backdropFilterValue
|
|
39
|
-
} }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
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: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (backgroundColor ? { backgroundColor: `${backgroundColor.fmt('rgba')}` } : {})), (borderColor ? { borderColor: `${borderColor.fmt('rgba')}` } : {})), (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (backdropFilterValue !== undefined
|
|
31
|
+
? { backdropFilter: backdropFilterValue, WebkitBackdropFilter: backdropFilterValue }
|
|
32
|
+
: {})) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
40
33
|
.rectangle-${item.id} {
|
|
41
34
|
position: absolute;
|
|
42
35
|
width: 100%;
|
|
@@ -24,11 +24,11 @@ const RichTextItem = ({ item, sectionId, onResize }) => {
|
|
|
24
24
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
25
25
|
const angle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
26
26
|
const { blur, wordSpacing, letterSpacing, color, fontSize, lineHeight } = (0, useRichTextItemValues_1.useRichTextItemValues)(item, sectionId);
|
|
27
|
-
const textColor = (0, react_1.useMemo)(() => color_1.CntrlColor.parse(color), [color]);
|
|
27
|
+
const textColor = (0, react_1.useMemo)(() => color ? color_1.CntrlColor.parse(color) : undefined, [color]);
|
|
28
28
|
const layoutValues = [item.area, item.layoutParams, item.state.hover];
|
|
29
29
|
const exemplary = (0, useExemplary_1.useExemplary)();
|
|
30
30
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
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: Object.assign(Object.assign(Object.assign(Object.assign({
|
|
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: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (textColor ? { color: `${textColor.fmt('rgba')}` } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (letterSpacing !== undefined ? { letterSpacing: `${letterSpacing * exemplary}px` } : {})), (wordSpacing !== undefined ? { wordSpacing: `${wordSpacing * exemplary}px` } : {})), (fontSize !== undefined ? { fontSize: `${Math.round(fontSize * exemplary)}px` } : {})), (lineHeight !== undefined ? { lineHeight: `${lineHeight * exemplary}px` } : {})), children: content }), (0, jsx_runtime_1.jsxs)(style_1.default, { id: id, children: [styles, `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams, hoverParams], exemplary) => {
|
|
32
32
|
const color = color_1.CntrlColor.parse(layoutParams.color);
|
|
33
33
|
return (`
|
|
34
34
|
.rich-text-wrapper-${item.id} {
|
|
@@ -32,11 +32,7 @@ const VideoItem = ({ item, sectionId, onResize }) => {
|
|
|
32
32
|
const hasScrollPlayback = scrollPlayback !== null;
|
|
33
33
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
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,
|
|
37
|
-
transform: `rotate(${angle}deg)`,
|
|
38
|
-
filter: `blur(${blur * 100}vw)`,
|
|
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: `
|
|
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: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), 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: `
|
|
40
36
|
.video-wrapper-${item.id} {
|
|
41
37
|
position: absolute;
|
|
42
38
|
overflow: hidden;
|
|
@@ -41,11 +41,7 @@ const VimeoEmbedItem = ({ item, sectionId, onResize }) => {
|
|
|
41
41
|
return validURL.href;
|
|
42
42
|
};
|
|
43
43
|
const validUrl = getValidVimeoUrl(url);
|
|
44
|
-
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-video-wrapper-${item.id}`, ref: setRef, style: {
|
|
45
|
-
opacity: `${opacity}`,
|
|
46
|
-
transform: `rotate(${angle}deg)`,
|
|
47
|
-
filter: `blur(${blur * 100}vw)`
|
|
48
|
-
}, onMouseEnter: () => {
|
|
44
|
+
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-video-wrapper-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), onMouseEnter: () => {
|
|
49
45
|
if (!vimeoPlayer || play !== 'on-hover')
|
|
50
46
|
return;
|
|
51
47
|
vimeoPlayer.play();
|
|
@@ -53,9 +49,7 @@ const VimeoEmbedItem = ({ item, sectionId, onResize }) => {
|
|
|
53
49
|
if (!vimeoPlayer || play !== 'on-hover')
|
|
54
50
|
return;
|
|
55
51
|
vimeoPlayer.pause();
|
|
56
|
-
}, children: (0, jsx_runtime_1.jsx)("iframe", { ref: setIframeRef, className: "embedVideo", src: validUrl || '', allow: "autoplay; fullscreen; picture-in-picture;", allowFullScreen: true, style: {
|
|
57
|
-
borderRadius: `${radius * 100}vw`
|
|
58
|
-
} }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
52
|
+
}, children: (0, jsx_runtime_1.jsx)("iframe", { ref: setIframeRef, className: "embedVideo", src: validUrl || '', allow: "autoplay; fullscreen; picture-in-picture;", allowFullScreen: true, style: Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
59
53
|
.embed-video-wrapper-${item.id} {
|
|
60
54
|
position: absolute;
|
|
61
55
|
width: 100%;
|
|
@@ -65,11 +65,7 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize }) => {
|
|
|
65
65
|
if (!player || play !== 'on-hover')
|
|
66
66
|
return;
|
|
67
67
|
player.pauseVideo();
|
|
68
|
-
}, style: {
|
|
69
|
-
opacity: `${opacity}`,
|
|
70
|
-
transform: `rotate(${angle}deg)`,
|
|
71
|
-
filter: `blur(${blur * 100}vw)`
|
|
72
|
-
}, children: (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
68
|
+
}, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), children: (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
73
69
|
.embed-youtube-video-wrapper-${item.id},
|
|
74
70
|
.embed-${item.id} {
|
|
75
71
|
position: absolute;
|
|
@@ -8,16 +8,16 @@ const useCodeEmbedItem = (item, sectionId) => {
|
|
|
8
8
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
9
9
|
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
10
10
|
if (!layoutId)
|
|
11
|
-
return
|
|
11
|
+
return;
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
13
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
14
|
-
}, (animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur, sectionId, [layoutId]);
|
|
14
|
+
}, (animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
15
15
|
const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Opacity, (item, layoutId) => {
|
|
16
16
|
if (!layoutId)
|
|
17
|
-
return
|
|
17
|
+
return;
|
|
18
18
|
const layoutParams = item.layoutParams[layoutId];
|
|
19
19
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
20
|
-
}, (animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity, sectionId, [layoutId]);
|
|
20
|
+
}, (animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
21
21
|
const anchor = layoutId && 'areaAnchor' in item.layoutParams[layoutId] ? item.layoutParams[layoutId].areaAnchor : sdk_1.AreaAnchor.TopLeft;
|
|
22
22
|
return { anchor, blur, opacity };
|
|
23
23
|
};
|
|
@@ -8,22 +8,22 @@ const useEmbedVideoItem = (item, sectionId) => {
|
|
|
8
8
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
9
9
|
const radius = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderRadius, (item, layoutId) => {
|
|
10
10
|
if (!layoutId)
|
|
11
|
-
return
|
|
11
|
+
return;
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
13
|
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
14
|
-
}, (animator, scroll, value) => animator.getRadius({ radius: value }, scroll).radius, sectionId, [layoutId]);
|
|
14
|
+
}, (animator, scroll, value) => value ? animator.getRadius({ radius: value }, scroll).radius : undefined, sectionId, [layoutId]);
|
|
15
15
|
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
16
16
|
if (!layoutId)
|
|
17
|
-
return
|
|
17
|
+
return;
|
|
18
18
|
const layoutParams = item.layoutParams[layoutId];
|
|
19
19
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
20
|
-
}, (animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur, sectionId, [layoutId]);
|
|
20
|
+
}, (animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
21
21
|
const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Opacity, (item, layoutId) => {
|
|
22
22
|
if (!layoutId)
|
|
23
|
-
return
|
|
23
|
+
return;
|
|
24
24
|
const layoutParams = item.layoutParams[layoutId];
|
|
25
25
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
26
|
-
}, (animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity, sectionId, [layoutId]);
|
|
26
|
+
}, (animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
27
27
|
return { radius, blur, opacity };
|
|
28
28
|
};
|
|
29
29
|
exports.useEmbedVideoItem = useEmbedVideoItem;
|
|
@@ -9,34 +9,34 @@ const useFileItem = (item, sectionId) => {
|
|
|
9
9
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
10
10
|
const radius = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderRadius, (item, layoutId) => {
|
|
11
11
|
if (!layoutId)
|
|
12
|
-
return
|
|
12
|
+
return;
|
|
13
13
|
const layoutParams = item.layoutParams[layoutId];
|
|
14
14
|
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
15
|
-
}, (animator, scroll, value) => animator.getRadius({ radius: value }, scroll).radius, sectionId, [layoutId]);
|
|
15
|
+
}, (animator, scroll, value) => value ? animator.getRadius({ radius: value }, scroll).radius : undefined, sectionId, [layoutId]);
|
|
16
16
|
const strokeWidth = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderWidth, (item, layoutId) => {
|
|
17
17
|
if (!layoutId)
|
|
18
|
-
return
|
|
18
|
+
return;
|
|
19
19
|
const layoutParams = item.layoutParams[layoutId];
|
|
20
20
|
return 'strokeWidth' in layoutParams ? layoutParams.strokeWidth : 0;
|
|
21
|
-
}, (animator, scroll, value) => animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth, sectionId, [layoutId]);
|
|
21
|
+
}, (animator, scroll, value) => value ? animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth : undefined, sectionId, [layoutId]);
|
|
22
22
|
const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Opacity, (item, layoutId) => {
|
|
23
23
|
if (!layoutId)
|
|
24
|
-
return
|
|
24
|
+
return;
|
|
25
25
|
const layoutParams = item.layoutParams[layoutId];
|
|
26
26
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
27
|
-
}, (animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity, sectionId, [layoutId]);
|
|
27
|
+
}, (animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
28
28
|
const strokeColor = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderColor, (item, layoutId) => {
|
|
29
29
|
if (!layoutId)
|
|
30
|
-
return
|
|
30
|
+
return;
|
|
31
31
|
const layoutParams = item.layoutParams[layoutId];
|
|
32
32
|
return 'strokeColor' in layoutParams ? layoutParams.strokeColor : DEFAULT_COLOR;
|
|
33
|
-
}, (animator, scroll, value) => animator.getBorderColor({ color: value }, scroll).color, sectionId);
|
|
33
|
+
}, (animator, scroll, value) => value ? animator.getBorderColor({ color: value }, scroll).color : undefined, sectionId, [layoutId]);
|
|
34
34
|
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
35
35
|
if (!layoutId)
|
|
36
|
-
return
|
|
36
|
+
return;
|
|
37
37
|
const layoutParams = item.layoutParams[layoutId];
|
|
38
38
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
39
|
-
}, (animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur, sectionId);
|
|
39
|
+
}, (animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
40
40
|
return { radius, strokeWidth, opacity, strokeColor, blur };
|
|
41
41
|
};
|
|
42
42
|
exports.useFileItem = useFileItem;
|
|
@@ -8,10 +8,10 @@ function useGroupItem(item, sectionId) {
|
|
|
8
8
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
9
9
|
const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Opacity, (item, layoutId) => {
|
|
10
10
|
if (!layoutId)
|
|
11
|
-
return
|
|
11
|
+
return;
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
13
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
14
|
-
}, (animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity, sectionId, [layoutId]);
|
|
14
|
+
}, (animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
15
15
|
return { opacity };
|
|
16
16
|
}
|
|
17
17
|
exports.useGroupItem = useGroupItem;
|
|
@@ -9,40 +9,40 @@ const useRectangleItem = (item, sectionId) => {
|
|
|
9
9
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
10
10
|
const radius = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderRadius, (item, layoutId) => {
|
|
11
11
|
if (!layoutId)
|
|
12
|
-
return
|
|
12
|
+
return;
|
|
13
13
|
const layoutParams = item.layoutParams[layoutId];
|
|
14
14
|
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
15
|
-
}, (animator, scroll, value) => animator.getRadius({ radius: value }, scroll).radius, sectionId, [layoutId]);
|
|
15
|
+
}, (animator, scroll, value) => value ? animator.getRadius({ radius: value }, scroll).radius : undefined, sectionId, [layoutId]);
|
|
16
16
|
const strokeWidth = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderWidth, (item, layoutId) => {
|
|
17
17
|
if (!layoutId)
|
|
18
|
-
return
|
|
18
|
+
return;
|
|
19
19
|
const layoutParams = item.layoutParams[layoutId];
|
|
20
20
|
return 'strokeWidth' in layoutParams ? layoutParams.strokeWidth : 0;
|
|
21
|
-
}, (animator, scroll, value) => animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth, sectionId, [layoutId]);
|
|
21
|
+
}, (animator, scroll, value) => value ? animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth : undefined, sectionId, [layoutId]);
|
|
22
22
|
const fillColor = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Color, (item, layoutId) => {
|
|
23
23
|
if (!layoutId)
|
|
24
|
-
return
|
|
24
|
+
return;
|
|
25
25
|
const layoutParams = item.layoutParams[layoutId];
|
|
26
26
|
return 'fillColor' in layoutParams ? layoutParams.fillColor : defaultColor;
|
|
27
|
-
}, (animator, scroll, value) => animator.getColor({ color: value }, scroll).color, sectionId, [layoutId]);
|
|
27
|
+
}, (animator, scroll, value) => value ? animator.getColor({ color: value }, scroll).color : undefined, sectionId, [layoutId]);
|
|
28
28
|
const strokeColor = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderColor, (item, layoutId) => {
|
|
29
29
|
if (!layoutId)
|
|
30
|
-
return
|
|
30
|
+
return;
|
|
31
31
|
const layoutParams = item.layoutParams[layoutId];
|
|
32
32
|
return 'strokeColor' in layoutParams ? layoutParams.strokeColor : defaultColor;
|
|
33
|
-
}, (animator, scroll, value) => animator.getBorderColor({ color: value }, scroll).color, sectionId, [layoutId]);
|
|
33
|
+
}, (animator, scroll, value) => value ? animator.getBorderColor({ color: value }, scroll).color : undefined, sectionId, [layoutId]);
|
|
34
34
|
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
35
35
|
if (!layoutId)
|
|
36
|
-
return
|
|
36
|
+
return;
|
|
37
37
|
const layoutParams = item.layoutParams[layoutId];
|
|
38
38
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
39
|
-
}, (animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur, sectionId, [layoutId]);
|
|
39
|
+
}, (animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
40
40
|
const backdropBlur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BackdropBlur, (item, layoutId) => {
|
|
41
41
|
if (!layoutId)
|
|
42
|
-
return
|
|
42
|
+
return;
|
|
43
43
|
const layoutParams = item.layoutParams[layoutId];
|
|
44
44
|
return 'backdropBlur' in layoutParams ? layoutParams.backdropBlur : 0;
|
|
45
|
-
}, (animator, scroll, value) => animator.getBackdropBlur({ backdropBlur: value }, scroll).backdropBlur, sectionId, [layoutId]);
|
|
45
|
+
}, (animator, scroll, value) => value ? animator.getBackdropBlur({ backdropBlur: value }, scroll).backdropBlur : undefined, sectionId, [layoutId]);
|
|
46
46
|
return { fillColor, strokeWidth, radius, strokeColor, blur, backdropBlur };
|
|
47
47
|
};
|
|
48
48
|
exports.useRectangleItem = useRectangleItem;
|
|
@@ -9,10 +9,10 @@ const useRichTextItemValues = (item, sectionId) => {
|
|
|
9
9
|
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
10
10
|
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
11
11
|
if (!layoutId)
|
|
12
|
-
return
|
|
12
|
+
return;
|
|
13
13
|
const layoutParams = item.layoutParams[layoutId];
|
|
14
14
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
15
|
-
}, (animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur, sectionId, [layoutId]);
|
|
15
|
+
}, (animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
16
16
|
const letterSpacing = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.LetterSpacing, (item, layoutId) => {
|
|
17
17
|
if (!layoutId)
|
|
18
18
|
return;
|
|
@@ -27,10 +27,10 @@ const useRichTextItemValues = (item, sectionId) => {
|
|
|
27
27
|
}, (animator, scroll, value) => value !== undefined ? animator.getWordSpacing({ wordSpacing: value }, scroll).wordSpacing : undefined, sectionId, [layoutId]);
|
|
28
28
|
const color = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.TextColor, (item, layoutId) => {
|
|
29
29
|
if (!layoutId)
|
|
30
|
-
return
|
|
30
|
+
return;
|
|
31
31
|
const layoutParams = item.layoutParams[layoutId];
|
|
32
32
|
return 'color' in layoutParams ? layoutParams.color : DEFAULT_COLOR;
|
|
33
|
-
}, (animator, scroll, value) => animator.getTextColor({ color: value }, scroll).color, sectionId, [layoutId]);
|
|
33
|
+
}, (animator, scroll, value) => value ? animator.getTextColor({ color: value }, scroll).color : undefined, sectionId, [layoutId]);
|
|
34
34
|
const fontSize = layoutId ? item.layoutParams[layoutId].fontSize : undefined;
|
|
35
35
|
const lineHeight = layoutId ? item.layoutParams[layoutId].lineHeight : undefined;
|
|
36
36
|
return { blur, letterSpacing, wordSpacing, color, fontSize, lineHeight };
|
|
@@ -4,7 +4,7 @@ exports.useItemAngle = void 0;
|
|
|
4
4
|
const sdk_1 = require("@cntrl-site/sdk");
|
|
5
5
|
const useKeyframeValue_1 = require("../common/useKeyframeValue");
|
|
6
6
|
const useItemAngle = (item, sectionId) => {
|
|
7
|
-
const angle = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Rotation, (item, layoutId) => layoutId ? item.area[layoutId].angle :
|
|
7
|
+
const angle = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Rotation, (item, layoutId) => layoutId ? item.area[layoutId].angle : undefined, (animator, scroll, value) => value ? animator.getRotation({ angle: value }, scroll).angle : undefined, sectionId);
|
|
8
8
|
return angle;
|
|
9
9
|
};
|
|
10
10
|
exports.useItemAngle = useItemAngle;
|
package/package.json
CHANGED
package/src/components/Item.tsx
CHANGED
|
@@ -148,7 +148,7 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isI
|
|
|
148
148
|
opacity: (keyframes.length !== 0 && !layout) ? 0 : 1,
|
|
149
149
|
top: `${stickyTop * 100}vw`,
|
|
150
150
|
height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset',
|
|
151
|
-
...(scale !== undefined ? { transform: `scale(${scale}) translateZ(0)`, '
|
|
151
|
+
...(scale !== undefined ? { transform: `scale(${scale}) translateZ(0)`, 'WebkitTransform': `scale(${scale}) translateZ(0)` } : {}),
|
|
152
152
|
}}
|
|
153
153
|
>
|
|
154
154
|
<RichTextWrapper isRichText={isRichText}>
|
|
@@ -57,7 +57,11 @@ export const CodeEmbedItem: FC<ItemProps<TCodeEmbedItem>> = ({ item, sectionId,
|
|
|
57
57
|
<LinkWrapper url={item.link?.url} target={item.link?.target}>
|
|
58
58
|
<div
|
|
59
59
|
className={`embed-wrapper-${item.id}`}
|
|
60
|
-
style={{
|
|
60
|
+
style={{
|
|
61
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
62
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
63
|
+
...(opacity !== undefined ? { opacity } : {}),
|
|
64
|
+
}}
|
|
61
65
|
ref={setRef}
|
|
62
66
|
>
|
|
63
67
|
{item.commonParams.iframe ? (
|
|
@@ -22,7 +22,7 @@ export const CustomItem: FC<ItemProps<TCustomItem>> = ({ item, onResize, section
|
|
|
22
22
|
className={`custom-component-${item.id}`}
|
|
23
23
|
ref={setRef}
|
|
24
24
|
style={{
|
|
25
|
-
transform: `rotate(${angle}deg)
|
|
25
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
26
26
|
}}
|
|
27
27
|
>
|
|
28
28
|
{component({})}
|
|
@@ -26,8 +26,8 @@ export const GroupItem: FC<ItemProps<TGroupItem>> = ({ item, sectionId, onResize
|
|
|
26
26
|
className={`group-${item.id}`}
|
|
27
27
|
ref={setRef}
|
|
28
28
|
style={{
|
|
29
|
-
opacity,
|
|
30
|
-
transform: `rotate(${angle}deg)
|
|
29
|
+
...(opacity !== undefined ? { opacity } : {}),
|
|
30
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
31
31
|
}}
|
|
32
32
|
>
|
|
33
33
|
{items && items.map(item => (
|
|
@@ -28,7 +28,7 @@ export const ImageItem: FC<ItemProps<TImageItem>> = ({ item, sectionId, onResize
|
|
|
28
28
|
const layoutId = useLayoutContext();
|
|
29
29
|
const { radius, strokeWidth, opacity, strokeColor, blur } = useFileItem(item, sectionId);
|
|
30
30
|
const angle = useItemAngle(item, sectionId);
|
|
31
|
-
const borderColor = useMemo(() => CntrlColor.parse(strokeColor), [strokeColor]);
|
|
31
|
+
const borderColor = useMemo(() => strokeColor ? CntrlColor.parse(strokeColor) : undefined, [strokeColor]);
|
|
32
32
|
const [ref, setRef] = useState<HTMLDivElement | null>(null);
|
|
33
33
|
useRegisterResize(ref, onResize);
|
|
34
34
|
const { url, hasGLEffect, fragmentShader } = item.commonParams;
|
|
@@ -66,9 +66,9 @@ export const ImageItem: FC<ItemProps<TImageItem>> = ({ item, sectionId, onResize
|
|
|
66
66
|
const rectWidth = Math.floor(rect?.width ?? 0);
|
|
67
67
|
const rectHeight = Math.floor(rect?.height ?? 0);
|
|
68
68
|
const inlineStyles = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
...(borderColor ? { borderColor: `${borderColor.fmt('rgba')}` } : {}),
|
|
70
|
+
...(radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {}),
|
|
71
|
+
...(strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {}),
|
|
72
72
|
};
|
|
73
73
|
return (
|
|
74
74
|
<LinkWrapper url={item.link?.url} target={item.link?.target}>
|
|
@@ -77,9 +77,9 @@ export const ImageItem: FC<ItemProps<TImageItem>> = ({ item, sectionId, onResize
|
|
|
77
77
|
className={`image-wrapper-${item.id}`}
|
|
78
78
|
ref={setRef}
|
|
79
79
|
style={{
|
|
80
|
-
opacity
|
|
81
|
-
transform: `rotate(${angle}deg)
|
|
82
|
-
filter: `blur(${blur * 100}vw)`
|
|
80
|
+
...(opacity !== undefined ? { opacity } : {}),
|
|
81
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
82
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
85
|
{item.commonParams.hasGLEffect ? (
|
|
@@ -16,8 +16,8 @@ export const RectangleItem: FC<ItemProps<TRectangleItem>> = ({ item, sectionId,
|
|
|
16
16
|
const { layouts } = useCntrlContext();
|
|
17
17
|
const { fillColor, radius, strokeWidth, strokeColor, blur, backdropBlur } = useRectangleItem(item, sectionId);
|
|
18
18
|
const angle = useItemAngle(item, sectionId);
|
|
19
|
-
const backgroundColor = useMemo(() => CntrlColor.parse(fillColor), [fillColor]);
|
|
20
|
-
const borderColor = useMemo(() => CntrlColor.parse(strokeColor), [strokeColor]);
|
|
19
|
+
const backgroundColor = useMemo(() => fillColor ? CntrlColor.parse(fillColor) : undefined, [fillColor]);
|
|
20
|
+
const borderColor = useMemo(() => strokeColor ? CntrlColor.parse(strokeColor) : undefined, [strokeColor]);
|
|
21
21
|
const layoutValues: Record<string, any>[] = [item.area, item.layoutParams, item.state.hover];
|
|
22
22
|
const [ref, setRef] = useState<HTMLDivElement | null>(null);
|
|
23
23
|
useRegisterResize(ref, onResize);
|
|
@@ -30,14 +30,16 @@ export const RectangleItem: FC<ItemProps<TRectangleItem>> = ({ item, sectionId,
|
|
|
30
30
|
className={`rectangle-${item.id}`}
|
|
31
31
|
ref={setRef}
|
|
32
32
|
style={{
|
|
33
|
-
backgroundColor: `${backgroundColor.fmt('rgba')}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
transform: `rotate(${angle}deg)
|
|
38
|
-
filter: `blur(${blur * 100}vw)
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
...(backgroundColor ? { backgroundColor : `${backgroundColor.fmt('rgba')}` } : {}),
|
|
34
|
+
...(borderColor ? { borderColor: `${borderColor.fmt('rgba')}` } : {}),
|
|
35
|
+
...(radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {}),
|
|
36
|
+
...(strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {}),
|
|
37
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
38
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
39
|
+
...(backdropFilterValue !== undefined
|
|
40
|
+
? { backdropFilter: backdropFilterValue, WebkitBackdropFilter: backdropFilterValue }
|
|
41
|
+
: {}
|
|
42
|
+
),
|
|
41
43
|
}}
|
|
42
44
|
/>
|
|
43
45
|
<JSXStyle id={id}>{`
|
|
@@ -19,7 +19,7 @@ export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item, sectionId, on
|
|
|
19
19
|
const { layouts } = useCntrlContext();
|
|
20
20
|
const angle = useItemAngle(item, sectionId);
|
|
21
21
|
const { blur, wordSpacing, letterSpacing, color, fontSize, lineHeight } = useRichTextItemValues(item, sectionId);
|
|
22
|
-
const textColor = useMemo(() => CntrlColor.parse(color), [color]);
|
|
22
|
+
const textColor = useMemo(() => color ? CntrlColor.parse(color) : undefined, [color]);
|
|
23
23
|
const layoutValues: Record<string, any>[] = [item.area, item.layoutParams, item.state.hover];
|
|
24
24
|
const exemplary = useExemplary();
|
|
25
25
|
useRegisterResize(ref, onResize);
|
|
@@ -30,9 +30,9 @@ export const RichTextItem: FC<ItemProps<TRichTextItem>> = ({ item, sectionId, on
|
|
|
30
30
|
ref={setRef}
|
|
31
31
|
className={`rich-text-wrapper-${item.id}`}
|
|
32
32
|
style={{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
34
|
+
...(textColor ? { color: `${textColor.fmt('rgba')}` } : {}),
|
|
35
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
36
36
|
...(letterSpacing !== undefined ? { letterSpacing: `${letterSpacing * exemplary}px` } : {}),
|
|
37
37
|
...(wordSpacing !== undefined ? { wordSpacing: `${wordSpacing * exemplary}px` } : {}),
|
|
38
38
|
...(fontSize !== undefined ? { fontSize: `${Math.round(fontSize * exemplary)}px` } : {}),
|
|
@@ -37,9 +37,9 @@ export const VideoItem: FC<ItemProps<TVideoItem>> = ({ item, sectionId, onResize
|
|
|
37
37
|
className={`video-wrapper-${item.id}`}
|
|
38
38
|
ref={setRef}
|
|
39
39
|
style={{
|
|
40
|
-
opacity,
|
|
41
|
-
transform: `rotate(${angle}deg)
|
|
42
|
-
filter: `blur(${blur * 100}vw)
|
|
40
|
+
...(opacity !== undefined ? { opacity } : {}),
|
|
41
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
42
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
43
43
|
}}
|
|
44
44
|
>
|
|
45
45
|
{hasScrollPlayback ? (
|
|
@@ -43,9 +43,9 @@ export const VimeoEmbedItem: FC<ItemProps<TVimeoEmbedItem>> = ({ item, sectionId
|
|
|
43
43
|
className={`embed-video-wrapper-${item.id}`}
|
|
44
44
|
ref={setRef}
|
|
45
45
|
style={{
|
|
46
|
-
opacity
|
|
47
|
-
transform: `rotate(${angle}deg)
|
|
48
|
-
filter: `blur(${blur * 100}vw)`
|
|
46
|
+
...(opacity !== undefined ? { opacity } : {}),
|
|
47
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
48
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
49
49
|
}}
|
|
50
50
|
onMouseEnter={() => {
|
|
51
51
|
if (!vimeoPlayer || play !== 'on-hover') return;
|
|
@@ -63,7 +63,7 @@ export const VimeoEmbedItem: FC<ItemProps<TVimeoEmbedItem>> = ({ item, sectionId
|
|
|
63
63
|
allow="autoplay; fullscreen; picture-in-picture;"
|
|
64
64
|
allowFullScreen
|
|
65
65
|
style={{
|
|
66
|
-
borderRadius: `${radius * 100}vw`
|
|
66
|
+
...(radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})
|
|
67
67
|
}}
|
|
68
68
|
/>
|
|
69
69
|
</div>
|
|
@@ -65,9 +65,9 @@ export const YoutubeEmbedItem: FC<ItemProps<TYoutubeEmbedItem>> = ({ item, secti
|
|
|
65
65
|
player.pauseVideo();
|
|
66
66
|
}}
|
|
67
67
|
style={{
|
|
68
|
-
opacity
|
|
69
|
-
transform: `rotate(${angle}deg)
|
|
70
|
-
filter: `blur(${blur * 100}vw)`
|
|
68
|
+
...(opacity !== undefined ? { opacity } : {}),
|
|
69
|
+
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
70
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
71
71
|
}}
|
|
72
72
|
>
|
|
73
73
|
<div
|
|
@@ -9,11 +9,11 @@ export const useCodeEmbedItem = (item: CodeEmbedItem, sectionId: string) => {
|
|
|
9
9
|
item,
|
|
10
10
|
KeyframeType.Blur,
|
|
11
11
|
(item, layoutId) => {
|
|
12
|
-
if (!layoutId) return
|
|
12
|
+
if (!layoutId) return;
|
|
13
13
|
const layoutParams = item.layoutParams[layoutId];
|
|
14
14
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
15
15
|
},
|
|
16
|
-
(animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur,
|
|
16
|
+
(animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined,
|
|
17
17
|
sectionId,
|
|
18
18
|
[layoutId]
|
|
19
19
|
);
|
|
@@ -22,11 +22,11 @@ export const useCodeEmbedItem = (item: CodeEmbedItem, sectionId: string) => {
|
|
|
22
22
|
item,
|
|
23
23
|
KeyframeType.Opacity,
|
|
24
24
|
(item, layoutId) => {
|
|
25
|
-
if (!layoutId) return
|
|
25
|
+
if (!layoutId) return;
|
|
26
26
|
const layoutParams = item.layoutParams[layoutId];
|
|
27
27
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
28
28
|
},
|
|
29
|
-
(animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity,
|
|
29
|
+
(animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined,
|
|
30
30
|
sectionId,
|
|
31
31
|
[layoutId]
|
|
32
32
|
);
|
|
@@ -8,11 +8,11 @@ export const useEmbedVideoItem = (item: VimeoEmbedItem | YoutubeEmbedItem, secti
|
|
|
8
8
|
item,
|
|
9
9
|
KeyframeType.BorderRadius,
|
|
10
10
|
(item, layoutId) => {
|
|
11
|
-
if (!layoutId) return
|
|
11
|
+
if (!layoutId) return;
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
|
-
return
|
|
13
|
+
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
14
14
|
},
|
|
15
|
-
(animator, scroll, value) => animator.getRadius({ radius: value }, scroll).radius,
|
|
15
|
+
(animator, scroll, value) => value ? animator.getRadius({ radius: value }, scroll).radius : undefined,
|
|
16
16
|
sectionId,
|
|
17
17
|
[layoutId]
|
|
18
18
|
);
|
|
@@ -20,11 +20,11 @@ export const useEmbedVideoItem = (item: VimeoEmbedItem | YoutubeEmbedItem, secti
|
|
|
20
20
|
item,
|
|
21
21
|
KeyframeType.Blur,
|
|
22
22
|
(item, layoutId) => {
|
|
23
|
-
if (!layoutId) return
|
|
23
|
+
if (!layoutId) return;
|
|
24
24
|
const layoutParams = item.layoutParams[layoutId];
|
|
25
25
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
26
26
|
},
|
|
27
|
-
(animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur,
|
|
27
|
+
(animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined,
|
|
28
28
|
sectionId,
|
|
29
29
|
[layoutId]
|
|
30
30
|
);
|
|
@@ -33,11 +33,11 @@ export const useEmbedVideoItem = (item: VimeoEmbedItem | YoutubeEmbedItem, secti
|
|
|
33
33
|
item,
|
|
34
34
|
KeyframeType.Opacity,
|
|
35
35
|
(item, layoutId) => {
|
|
36
|
-
if (!layoutId) return
|
|
36
|
+
if (!layoutId) return;
|
|
37
37
|
const layoutParams = item.layoutParams[layoutId];
|
|
38
38
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
39
39
|
},
|
|
40
|
-
(animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity,
|
|
40
|
+
(animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined,
|
|
41
41
|
sectionId,
|
|
42
42
|
[layoutId]
|
|
43
43
|
);
|
|
@@ -9,11 +9,11 @@ export const useFileItem = (item: ImageItem | VideoItem, sectionId: string) => {
|
|
|
9
9
|
item,
|
|
10
10
|
KeyframeType.BorderRadius,
|
|
11
11
|
(item, layoutId) => {
|
|
12
|
-
if (!layoutId) return
|
|
12
|
+
if (!layoutId) return;
|
|
13
13
|
const layoutParams = item.layoutParams[layoutId];
|
|
14
14
|
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
15
15
|
},
|
|
16
|
-
(animator, scroll, value) => animator.getRadius({ radius: value }, scroll).radius,
|
|
16
|
+
(animator, scroll, value) => value ? animator.getRadius({ radius: value }, scroll).radius : undefined,
|
|
17
17
|
sectionId,
|
|
18
18
|
[layoutId]
|
|
19
19
|
);
|
|
@@ -21,11 +21,11 @@ export const useFileItem = (item: ImageItem | VideoItem, sectionId: string) => {
|
|
|
21
21
|
item,
|
|
22
22
|
KeyframeType.BorderWidth,
|
|
23
23
|
(item, layoutId) => {
|
|
24
|
-
if (!layoutId) return
|
|
24
|
+
if (!layoutId) return;
|
|
25
25
|
const layoutParams = item.layoutParams[layoutId];
|
|
26
26
|
return 'strokeWidth' in layoutParams ? layoutParams.strokeWidth : 0;
|
|
27
27
|
},
|
|
28
|
-
(animator, scroll, value) => animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth,
|
|
28
|
+
(animator, scroll, value) => value ? animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth : undefined,
|
|
29
29
|
sectionId,
|
|
30
30
|
[layoutId]
|
|
31
31
|
);
|
|
@@ -34,11 +34,11 @@ export const useFileItem = (item: ImageItem | VideoItem, sectionId: string) => {
|
|
|
34
34
|
item,
|
|
35
35
|
KeyframeType.Opacity,
|
|
36
36
|
(item, layoutId) => {
|
|
37
|
-
if (!layoutId) return
|
|
37
|
+
if (!layoutId) return;
|
|
38
38
|
const layoutParams = item.layoutParams[layoutId];
|
|
39
39
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
40
40
|
},
|
|
41
|
-
(animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity,
|
|
41
|
+
(animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined,
|
|
42
42
|
sectionId,
|
|
43
43
|
[layoutId]
|
|
44
44
|
);
|
|
@@ -47,24 +47,26 @@ export const useFileItem = (item: ImageItem | VideoItem, sectionId: string) => {
|
|
|
47
47
|
item,
|
|
48
48
|
KeyframeType.BorderColor,
|
|
49
49
|
(item, layoutId) => {
|
|
50
|
-
if (!layoutId) return
|
|
50
|
+
if (!layoutId) return;
|
|
51
51
|
const layoutParams = item.layoutParams[layoutId];
|
|
52
52
|
return 'strokeColor' in layoutParams ? layoutParams.strokeColor : DEFAULT_COLOR;
|
|
53
53
|
},
|
|
54
|
-
(animator, scroll, value) => animator.getBorderColor({ color: value }, scroll).color,
|
|
55
|
-
sectionId
|
|
54
|
+
(animator, scroll, value) => value ? animator.getBorderColor({ color: value }, scroll).color : undefined,
|
|
55
|
+
sectionId,
|
|
56
|
+
[layoutId]
|
|
56
57
|
);
|
|
57
58
|
|
|
58
59
|
const blur = useKeyframeValue(
|
|
59
60
|
item,
|
|
60
61
|
KeyframeType.Blur,
|
|
61
62
|
(item, layoutId) => {
|
|
62
|
-
if (!layoutId) return
|
|
63
|
+
if (!layoutId) return;
|
|
63
64
|
const layoutParams = item.layoutParams[layoutId];
|
|
64
65
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
65
66
|
},
|
|
66
|
-
(animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur,
|
|
67
|
-
sectionId
|
|
67
|
+
(animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined,
|
|
68
|
+
sectionId,
|
|
69
|
+
[layoutId]
|
|
68
70
|
);
|
|
69
71
|
|
|
70
72
|
return { radius, strokeWidth, opacity, strokeColor, blur };
|
|
@@ -8,11 +8,11 @@ export function useGroupItem(item: GroupItem, sectionId: string) {
|
|
|
8
8
|
item,
|
|
9
9
|
KeyframeType.Opacity,
|
|
10
10
|
(item, layoutId) => {
|
|
11
|
-
if (!layoutId) return
|
|
11
|
+
if (!layoutId) return;
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
13
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
14
14
|
},
|
|
15
|
-
(animator, scroll, value) => animator.getOpacity({ opacity: value }, scroll).opacity,
|
|
15
|
+
(animator, scroll, value) => value ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined,
|
|
16
16
|
sectionId,
|
|
17
17
|
[layoutId]
|
|
18
18
|
);
|
|
@@ -10,11 +10,11 @@ export const useRectangleItem = (item: RectangleItem, sectionId: string) => {
|
|
|
10
10
|
item,
|
|
11
11
|
KeyframeType.BorderRadius,
|
|
12
12
|
(item, layoutId) => {
|
|
13
|
-
if (!layoutId) return
|
|
13
|
+
if (!layoutId) return;
|
|
14
14
|
const layoutParams = item.layoutParams[layoutId];
|
|
15
15
|
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
16
16
|
},
|
|
17
|
-
(animator, scroll, value) => animator.getRadius({ radius: value }, scroll).radius,
|
|
17
|
+
(animator, scroll, value) => value ? animator.getRadius({ radius: value }, scroll).radius : undefined,
|
|
18
18
|
sectionId,
|
|
19
19
|
[layoutId]
|
|
20
20
|
);
|
|
@@ -22,11 +22,11 @@ export const useRectangleItem = (item: RectangleItem, sectionId: string) => {
|
|
|
22
22
|
item,
|
|
23
23
|
KeyframeType.BorderWidth,
|
|
24
24
|
(item, layoutId) => {
|
|
25
|
-
if (!layoutId) return
|
|
25
|
+
if (!layoutId) return;
|
|
26
26
|
const layoutParams = item.layoutParams[layoutId];
|
|
27
27
|
return 'strokeWidth' in layoutParams ? layoutParams.strokeWidth : 0;
|
|
28
28
|
},
|
|
29
|
-
(animator, scroll, value) => animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth,
|
|
29
|
+
(animator, scroll, value) => value ? animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth : undefined,
|
|
30
30
|
sectionId,
|
|
31
31
|
[layoutId]
|
|
32
32
|
);
|
|
@@ -34,11 +34,11 @@ export const useRectangleItem = (item: RectangleItem, sectionId: string) => {
|
|
|
34
34
|
item,
|
|
35
35
|
KeyframeType.Color,
|
|
36
36
|
(item, layoutId) => {
|
|
37
|
-
if (!layoutId) return
|
|
37
|
+
if (!layoutId) return;
|
|
38
38
|
const layoutParams = item.layoutParams[layoutId];
|
|
39
39
|
return 'fillColor' in layoutParams ? layoutParams.fillColor : defaultColor;
|
|
40
40
|
},
|
|
41
|
-
(animator, scroll, value) => animator.getColor({ color: value }, scroll).color,
|
|
41
|
+
(animator, scroll, value) => value ? animator.getColor({ color: value }, scroll).color : undefined,
|
|
42
42
|
sectionId,
|
|
43
43
|
[layoutId]
|
|
44
44
|
);
|
|
@@ -46,11 +46,11 @@ export const useRectangleItem = (item: RectangleItem, sectionId: string) => {
|
|
|
46
46
|
item,
|
|
47
47
|
KeyframeType.BorderColor,
|
|
48
48
|
(item, layoutId) => {
|
|
49
|
-
if (!layoutId) return
|
|
49
|
+
if (!layoutId) return;
|
|
50
50
|
const layoutParams = item.layoutParams[layoutId];
|
|
51
51
|
return 'strokeColor' in layoutParams ? layoutParams.strokeColor : defaultColor;
|
|
52
52
|
},
|
|
53
|
-
(animator, scroll, value) => animator.getBorderColor({ color: value }, scroll).color,
|
|
53
|
+
(animator, scroll, value) => value ? animator.getBorderColor({ color: value }, scroll).color : undefined,
|
|
54
54
|
sectionId,
|
|
55
55
|
[layoutId]
|
|
56
56
|
);
|
|
@@ -58,11 +58,11 @@ export const useRectangleItem = (item: RectangleItem, sectionId: string) => {
|
|
|
58
58
|
item,
|
|
59
59
|
KeyframeType.Blur,
|
|
60
60
|
(item, layoutId) => {
|
|
61
|
-
if (!layoutId) return
|
|
61
|
+
if (!layoutId) return;
|
|
62
62
|
const layoutParams = item.layoutParams[layoutId];
|
|
63
63
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
64
64
|
},
|
|
65
|
-
(animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur,
|
|
65
|
+
(animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined,
|
|
66
66
|
sectionId,
|
|
67
67
|
[layoutId]
|
|
68
68
|
);
|
|
@@ -70,11 +70,11 @@ export const useRectangleItem = (item: RectangleItem, sectionId: string) => {
|
|
|
70
70
|
item,
|
|
71
71
|
KeyframeType.BackdropBlur,
|
|
72
72
|
(item, layoutId) => {
|
|
73
|
-
if (!layoutId) return
|
|
73
|
+
if (!layoutId) return;
|
|
74
74
|
const layoutParams = item.layoutParams[layoutId];
|
|
75
75
|
return 'backdropBlur' in layoutParams ? layoutParams.backdropBlur : 0;
|
|
76
76
|
},
|
|
77
|
-
(animator, scroll, value) => animator.getBackdropBlur({ backdropBlur: value }, scroll).backdropBlur,
|
|
77
|
+
(animator, scroll, value) => value ? animator.getBackdropBlur({ backdropBlur: value }, scroll).backdropBlur : undefined,
|
|
78
78
|
sectionId,
|
|
79
79
|
[layoutId]
|
|
80
80
|
);
|
|
@@ -10,11 +10,11 @@ export const useRichTextItemValues = (item: RichTextItem, sectionId: string) =>
|
|
|
10
10
|
item,
|
|
11
11
|
KeyframeType.Blur,
|
|
12
12
|
(item, layoutId) => {
|
|
13
|
-
if (!layoutId) return
|
|
13
|
+
if (!layoutId) return;
|
|
14
14
|
const layoutParams = item.layoutParams[layoutId];
|
|
15
15
|
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
16
16
|
},
|
|
17
|
-
(animator, scroll, value) => animator.getBlur({ blur: value }, scroll).blur,
|
|
17
|
+
(animator, scroll, value) => value ? animator.getBlur({ blur: value }, scroll).blur : undefined,
|
|
18
18
|
sectionId,
|
|
19
19
|
[layoutId]
|
|
20
20
|
);
|
|
@@ -49,11 +49,11 @@ export const useRichTextItemValues = (item: RichTextItem, sectionId: string) =>
|
|
|
49
49
|
item,
|
|
50
50
|
KeyframeType.TextColor,
|
|
51
51
|
(item, layoutId) => {
|
|
52
|
-
if (!layoutId) return
|
|
52
|
+
if (!layoutId) return;
|
|
53
53
|
const layoutParams = item.layoutParams[layoutId];
|
|
54
54
|
return 'color' in layoutParams ? layoutParams.color : DEFAULT_COLOR;
|
|
55
55
|
},
|
|
56
|
-
(animator, scroll, value) => animator.getTextColor({ color: value }, scroll).color,
|
|
56
|
+
(animator, scroll, value) => value ? animator.getTextColor({ color: value }, scroll).color : undefined,
|
|
57
57
|
sectionId,
|
|
58
58
|
[layoutId]
|
|
59
59
|
);
|
|
@@ -5,8 +5,8 @@ export const useItemAngle = (item: ItemAny, sectionId: string) => {
|
|
|
5
5
|
const angle = useKeyframeValue(
|
|
6
6
|
item,
|
|
7
7
|
KeyframeType.Rotation,
|
|
8
|
-
(item, layoutId) => layoutId ? item.area[layoutId].angle :
|
|
9
|
-
(animator, scroll, value) => animator.getRotation({ angle: value }, scroll).angle,
|
|
8
|
+
(item, layoutId) => layoutId ? item.area[layoutId].angle : undefined,
|
|
9
|
+
(animator, scroll, value) => value ? animator.getRotation({ angle: value }, scroll).angle : undefined,
|
|
10
10
|
sectionId
|
|
11
11
|
);
|
|
12
12
|
return angle;
|
|
Binary file
|