@cntrl-site/sdk-nextjs 0.30.0 → 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.
|
Binary file
|
|
Binary file
|
package/lib/components/Item.js
CHANGED
|
@@ -102,18 +102,14 @@ 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: {
|
|
106
|
-
opacity: (keyframes.length !== 0 && !layout) ? 0 : 1,
|
|
107
|
-
top: `${stickyTop * 100}vw`,
|
|
108
|
-
height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset'
|
|
109
|
-
}, children: (0, jsx_runtime_1.jsx)(RichTextWrapper, { isRichText: isRichText, children: (0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: Object.assign(Object.assign({}, (dimensions ? {
|
|
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 ? {
|
|
110
106
|
width: `${sizingAxis.x === 'manual'
|
|
111
107
|
? isRichText
|
|
112
108
|
? `${dimensions.width * exemplary}px`
|
|
113
109
|
: `${dimensions.width * 100}vw`
|
|
114
110
|
: 'max-content'}`,
|
|
115
111
|
height: `${sizingAxis.y === 'manual' ? `${dimensions.height * 100}vw` : 'unset'}`
|
|
116
|
-
} : {})),
|
|
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: `
|
|
117
113
|
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, hoverParams, sticky, sectionHeight, layoutParams], exemplary) => {
|
|
118
114
|
const sizingAxis = parseSizing(layoutParams.sizing);
|
|
119
115
|
const isScreenBasedBottom = area.positionType === sdk_1.PositionType.ScreenBased && area.anchorSide === sdk_1.AnchorSide.Bottom;
|
|
@@ -126,6 +122,8 @@ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
|
126
122
|
transition: opacity 0.1s linear;
|
|
127
123
|
display: ${hidden ? 'none' : 'block'};
|
|
128
124
|
height: fit-content;
|
|
125
|
+
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
126
|
+
transform: scale(${area.scale});
|
|
129
127
|
}
|
|
130
128
|
.item-${item.id}-inner {
|
|
131
129
|
transition: ${(0, HoverStyles_1.getTransitions)(['width', 'height', 'scale'], hoverParams)};
|
|
@@ -135,9 +133,6 @@ const Item = ({ item, sectionId, articleHeight, isInGroup = false }) => {
|
|
|
135
133
|
: `${area.width * 100}vw`
|
|
136
134
|
: 'max-content'};
|
|
137
135
|
height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
|
|
138
|
-
transform: scale(${area.scale});
|
|
139
|
-
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
140
|
-
--webkit-backface-visibility: hidden;
|
|
141
136
|
}
|
|
142
137
|
.item-wrapper-${item.id} {
|
|
143
138
|
position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
|
package/package.json
CHANGED
package/src/components/Item.tsx
CHANGED
|
@@ -147,7 +147,8 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isI
|
|
|
147
147
|
style={{
|
|
148
148
|
opacity: (keyframes.length !== 0 && !layout) ? 0 : 1,
|
|
149
149
|
top: `${stickyTop * 100}vw`,
|
|
150
|
-
height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset'
|
|
150
|
+
height: isRichText && itemHeight ? `${itemHeight * 100}vw` : 'unset',
|
|
151
|
+
...(scale !== undefined ? { transform: `scale(${scale}) translateZ(0)`, '-webkit-transform': `scale(${scale}) translateZ(0)` } : {}),
|
|
151
152
|
}}
|
|
152
153
|
>
|
|
153
154
|
<RichTextWrapper isRichText={isRichText}>
|
|
@@ -160,8 +161,7 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isI
|
|
|
160
161
|
? `${dimensions.width * exemplary}px`
|
|
161
162
|
: `${dimensions.width * 100}vw`
|
|
162
163
|
: 'max-content'}`,
|
|
163
|
-
height: `${sizingAxis.y === 'manual' ? `${dimensions.height * 100}vw` : 'unset'}` } : {})
|
|
164
|
-
...(scale !== undefined ? { transform: `scale(${scale})` } : {}),
|
|
164
|
+
height: `${sizingAxis.y === 'manual' ? `${dimensions.height * 100}vw` : 'unset'}` } : {})
|
|
165
165
|
}}
|
|
166
166
|
>
|
|
167
167
|
<ItemComponent item={item} sectionId={sectionId} onResize={handleItemResize} articleHeight={articleHeight} />
|
|
@@ -181,6 +181,8 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isI
|
|
|
181
181
|
transition: opacity 0.1s linear;
|
|
182
182
|
display: ${hidden ? 'none' : 'block'};
|
|
183
183
|
height: fit-content;
|
|
184
|
+
transform-origin: ${ScaleAnchorMap[scaleAnchor]};
|
|
185
|
+
transform: scale(${area.scale});
|
|
184
186
|
}
|
|
185
187
|
.item-${item.id}-inner {
|
|
186
188
|
transition: ${getTransitions(['width', 'height', 'scale'], hoverParams)};
|
|
@@ -190,9 +192,6 @@ export const Item: FC<ItemWrapperProps> = ({ item, sectionId, articleHeight, isI
|
|
|
190
192
|
: `${area.width * 100}vw`
|
|
191
193
|
: 'max-content'};
|
|
192
194
|
height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
|
|
193
|
-
transform: scale(${area.scale});
|
|
194
|
-
transform-origin: ${ScaleAnchorMap[scaleAnchor]};
|
|
195
|
-
--webkit-backface-visibility: hidden;
|
|
196
195
|
}
|
|
197
196
|
.item-wrapper-${item.id} {
|
|
198
197
|
position: ${area.positionType === PositionType.ScreenBased ? 'fixed': 'absolute'};
|