@cntrl-site/sdk-nextjs 1.9.23 → 1.9.24

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.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -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
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -48,13 +48,9 @@ const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
48
48
  const stroke = strokeFill
49
49
  ? (_g = (0, getFill_1.getFill)(strokeFill)) !== null && _g !== void 0 ? _g : 'transparent'
50
50
  : 'transparent';
51
- return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_h = item.link) === null || _h === void 0 ? void 0 : _h.url, target: (_j = item.link) === null || _j === void 0 ? void 0 : _j.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({}, (strokeFill ? Object.assign({ borderColor: stroke, borderWidth: strokeWidth !== undefined ? `${strokeWidth * 100}vw` : 0, borderRadius: radius !== undefined ? `${radius * 100}vw` : 'inherit', borderStyle: 'solid' }, (strokeFill.type === 'image' ? {
52
- backgroundPosition: 'center',
53
- backgroundSize: strokeFill.behavior === 'repeat' ? `${strokeFill.backgroundSize}%` : strokeFill.behavior,
54
- backgroundRepeat: strokeFill.behavior === 'repeat' ? 'repeat' : 'no-repeat'
55
- } : {})) : {})), (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), (backdropFilterValue !== undefined
51
+ return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_h = item.link) === null || _h === void 0 ? void 0 : _h.url, target: (_j = item.link) === null || _j === void 0 ? void 0 : _j.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({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), (backdropFilterValue !== undefined
56
52
  ? { backdropFilter: backdropFilterValue, WebkitBackdropFilter: backdropFilterValue }
57
- : {})), { transition: (_k = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _k !== void 0 ? _k : 'none' }), children: itemFill && itemFill.map((fill) => {
53
+ : {})), { transition: (_k = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _k !== void 0 ? _k : 'none' }), children: itemFill && itemFill.map((fill, index) => {
58
54
  var _a, _b;
59
55
  const stateFillLayer = stateFillLayers === null || stateFillLayers === void 0 ? void 0 : stateFillLayers.find((layer) => layer.id === fill.id);
60
56
  const value = stateFillLayer
@@ -63,7 +59,7 @@ const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
63
59
  const background = value
64
60
  ? (_b = (0, getFill_1.getFill)(value)) !== null && _b !== void 0 ? _b : 'transparent'
65
61
  : 'transparent';
66
- return ((0, jsx_runtime_1.jsx)(Fill, { fill: value, itemId: item.id, background: background, solidTransition: solidTransition, radius: radius, strokeWidth: strokeWidth }));
62
+ return ((0, jsx_runtime_1.jsx)(Fill, { fill: value, itemId: item.id, background: background, solidTransition: solidTransition, transition: (stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) || '', radius: radius, strokeWidth: strokeWidth, isHighest: index === itemFill.length - 1, borderColor: stroke }, fill.id));
67
63
  }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
68
64
  .rectangle-${item.id} {
69
65
  position: absolute;
@@ -96,16 +92,27 @@ const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
96
92
  ` })] }) }));
97
93
  };
98
94
  exports.RectangleItem = RectangleItem;
99
- function Fill({ fill, itemId, background, solidTransition, radius, strokeWidth }) {
95
+ function Fill({ fill, itemId, background, solidTransition, transition, radius, strokeWidth, isHighest, borderColor }) {
100
96
  const isRotatedImage = fill.type === 'image' && fill.rotation && fill.rotation !== 0;
101
- return ((0, jsx_runtime_1.jsx)("div", { className: fill.type === 'image' ? `image-fill-${itemId}` : `fill-${itemId}`, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (fill.type === 'solid' ? { background, transition: solidTransition } : {})), (fill.type === 'image'
97
+ return ((0, jsx_runtime_1.jsx)("div", { className: fill.type === 'image' ? `image-fill-${itemId}` : `fill-${itemId}`, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (fill.type === 'solid' ? {
98
+ background,
99
+ transition: transition && transition !== 'none' && transition.trim()
100
+ ? `${solidTransition}, ${transition}`
101
+ : solidTransition
102
+ } : {})), (fill.type === 'image'
102
103
  ? {
103
104
  transform: `rotate(${fill.rotation}deg)`,
104
105
  backgroundImage: `url(${fill.src})`,
105
106
  backgroundSize: fill.behavior === 'repeat' ? `${fill.backgroundSize}%` : fill.behavior,
106
107
  backgroundRepeat: fill.behavior === 'repeat' ? 'repeat' : 'no-repeat',
108
+ backgroundOrigin: 'border-box',
107
109
  opacity: fill.opacity
108
110
  }
109
- : { background })), { position: 'absolute', mixBlendMode: fill.blendMode, borderRadius: `calc(${radius * 100}vw - ${strokeWidth * 100}vw)`, top: 0, left: 0, width: '100%', height: '100%', pointerEvents: 'none' }), (isRotatedImage ? { overflow: 'hidden' } : {})) }, fill.id));
111
+ : { background })), { position: 'absolute', mixBlendMode: fill.blendMode, borderRadius: `${radius * 100}vw`, top: 0, left: 0, width: '100%', height: '100%', pointerEvents: 'none' }), (isHighest ? {
112
+ borderColor,
113
+ borderWidth: `${strokeWidth * 100}vw`,
114
+ borderStyle: 'solid',
115
+ boxSizing: 'border-box'
116
+ } : {})), (isRotatedImage ? { overflow: 'hidden' } : {})), (fill.type !== 'solid' ? { transition } : {})) }));
110
117
  }
111
118
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.9.23",
3
+ "version": "1.9.24",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -58,18 +58,6 @@ export const RectangleItem: FC<ItemProps<TRectangleItem>> = ({ item, sectionId,
58
58
  className={`rectangle-${item.id}`}
59
59
  ref={setRef}
60
60
  style={{
61
- ...(strokeFill ? {
62
- borderColor: stroke,
63
- borderWidth: strokeWidth !== undefined ? `${strokeWidth * 100}vw` : 0,
64
- borderRadius: radius !== undefined ? `${radius * 100}vw` : 'inherit',
65
- borderStyle: 'solid',
66
- ...(strokeFill.type === 'image' ? {
67
- backgroundPosition: 'center',
68
- backgroundSize: strokeFill.behavior === 'repeat' ? `${strokeFill.backgroundSize}%` : strokeFill.behavior,
69
- backgroundRepeat: strokeFill.behavior === 'repeat' ? 'repeat' : 'no-repeat'
70
- } : {})
71
- } : {}),
72
- ...(radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {}),
73
61
  ...(angle !== undefined ? { transform: `rotate(${angle}deg)` } : {}),
74
62
  ...(blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {}),
75
63
  willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset',
@@ -80,7 +68,7 @@ export const RectangleItem: FC<ItemProps<TRectangleItem>> = ({ item, sectionId,
80
68
  transition: stateParams?.transition ?? 'none'
81
69
  }}
82
70
  >
83
- {itemFill && itemFill.map((fill) => {
71
+ {itemFill && itemFill.map((fill, index) => {
84
72
  const stateFillLayer = stateFillLayers?.find((layer) => layer.id === fill.id);
85
73
  const value = stateFillLayer
86
74
  ? (getStyleFromItemStateAndParams<FillLayer>(stateFillLayer, fill) ?? fill)
@@ -91,12 +79,16 @@ export const RectangleItem: FC<ItemProps<TRectangleItem>> = ({ item, sectionId,
91
79
 
92
80
  return (
93
81
  <Fill
82
+ key={fill.id}
94
83
  fill={value}
95
84
  itemId={item.id}
96
85
  background={background}
97
86
  solidTransition={solidTransition}
87
+ transition={stateParams?.transition || ''}
98
88
  radius={radius}
99
89
  strokeWidth={strokeWidth}
90
+ isHighest={index === itemFill.length - 1}
91
+ borderColor={stroke}
100
92
  />
101
93
  );
102
94
  })}
@@ -136,33 +128,55 @@ export const RectangleItem: FC<ItemProps<TRectangleItem>> = ({ item, sectionId,
136
128
  );
137
129
  };
138
130
 
139
- function Fill({ fill, itemId, background, solidTransition, radius, strokeWidth }: { fill: FillLayer; itemId: string; background: string; solidTransition: string; radius: number; strokeWidth: number; }) {
131
+ function Fill({ fill, itemId, background, solidTransition, transition, radius, strokeWidth, isHighest, borderColor }: {
132
+ fill: FillLayer;
133
+ itemId: string;
134
+ background: string;
135
+ solidTransition: string;
136
+ transition: string;
137
+ radius: number;
138
+ strokeWidth: number;
139
+ isHighest: boolean;
140
+ borderColor: string;
141
+ }) {
140
142
  const isRotatedImage = fill.type === 'image' && fill.rotation && fill.rotation !== 0;
141
143
 
142
144
  return (
143
145
  <div
144
- key={fill.id}
145
146
  className={fill.type === 'image' ? `image-fill-${itemId}` : `fill-${itemId}`}
146
147
  style={{
147
- ...(fill.type === 'solid' ? { background, transition: solidTransition } : {}),
148
+ ...(fill.type === 'solid' ? {
149
+ background,
150
+ transition: transition && transition !== 'none' && transition.trim()
151
+ ? `${solidTransition}, ${transition}`
152
+ : solidTransition
153
+ } : {}),
148
154
  ...(fill.type === 'image'
149
155
  ? {
150
156
  transform: `rotate(${fill.rotation}deg)`,
151
157
  backgroundImage: `url(${fill.src})`,
152
158
  backgroundSize: fill.behavior === 'repeat' ? `${fill.backgroundSize}%` : fill.behavior,
153
159
  backgroundRepeat: fill.behavior === 'repeat' ? 'repeat' : 'no-repeat',
160
+ backgroundOrigin: 'border-box',
154
161
  opacity: fill.opacity
155
162
  }
156
163
  : { background }),
157
164
  position: 'absolute',
158
165
  mixBlendMode: fill.blendMode as any,
159
- borderRadius: `calc(${radius * 100}vw - ${strokeWidth * 100}vw)`,
166
+ borderRadius: `${radius * 100}vw`,
160
167
  top: 0,
161
168
  left: 0,
162
169
  width: '100%',
163
170
  height: '100%',
164
171
  pointerEvents: 'none',
165
- ...(isRotatedImage ? { overflow: 'hidden' } : {})
172
+ ...(isHighest ? {
173
+ borderColor,
174
+ borderWidth: `${strokeWidth * 100}vw`,
175
+ borderStyle: 'solid',
176
+ boxSizing: 'border-box'
177
+ } : {}),
178
+ ...(isRotatedImage ? { overflow: 'hidden' } : {}),
179
+ ...(fill.type !== 'solid' ? { transition } : {})
166
180
  }}
167
181
  >
168
182
  </div>
Binary file