@cntrl-site/sdk-nextjs 1.9.42 → 1.9.43

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.
Files changed (138) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +4 -4
  3. package/TODO.md +1 -1
  4. package/eslint.config.mjs +35 -35
  5. package/jest.config.js +6 -6
  6. package/lib/common/useItemFXData.js +7 -7
  7. package/lib/components/Article.js +5 -5
  8. package/lib/components/LayoutStyle.js +4 -4
  9. package/lib/components/Section/Section.js +27 -27
  10. package/lib/components/items/CodeEmbedItem/CodeEmbedItem.js +36 -36
  11. package/lib/components/items/ComponentItem/ComponentItem.js +13 -13
  12. package/lib/components/items/CompoundItem/CompoundChild.js +20 -20
  13. package/lib/components/items/CompoundItem/CompoundItem.js +14 -14
  14. package/lib/components/items/CustomItem/CustomItem.js +9 -9
  15. package/lib/components/items/EmbedVideoItem/VimeoEmbed.js +24 -24
  16. package/lib/components/items/EmbedVideoItem/YoutubeEmbed.js +27 -27
  17. package/lib/components/items/FileItem/ImageItem.js +40 -40
  18. package/lib/components/items/FileItem/VideoItem.js +64 -64
  19. package/lib/components/items/GroupItem/GroupItem.js +14 -14
  20. package/lib/components/items/Item.js +36 -32
  21. package/lib/components/items/RectangleItem/RectangleItem.js +27 -27
  22. package/lib/components/items/RichTextItem/RichTextItem.js +22 -22
  23. package/lib/utils/RichTextConverter/RichTextConverter.js +21 -21
  24. package/lib/utils/getItemTopStyle.js +27 -1
  25. package/package.json +60 -60
  26. package/src/ItemGeometry/CSSPropertyNameMap.ts +37 -37
  27. package/src/ItemGeometry/GenericGeometryController.ts +59 -59
  28. package/src/ItemGeometry/ItemGeometryContext.ts +4 -4
  29. package/src/ItemGeometry/ItemGeometryController.ts +22 -22
  30. package/src/ItemGeometry/ItemGeometryService.ts +34 -34
  31. package/src/ItemGeometry/RichTextGeometryController.ts +166 -166
  32. package/src/ItemGeometry/useItemGeometry.ts +25 -25
  33. package/src/common/useCurrentLayout.ts +52 -52
  34. package/src/common/useExemplary.ts +9 -9
  35. package/src/common/useItemFXData.ts +47 -47
  36. package/src/common/useKeyframeValue.ts +85 -85
  37. package/src/common/useRegisterResize.ts +16 -16
  38. package/src/components/Article.tsx +75 -75
  39. package/src/components/ArticleWrapper.tsx +21 -21
  40. package/src/components/Head.tsx +56 -56
  41. package/src/components/LayoutStyle.tsx +21 -21
  42. package/src/components/Page.tsx +38 -38
  43. package/src/components/ScrollPlaybackVideo.tsx +56 -56
  44. package/src/components/Section/Section.tsx +129 -129
  45. package/src/components/Section/SectionImage.tsx +48 -48
  46. package/src/components/Section/SectionVideo.tsx +144 -144
  47. package/src/components/Section/useSectionColor.ts +19 -19
  48. package/src/components/Section/useSectionHeightMap.ts +19 -19
  49. package/src/components/items/CodeEmbedItem/CodeEmbedItem.tsx +147 -147
  50. package/src/components/items/CodeEmbedItem/useCodeEmbedItem.ts +36 -36
  51. package/src/components/items/ComponentItem/ComponentItem.tsx +72 -72
  52. package/src/components/items/ComponentItem/useComponentItem.ts +35 -35
  53. package/src/components/items/CompoundItem/CompoundChild.tsx +150 -150
  54. package/src/components/items/CompoundItem/CompoundItem.tsx +87 -87
  55. package/src/components/items/CompoundItem/useCompoundItem.ts +21 -21
  56. package/src/components/items/CustomItem/CustomItem.tsx +50 -50
  57. package/src/components/items/EmbedVideoItem/VimeoEmbed.tsx +216 -216
  58. package/src/components/items/EmbedVideoItem/YoutubeEmbed.tsx +200 -200
  59. package/src/components/items/EmbedVideoItem/useEmbedVideoItem.ts +46 -46
  60. package/src/components/items/FileItem/ImageItem.tsx +165 -165
  61. package/src/components/items/FileItem/VideoItem.tsx +282 -282
  62. package/src/components/items/FileItem/useFileItem.ts +81 -81
  63. package/src/components/items/GroupItem/GroupItem.tsx +98 -98
  64. package/src/components/items/GroupItem/useGroupItem.ts +34 -34
  65. package/src/components/items/Item.tsx +267 -262
  66. package/src/components/items/LinkWrapper.tsx +39 -39
  67. package/src/components/items/RectangleItem/RectangleItem.tsx +184 -184
  68. package/src/components/items/RectangleItem/useRectangleItem.ts +89 -89
  69. package/src/components/items/RichTextItem/RichTextItem.tsx +112 -112
  70. package/src/components/items/RichTextItem/useRichTextItem.ts +12 -12
  71. package/src/components/items/RichTextWrapper.tsx +15 -15
  72. package/src/components/items/itemsMap.ts +28 -28
  73. package/src/components/items/useDraggable.ts +252 -252
  74. package/src/components/items/useItemAngle.ts +13 -13
  75. package/src/components/items/useItemArea.ts +35 -35
  76. package/src/components/items/useItemPointerEvents.ts +23 -23
  77. package/src/components/items/useItemScale.ts +17 -17
  78. package/src/components/items/useItemTriggers.ts +15 -15
  79. package/src/components/items/useRichTextItemValues.ts +66 -66
  80. package/src/components/items/useSizing.ts +25 -25
  81. package/src/components/items/useStickyItemTop.ts +21 -21
  82. package/src/components/useLayoutContext.ts +7 -7
  83. package/src/index.ts +24 -24
  84. package/src/interactions/InteractionsRegistry.ts +512 -512
  85. package/src/interactions/ItemInteractionCtrl.ts +78 -78
  86. package/src/interactions/getTransition.ts +27 -27
  87. package/src/interactions/types.ts +36 -36
  88. package/src/interactions/useItemInteractionCtrl.ts +18 -18
  89. package/src/provider/ArticleRectContext.ts +4 -4
  90. package/src/provider/CntrlContext.ts +5 -5
  91. package/src/provider/CntrlProvider.tsx +11 -11
  92. package/src/provider/CntrlSdkContext.ts +84 -84
  93. package/src/provider/CustomItemRegistry.ts +14 -14
  94. package/src/provider/CustomItemTypes.ts +3 -3
  95. package/src/provider/CustomSectionRegistry.ts +25 -25
  96. package/src/provider/InteractionsContext.tsx +73 -73
  97. package/src/provider/Keyframes.ts +11 -11
  98. package/src/provider/KeyframesContext.ts +5 -5
  99. package/src/provider/LayoutContext.ts +3 -3
  100. package/src/provider/WebGLContextManagerContext.tsx +4 -4
  101. package/src/provider/defaultContext.ts +8 -8
  102. package/src/provider/useCntrlContext.ts +8 -8
  103. package/src/styled-jsx.d.ts +1 -1
  104. package/src/utils/Animator/Animator.ts +570 -570
  105. package/src/utils/ArticleRectManager/ArticleRectObserver.ts +93 -93
  106. package/src/utils/ArticleRectManager/useArticleRectObserver.ts +17 -17
  107. package/src/utils/ArticleRectManager/useSectionRegistry.ts +11 -11
  108. package/src/utils/CSSNumeric.ts +19 -19
  109. package/src/utils/EventEmitter.ts +41 -41
  110. package/src/utils/RichTextConverter/RichTextConverter.tsx +342 -342
  111. package/src/utils/ScaleAnchorMap.ts +13 -13
  112. package/src/utils/StickyManager/StickyManager.ts +23 -23
  113. package/src/utils/Youtube/YouTubeIframeApiLoader.ts +58 -58
  114. package/src/utils/Youtube/YoutubeIframeApi.ts +101 -101
  115. package/src/utils/Youtube/useYouTubeIframeApi.ts +12 -12
  116. package/src/utils/areFillsVisible/areFillsVisible.test.ts +63 -63
  117. package/src/utils/areFillsVisible/areFillsVisible.ts +37 -37
  118. package/src/utils/binSearchInsertAt.ts +33 -33
  119. package/src/utils/castObject.ts +10 -10
  120. package/src/utils/checkOverflowClipSupport.ts +13 -13
  121. package/src/utils/domDfs.ts +11 -11
  122. package/src/utils/effects/useImageFx.ts +156 -156
  123. package/src/utils/effects/useVideoFx.ts +158 -158
  124. package/src/utils/getAnchoredItemTop.ts +12 -12
  125. package/src/utils/getCompoundBoundaryStyles.ts +60 -60
  126. package/src/utils/getFill.ts +46 -46
  127. package/src/utils/getFontFamilyValue.ts +3 -3
  128. package/src/utils/getInvertedRanges.ts +43 -43
  129. package/src/utils/getItemTopStyle.ts +39 -14
  130. package/src/utils/getStyleFromItemStateAndParams.ts +8 -8
  131. package/src/utils/getValidYoutubeUrl.ts +29 -29
  132. package/src/utils/isItemType.ts +5 -5
  133. package/src/utils/rangeMap.ts +13 -13
  134. package/src/utils/useElementRect.ts +23 -23
  135. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  136. package/.idea/modules.xml +0 -8
  137. package/.idea/sdk-nextjs.iml +0 -12
  138. package/.idea/vcs.xml +0 -6
@@ -139,35 +139,35 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibi
139
139
  top: '0',
140
140
  left: '0',
141
141
  zIndex: 1
142
- }, alt: "Cover img" }))), (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), { transition: (_j = frameStateParams === null || frameStateParams === void 0 ? void 0 : frameStateParams.transition) !== null && _j !== void 0 ? _j : 'none' }) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
143
- .embed-youtube-video-wrapper-${item.id},
144
- .embed-${item.id} {
145
- position: absolute;
146
- width: 100%;
147
- height: 100%;
148
- }
149
- .embed-${item.id} {
150
- overflow: hidden;
151
- }
152
- .embed-youtube-video-wrapper-${item.id} iframe {
153
- width: 100%;
154
- height: 100%;
155
- z-index: 1;
156
- border: none;
157
- }
142
+ }, alt: "Cover img" }))), (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), { transition: (_j = frameStateParams === null || frameStateParams === void 0 ? void 0 : frameStateParams.transition) !== null && _j !== void 0 ? _j : 'none' }) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
143
+ .embed-youtube-video-wrapper-${item.id},
144
+ .embed-${item.id} {
145
+ position: absolute;
146
+ width: 100%;
147
+ height: 100%;
148
+ }
149
+ .embed-${item.id} {
150
+ overflow: hidden;
151
+ }
152
+ .embed-youtube-video-wrapper-${item.id} iframe {
153
+ width: 100%;
154
+ height: 100%;
155
+ z-index: 1;
156
+ border: none;
157
+ }
158
158
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
159
- return (`
160
- .embed-youtube-video-wrapper-${item.id} {
161
- opacity: ${layoutParams.opacity};
162
- transform: rotate(${area.angle}deg);
163
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
164
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
165
- }
166
- .embed-youtube-video-wrapper-${item.id} .embed-${item.id} {
167
- border-radius: ${layoutParams.radius * 100}vw;
168
- }
159
+ return (`
160
+ .embed-youtube-video-wrapper-${item.id} {
161
+ opacity: ${layoutParams.opacity};
162
+ transform: rotate(${area.angle}deg);
163
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
164
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
165
+ }
166
+ .embed-youtube-video-wrapper-${item.id} .embed-${item.id} {
167
+ border-radius: ${layoutParams.radius * 100}vw;
168
+ }
169
169
  `);
170
- })}
170
+ })}
171
171
  ` })] }));
172
172
  };
173
173
  exports.YoutubeEmbedItem = YoutubeEmbedItem;
@@ -73,48 +73,48 @@ const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
73
73
  }, [isInteractive, onVisibilityChange]);
74
74
  return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_p = item.link) === null || _p === void 0 ? void 0 : _p.url, target: (_q = item.link) === null || _q === void 0 ? void 0 : _q.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `image-wrapper-${item.id}`, ref: setWrapperRef, 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)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_r = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _r !== void 0 ? _r : 'none' }), children: hasGLEffect && isFXAllowed
75
75
  ? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `img-canvas image-${item.id}`, width: rectWidth, height: rectHeight }))
76
- : ((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
- .image-wrapper-${item.id} {
78
- position: absolute;
79
- width: 100%;
80
- height: 100%;
81
- box-sizing: border-box;
82
- display: flex;
83
- }
84
- .image {
85
- width: 100%;
86
- height: 100%;
87
- opacity: 1;
88
- object-fit: cover;
89
- pointer-events: none;
90
- border-style: solid;
91
- overflow: hidden;
92
- box-sizing: border-box;
93
- }
94
- .img-canvas {
95
- border: solid;
96
- width: 100%;
97
- height: 100%;
98
- pointer-events: none;
99
- border-width: 0;
100
- box-sizing: border-box;
101
- }
76
+ : ((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
+ .image-wrapper-${item.id} {
78
+ position: absolute;
79
+ width: 100%;
80
+ height: 100%;
81
+ box-sizing: border-box;
82
+ display: flex;
83
+ }
84
+ .image {
85
+ width: 100%;
86
+ height: 100%;
87
+ opacity: 1;
88
+ object-fit: cover;
89
+ pointer-events: none;
90
+ border-style: solid;
91
+ overflow: hidden;
92
+ box-sizing: border-box;
93
+ }
94
+ .img-canvas {
95
+ border: solid;
96
+ width: 100%;
97
+ height: 100%;
98
+ pointer-events: none;
99
+ border-width: 0;
100
+ box-sizing: border-box;
101
+ }
102
102
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
103
- return (`
104
- .image-wrapper-${item.id} {
105
- opacity: ${layoutParams.opacity};
106
- transform: rotate(${area.angle}deg);
107
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
108
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
109
- }
110
- .image-${item.id} {
111
- border: solid;
112
- border-color: ${stroke};
113
- border-radius: ${layoutParams.radius * 100}vw;
114
- border-width: ${layoutParams.strokeWidth * 100}vw;
115
- }
103
+ return (`
104
+ .image-wrapper-${item.id} {
105
+ opacity: ${layoutParams.opacity};
106
+ transform: rotate(${area.angle}deg);
107
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
108
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
109
+ }
110
+ .image-${item.id} {
111
+ border: solid;
112
+ border-color: ${stroke};
113
+ border-radius: ${layoutParams.radius * 100}vw;
114
+ border-width: ${layoutParams.strokeWidth * 100}vw;
115
+ }
116
116
  `);
117
- })}
117
+ })}
118
118
  ` })] }) }));
119
119
  };
120
120
  exports.ImageItem = ImageItem;
@@ -136,72 +136,72 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
136
136
  else {
137
137
  videoRef.play();
138
138
  }
139
- } })))] }))] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
140
- .video-wrapper-${item.id} {
141
- position: absolute;
142
- overflow: hidden;
143
- width: 100%;
144
- height: 100%;
145
- box-sizing: border-box;
146
- opacity: ${opacity};
147
- }
148
- .video-overlay-${item.id} {
149
- position: absolute;
150
- top: 0;
151
- left: 0;
152
- cursor: pointer;
153
- width: 100%;
154
- height: 100%;
155
- }
156
- .video-cover-${item.id} {
157
- position: absolute;
158
- top: 0;
159
- left: 0;
160
- cursor: pointer;
161
- width: 100%;
162
- height: 100%;
163
- object-fit: cover;
164
- }
165
- .video {
166
- width: 100%;
167
- height: 100%;
168
- box-sizing: border-box;
169
- opacity: 1;
170
- object-fit: cover;
171
- overflow: hidden;
172
- border-style: solid;
173
- }
174
- .video-${item.id} {
175
- border-radius: ${radius !== undefined ? `${radius * 100}vw` : '0'};
176
- }
177
- .video-playback-wrapper {
178
- display: flex;
179
- justify-content: center;
180
- }
181
- .video-canvas {
182
- border: solid;
183
- width: 100%;
184
- height: 100%;
185
- pointer-events: none;
186
- border-width: 0;
187
- box-sizing: border-box;
188
- }
139
+ } })))] }))] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
140
+ .video-wrapper-${item.id} {
141
+ position: absolute;
142
+ overflow: hidden;
143
+ width: 100%;
144
+ height: 100%;
145
+ box-sizing: border-box;
146
+ opacity: ${opacity};
147
+ }
148
+ .video-overlay-${item.id} {
149
+ position: absolute;
150
+ top: 0;
151
+ left: 0;
152
+ cursor: pointer;
153
+ width: 100%;
154
+ height: 100%;
155
+ }
156
+ .video-cover-${item.id} {
157
+ position: absolute;
158
+ top: 0;
159
+ left: 0;
160
+ cursor: pointer;
161
+ width: 100%;
162
+ height: 100%;
163
+ object-fit: cover;
164
+ }
165
+ .video {
166
+ width: 100%;
167
+ height: 100%;
168
+ box-sizing: border-box;
169
+ opacity: 1;
170
+ object-fit: cover;
171
+ overflow: hidden;
172
+ border-style: solid;
173
+ }
174
+ .video-${item.id} {
175
+ border-radius: ${radius !== undefined ? `${radius * 100}vw` : '0'};
176
+ }
177
+ .video-playback-wrapper {
178
+ display: flex;
179
+ justify-content: center;
180
+ }
181
+ .video-canvas {
182
+ border: solid;
183
+ width: 100%;
184
+ height: 100%;
185
+ pointer-events: none;
186
+ border-width: 0;
187
+ box-sizing: border-box;
188
+ }
189
189
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
190
- return (`
191
- .video-wrapper-${item.id} {
192
- opacity: ${layoutParams.opacity};
193
- transform: rotate(${area.angle}deg);
194
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
195
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
196
- }
197
- .video-${item.id} {
198
- border: solid;
199
- border-color: ${stroke};
200
- border-radius: ${layoutParams.radius * 100}vw;
201
- border-width: ${layoutParams.strokeWidth * 100}vw;
202
- }
190
+ return (`
191
+ .video-wrapper-${item.id} {
192
+ opacity: ${layoutParams.opacity};
193
+ transform: rotate(${area.angle}deg);
194
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
195
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
196
+ }
197
+ .video-${item.id} {
198
+ border: solid;
199
+ border-color: ${stroke};
200
+ border-radius: ${layoutParams.radius * 100}vw;
201
+ border-width: ${layoutParams.strokeWidth * 100}vw;
202
+ }
203
203
  `);
204
- })}
204
+ })}
205
205
  ` })] }));
206
206
  };
207
207
  exports.VideoItem = VideoItem;
@@ -51,22 +51,22 @@ const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
51
51
  }
52
52
  }, 0);
53
53
  }, [itemIds, item.id]);
54
- 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', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((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: `
55
- .group-${item.id} {
56
- position: absolute;
57
- width: 100%;
58
- height: 100%;
59
- box-sizing: border-box;
60
- }
54
+ 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', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((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: `
55
+ .group-${item.id} {
56
+ position: absolute;
57
+ width: 100%;
58
+ height: 100%;
59
+ box-sizing: border-box;
60
+ }
61
61
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
62
- return (`
63
- .group-${item.id} {
64
- opacity: ${layoutParams.opacity};
65
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
66
- transform: rotate(${area.angle}deg);
67
- }
62
+ return (`
63
+ .group-${item.id} {
64
+ opacity: ${layoutParams.opacity};
65
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
66
+ transform: rotate(${area.angle}deg);
67
+ }
68
68
  `);
69
- })}
69
+ })}
70
70
  ` })] }) }));
71
71
  };
72
72
  exports.GroupItem = GroupItem;
@@ -29,9 +29,9 @@ const useItemPointerEvents_1 = require("./useItemPointerEvents");
29
29
  const useItemArea_1 = require("./useItemArea");
30
30
  const useDraggable_1 = require("./useDraggable");
31
31
  const ItemGeometryContext_1 = require("../../ItemGeometry/ItemGeometryContext");
32
- const stickyFix = `
33
- -webkit-transform: translate3d(0, 0, 0);
34
- transform: translate3d(0, 0, 0);
32
+ const stickyFix = `
33
+ -webkit-transform: translate3d(0, 0, 0);
34
+ transform: translate3d(0, 0, 0);
35
35
  `;
36
36
  const noop = () => null;
37
37
  const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGroup = false }) => {
@@ -117,6 +117,9 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
117
117
  };
118
118
  const isRichText = (0, isItemType_1.isItemType)(item, sdk_1.ArticleItemType.RichText);
119
119
  const anchorSide = layout ? item.area[layout].anchorSide : sdk_1.AnchorSide.Top;
120
+ const dimensionsType = layout ? item.area[layout].dimensionsType : sdk_1.DimensionsType.PixelsBased;
121
+ const isContainItem = dimensionsType === sdk_1.DimensionsType.PercentageBased;
122
+ const itemInnerHeight = isContainItem ? `${height}vh` : `${height * 100}vw`;
120
123
  const positionType = layout ? item.area[layout].positionType : sdk_1.PositionType.ScreenBased;
121
124
  const isScreenBasedBottom = positionType === sdk_1.PositionType.ScreenBased && anchorSide === sdk_1.AnchorSide.Bottom;
122
125
  const scale = (_h = (_g = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _g === void 0 ? void 0 : _g.scale) !== null && _h !== void 0 ? _h : itemScale;
@@ -125,7 +128,7 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
125
128
  var _a;
126
129
  e.stopPropagation();
127
130
  (_a = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.handleTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(interactionCtrl, e.propertyName);
128
- }, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (top !== undefined ? { top: isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(top, anchorSide) } : {})), (left !== undefined ? { left: `${left * 100}vw` } : {})), (top !== undefined ? { bottom: isScreenBasedBottom ? `${-top * 100}vw` : 'unset' } : {})), (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none' }), (blendMode && { mixBlendMode: blendMode })), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: {
131
+ }, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (top !== undefined ? { top: isScreenBasedBottom ? 'unset' : isContainItem ? (0, getItemTopStyle_1.getPercentageBasedTopStyle)(top, height, anchorSide) : (0, getItemTopStyle_1.getItemTopStyle)(top, anchorSide) } : {})), (left !== undefined ? { left: `${left * 100}vw` } : {})), (top !== undefined ? { bottom: isScreenBasedBottom ? `${-top * 100}vw` : 'unset' } : {})), (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none' }), (blendMode && { mixBlendMode: blendMode })), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: {
129
132
  opacity: (keyframes.length !== 0 && !layout) ? 0 : 1,
130
133
  top: sticky ? (0, getAnchoredItemTop_1.getAnchoredItemTop)(stickyTop, sectionHeight, anchorSide) : 0,
131
134
  height: isRichText && itemHeight !== undefined ? `${itemHeight * 100}vw` : 'unset'
@@ -136,7 +139,7 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
136
139
  ? `${width * exemplary}px`
137
140
  : `${width * 100}vw`
138
141
  : 'max-content'}`,
139
- height: `${sizingAxis.y === 'manual' ? `${height * 100}vw` : 'unset'}`
142
+ height: `${sizingAxis.y === 'manual' ? itemInnerHeight : 'unset'}`
140
143
  }
141
144
  : {})), (scale !== undefined ? { transform: `scale(${scale})`, WebkitTransform: `scale(${scale})` } : {})), { transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none', cursor: isDraggingActive
142
145
  ? 'grabbing'
@@ -144,40 +147,41 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
144
147
  ? 'grab'
145
148
  : hasClickTriggers
146
149
  ? 'pointer'
147
- : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none', userSelect: isDraggable ? 'none' : 'unset', WebkitUserSelect: isDraggable ? 'none' : 'unset', MozUserSelect: isDraggable ? 'none' : 'unset', msUserSelect: isDraggable ? 'none' : 'unset' }) }, triggers, { children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) })) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
150
+ : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none', userSelect: isDraggable ? 'none' : 'unset', WebkitUserSelect: isDraggable ? 'none' : 'unset', MozUserSelect: isDraggable ? 'none' : 'unset', msUserSelect: isDraggable ? 'none' : 'unset' }) }, triggers, { children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) })) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
148
151
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, sticky, sectionHeight, layoutParams]) => {
149
152
  const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
150
153
  const isScreenBasedBottom = area.positionType === sdk_1.PositionType.ScreenBased && area.anchorSide === sdk_1.AnchorSide.Bottom;
151
154
  const scaleAnchor = area.scaleAnchor;
152
- return (`
153
- .item-${item.id} {
154
- position: ${sticky ? 'sticky' : 'absolute'};
155
- top: ${sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(area.top - sticky.from, sectionHeight, area.anchorSide)}` : 0};
156
- transition: opacity 0.2s linear 0.1s;
157
- pointer-events: none;
158
- display: ${hidden ? 'none' : 'block'};
159
- height: fit-content;
160
- }
161
- .item-${item.id}-inner {
155
+ const innerHeight = (area === null || area === void 0 ? void 0 : area.dimensionsType) && (area === null || area === void 0 ? void 0 : area.dimensionsType) === sdk_1.DimensionsType.PercentageBased ? `${area.height}vh` : `${area.height * 100}vw`;
156
+ return (`
157
+ .item-${item.id} {
158
+ position: ${sticky ? 'sticky' : 'absolute'};
159
+ top: ${sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(area.top - sticky.from, sectionHeight, area.anchorSide)}` : 0};
160
+ transition: opacity 0.2s linear 0.1s;
161
+ pointer-events: none;
162
+ display: ${hidden ? 'none' : 'block'};
163
+ height: fit-content;
164
+ }
165
+ .item-${item.id}-inner {
162
166
  width: ${sizingAxis.x === 'manual'
163
167
  ? `${area.width * 100}vw`
164
- : 'max-content'};
165
- height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
166
- transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
167
- transform: scale(${area.scale});
168
- position: relative;
169
- }
170
- .item-wrapper-${item.id} {
171
- position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
172
- z-index: ${area.zIndex};
173
- ${!isInGroup && stickyFix}
174
- pointer-events: none;
175
- bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
176
- top: ${isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(area.top, area.anchorSide)};
177
- left: ${area.left * 100}vw;
178
- }
168
+ : 'max-content'};
169
+ height: ${sizingAxis.y === 'manual' ? innerHeight : 'unset'};
170
+ transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
171
+ transform: scale(${area.scale});
172
+ position: relative;
173
+ }
174
+ .item-wrapper-${item.id} {
175
+ position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
176
+ z-index: ${area.zIndex};
177
+ ${!isInGroup && stickyFix}
178
+ pointer-events: none;
179
+ bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
180
+ top: ${isScreenBasedBottom ? 'unset' : isContainItem ? (0, getItemTopStyle_1.getPercentageBasedTopStyle)(area.top, area.height, area.anchorSide) : (0, getItemTopStyle_1.getItemTopStyle)(area.top, area.anchorSide)};
181
+ left: ${area.left * 100}vw;
182
+ }
179
183
  `);
180
- })}
184
+ })}
181
185
  ` })] }));
182
186
  };
183
187
  exports.Item = Item;
@@ -60,35 +60,35 @@ const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
60
60
  ? (_b = (0, getFill_1.getFill)(value)) !== null && _b !== void 0 ? _b : 'transparent'
61
61
  : 'transparent';
62
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));
63
- }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
64
- .rectangle-${item.id} {
65
- position: absolute;
66
- width: 100%;
67
- height: 100%;
68
- box-sizing: border-box;
69
- },
70
- .image-fill-${item.id} {
71
- position: absolute;
72
- top: 0;
73
- left: 0;
74
- width: 100%;
75
- height: 100%;
76
- transform-origin: center center;
77
- z-index: 1;
78
- background-position: center;
79
- },
63
+ }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
64
+ .rectangle-${item.id} {
65
+ position: absolute;
66
+ width: 100%;
67
+ height: 100%;
68
+ box-sizing: border-box;
69
+ },
70
+ .image-fill-${item.id} {
71
+ position: absolute;
72
+ top: 0;
73
+ left: 0;
74
+ width: 100%;
75
+ height: 100%;
76
+ transform-origin: center center;
77
+ z-index: 1;
78
+ background-position: center;
79
+ },
80
80
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
81
- return (`
82
- .rectangle-${item.id} {
83
- border-radius: ${layoutParams.radius * 100}vw
84
- transform: rotate(${area.angle}deg);
85
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
86
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
87
- backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
88
- -webkit-backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
89
- }
81
+ return (`
82
+ .rectangle-${item.id} {
83
+ border-radius: ${layoutParams.radius * 100}vw
84
+ transform: rotate(${area.angle}deg);
85
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
86
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
87
+ backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
88
+ -webkit-backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
89
+ }
90
90
  `);
91
- })}
91
+ })}
92
92
  ` })] }) }));
93
93
  };
94
94
  exports.RectangleItem = RectangleItem;
@@ -59,28 +59,28 @@ const RichTextItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
59
59
  }, [isInteractive, onVisibilityChange]);
60
60
  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(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` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition }), children: content }), (0, jsx_runtime_1.jsxs)(style_1.default, { id: id, children: [styles, `${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
61
61
  const color = color_1.CntrlColor.parse(layoutParams.color);
62
- return (`
63
- .rich-text-wrapper-${item.id} {
64
- font-size: ${layoutParams.fontSize * 100}vw;
65
- line-height: ${layoutParams.lineHeight * 100}vw;
66
- letter-spacing: ${layoutParams.letterSpacing * 100}vw;
67
- word-spacing: ${layoutParams.wordSpacing * 100}vw;
68
- font-family: ${(0, getFontFamilyValue_1.getFontFamilyValue)(layoutParams.typeFace)};
69
- font-weight: ${layoutParams.fontWeight};
70
- font-style: ${layoutParams.fontStyle ? layoutParams.fontStyle : 'normal'};
71
- vertical-align: ${layoutParams.verticalAlign};
72
- font-variant: ${layoutParams.fontVariant};
73
- color: ${color.fmt('rgba')};
74
- transform: rotate(${area.angle}deg);
75
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
76
- text-transform: ${layoutParams.textTransform};
77
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
78
- }
79
- @supports not (color: oklch(42% 0.3 90 / 1)) {
80
- .rich-text-wrapper-${item.id} {
81
- color: ${color.fmt('rgba')};
82
- }
83
- }
62
+ return (`
63
+ .rich-text-wrapper-${item.id} {
64
+ font-size: ${layoutParams.fontSize * 100}vw;
65
+ line-height: ${layoutParams.lineHeight * 100}vw;
66
+ letter-spacing: ${layoutParams.letterSpacing * 100}vw;
67
+ word-spacing: ${layoutParams.wordSpacing * 100}vw;
68
+ font-family: ${(0, getFontFamilyValue_1.getFontFamilyValue)(layoutParams.typeFace)};
69
+ font-weight: ${layoutParams.fontWeight};
70
+ font-style: ${layoutParams.fontStyle ? layoutParams.fontStyle : 'normal'};
71
+ vertical-align: ${layoutParams.verticalAlign};
72
+ font-variant: ${layoutParams.fontVariant};
73
+ color: ${color.fmt('rgba')};
74
+ transform: rotate(${area.angle}deg);
75
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
76
+ text-transform: ${layoutParams.textTransform};
77
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
78
+ }
79
+ @supports not (color: oklch(42% 0.3 90 / 1)) {
80
+ .rich-text-wrapper-${item.id} {
81
+ color: ${color.fmt('rgba')};
82
+ }
83
+ }
84
84
  `);
85
85
  })}`] })] }));
86
86
  };
@@ -61,13 +61,13 @@ class RichTextConverter {
61
61
  const kids = [];
62
62
  layouts.forEach(l => {
63
63
  const ta = richText.layoutParams[l.id].textAlign;
64
- styleRules[l.id].push(`
65
- .${blockClass} {
66
- display: ${group.some(g => g.layout === l.id) ? 'block' : 'none'};
67
- text-align: ${ta};
68
- white-space: pre-wrap;
69
- overflow-wrap: break-word;
70
- }
64
+ styleRules[l.id].push(`
65
+ .${blockClass} {
66
+ display: ${group.some(g => g.layout === l.id) ? 'block' : 'none'};
67
+ text-align: ${ta};
68
+ white-space: pre-wrap;
69
+ overflow-wrap: break-word;
70
+ }
71
71
  `);
72
72
  });
73
73
  const item = group[0];
@@ -111,18 +111,18 @@ class RichTextConverter {
111
111
  if (lineHeight === null || lineHeight === void 0 ? void 0 : lineHeight.value) {
112
112
  currentLineHeight[item.layout] = lineHeight.value;
113
113
  }
114
- styleRules[item.layout].push(`
115
- .${blockClass} .s-${styleGroup.start}-${styleGroup.end} {
116
- ${styleGroup.styles.map(s => RichTextConverter.fromRangeStylesToInline(s, exemplary)).join('\n')}
117
- }
114
+ styleRules[item.layout].push(`
115
+ .${blockClass} .s-${styleGroup.start}-${styleGroup.end} {
116
+ ${styleGroup.styles.map(s => RichTextConverter.fromRangeStylesToInline(s, exemplary)).join('\n')}
117
+ }
118
118
  `);
119
119
  if (color) {
120
- styleRules[item.layout].push(`
121
- @supports not (color: oklch(42% 0.3 90 / 1)) {
122
- .${blockClass} .s-${styleGroup.start}-${styleGroup.end} {
123
- color: ${color_1.CntrlColor.parse(getResolvedValue(color.value, 'COLOR')).fmt('rgba')};
124
- }
125
- }
120
+ styleRules[item.layout].push(`
121
+ @supports not (color: oklch(42% 0.3 90 / 1)) {
122
+ .${blockClass} .s-${styleGroup.start}-${styleGroup.end} {
123
+ color: ${color_1.CntrlColor.parse(getResolvedValue(color.value, 'COLOR')).fmt('rgba')};
124
+ }
125
+ }
126
126
  `);
127
127
  }
128
128
  }
@@ -131,10 +131,10 @@ class RichTextConverter {
131
131
  root.push((0, jsx_runtime_1.jsx)("div", { className: blockClass, children: kids }, blockClass));
132
132
  }
133
133
  }
134
- const styles = layouts.map(l => `
135
- ${(0, sdk_1.getLayoutMediaQuery)(l.id, layouts)} {
136
- ${styleRules[l.id].join('\n')}
137
- }
134
+ const styles = layouts.map(l => `
135
+ ${(0, sdk_1.getLayoutMediaQuery)(l.id, layouts)} {
136
+ ${styleRules[l.id].join('\n')}
137
+ }
138
138
  `).join('\n');
139
139
  return [
140
140
  root,