@cntrl-site/sdk-nextjs 1.7.0-alpha.1 → 1.7.0-alpha.11
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.
|
@@ -17,6 +17,7 @@ const useLayoutContext_1 = require("../../useLayoutContext");
|
|
|
17
17
|
const ComponentItem = ({ item, sectionId, onResize, interactionCtrl }) => {
|
|
18
18
|
var _a, _b, _c;
|
|
19
19
|
const sdk = (0, useCntrlContext_1.useCntrlContext)();
|
|
20
|
+
const id = (0, react_1.useId)();
|
|
20
21
|
const { layouts } = sdk;
|
|
21
22
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
22
23
|
const layout = (0, useLayoutContext_1.useLayoutContext)();
|
|
@@ -32,19 +33,15 @@ const ComponentItem = ({ item, sectionId, onResize, interactionCtrl }) => {
|
|
|
32
33
|
return null;
|
|
33
34
|
const Element = component.element;
|
|
34
35
|
const parameters = item.layoutParams[layout].parameters;
|
|
35
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `custom-component-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _c !== void 0 ? _c : 'none' }), children: (0, jsx_runtime_1.jsx)(Element, Object.assign({ content: item.commonParams.content }, parameters)) }), (0, jsx_runtime_1.jsx)(style_1.default, { id:
|
|
36
|
-
.custom-component-${item.id} {
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
}
|
|
40
|
-
${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
|
|
36
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `custom-component-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _c !== void 0 ? _c : 'none' }), children: (0, jsx_runtime_1.jsx)(Element, Object.assign({ content: item.commonParams.content }, parameters)) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
|
|
41
37
|
return (`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
.custom-component-${item.id} {
|
|
39
|
+
transform: rotate(${area.angle}deg);
|
|
40
|
+
opacity: ${layoutParams.opacity};
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
`);
|
|
45
|
+
})}` })] }));
|
|
49
46
|
};
|
|
50
47
|
exports.ComponentItem = ComponentItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntrl-site/sdk-nextjs",
|
|
3
|
-
"version": "1.7.0-alpha.
|
|
3
|
+
"version": "1.7.0-alpha.11",
|
|
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.21.0-alpha.
|
|
34
|
+
"@cntrl-site/sdk": "^1.21.0-alpha.12",
|
|
35
35
|
"@types/vimeo__player": "^2.18.0",
|
|
36
36
|
"@vimeo/player": "^2.25.0",
|
|
37
37
|
"html-react-parser": "^3.0.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ItemProps } from '../Item';
|
|
2
2
|
import { ComponentItem as TComponentItem, getLayoutStyles } from '@cntrl-site/sdk';
|
|
3
|
-
import { FC, useState } from 'react';
|
|
3
|
+
import { FC, useId, useState } from 'react';
|
|
4
4
|
import { useCntrlContext } from '../../../provider/useCntrlContext';
|
|
5
5
|
import { useComponentItem } from './useComponentItem';
|
|
6
6
|
import { useItemAngle } from '../useItemAngle';
|
|
@@ -11,6 +11,7 @@ import { useLayoutContext } from '../../useLayoutContext';
|
|
|
11
11
|
|
|
12
12
|
export const ComponentItem: FC<ItemProps<TComponentItem>> = ({ item, sectionId, onResize, interactionCtrl }) => {
|
|
13
13
|
const sdk = useCntrlContext();
|
|
14
|
+
const id = useId();
|
|
14
15
|
const { layouts } = sdk;
|
|
15
16
|
const itemAngle = useItemAngle(item, sectionId);
|
|
16
17
|
const layout = useLayoutContext();
|
|
@@ -41,21 +42,17 @@ export const ComponentItem: FC<ItemProps<TComponentItem>> = ({ item, sectionId,
|
|
|
41
42
|
{...parameters}
|
|
42
43
|
/>
|
|
43
44
|
</div>
|
|
44
|
-
<JSXStyle id={
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
`);
|
|
57
|
-
})}
|
|
58
|
-
`}
|
|
45
|
+
<JSXStyle id={id}>
|
|
46
|
+
{`${getLayoutStyles(layouts, layoutValues, ([area, layoutParams]) => {
|
|
47
|
+
return (`
|
|
48
|
+
.custom-component-${item.id} {
|
|
49
|
+
transform: rotate(${area.angle}deg);
|
|
50
|
+
opacity: ${layoutParams.opacity};
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
}
|
|
54
|
+
`);
|
|
55
|
+
})}`}
|
|
59
56
|
</JSXStyle>
|
|
60
57
|
</>
|
|
61
58
|
);
|