@cntrl-site/sdk-nextjs 1.5.1 → 1.5.2
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/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/modules.xml +8 -0
- package/.idea/sdk-nextjs.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/lib/components/items/GroupItem/GroupItem.js +5 -4
- package/lib/components/items/GroupItem/useGroupItem.js +7 -1
- package/package.json +2 -2
- package/src/components/items/GroupItem/GroupItem.tsx +4 -2
- package/src/components/items/GroupItem/useGroupItem.ts +14 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/sdk-nextjs.iml" filepath="$PROJECT_DIR$/.idea/sdk-nextjs.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
@@ -16,23 +16,24 @@ const useItemAngle_1 = require("../useItemAngle");
|
|
|
16
16
|
const useGroupItem_1 = require("./useGroupItem");
|
|
17
17
|
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
18
18
|
const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
19
|
-
var _a, _b, _c, _d, _e;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20
20
|
const id = (0, react_1.useId)();
|
|
21
21
|
const { items } = item;
|
|
22
22
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
23
23
|
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
24
|
-
const { opacity: itemOpacity } = (0, useGroupItem_1.useGroupItem)(item, sectionId);
|
|
24
|
+
const { opacity: itemOpacity, blur: itemBlur } = (0, useGroupItem_1.useGroupItem)(item, sectionId);
|
|
25
25
|
const layoutValues = [item.area, item.layoutParams];
|
|
26
26
|
const [ref, setRef] = (0, react_1.useState)(null);
|
|
27
27
|
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
28
|
-
const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle']);
|
|
28
|
+
const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle', 'blur']);
|
|
29
29
|
const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_a = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _a === void 0 ? void 0 : _a.angle, itemAngle);
|
|
30
30
|
const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_b = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _b === void 0 ? void 0 : _b.opacity, itemOpacity);
|
|
31
|
+
const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _c === void 0 ? void 0 : _c.blur, itemBlur);
|
|
31
32
|
const isInteractive = opacity !== 0 && opacity !== undefined;
|
|
32
33
|
(0, react_1.useEffect)(() => {
|
|
33
34
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
34
35
|
}, [isInteractive, onVisibilityChange]);
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_d = item.link) === null || _d === void 0 ? void 0 : _d.url, target: (_e = item.link) === null || _e === void 0 ? void 0 : _e.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(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { transition: (_f = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _f !== void 0 ? _f : 'none' }), children: items && items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, isParentVisible: isInteractive, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
36
37
|
.group-${item.id} {
|
|
37
38
|
position: absolute;
|
|
38
39
|
width: 100%;
|
|
@@ -12,6 +12,12 @@ function useGroupItem(item, sectionId) {
|
|
|
12
12
|
const layoutParams = item.layoutParams[layoutId];
|
|
13
13
|
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
14
14
|
}, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
15
|
-
|
|
15
|
+
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
|
|
16
|
+
if (!layoutId)
|
|
17
|
+
return;
|
|
18
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
19
|
+
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
20
|
+
}, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
21
|
+
return { opacity, blur };
|
|
16
22
|
}
|
|
17
23
|
exports.useGroupItem = useGroupItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntrl-site/sdk-nextjs",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "SDK for Next.js",
|
|
5
5
|
"author": "arsen@momdesign.nyc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@antfu/eslint-config": "^3.8.0",
|
|
32
32
|
"@cntrl-site/color": "^1.0.0",
|
|
33
33
|
"@cntrl-site/effects": "^1.3.2",
|
|
34
|
-
"@cntrl-site/sdk": "^1.
|
|
34
|
+
"@cntrl-site/sdk": "^1.19.0",
|
|
35
35
|
"@types/vimeo__player": "^2.18.0",
|
|
36
36
|
"@vimeo/player": "^2.25.0",
|
|
37
37
|
"html-react-parser": "^3.0.1",
|
|
@@ -14,13 +14,14 @@ export const GroupItem: FC<ItemProps<TGroupItem>> = ({ item, sectionId, onResize
|
|
|
14
14
|
const { items } = item;
|
|
15
15
|
const itemAngle = useItemAngle(item, sectionId);
|
|
16
16
|
const { layouts } = useCntrlContext();
|
|
17
|
-
const { opacity: itemOpacity } = useGroupItem(item, sectionId);
|
|
17
|
+
const { opacity: itemOpacity, blur: itemBlur } = useGroupItem(item, sectionId);
|
|
18
18
|
const layoutValues: Record<string, any>[] = [item.area, item.layoutParams];
|
|
19
19
|
const [ref, setRef] = useState<HTMLDivElement | null>(null);
|
|
20
20
|
useRegisterResize(ref, onResize);
|
|
21
|
-
const stateParams = interactionCtrl?.getState(['opacity', 'angle']);
|
|
21
|
+
const stateParams = interactionCtrl?.getState(['opacity', 'angle', 'blur']);
|
|
22
22
|
const angle = getStyleFromItemStateAndParams(stateParams?.styles?.angle, itemAngle);
|
|
23
23
|
const opacity = getStyleFromItemStateAndParams(stateParams?.styles?.opacity, itemOpacity);
|
|
24
|
+
const blur = getStyleFromItemStateAndParams(stateParams?.styles?.blur, itemBlur);
|
|
24
25
|
const isInteractive = opacity !== 0 && opacity !== undefined;
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
onVisibilityChange?.(isInteractive);
|
|
@@ -34,6 +35,7 @@ export const GroupItem: FC<ItemProps<TGroupItem>> = ({ item, sectionId, onResize
|
|
|
34
35
|
style={{
|
|
35
36
|
...(opacity !== undefined ? { opacity } : {}),
|
|
36
37
|
...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
|
|
38
|
+
...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
|
|
37
39
|
transition: stateParams?.transition ?? 'none'
|
|
38
40
|
}}
|
|
39
41
|
>
|
|
@@ -17,5 +17,18 @@ export function useGroupItem(item: GroupItem, sectionId: string) {
|
|
|
17
17
|
[layoutId]
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const blur = useKeyframeValue(
|
|
21
|
+
item,
|
|
22
|
+
KeyframeType.Blur,
|
|
23
|
+
(item, layoutId) => {
|
|
24
|
+
if (!layoutId) return;
|
|
25
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
26
|
+
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
27
|
+
},
|
|
28
|
+
(animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined,
|
|
29
|
+
sectionId,
|
|
30
|
+
[layoutId]
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return { opacity, blur };
|
|
21
34
|
}
|