@cntrl-site/sdk-nextjs 1.9.11 → 1.9.12

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 (130) 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 +30 -30
  21. package/lib/components/items/RectangleItem/RectangleItem.js +27 -27
  22. package/lib/components/items/RichTextItem/RichTextItem.js +22 -22
  23. package/lib/provider/CntrlSdkContext.js +2 -2
  24. package/lib/utils/RichTextConverter/RichTextConverter.js +21 -21
  25. package/package.json +60 -59
  26. package/src/common/useCurrentLayout.ts +52 -52
  27. package/src/common/useExemplary.ts +9 -9
  28. package/src/common/useItemFXData.ts +47 -47
  29. package/src/common/useKeyframeValue.ts +85 -85
  30. package/src/common/useRegisterResize.ts +16 -16
  31. package/src/components/Article.tsx +73 -73
  32. package/src/components/ArticleWrapper.tsx +21 -21
  33. package/src/components/Head.tsx +56 -56
  34. package/src/components/LayoutStyle.tsx +21 -21
  35. package/src/components/Page.tsx +33 -33
  36. package/src/components/ScrollPlaybackVideo.tsx +56 -56
  37. package/src/components/Section/Section.tsx +127 -127
  38. package/src/components/Section/SectionImage.tsx +48 -48
  39. package/src/components/Section/SectionVideo.tsx +144 -144
  40. package/src/components/Section/useSectionColor.ts +19 -19
  41. package/src/components/Section/useSectionHeightMap.ts +19 -19
  42. package/src/components/items/CodeEmbedItem/CodeEmbedItem.tsx +145 -145
  43. package/src/components/items/CodeEmbedItem/useCodeEmbedItem.ts +36 -36
  44. package/src/components/items/ComponentItem/ComponentItem.tsx +67 -67
  45. package/src/components/items/ComponentItem/useComponentItem.ts +35 -35
  46. package/src/components/items/CompoundItem/CompoundChild.tsx +150 -150
  47. package/src/components/items/CompoundItem/CompoundItem.tsx +70 -70
  48. package/src/components/items/CompoundItem/useCompoundItem.ts +21 -21
  49. package/src/components/items/CustomItem/CustomItem.tsx +48 -48
  50. package/src/components/items/EmbedVideoItem/VimeoEmbed.tsx +214 -214
  51. package/src/components/items/EmbedVideoItem/YoutubeEmbed.tsx +198 -198
  52. package/src/components/items/EmbedVideoItem/useEmbedVideoItem.ts +46 -46
  53. package/src/components/items/FileItem/ImageItem.tsx +163 -163
  54. package/src/components/items/FileItem/VideoItem.tsx +280 -280
  55. package/src/components/items/FileItem/useFileItem.ts +81 -81
  56. package/src/components/items/GroupItem/GroupItem.tsx +81 -81
  57. package/src/components/items/GroupItem/useGroupItem.ts +34 -34
  58. package/src/components/items/Item.tsx +253 -253
  59. package/src/components/items/LinkWrapper.tsx +39 -39
  60. package/src/components/items/RectangleItem/RectangleItem.tsx +168 -168
  61. package/src/components/items/RectangleItem/useRectangleItem.ts +89 -89
  62. package/src/components/items/RichTextItem/RichTextItem.tsx +107 -107
  63. package/src/components/items/RichTextItem/useRichTextItem.ts +12 -12
  64. package/src/components/items/RichTextWrapper.tsx +15 -15
  65. package/src/components/items/itemsMap.ts +28 -28
  66. package/src/components/items/useDraggable.ts +252 -252
  67. package/src/components/items/useItemAngle.ts +13 -13
  68. package/src/components/items/useItemArea.ts +35 -35
  69. package/src/components/items/useItemPointerEvents.ts +23 -23
  70. package/src/components/items/useItemScale.ts +17 -17
  71. package/src/components/items/useItemTriggers.ts +15 -15
  72. package/src/components/items/useRichTextItemValues.ts +65 -65
  73. package/src/components/items/useSizing.ts +25 -25
  74. package/src/components/items/useStickyItemTop.ts +21 -21
  75. package/src/components/useLayoutContext.ts +7 -7
  76. package/src/index.ts +24 -24
  77. package/src/interactions/CSSPropertyNameMap.ts +37 -37
  78. package/src/interactions/InteractionsRegistry.ts +380 -380
  79. package/src/interactions/ItemInteractionCtrl.ts +78 -78
  80. package/src/interactions/getTransition.ts +27 -27
  81. package/src/interactions/types.ts +36 -36
  82. package/src/interactions/useItemInteractionCtrl.ts +18 -18
  83. package/src/provider/ArticleRectContext.ts +4 -4
  84. package/src/provider/CntrlContext.ts +5 -5
  85. package/src/provider/CntrlProvider.tsx +11 -11
  86. package/src/provider/CntrlSdkContext.ts +84 -83
  87. package/src/provider/CustomItemRegistry.ts +14 -14
  88. package/src/provider/CustomItemTypes.ts +3 -3
  89. package/src/provider/CustomSectionRegistry.ts +25 -25
  90. package/src/provider/InteractionsContext.tsx +59 -59
  91. package/src/provider/Keyframes.ts +11 -11
  92. package/src/provider/KeyframesContext.ts +5 -5
  93. package/src/provider/LayoutContext.ts +3 -3
  94. package/src/provider/WebGLContextManagerContext.tsx +4 -4
  95. package/src/provider/defaultContext.ts +8 -8
  96. package/src/provider/useCntrlContext.ts +8 -8
  97. package/src/styled-jsx.d.ts +1 -1
  98. package/src/utils/Animator/Animator.ts +570 -570
  99. package/src/utils/ArticleRectManager/ArticleRectObserver.ts +93 -93
  100. package/src/utils/ArticleRectManager/useArticleRectObserver.ts +17 -17
  101. package/src/utils/ArticleRectManager/useSectionRegistry.ts +11 -11
  102. package/src/utils/EventEmitter.ts +41 -41
  103. package/src/utils/RichTextConverter/RichTextConverter.tsx +326 -326
  104. package/src/utils/ScaleAnchorMap.ts +13 -13
  105. package/src/utils/StickyManager/StickyManager.ts +23 -23
  106. package/src/utils/Youtube/YouTubeIframeApiLoader.ts +58 -58
  107. package/src/utils/Youtube/YoutubeIframeApi.ts +101 -101
  108. package/src/utils/Youtube/useYouTubeIframeApi.ts +12 -12
  109. package/src/utils/areFillsVisible/areFillsVisible.test.ts +63 -63
  110. package/src/utils/areFillsVisible/areFillsVisible.ts +37 -37
  111. package/src/utils/binSearchInsertAt.ts +33 -33
  112. package/src/utils/castObject.ts +10 -10
  113. package/src/utils/checkOverflowClipSupport.ts +13 -13
  114. package/src/utils/effects/useImageFx.ts +156 -156
  115. package/src/utils/effects/useVideoFx.ts +158 -158
  116. package/src/utils/getAnchoredItemTop.ts +12 -12
  117. package/src/utils/getCompoundBoundaryStyles.ts +60 -60
  118. package/src/utils/getFill.ts +46 -46
  119. package/src/utils/getFontFamilyValue.ts +3 -3
  120. package/src/utils/getInvertedRanges.ts +43 -43
  121. package/src/utils/getItemTopStyle.ts +14 -14
  122. package/src/utils/getStyleFromItemStateAndParams.ts +8 -8
  123. package/src/utils/getValidYoutubeUrl.ts +29 -29
  124. package/src/utils/isItemType.ts +5 -5
  125. package/src/utils/rangeMap.ts +13 -13
  126. package/src/utils/useElementRect.ts +23 -23
  127. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  128. package/.idea/modules.xml +0 -8
  129. package/.idea/sdk-nextjs.iml +0 -12
  130. package/.idea/vcs.xml +0 -6
@@ -137,35 +137,35 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibi
137
137
  top: '0',
138
138
  left: '0',
139
139
  zIndex: 1
140
- }, 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: `
141
- .embed-youtube-video-wrapper-${item.id},
142
- .embed-${item.id} {
143
- position: absolute;
144
- width: 100%;
145
- height: 100%;
146
- }
147
- .embed-${item.id} {
148
- overflow: hidden;
149
- }
150
- .embed-youtube-video-wrapper-${item.id} iframe {
151
- width: 100%;
152
- height: 100%;
153
- z-index: 1;
154
- border: none;
155
- }
140
+ }, 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: `
141
+ .embed-youtube-video-wrapper-${item.id},
142
+ .embed-${item.id} {
143
+ position: absolute;
144
+ width: 100%;
145
+ height: 100%;
146
+ }
147
+ .embed-${item.id} {
148
+ overflow: hidden;
149
+ }
150
+ .embed-youtube-video-wrapper-${item.id} iframe {
151
+ width: 100%;
152
+ height: 100%;
153
+ z-index: 1;
154
+ border: none;
155
+ }
156
156
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
157
- return (`
158
- .embed-youtube-video-wrapper-${item.id} {
159
- opacity: ${layoutParams.opacity};
160
- transform: rotate(${area.angle}deg);
161
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
162
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
163
- }
164
- .embed-youtube-video-wrapper-${item.id} .embed-${item.id} {
165
- border-radius: ${layoutParams.radius * 100}vw;
166
- }
157
+ return (`
158
+ .embed-youtube-video-wrapper-${item.id} {
159
+ opacity: ${layoutParams.opacity};
160
+ transform: rotate(${area.angle}deg);
161
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
162
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
163
+ }
164
+ .embed-youtube-video-wrapper-${item.id} .embed-${item.id} {
165
+ border-radius: ${layoutParams.radius * 100}vw;
166
+ }
167
167
  `);
168
- })}
168
+ })}
169
169
  ` })] }));
170
170
  };
171
171
  exports.YoutubeEmbedItem = YoutubeEmbedItem;
@@ -71,48 +71,48 @@ const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
71
71
  }, [isInteractive, onVisibilityChange]);
72
72
  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
73
73
  ? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `img-canvas image-${item.id}`, width: rectWidth, height: rectHeight }))
74
- : ((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: `
75
- .image-wrapper-${item.id} {
76
- position: absolute;
77
- width: 100%;
78
- height: 100%;
79
- box-sizing: border-box;
80
- display: flex;
81
- }
82
- .image {
83
- width: 100%;
84
- height: 100%;
85
- opacity: 1;
86
- object-fit: cover;
87
- pointer-events: none;
88
- border-style: solid;
89
- overflow: hidden;
90
- box-sizing: border-box;
91
- }
92
- .img-canvas {
93
- border: solid;
94
- width: 100%;
95
- height: 100%;
96
- pointer-events: none;
97
- border-width: 0;
98
- box-sizing: border-box;
99
- }
74
+ : ((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: `
75
+ .image-wrapper-${item.id} {
76
+ position: absolute;
77
+ width: 100%;
78
+ height: 100%;
79
+ box-sizing: border-box;
80
+ display: flex;
81
+ }
82
+ .image {
83
+ width: 100%;
84
+ height: 100%;
85
+ opacity: 1;
86
+ object-fit: cover;
87
+ pointer-events: none;
88
+ border-style: solid;
89
+ overflow: hidden;
90
+ box-sizing: border-box;
91
+ }
92
+ .img-canvas {
93
+ border: solid;
94
+ width: 100%;
95
+ height: 100%;
96
+ pointer-events: none;
97
+ border-width: 0;
98
+ box-sizing: border-box;
99
+ }
100
100
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
101
- return (`
102
- .image-wrapper-${item.id} {
103
- opacity: ${layoutParams.opacity};
104
- transform: rotate(${area.angle}deg);
105
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
106
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
107
- }
108
- .image-${item.id} {
109
- border: solid;
110
- border-color: ${stroke};
111
- border-radius: ${layoutParams.radius * 100}vw;
112
- border-width: ${layoutParams.strokeWidth * 100}vw;
113
- }
101
+ return (`
102
+ .image-wrapper-${item.id} {
103
+ opacity: ${layoutParams.opacity};
104
+ transform: rotate(${area.angle}deg);
105
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
106
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
107
+ }
108
+ .image-${item.id} {
109
+ border: solid;
110
+ border-color: ${stroke};
111
+ border-radius: ${layoutParams.radius * 100}vw;
112
+ border-width: ${layoutParams.strokeWidth * 100}vw;
113
+ }
114
114
  `);
115
- })}
115
+ })}
116
116
  ` })] }) }));
117
117
  };
118
118
  exports.ImageItem = ImageItem;
@@ -134,72 +134,72 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
134
134
  else {
135
135
  videoRef.play();
136
136
  }
137
- } })))] }))] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
138
- .video-wrapper-${item.id} {
139
- position: absolute;
140
- overflow: hidden;
141
- width: 100%;
142
- height: 100%;
143
- box-sizing: border-box;
144
- opacity: ${opacity};
145
- }
146
- .video-overlay-${item.id} {
147
- position: absolute;
148
- top: 0;
149
- left: 0;
150
- cursor: pointer;
151
- width: 100%;
152
- height: 100%;
153
- }
154
- .video-cover-${item.id} {
155
- position: absolute;
156
- top: 0;
157
- left: 0;
158
- cursor: pointer;
159
- width: 100%;
160
- height: 100%;
161
- object-fit: cover;
162
- }
163
- .video {
164
- width: 100%;
165
- height: 100%;
166
- box-sizing: border-box;
167
- opacity: 1;
168
- object-fit: cover;
169
- overflow: hidden;
170
- border-style: solid;
171
- }
172
- .video-${item.id} {
173
- border-radius: ${radius !== undefined ? `${radius * 100}vw` : '0'};
174
- }
175
- .video-playback-wrapper {
176
- display: flex;
177
- justify-content: center;
178
- }
179
- .video-canvas {
180
- border: solid;
181
- width: 100%;
182
- height: 100%;
183
- pointer-events: none;
184
- border-width: 0;
185
- box-sizing: border-box;
186
- }
137
+ } })))] }))] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
138
+ .video-wrapper-${item.id} {
139
+ position: absolute;
140
+ overflow: hidden;
141
+ width: 100%;
142
+ height: 100%;
143
+ box-sizing: border-box;
144
+ opacity: ${opacity};
145
+ }
146
+ .video-overlay-${item.id} {
147
+ position: absolute;
148
+ top: 0;
149
+ left: 0;
150
+ cursor: pointer;
151
+ width: 100%;
152
+ height: 100%;
153
+ }
154
+ .video-cover-${item.id} {
155
+ position: absolute;
156
+ top: 0;
157
+ left: 0;
158
+ cursor: pointer;
159
+ width: 100%;
160
+ height: 100%;
161
+ object-fit: cover;
162
+ }
163
+ .video {
164
+ width: 100%;
165
+ height: 100%;
166
+ box-sizing: border-box;
167
+ opacity: 1;
168
+ object-fit: cover;
169
+ overflow: hidden;
170
+ border-style: solid;
171
+ }
172
+ .video-${item.id} {
173
+ border-radius: ${radius !== undefined ? `${radius * 100}vw` : '0'};
174
+ }
175
+ .video-playback-wrapper {
176
+ display: flex;
177
+ justify-content: center;
178
+ }
179
+ .video-canvas {
180
+ border: solid;
181
+ width: 100%;
182
+ height: 100%;
183
+ pointer-events: none;
184
+ border-width: 0;
185
+ box-sizing: border-box;
186
+ }
187
187
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
188
- return (`
189
- .video-wrapper-${item.id} {
190
- opacity: ${layoutParams.opacity};
191
- transform: rotate(${area.angle}deg);
192
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
193
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
194
- }
195
- .video-${item.id} {
196
- border: solid;
197
- border-color: ${stroke};
198
- border-radius: ${layoutParams.radius * 100}vw;
199
- border-width: ${layoutParams.strokeWidth * 100}vw;
200
- }
188
+ return (`
189
+ .video-wrapper-${item.id} {
190
+ opacity: ${layoutParams.opacity};
191
+ transform: rotate(${area.angle}deg);
192
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
193
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
194
+ }
195
+ .video-${item.id} {
196
+ border: solid;
197
+ border-color: ${stroke};
198
+ border-radius: ${layoutParams.radius * 100}vw;
199
+ border-width: ${layoutParams.strokeWidth * 100}vw;
200
+ }
201
201
  `);
202
- })}
202
+ })}
203
203
  ` })] }));
204
204
  };
205
205
  exports.VideoItem = VideoItem;
@@ -34,22 +34,22 @@ const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
34
34
  (0, react_1.useEffect)(() => {
35
35
  onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
36
36
  }, [isInteractive, onVisibilityChange]);
37
- 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: `
38
- .group-${item.id} {
39
- position: absolute;
40
- width: 100%;
41
- height: 100%;
42
- box-sizing: border-box;
43
- }
37
+ 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: `
38
+ .group-${item.id} {
39
+ position: absolute;
40
+ width: 100%;
41
+ height: 100%;
42
+ box-sizing: border-box;
43
+ }
44
44
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
45
- return (`
46
- .group-${item.id} {
47
- opacity: ${layoutParams.opacity};
48
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
49
- transform: rotate(${area.angle}deg);
50
- }
45
+ return (`
46
+ .group-${item.id} {
47
+ opacity: ${layoutParams.opacity};
48
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
49
+ transform: rotate(${area.angle}deg);
50
+ }
51
51
  `);
52
- })}
52
+ })}
53
53
  ` })] }) }));
54
54
  };
55
55
  exports.GroupItem = GroupItem;
@@ -28,9 +28,9 @@ const useSizing_1 = require("./useSizing");
28
28
  const useItemPointerEvents_1 = require("./useItemPointerEvents");
29
29
  const useItemArea_1 = require("./useItemArea");
30
30
  const useDraggable_1 = require("./useDraggable");
31
- const stickyFix = `
32
- -webkit-transform: translate3d(0, 0, 0);
33
- transform: translate3d(0, 0, 0);
31
+ const stickyFix = `
32
+ -webkit-transform: translate3d(0, 0, 0);
33
+ transform: translate3d(0, 0, 0);
34
34
  `;
35
35
  const noop = () => null;
36
36
  const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGroup = false }) => {
@@ -136,40 +136,40 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
136
136
  ? 'grab'
137
137
  : hasClickTriggers
138
138
  ? 'pointer'
139
- : '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: `
139
+ : '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: `
140
140
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, sticky, sectionHeight, layoutParams]) => {
141
141
  const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
142
142
  const isScreenBasedBottom = area.positionType === sdk_1.PositionType.ScreenBased && area.anchorSide === sdk_1.AnchorSide.Bottom;
143
143
  const scaleAnchor = area.scaleAnchor;
144
- return (`
145
- .item-${item.id} {
146
- position: ${sticky ? 'sticky' : 'absolute'};
147
- top: ${sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(area.top - sticky.from, sectionHeight, area.anchorSide)}` : 0};
148
- transition: opacity 0.2s linear 0.1s;
149
- pointer-events: none;
150
- display: ${hidden ? 'none' : 'block'};
151
- height: fit-content;
152
- }
153
- .item-${item.id}-inner {
144
+ return (`
145
+ .item-${item.id} {
146
+ position: ${sticky ? 'sticky' : 'absolute'};
147
+ top: ${sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(area.top - sticky.from, sectionHeight, area.anchorSide)}` : 0};
148
+ transition: opacity 0.2s linear 0.1s;
149
+ pointer-events: none;
150
+ display: ${hidden ? 'none' : 'block'};
151
+ height: fit-content;
152
+ }
153
+ .item-${item.id}-inner {
154
154
  width: ${sizingAxis.x === 'manual'
155
155
  ? `${area.width * 100}vw`
156
- : 'max-content'};
157
- height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
158
- transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
159
- transform: scale(${area.scale});
160
- position: relative;
161
- }
162
- .item-wrapper-${item.id} {
163
- position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
164
- z-index: ${area.zIndex};
165
- ${!isInGroup && stickyFix}
166
- pointer-events: none;
167
- bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
168
- top: ${isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(area.top, area.anchorSide)};
169
- left: ${area.left * 100}vw;
170
- }
156
+ : 'max-content'};
157
+ height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
158
+ transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
159
+ transform: scale(${area.scale});
160
+ position: relative;
161
+ }
162
+ .item-wrapper-${item.id} {
163
+ position: ${area.positionType === sdk_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
164
+ z-index: ${area.zIndex};
165
+ ${!isInGroup && stickyFix}
166
+ pointer-events: none;
167
+ bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
168
+ top: ${isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(area.top, area.anchorSide)};
169
+ left: ${area.left * 100}vw;
170
+ }
171
171
  `);
172
- })}
172
+ })}
173
173
  ` })] }));
174
174
  };
175
175
  exports.Item = Item;
@@ -62,35 +62,35 @@ const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
62
62
  ? (_b = (0, getFill_1.getFill)(value)) !== null && _b !== void 0 ? _b : 'transparent'
63
63
  : 'transparent';
64
64
  return ((0, jsx_runtime_1.jsx)(Fill, { fill: value, itemId: item.id, background: background, solidTransition: solidTransition, radius: radius, strokeWidth: strokeWidth }));
65
- }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
66
- .rectangle-${item.id} {
67
- position: absolute;
68
- width: 100%;
69
- height: 100%;
70
- box-sizing: border-box;
71
- },
72
- .image-fill-${item.id} {
73
- position: absolute;
74
- top: 0;
75
- left: 0;
76
- width: 100%;
77
- height: 100%;
78
- transform-origin: center center;
79
- z-index: 1;
80
- background-position: center;
81
- },
65
+ }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
66
+ .rectangle-${item.id} {
67
+ position: absolute;
68
+ width: 100%;
69
+ height: 100%;
70
+ box-sizing: border-box;
71
+ },
72
+ .image-fill-${item.id} {
73
+ position: absolute;
74
+ top: 0;
75
+ left: 0;
76
+ width: 100%;
77
+ height: 100%;
78
+ transform-origin: center center;
79
+ z-index: 1;
80
+ background-position: center;
81
+ },
82
82
  ${(0, sdk_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
83
- return (`
84
- .rectangle-${item.id} {
85
- border-radius: ${layoutParams.radius * 100}vw
86
- transform: rotate(${area.angle}deg);
87
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
88
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
89
- backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
90
- -webkit-backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
91
- }
83
+ return (`
84
+ .rectangle-${item.id} {
85
+ border-radius: ${layoutParams.radius * 100}vw
86
+ transform: rotate(${area.angle}deg);
87
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
88
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
89
+ backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
90
+ -webkit-backdrop-filter: ${layoutParams.backdropBlur !== 0 ? `blur(${layoutParams.backdropBlur * 100}vw)` : 'unset'};
91
+ }
92
92
  `);
93
- })}
93
+ })}
94
94
  ` })] }) }));
95
95
  };
96
96
  exports.RectangleItem = RectangleItem;
@@ -55,28 +55,28 @@ const RichTextItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
55
55
  }, [isInteractive, onVisibilityChange]);
56
56
  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]) => {
57
57
  const color = color_1.CntrlColor.parse(layoutParams.color);
58
- return (`
59
- .rich-text-wrapper-${item.id} {
60
- font-size: ${layoutParams.fontSize * 100}vw;
61
- line-height: ${layoutParams.lineHeight * 100}vw;
62
- letter-spacing: ${layoutParams.letterSpacing * 100}vw;
63
- word-spacing: ${layoutParams.wordSpacing * 100}vw;
64
- font-family: ${(0, getFontFamilyValue_1.getFontFamilyValue)(layoutParams.typeFace)};
65
- font-weight: ${layoutParams.fontWeight};
66
- font-style: ${layoutParams.fontStyle ? layoutParams.fontStyle : 'normal'};
67
- vertical-align: ${layoutParams.verticalAlign};
68
- font-variant: ${layoutParams.fontVariant};
69
- color: ${color.fmt('rgba')};
70
- transform: rotate(${area.angle}deg);
71
- filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
72
- text-transform: ${layoutParams.textTransform};
73
- ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
74
- }
75
- @supports not (color: oklch(42% 0.3 90 / 1)) {
76
- .rich-text-wrapper-${item.id} {
77
- color: ${color.fmt('rgba')};
78
- }
79
- }
58
+ return (`
59
+ .rich-text-wrapper-${item.id} {
60
+ font-size: ${layoutParams.fontSize * 100}vw;
61
+ line-height: ${layoutParams.lineHeight * 100}vw;
62
+ letter-spacing: ${layoutParams.letterSpacing * 100}vw;
63
+ word-spacing: ${layoutParams.wordSpacing * 100}vw;
64
+ font-family: ${(0, getFontFamilyValue_1.getFontFamilyValue)(layoutParams.typeFace)};
65
+ font-weight: ${layoutParams.fontWeight};
66
+ font-style: ${layoutParams.fontStyle ? layoutParams.fontStyle : 'normal'};
67
+ vertical-align: ${layoutParams.verticalAlign};
68
+ font-variant: ${layoutParams.fontVariant};
69
+ color: ${color.fmt('rgba')};
70
+ transform: rotate(${area.angle}deg);
71
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
72
+ text-transform: ${layoutParams.textTransform};
73
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
74
+ }
75
+ @supports not (color: oklch(42% 0.3 90 / 1)) {
76
+ .rich-text-wrapper-${item.id} {
77
+ color: ${color.fmt('rgba')};
78
+ }
79
+ }
80
80
  `);
81
81
  })}`] })] }));
82
82
  };
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CntrlSdkContext = void 0;
13
- const sdk_1 = require("@cntrl-site/sdk");
13
+ const components_1 = require("@cntrl-site/components");
14
14
  class CntrlSdkContext {
15
15
  constructor(customItems, customSections) {
16
16
  this.customItems = customItems;
@@ -36,7 +36,7 @@ class CntrlSdkContext {
36
36
  }
37
37
  init({ project, article }) {
38
38
  this.setLayouts(project.layouts);
39
- this.setComponents(sdk_1.components);
39
+ this.setComponents(components_1.components);
40
40
  this.setFonts(project.fonts);
41
41
  this.setSectionsHeight(article.sections);
42
42
  }
@@ -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,