@gxpl/sdk 0.0.7 → 0.0.8

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 (283) hide show
  1. package/{dist → lib}/index.d.ts +3 -4
  2. package/lib/sdk/FontFaceGenerator/FontFaceGenerator.js +28 -0
  3. package/lib/sdk/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.js +221 -0
  4. package/lib/sdk/VideoDecoder/VideoDecoder.js +184 -0
  5. package/{dist → lib}/sdk/schemas/article/Article.schema.d.ts +12 -12
  6. package/{dist → lib}/sdk/schemas/article/ItemBase.schema.d.ts +10 -10
  7. package/{dist → lib}/sdk/schemas/article/RichTextItem.schema.d.ts +30 -30
  8. package/{dist → lib}/sdk/schemas/article/Section.schema.d.ts +3 -3
  9. package/{dist → lib}/sdk/types/component/Component.d.ts +1 -1
  10. package/{dist → lib}/sdk/types/keyframe/Keyframe.d.ts +1 -1
  11. package/lib/sdk/types/project/Meta.js +2 -0
  12. package/lib/sdk/types/project/Page.js +2 -0
  13. package/lib/sdk/types/project/Project.js +2 -0
  14. package/lib/sdk-nextjs/common/useCurrentLayout.js +42 -0
  15. package/lib/sdk-nextjs/common/useExemplary.js +13 -0
  16. package/lib/sdk-nextjs/common/useItemFXData.js +36 -0
  17. package/lib/sdk-nextjs/common/useKeyframeValue.js +75 -0
  18. package/lib/sdk-nextjs/common/useRegisterResize.js +22 -0
  19. package/lib/sdk-nextjs/components/Article.js +41 -0
  20. package/lib/sdk-nextjs/components/ArticleWrapper.js +12 -0
  21. package/lib/sdk-nextjs/components/Head.js +32 -0
  22. package/lib/sdk-nextjs/components/Page.js +20 -0
  23. package/{dist → lib}/sdk-nextjs/components/ScrollPlaybackVideo.d.ts +1 -1
  24. package/lib/sdk-nextjs/components/ScrollPlaybackVideo.js +46 -0
  25. package/lib/sdk-nextjs/components/Section/Section.js +85 -0
  26. package/lib/sdk-nextjs/components/Section/SectionImage.js +24 -0
  27. package/lib/sdk-nextjs/components/Section/SectionVideo.js +91 -0
  28. package/lib/sdk-nextjs/components/Section/useSectionHeightMap.js +20 -0
  29. package/lib/sdk-nextjs/components/items/CodeEmbedItem/CodeEmbedItem.js +120 -0
  30. package/lib/sdk-nextjs/components/items/CodeEmbedItem/useCodeEmbedItem.js +24 -0
  31. package/lib/sdk-nextjs/components/items/ComponentItem/ComponentItem.js +51 -0
  32. package/lib/sdk-nextjs/components/items/ComponentItem/useComponentItem.js +25 -0
  33. package/lib/sdk-nextjs/components/items/CompoundItem/CompoundChild.js +102 -0
  34. package/lib/sdk-nextjs/components/items/CompoundItem/CompoundItem.js +53 -0
  35. package/lib/sdk-nextjs/components/items/CompoundItem/useCompoundItem.js +16 -0
  36. package/lib/sdk-nextjs/components/items/CustomItem/CustomItem.js +40 -0
  37. package/{dist → lib}/sdk-nextjs/components/items/EmbedVideoItem/VimeoEmbed.d.ts +2 -2
  38. package/lib/sdk-nextjs/components/items/EmbedVideoItem/VimeoEmbed.js +170 -0
  39. package/lib/sdk-nextjs/components/items/EmbedVideoItem/YoutubeEmbed.js +166 -0
  40. package/lib/sdk-nextjs/components/items/EmbedVideoItem/useEmbedVideoItem.js +29 -0
  41. package/lib/sdk-nextjs/components/items/FileItem/ImageItem.js +140 -0
  42. package/lib/sdk-nextjs/components/items/FileItem/VideoItem.js +227 -0
  43. package/{dist → lib}/sdk-nextjs/components/items/FileItem/useFileItem.d.ts +1 -1
  44. package/lib/sdk-nextjs/components/items/FileItem/useFileItem.js +48 -0
  45. package/lib/sdk-nextjs/components/items/GroupItem/GroupItem.js +55 -0
  46. package/lib/sdk-nextjs/components/items/GroupItem/useGroupItem.js +22 -0
  47. package/lib/sdk-nextjs/components/items/Item.js +175 -0
  48. package/{dist → lib}/sdk-nextjs/components/items/LinkWrapper.d.ts +1 -1
  49. package/lib/sdk-nextjs/components/items/LinkWrapper.js +27 -0
  50. package/lib/sdk-nextjs/components/items/RectangleItem/RectangleItem.js +130 -0
  51. package/lib/sdk-nextjs/components/items/RectangleItem/useRectangleItem.js +54 -0
  52. package/lib/sdk-nextjs/components/items/RichTextItem/RichTextItem.js +83 -0
  53. package/lib/sdk-nextjs/components/items/RichTextItem/useRichTextItem.js +12 -0
  54. package/lib/sdk-nextjs/components/items/RichTextWrapper.js +10 -0
  55. package/lib/sdk-nextjs/components/items/itemsMap.js +28 -0
  56. package/lib/sdk-nextjs/components/items/useDraggable.js +177 -0
  57. package/lib/sdk-nextjs/components/items/useItemAngle.js +10 -0
  58. package/lib/sdk-nextjs/components/items/useItemArea.js +21 -0
  59. package/lib/sdk-nextjs/components/items/useItemPointerEvents.js +23 -0
  60. package/lib/sdk-nextjs/components/items/useItemScale.js +12 -0
  61. package/lib/sdk-nextjs/components/items/useItemTriggers.js +16 -0
  62. package/lib/sdk-nextjs/components/items/useRichTextItemValues.js +38 -0
  63. package/lib/sdk-nextjs/components/items/useSizing.js +22 -0
  64. package/lib/sdk-nextjs/components/items/useStickyItemTop.js +17 -0
  65. package/lib/sdk-nextjs/components/useLayoutContext.js +9 -0
  66. package/{dist → lib}/sdk-nextjs/interactions/CSSPropertyNameMap.d.ts +2 -2
  67. package/lib/sdk-nextjs/interactions/CSSPropertyNameMap.js +38 -0
  68. package/lib/sdk-nextjs/interactions/InteractionsRegistry.js +355 -0
  69. package/lib/sdk-nextjs/interactions/ItemInteractionCtrl.js +72 -0
  70. package/lib/sdk-nextjs/interactions/getTransition.js +20 -0
  71. package/{dist → lib}/sdk-nextjs/interactions/types.d.ts +3 -3
  72. package/lib/sdk-nextjs/interactions/useItemInteractionCtrl.js +16 -0
  73. package/{dist → lib}/sdk-nextjs/provider/ArticleRectContext.d.ts +1 -1
  74. package/lib/sdk-nextjs/provider/ArticleRectContext.js +5 -0
  75. package/{dist → lib}/sdk-nextjs/provider/CntrlContext.d.ts +1 -1
  76. package/lib/sdk-nextjs/provider/CntrlContext.js +6 -0
  77. package/lib/sdk-nextjs/provider/CntrlProvider.js +10 -0
  78. package/lib/sdk-nextjs/provider/CntrlSdkContext.js +76 -0
  79. package/lib/sdk-nextjs/provider/CustomItemRegistry.js +16 -0
  80. package/{dist → lib}/sdk-nextjs/provider/CustomSectionRegistry.d.ts +1 -1
  81. package/lib/sdk-nextjs/provider/CustomSectionRegistry.js +21 -0
  82. package/{dist → lib}/sdk-nextjs/provider/InteractionsContext.d.ts +1 -1
  83. package/lib/sdk-nextjs/provider/InteractionsContext.js +52 -0
  84. package/{dist → lib}/sdk-nextjs/provider/Keyframes.d.ts +1 -1
  85. package/lib/sdk-nextjs/provider/Keyframes.js +12 -0
  86. package/lib/sdk-nextjs/provider/KeyframesContext.d.ts +2 -0
  87. package/lib/sdk-nextjs/provider/KeyframesContext.js +6 -0
  88. package/lib/sdk-nextjs/provider/LayoutContext.d.ts +1 -0
  89. package/lib/sdk-nextjs/provider/LayoutContext.js +5 -0
  90. package/{dist → lib}/sdk-nextjs/provider/WebGLContextManagerContext.d.ts +1 -1
  91. package/lib/sdk-nextjs/provider/WebGLContextManagerContext.js +6 -0
  92. package/lib/sdk-nextjs/provider/defaultContext.js +9 -0
  93. package/lib/sdk-nextjs/provider/useCntrlContext.js +9 -0
  94. package/lib/sdk-nextjs/utils/Animator/Animator.js +443 -0
  95. package/lib/sdk-nextjs/utils/ArticleRectManager/ArticleRectObserver.js +88 -0
  96. package/lib/sdk-nextjs/utils/ArticleRectManager/useArticleRectObserver.js +18 -0
  97. package/lib/sdk-nextjs/utils/ArticleRectManager/useSectionRegistry.js +14 -0
  98. package/lib/sdk-nextjs/utils/EventEmitter.js +37 -0
  99. package/lib/sdk-nextjs/utils/RichTextConverter/RichTextConverter.js +288 -0
  100. package/lib/sdk-nextjs/utils/ScaleAnchorMap.js +15 -0
  101. package/lib/sdk-nextjs/utils/Youtube/YouTubeIframeApiLoader.js +64 -0
  102. package/lib/sdk-nextjs/utils/Youtube/YoutubeIframeApi.js +12 -0
  103. package/lib/sdk-nextjs/utils/Youtube/useYouTubeIframeApi.js +13 -0
  104. package/lib/sdk-nextjs/utils/areFillsVisible/areFillsVisible.js +22 -0
  105. package/lib/sdk-nextjs/utils/binSearchInsertAt.js +35 -0
  106. package/lib/sdk-nextjs/utils/checkOverflowClipSupport.js +18 -0
  107. package/lib/sdk-nextjs/utils/effects/useImageFx.js +114 -0
  108. package/lib/sdk-nextjs/utils/effects/useVideoFx.js +117 -0
  109. package/lib/sdk-nextjs/utils/getAnchoredItemTop.js +14 -0
  110. package/lib/sdk-nextjs/utils/getCompoundBoundaryStyles.js +60 -0
  111. package/lib/sdk-nextjs/utils/getFill.js +42 -0
  112. package/lib/sdk-nextjs/utils/getFontFamilyValue.js +6 -0
  113. package/lib/sdk-nextjs/utils/getItemTopStyle.js +17 -0
  114. package/lib/sdk-nextjs/utils/getStyleFromItemStateAndParams.js +8 -0
  115. package/lib/sdk-nextjs/utils/getValidYoutubeUrl.js +33 -0
  116. package/lib/sdk-nextjs/utils/isItemType.js +6 -0
  117. package/lib/sdk-nextjs/utils/rangeMap.js +11 -0
  118. package/lib/sdk-nextjs/utils/useElementRect.js +24 -0
  119. package/lib/utils.js +30 -0
  120. package/package.json +3 -3
  121. package/dist/cli.js +0 -64
  122. package/dist/index.js +0 -7765
  123. package/dist/index.mjs +0 -7748
  124. package/dist/sdk/Client/Client.test.d.ts +0 -1
  125. package/dist/sdk/Client/__mock__/articleMock.d.ts +0 -2
  126. package/dist/sdk/Client/__mock__/keyframesMock.d.ts +0 -2
  127. package/dist/sdk/Client/__mock__/projectMock.d.ts +0 -2
  128. package/dist/sdk/Components/ControlSlider/ControlSlider.d.ts +0 -90
  129. package/dist/sdk/Components/ControlSlider/ControlSliderComponent.d.ts +0 -519
  130. package/dist/sdk/Components/ImageRevealSlider/ControlImageRevealSliderComponent.d.ts +0 -209
  131. package/dist/sdk/Components/ImageRevealSlider/ImageRevealSlider.d.ts +0 -38
  132. package/dist/sdk/Components/components.d.ts +0 -2
  133. package/dist/sdk/Components/helpers/RichTextRenderer/RichTextRenderer.d.ts +0 -6
  134. package/dist/sdk/Components/helpers/SvgImage/SvgImage.d.ts +0 -9
  135. package/dist/sdk/Components/utils/scalingValue.d.ts +0 -1
  136. package/dist/sdk/FontFaceGenerator/FontFaceGenerator.test.d.ts +0 -1
  137. package/dist/sdk/schemas/shared/FillLayer.schema.d.ts +0 -186
  138. package/dist/sdk-nextjs/components/LayoutStyle.d.ts +0 -9
  139. package/dist/sdk-nextjs/components/Section/useSectionColor.d.ts +0 -4
  140. package/dist/sdk-nextjs/provider/KeyframesContext.d.ts +0 -2
  141. package/dist/sdk-nextjs/provider/LayoutContext.d.ts +0 -1
  142. package/dist/sdk-nextjs/utils/StickyManager/StickyManager.d.ts +0 -10
  143. package/dist/sdk-nextjs/utils/areFillsVisible/areFillsVisible.test.d.ts +0 -1
  144. package/dist/sdk-nextjs/utils/castObject.d.ts +0 -5
  145. package/dist/sdk-nextjs/utils/getInvertedRanges.d.ts +0 -10
  146. package/dist/sdk.css +0 -1
  147. /package/{dist → lib}/cli.d.ts +0 -0
  148. /package/{dist → lib}/sdk/Client/Client.d.ts +0 -0
  149. /package/{dist → lib}/sdk/Client/Client.js +0 -0
  150. /package/{dist → lib}/sdk/FontFaceGenerator/FontFaceGenerator.d.ts +0 -0
  151. /package/{dist → lib}/sdk/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.d.ts +0 -0
  152. /package/{dist → lib}/sdk/VideoDecoder/VideoDecoder.d.ts +0 -0
  153. /package/{dist → lib}/sdk/schemas/article/Article.schema.js +0 -0
  154. /package/{dist → lib}/sdk/schemas/article/FillLayer.schema.d.ts +0 -0
  155. /package/{dist → lib}/sdk/schemas/article/FillLayer.schema.js +0 -0
  156. /package/{dist → lib}/sdk/schemas/article/Interaction.schema.d.ts +0 -0
  157. /package/{dist → lib}/sdk/schemas/article/Interaction.schema.js +0 -0
  158. /package/{dist → lib}/sdk/schemas/article/Item.schema.d.ts +0 -0
  159. /package/{dist → lib}/sdk/schemas/article/Item.schema.js +0 -0
  160. /package/{dist → lib}/sdk/schemas/article/ItemArea.schema.d.ts +0 -0
  161. /package/{dist → lib}/sdk/schemas/article/ItemArea.schema.js +0 -0
  162. /package/{dist → lib}/sdk/schemas/article/ItemBase.schema.js +0 -0
  163. /package/{dist → lib}/sdk/schemas/article/ItemState.schema.d.ts +0 -0
  164. /package/{dist → lib}/sdk/schemas/article/ItemState.schema.js +0 -0
  165. /package/{dist → lib}/sdk/schemas/article/RichTextItem.schema.js +0 -0
  166. /package/{dist → lib}/sdk/schemas/article/Section.schema.js +0 -0
  167. /package/{dist → lib}/sdk/schemas/keyframe/Keyframes.schema.d.ts +0 -0
  168. /package/{dist → lib}/sdk/schemas/keyframe/Keyframes.schema.js +0 -0
  169. /package/{dist → lib}/sdk/schemas/project/Layout.schema.d.ts +0 -0
  170. /package/{dist → lib}/sdk/schemas/project/Layout.schema.js +0 -0
  171. /package/{dist → lib}/sdk/schemas/project/Project.schema.d.ts +0 -0
  172. /package/{dist → lib}/sdk/schemas/project/Project.schema.js +0 -0
  173. /package/{dist → lib}/sdk/types/article/Article.d.ts +0 -0
  174. /package/{dist/sdk/types/article/FX.js → lib/sdk/types/article/Article.js} +0 -0
  175. /package/{dist → lib}/sdk/types/article/ArticleItemType.d.ts +0 -0
  176. /package/{dist → lib}/sdk/types/article/ArticleItemType.js +0 -0
  177. /package/{dist → lib}/sdk/types/article/CompoundSettings.d.ts +0 -0
  178. /package/{dist/sdk/types/article/Interaction.js → lib/sdk/types/article/CompoundSettings.js} +0 -0
  179. /package/{dist → lib}/sdk/types/article/FX.d.ts +0 -0
  180. /package/{dist/sdk/types/project/Layout.js → lib/sdk/types/article/FX.js} +0 -0
  181. /package/{dist → lib}/sdk/types/article/Interaction.d.ts +0 -0
  182. /package/{dist/sdk/types/project/Meta.js → lib/sdk/types/article/Interaction.js} +0 -0
  183. /package/{dist → lib}/sdk/types/article/Item.d.ts +0 -0
  184. /package/{dist → lib}/sdk/types/article/Item.js +0 -0
  185. /package/{dist → lib}/sdk/types/article/ItemArea.d.ts +0 -0
  186. /package/{dist → lib}/sdk/types/article/ItemArea.js +0 -0
  187. /package/{dist → lib}/sdk/types/article/ItemState.d.ts +0 -0
  188. /package/{dist → lib}/sdk/types/article/ItemState.js +0 -0
  189. /package/{dist → lib}/sdk/types/article/RichText.d.ts +0 -0
  190. /package/{dist → lib}/sdk/types/article/RichText.js +0 -0
  191. /package/{dist → lib}/sdk/types/article/Section.d.ts +0 -0
  192. /package/{dist → lib}/sdk/types/article/Section.js +0 -0
  193. /package/{dist/sdk/types/project/Page.js → lib/sdk/types/component/Component.js} +0 -0
  194. /package/{dist → lib}/sdk/types/keyframe/Keyframe.js +0 -0
  195. /package/{dist → lib}/sdk/types/project/Fonts.d.ts +0 -0
  196. /package/{dist → lib}/sdk/types/project/Fonts.js +0 -0
  197. /package/{dist → lib}/sdk/types/project/Layout.d.ts +0 -0
  198. /package/{dist/sdk/types/project/Project.js → lib/sdk/types/project/Layout.js} +0 -0
  199. /package/{dist → lib}/sdk/types/project/Meta.d.ts +0 -0
  200. /package/{dist → lib}/sdk/types/project/Page.d.ts +0 -0
  201. /package/{dist → lib}/sdk/types/project/Project.d.ts +0 -0
  202. /package/{dist → lib}/sdk-nextjs/common/useCurrentLayout.d.ts +0 -0
  203. /package/{dist → lib}/sdk-nextjs/common/useExemplary.d.ts +0 -0
  204. /package/{dist → lib}/sdk-nextjs/common/useItemFXData.d.ts +0 -0
  205. /package/{dist → lib}/sdk-nextjs/common/useKeyframeValue.d.ts +0 -0
  206. /package/{dist → lib}/sdk-nextjs/common/useRegisterResize.d.ts +0 -0
  207. /package/{dist → lib}/sdk-nextjs/components/Article.d.ts +0 -0
  208. /package/{dist → lib}/sdk-nextjs/components/ArticleWrapper.d.ts +0 -0
  209. /package/{dist → lib}/sdk-nextjs/components/Head.d.ts +0 -0
  210. /package/{dist → lib}/sdk-nextjs/components/Page.d.ts +0 -0
  211. /package/{dist → lib}/sdk-nextjs/components/Section/Section.d.ts +0 -0
  212. /package/{dist → lib}/sdk-nextjs/components/Section/SectionImage.d.ts +0 -0
  213. /package/{dist → lib}/sdk-nextjs/components/Section/SectionVideo.d.ts +0 -0
  214. /package/{dist → lib}/sdk-nextjs/components/Section/useSectionHeightMap.d.ts +0 -0
  215. /package/{dist → lib}/sdk-nextjs/components/items/CodeEmbedItem/CodeEmbedItem.d.ts +0 -0
  216. /package/{dist → lib}/sdk-nextjs/components/items/CodeEmbedItem/useCodeEmbedItem.d.ts +0 -0
  217. /package/{dist → lib}/sdk-nextjs/components/items/ComponentItem/ComponentItem.d.ts +0 -0
  218. /package/{dist → lib}/sdk-nextjs/components/items/ComponentItem/useComponentItem.d.ts +0 -0
  219. /package/{dist → lib}/sdk-nextjs/components/items/CompoundItem/CompoundChild.d.ts +0 -0
  220. /package/{dist → lib}/sdk-nextjs/components/items/CompoundItem/CompoundItem.d.ts +0 -0
  221. /package/{dist → lib}/sdk-nextjs/components/items/CompoundItem/useCompoundItem.d.ts +0 -0
  222. /package/{dist → lib}/sdk-nextjs/components/items/CustomItem/CustomItem.d.ts +0 -0
  223. /package/{dist → lib}/sdk-nextjs/components/items/EmbedVideoItem/YoutubeEmbed.d.ts +0 -0
  224. /package/{dist → lib}/sdk-nextjs/components/items/EmbedVideoItem/useEmbedVideoItem.d.ts +0 -0
  225. /package/{dist → lib}/sdk-nextjs/components/items/FileItem/ImageItem.d.ts +0 -0
  226. /package/{dist → lib}/sdk-nextjs/components/items/FileItem/VideoItem.d.ts +0 -0
  227. /package/{dist → lib}/sdk-nextjs/components/items/GroupItem/GroupItem.d.ts +0 -0
  228. /package/{dist → lib}/sdk-nextjs/components/items/GroupItem/useGroupItem.d.ts +0 -0
  229. /package/{dist → lib}/sdk-nextjs/components/items/Item.d.ts +0 -0
  230. /package/{dist → lib}/sdk-nextjs/components/items/RectangleItem/RectangleItem.d.ts +0 -0
  231. /package/{dist → lib}/sdk-nextjs/components/items/RectangleItem/useRectangleItem.d.ts +0 -0
  232. /package/{dist → lib}/sdk-nextjs/components/items/RichTextItem/RichTextItem.d.ts +0 -0
  233. /package/{dist → lib}/sdk-nextjs/components/items/RichTextItem/useRichTextItem.d.ts +0 -0
  234. /package/{dist → lib}/sdk-nextjs/components/items/RichTextWrapper.d.ts +0 -0
  235. /package/{dist → lib}/sdk-nextjs/components/items/itemsMap.d.ts +0 -0
  236. /package/{dist → lib}/sdk-nextjs/components/items/useDraggable.d.ts +0 -0
  237. /package/{dist → lib}/sdk-nextjs/components/items/useItemAngle.d.ts +0 -0
  238. /package/{dist → lib}/sdk-nextjs/components/items/useItemArea.d.ts +0 -0
  239. /package/{dist → lib}/sdk-nextjs/components/items/useItemPointerEvents.d.ts +0 -0
  240. /package/{dist → lib}/sdk-nextjs/components/items/useItemScale.d.ts +0 -0
  241. /package/{dist → lib}/sdk-nextjs/components/items/useItemTriggers.d.ts +0 -0
  242. /package/{dist → lib}/sdk-nextjs/components/items/useRichTextItemValues.d.ts +0 -0
  243. /package/{dist → lib}/sdk-nextjs/components/items/useSizing.d.ts +0 -0
  244. /package/{dist → lib}/sdk-nextjs/components/items/useStickyItemTop.d.ts +0 -0
  245. /package/{dist → lib}/sdk-nextjs/components/useLayoutContext.d.ts +0 -0
  246. /package/{dist → lib}/sdk-nextjs/interactions/InteractionsRegistry.d.ts +0 -0
  247. /package/{dist → lib}/sdk-nextjs/interactions/ItemInteractionCtrl.d.ts +0 -0
  248. /package/{dist → lib}/sdk-nextjs/interactions/getTransition.d.ts +0 -0
  249. /package/{dist/sdk/types/article/Article.js → lib/sdk-nextjs/interactions/types.js} +0 -0
  250. /package/{dist → lib}/sdk-nextjs/interactions/useItemInteractionCtrl.d.ts +0 -0
  251. /package/{dist → lib}/sdk-nextjs/provider/CntrlProvider.d.ts +0 -0
  252. /package/{dist → lib}/sdk-nextjs/provider/CntrlSdkContext.d.ts +0 -0
  253. /package/{dist → lib}/sdk-nextjs/provider/CustomItemRegistry.d.ts +0 -0
  254. /package/{dist → lib}/sdk-nextjs/provider/CustomItemTypes.d.ts +0 -0
  255. /package/{dist/sdk/types/article/CompoundSettings.js → lib/sdk-nextjs/provider/CustomItemTypes.js} +0 -0
  256. /package/{dist → lib}/sdk-nextjs/provider/defaultContext.d.ts +0 -0
  257. /package/{dist → lib}/sdk-nextjs/provider/useCntrlContext.d.ts +0 -0
  258. /package/{dist → lib}/sdk-nextjs/utils/Animator/Animator.d.ts +0 -0
  259. /package/{dist → lib}/sdk-nextjs/utils/ArticleRectManager/ArticleRectObserver.d.ts +0 -0
  260. /package/{dist → lib}/sdk-nextjs/utils/ArticleRectManager/useArticleRectObserver.d.ts +0 -0
  261. /package/{dist → lib}/sdk-nextjs/utils/ArticleRectManager/useSectionRegistry.d.ts +0 -0
  262. /package/{dist → lib}/sdk-nextjs/utils/EventEmitter.d.ts +0 -0
  263. /package/{dist → lib}/sdk-nextjs/utils/RichTextConverter/RichTextConverter.d.ts +0 -0
  264. /package/{dist → lib}/sdk-nextjs/utils/ScaleAnchorMap.d.ts +0 -0
  265. /package/{dist → lib}/sdk-nextjs/utils/Youtube/YouTubeIframeApiLoader.d.ts +0 -0
  266. /package/{dist → lib}/sdk-nextjs/utils/Youtube/YoutubeIframeApi.d.ts +0 -0
  267. /package/{dist → lib}/sdk-nextjs/utils/Youtube/useYouTubeIframeApi.d.ts +0 -0
  268. /package/{dist → lib}/sdk-nextjs/utils/areFillsVisible/areFillsVisible.d.ts +0 -0
  269. /package/{dist → lib}/sdk-nextjs/utils/binSearchInsertAt.d.ts +0 -0
  270. /package/{dist → lib}/sdk-nextjs/utils/checkOverflowClipSupport.d.ts +0 -0
  271. /package/{dist → lib}/sdk-nextjs/utils/effects/useImageFx.d.ts +0 -0
  272. /package/{dist → lib}/sdk-nextjs/utils/effects/useVideoFx.d.ts +0 -0
  273. /package/{dist → lib}/sdk-nextjs/utils/getAnchoredItemTop.d.ts +0 -0
  274. /package/{dist → lib}/sdk-nextjs/utils/getCompoundBoundaryStyles.d.ts +0 -0
  275. /package/{dist → lib}/sdk-nextjs/utils/getFill.d.ts +0 -0
  276. /package/{dist → lib}/sdk-nextjs/utils/getFontFamilyValue.d.ts +0 -0
  277. /package/{dist → lib}/sdk-nextjs/utils/getItemTopStyle.d.ts +0 -0
  278. /package/{dist → lib}/sdk-nextjs/utils/getStyleFromItemStateAndParams.d.ts +0 -0
  279. /package/{dist → lib}/sdk-nextjs/utils/getValidYoutubeUrl.d.ts +0 -0
  280. /package/{dist → lib}/sdk-nextjs/utils/isItemType.d.ts +0 -0
  281. /package/{dist → lib}/sdk-nextjs/utils/rangeMap.d.ts +0 -0
  282. /package/{dist → lib}/sdk-nextjs/utils/useElementRect.d.ts +0 -0
  283. /package/{dist → lib}/utils.d.ts +0 -0
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SectionImage = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const SectionImage = ({ media, sectionId }) => {
6
+ const { url, size, position, offsetX } = media;
7
+ const isContainHeight = size === 'contain-height';
8
+ const hasOffsetX = offsetX !== null && size === 'contain';
9
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: `section-image-wrapper-${sectionId}`, style: {
10
+ position: position === 'fixed' ? 'sticky' : 'relative',
11
+ height: position === 'fixed' ? '100vh' : '100%',
12
+ top: position === 'fixed' ? '100vh' : '0',
13
+ width: '100%',
14
+ overflow: 'hidden'
15
+ }, children: (0, jsx_runtime_1.jsx)("img", { src: url, className: `image-background-${sectionId}`, style: {
16
+ objectFit: isContainHeight ? 'unset' : (size !== null && size !== void 0 ? size : 'cover'),
17
+ width: isContainHeight || hasOffsetX ? 'auto' : '100%',
18
+ transform: isContainHeight ? 'translateX(-50%)' : 'none',
19
+ position: 'relative',
20
+ left: isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0'),
21
+ height: '100%'
22
+ } }) }) }));
23
+ };
24
+ exports.SectionImage = SectionImage;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SectionVideo = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const SectionVideo = ({ container, sectionId, media }) => {
7
+ const [video, setVideo] = (0, react_1.useState)(null);
8
+ const [videoWrapper, setVideoWrapper] = (0, react_1.useState)(null);
9
+ const [isVideoWidthOverflow, setIsVideoWidthOverflow] = (0, react_1.useState)(false);
10
+ const { url, size, position, offsetX, coverUrl, play } = media;
11
+ const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
12
+ const [userPaused, setUserPaused] = (0, react_1.useState)(false);
13
+ const [isClickedOnCover, setIsClickedOnCover] = (0, react_1.useState)(false);
14
+ const handleCoverClick = () => {
15
+ if (!video || play !== 'on-click')
16
+ return;
17
+ setIsClickedOnCover(true);
18
+ if (isPlaying) {
19
+ video.pause();
20
+ setUserPaused(true);
21
+ }
22
+ else {
23
+ video.play();
24
+ setUserPaused(false);
25
+ }
26
+ };
27
+ (0, react_1.useEffect)(() => {
28
+ if (!video || play !== 'on-click')
29
+ return;
30
+ const observer = new IntersectionObserver(([entry]) => {
31
+ if (userPaused || !isClickedOnCover)
32
+ return;
33
+ if (entry.isIntersecting) {
34
+ video.play();
35
+ }
36
+ else {
37
+ video.pause();
38
+ }
39
+ });
40
+ observer.observe(container);
41
+ return () => observer.disconnect();
42
+ }, [container, play, userPaused, isClickedOnCover]);
43
+ (0, react_1.useEffect)(() => {
44
+ if (!video || !videoWrapper)
45
+ return;
46
+ video.addEventListener('loadedmetadata', () => {
47
+ const h = video.videoHeight;
48
+ const w = video.videoWidth;
49
+ const width = (videoWrapper.clientHeight / h) * w;
50
+ if (width > videoWrapper.clientWidth) {
51
+ setIsVideoWidthOverflow(true);
52
+ }
53
+ else {
54
+ setIsVideoWidthOverflow(false);
55
+ }
56
+ });
57
+ }, [video, videoWrapper]);
58
+ const isContainHeight = size === 'contain-height';
59
+ const hasOffsetX = offsetX !== null && size === 'contain';
60
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { ref: setVideoWrapper, className: `section-video-wrapper-${sectionId}`, style: {
61
+ position: position === 'fixed' ? 'sticky' : 'relative',
62
+ height: position === 'fixed' ? '100vh' : '100%',
63
+ top: position === 'fixed' ? '100vh' : '0',
64
+ overflow: 'hidden',
65
+ width: '100%'
66
+ }, children: [(0, jsx_runtime_1.jsx)("video", { ref: setVideo, autoPlay: play === 'auto', loop: true, style: {
67
+ opacity: !isClickedOnCover && play === 'on-click' && coverUrl ? 0 : 1,
68
+ objectFit: isContainHeight ? 'cover' : (size !== null && size !== void 0 ? size : 'cover'),
69
+ width: isContainHeight && !isVideoWidthOverflow ? 'auto' : '100%',
70
+ transform: isContainHeight ? 'translateX(-50%)' : 'none',
71
+ left: isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0'),
72
+ height: '100%',
73
+ position: 'relative'
74
+ }, controls: play === 'on-click', muted: play === 'auto', playsInline: true, preload: "auto", className: `video-background-${sectionId}`, onPlay: () => setIsPlaying(true), onPause: () => setIsPlaying(false), children: (0, jsx_runtime_1.jsx)("source", { src: `${url}` }) }), play === 'on-click' && !isClickedOnCover && ((0, jsx_runtime_1.jsx)("div", { className: `video-background-${sectionId}-cover-container`, style: {
75
+ position: 'absolute',
76
+ left: 0,
77
+ width: '100%',
78
+ height: '100%',
79
+ top: 0
80
+ }, onClick: handleCoverClick, children: coverUrl && play === 'on-click' && ((0, jsx_runtime_1.jsx)("img", { src: coverUrl, alt: "Video cover", className: `video-background-${sectionId}-cover`, style: {
81
+ opacity: isPlaying ? 0 : 1,
82
+ left: isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0'),
83
+ width: isContainHeight ? 'auto' : '100%',
84
+ objectFit: isContainHeight ? 'unset' : (size !== null && size !== void 0 ? size : 'cover'),
85
+ transform: isContainHeight ? 'translateX(-50%)' : 'none',
86
+ position: 'relative',
87
+ height: '100%',
88
+ transition: 'opacity 0.1s ease-in-out'
89
+ } })) }))] }) }));
90
+ };
91
+ exports.SectionVideo = SectionVideo;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSectionHeightData = void 0;
4
+ exports.getSectionHeightMap = getSectionHeightMap;
5
+ const react_1 = require("react");
6
+ const CntrlContext_1 = require("../../provider/CntrlContext");
7
+ const Section_1 = require("./Section");
8
+ const useSectionHeightData = (sectionId) => {
9
+ const sectionHeightContext = (0, react_1.useContext)(CntrlContext_1.CntrlContext);
10
+ const layouts = sectionHeightContext.layouts;
11
+ const sectionHeightData = sectionHeightContext.getSectionHeightData(sectionId);
12
+ return sectionHeightData ? getSectionHeightMap(sectionHeightData) : getDefaultHeightData(layouts);
13
+ };
14
+ exports.useSectionHeightData = useSectionHeightData;
15
+ function getSectionHeightMap(sectionHeight) {
16
+ return Object.fromEntries(Object.entries(sectionHeight).map(([sectionId, heightData]) => [sectionId, (0, Section_1.getSectionHeight)(heightData)]));
17
+ }
18
+ function getDefaultHeightData(layouts) {
19
+ return layouts.reduce((acc, layout) => (Object.assign(Object.assign({}, acc), { [layout.id]: '0' })), {});
20
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CodeEmbedItem = void 0;
7
+ exports.decodeBase64 = decodeBase64;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const react_1 = require("react");
10
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
11
+ const style_1 = __importDefault(require("styled-jsx/style"));
12
+ const useRegisterResize_1 = require("../../../common/useRegisterResize");
13
+ const useItemAngle_1 = require("../useItemAngle");
14
+ const LinkWrapper_1 = require("../LinkWrapper");
15
+ const useCodeEmbedItem_1 = require("./useCodeEmbedItem");
16
+ const ItemArea_1 = require("../../../../sdk/types/article/ItemArea");
17
+ const utils_1 = require("../../../../utils");
18
+ const FontFaceGenerator_1 = require("../../../../sdk/FontFaceGenerator/FontFaceGenerator");
19
+ const stylesMap = {
20
+ [ItemArea_1.AreaAnchor.TopLeft]: {},
21
+ [ItemArea_1.AreaAnchor.TopCenter]: { justifyContent: 'center' },
22
+ [ItemArea_1.AreaAnchor.TopRight]: { justifyContent: 'flex-end' },
23
+ [ItemArea_1.AreaAnchor.MiddleLeft]: { alignItems: 'center' },
24
+ [ItemArea_1.AreaAnchor.MiddleCenter]: { justifyContent: 'center', alignItems: 'center' },
25
+ [ItemArea_1.AreaAnchor.MiddleRight]: { justifyContent: 'flex-end', alignItems: 'center' },
26
+ [ItemArea_1.AreaAnchor.BottomLeft]: { alignItems: 'flex-end' },
27
+ [ItemArea_1.AreaAnchor.BottomCenter]: { justifyContent: 'center', alignItems: 'flex-end' },
28
+ [ItemArea_1.AreaAnchor.BottomRight]: { justifyContent: 'flex-end', alignItems: 'flex-end' }
29
+ };
30
+ const CodeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
31
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
32
+ const id = (0, react_1.useId)();
33
+ const { layouts, fonts } = (0, useCntrlContext_1.useCntrlContext)();
34
+ const fontGoogleTags = fonts === null || fonts === void 0 ? void 0 : fonts.google;
35
+ const fontAdobeTags = fonts === null || fonts === void 0 ? void 0 : fonts.adobe;
36
+ const fontCustomTags = new FontFaceGenerator_1.FontFaceGenerator((_a = fonts === null || fonts === void 0 ? void 0 : fonts.custom) !== null && _a !== void 0 ? _a : []).generate();
37
+ const { anchor, blur: itemBlur, opacity: itemOpacity } = (0, useCodeEmbedItem_1.useCodeEmbedItem)(item, sectionId);
38
+ const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
39
+ const html = decodeBase64(item.commonParams.html);
40
+ const [ref, setRef] = (0, react_1.useState)(null);
41
+ (0, useRegisterResize_1.useRegisterResize)(ref, onResize);
42
+ const pos = stylesMap[anchor];
43
+ const layoutValues = [item.area, item.layoutParams];
44
+ const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['angle', 'blur', 'opacity']);
45
+ const blur = ((_c = (_b = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _b === void 0 ? void 0 : _b.blur) !== null && _c !== void 0 ? _c : itemBlur);
46
+ const opacity = (_e = (_d = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _d === void 0 ? void 0 : _d.opacity) !== null && _e !== void 0 ? _e : itemOpacity;
47
+ const angle = (_g = (_f = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _f === void 0 ? void 0 : _f.angle) !== null && _g !== void 0 ? _g : itemAngle;
48
+ (0, react_1.useEffect)(() => {
49
+ if (!ref)
50
+ return;
51
+ const scripts = ref.querySelectorAll('script');
52
+ for (const script of scripts) {
53
+ const newScript = document.createElement('script');
54
+ for (const attr of script.getAttributeNames()) {
55
+ newScript.setAttribute(attr, script.getAttribute(attr));
56
+ }
57
+ newScript.textContent = script.textContent;
58
+ script.parentNode.removeChild(script);
59
+ ref.appendChild(newScript);
60
+ }
61
+ }, [html]);
62
+ (0, react_1.useEffect)(() => {
63
+ if (!ref)
64
+ return;
65
+ const iframe = ref.querySelector(`[data-embed="${item.id}"]`);
66
+ if (!iframe)
67
+ return;
68
+ const htmlWithStyles = `
69
+ ${fontGoogleTags}
70
+ ${fontAdobeTags}
71
+ <style>
72
+ ${fontCustomTags}
73
+ html, body {
74
+ height: 100%;
75
+ margin: 0 !important;
76
+ padding: 0 !important;
77
+ }
78
+ </style>
79
+ ${html}
80
+ `;
81
+ iframe.srcdoc = htmlWithStyles;
82
+ }, [html, item.commonParams.iframe, ref]);
83
+ const isInteractive = opacity !== 0;
84
+ (0, react_1.useEffect)(() => {
85
+ onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
86
+ }, [isInteractive, onVisibilityChange]);
87
+ return ((0, jsx_runtime_1.jsxs)(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.jsx)("div", { className: `embed-wrapper-${item.id}`, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (opacity !== undefined ? { opacity } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_k = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _k !== void 0 ? _k : 'none' }), ref: setRef, children: item.commonParams.iframe ? ((0, jsx_runtime_1.jsx)("iframe", { "data-embed": item.id, className: `embed-${item.id}`, style: Object.assign(Object.assign({}, pos), { border: 'unset' }) })) : ((0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, style: Object.assign({}, pos), dangerouslySetInnerHTML: { __html: html } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
88
+ .embed-wrapper-${item.id} {
89
+ position: absolute;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+ .embed-${item.id} {
94
+ transform: ${item.commonParams.scale ? 'scale(var(--layout-deviation))' : 'none'};
95
+ transform-origin: top left;
96
+ z-index: 1;
97
+ border: none;
98
+ }
99
+ ${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams], exemplary) => {
100
+ return (`
101
+ .embed-wrapper-${item.id} {
102
+ opacity: ${layoutParams.opacity};
103
+ transform: rotate(${area.angle}deg);
104
+ filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
105
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
106
+ }
107
+ .embed-${item.id} {
108
+ width: ${item.commonParams.scale ? `${area.width * exemplary}px` : '100%'};
109
+ height: ${item.commonParams.scale ? `${area.height * exemplary}px` : '100%'};
110
+ }
111
+ `);
112
+ })}
113
+ ` })] }));
114
+ };
115
+ exports.CodeEmbedItem = CodeEmbedItem;
116
+ function decodeBase64(str) {
117
+ const binary = atob(str);
118
+ const bytes = Uint8Array.from(binary, char => char.charCodeAt(0));
119
+ return new TextDecoder().decode(bytes);
120
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCodeEmbedItem = useCodeEmbedItem;
4
+ const useLayoutContext_1 = require("../../useLayoutContext");
5
+ const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
6
+ const Keyframe_1 = require("../../../../sdk/types/keyframe/Keyframe");
7
+ const ItemArea_1 = require("../../../../sdk/types/article/ItemArea");
8
+ function useCodeEmbedItem(item, sectionId) {
9
+ const layoutId = (0, useLayoutContext_1.useLayoutContext)();
10
+ const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Blur, (item, layoutId) => {
11
+ if (!layoutId)
12
+ return;
13
+ const layoutParams = item.layoutParams[layoutId];
14
+ return 'blur' in layoutParams ? layoutParams.blur : 0;
15
+ }, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
16
+ const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Opacity, (item, layoutId) => {
17
+ if (!layoutId)
18
+ return;
19
+ const layoutParams = item.layoutParams[layoutId];
20
+ return 'opacity' in layoutParams ? layoutParams.opacity : 1;
21
+ }, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
22
+ const anchor = layoutId && 'areaAnchor' in item.layoutParams[layoutId] ? item.layoutParams[layoutId].areaAnchor : ItemArea_1.AreaAnchor.TopLeft;
23
+ return { anchor, blur, opacity };
24
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ComponentItem = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const style_1 = __importDefault(require("styled-jsx/style"));
9
+ const react_1 = require("react");
10
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
11
+ const useComponentItem_1 = require("./useComponentItem");
12
+ const useItemAngle_1 = require("../useItemAngle");
13
+ const useRegisterResize_1 = require("../../../common/useRegisterResize");
14
+ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
15
+ const useLayoutContext_1 = require("../../useLayoutContext");
16
+ const utils_1 = require("../../../../utils");
17
+ const ComponentItem = ({ item, sectionId, onResize, interactionCtrl }) => {
18
+ var _a, _b, _c, _d;
19
+ const sdk = (0, useCntrlContext_1.useCntrlContext)();
20
+ const { layouts } = sdk;
21
+ const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
22
+ const layout = (0, useLayoutContext_1.useLayoutContext)();
23
+ const layoutValues = [item.area, item.layoutParams];
24
+ const component = sdk.getComponent(item.commonParams.componentId);
25
+ const [ref, setRef] = (0, react_1.useState)(null);
26
+ const { opacity: itemOpacity, blur: itemBlur } = (0, useComponentItem_1.useComponentItem)(item, sectionId);
27
+ (0, useRegisterResize_1.useRegisterResize)(ref, onResize);
28
+ const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle', 'blur']);
29
+ const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_a = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _a === void 0 ? void 0 : _a.angle, itemAngle);
30
+ const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_b = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _b === void 0 ? void 0 : _b.opacity, itemOpacity);
31
+ const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _c === void 0 ? void 0 : _c.blur, itemBlur);
32
+ const Element = component ? component.element : undefined;
33
+ const parameters = layout ? item.layoutParams[layout].parameters : undefined;
34
+ 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(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: (_d = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _d !== void 0 ? _d : 'none' }), children: parameters && Element && ((0, jsx_runtime_1.jsx)(Element, Object.assign({ content: item.commonParams.content }, parameters))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: item.id, children: `
35
+ .custom-component-${item.id} {
36
+ width: 100%;
37
+ height: 100%;
38
+ pointer-events: auto;
39
+ }
40
+ ${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
41
+ return (`
42
+ .custom-component-${item.id} {
43
+ transform: rotate(${area.angle}deg);
44
+ opacity: ${layoutParams.opacity};
45
+ filter: blur(${layoutParams.blur}vw);
46
+ ${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
47
+ }
48
+ `);
49
+ })}` })] }));
50
+ };
51
+ exports.ComponentItem = ComponentItem;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useComponentItem = useComponentItem;
4
+ const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
5
+ const useLayoutContext_1 = require("../../useLayoutContext");
6
+ const Keyframe_1 = require("../../../../sdk/types/keyframe/Keyframe");
7
+ function useComponentItem(item, sectionId) {
8
+ const layoutId = (0, useLayoutContext_1.useLayoutContext)();
9
+ const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Opacity, (item, layoutId) => {
10
+ if (!layoutId)
11
+ return;
12
+ const layoutParams = item.layoutParams[layoutId];
13
+ return 'opacity' in layoutParams ? layoutParams.opacity : 1;
14
+ }, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
15
+ const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Blur, (item, layoutId) => {
16
+ if (!layoutId)
17
+ return;
18
+ const layoutParams = item.layoutParams[layoutId];
19
+ return 'blur' in layoutParams ? layoutParams.blur : 0;
20
+ }, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
21
+ return {
22
+ opacity,
23
+ blur
24
+ };
25
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CompoundChild = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
10
+ const useLayoutContext_1 = require("../../useLayoutContext");
11
+ const useExemplary_1 = require("../../../common/useExemplary");
12
+ const useItemScale_1 = require("../useItemScale");
13
+ const useItemInteractionCtrl_1 = require("../../../interactions/useItemInteractionCtrl");
14
+ const style_1 = __importDefault(require("styled-jsx/style"));
15
+ const ScaleAnchorMap_1 = require("../../../utils/ScaleAnchorMap");
16
+ const isItemType_1 = require("../../../utils/isItemType");
17
+ const RichTextWrapper_1 = require("../RichTextWrapper");
18
+ const itemsMap_1 = require("../itemsMap");
19
+ const getCompoundBoundaryStyles_1 = require("../../../utils/getCompoundBoundaryStyles");
20
+ const useItemTriggers_1 = require("../useItemTriggers");
21
+ const useSizing_1 = require("../useSizing");
22
+ const useItemPointerEvents_1 = require("../useItemPointerEvents");
23
+ const useItemArea_1 = require("../useItemArea");
24
+ const ArticleItemType_1 = require("../../../../sdk/types/article/ArticleItemType");
25
+ const utils_1 = require("../../../../utils");
26
+ const noop = () => null;
27
+ const CompoundChild = ({ item, sectionId, isParentVisible = true }) => {
28
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
29
+ const id = (0, react_1.useId)();
30
+ const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
31
+ const layout = (0, useLayoutContext_1.useLayoutContext)();
32
+ const exemplary = (0, useExemplary_1.useExemplary)();
33
+ const { handleVisibilityChange, allowPointerEvents } = (0, useItemPointerEvents_1.useItemPointerEvents)((_b = (_a = item.commonParams) === null || _a === void 0 ? void 0 : _a.pointerEvents) !== null && _b !== void 0 ? _b : 'when_visible', isParentVisible);
34
+ const itemScale = (0, useItemScale_1.useItemScale)(item, sectionId);
35
+ const interactionCtrl = (0, useItemInteractionCtrl_1.useItemInteractionCtrl)(item.id);
36
+ const triggers = (0, useItemTriggers_1.useItemTriggers)(interactionCtrl);
37
+ const wrapperStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['top', 'left', 'width', 'height']);
38
+ const innerStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['scale']);
39
+ const compoundSettings = layout && item.compoundSettings ? item.compoundSettings[layout] : undefined;
40
+ const { width, height, top, left } = (0, useItemArea_1.useItemArea)(item, sectionId, {
41
+ top: (_c = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _c === void 0 ? void 0 : _c.top,
42
+ left: (_d = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _d === void 0 ? void 0 : _d.left,
43
+ width: (_e = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _e === void 0 ? void 0 : _e.width,
44
+ height: (_f = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _f === void 0 ? void 0 : _f.height
45
+ });
46
+ const isInitialRef = (0, react_1.useRef)(true);
47
+ const sizingAxis = (0, useSizing_1.useSizing)(item);
48
+ const ItemComponent = itemsMap_1.itemsMap[item.type] || noop;
49
+ (0, react_1.useEffect)(() => {
50
+ isInitialRef.current = false;
51
+ }, []);
52
+ const transformOrigin = compoundSettings ? ScaleAnchorMap_1.ScaleAnchorMap[compoundSettings.positionAnchor] : 'top left';
53
+ const isRichText = (0, isItemType_1.isItemType)(item, ArticleItemType_1.ArticleItemType.RichText);
54
+ 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;
55
+ const hasClickTriggers = (_j = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getHasTrigger(item.id, 'click')) !== null && _j !== void 0 ? _j : false;
56
+ if (!item.compoundSettings)
57
+ return null;
58
+ const layoutValues = [item.area, item.hidden, item.compoundSettings];
59
+ if (item.layoutParams) {
60
+ layoutValues.push(item.layoutParams);
61
+ }
62
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `item-${item.id}`, onTransitionEnd: (e) => {
63
+ var _a;
64
+ e.stopPropagation();
65
+ (_a = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.handleTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(interactionCtrl, e.propertyName);
66
+ }, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (top !== undefined && compoundSettings ? { top: (0, getCompoundBoundaryStyles_1.getCompoundTop)(compoundSettings, top) } : {})), (left !== undefined && compoundSettings ? { left: (0, getCompoundBoundaryStyles_1.getCompoundLeft)(compoundSettings, left) } : {})), (width !== undefined && compoundSettings
67
+ ? { width: `${sizingAxis.x === 'manual'
68
+ ? (0, getCompoundBoundaryStyles_1.getCompoundWidth)(compoundSettings, width, isRichText, exemplary)
69
+ : 'max-content'}` }
70
+ : {})), (height !== undefined && compoundSettings
71
+ ? { height: `${sizingAxis.y === 'manual'
72
+ ? (0, getCompoundBoundaryStyles_1.getCompoundHeight)(compoundSettings, height)
73
+ : 'unset'}` }
74
+ : {})), (compoundSettings ? { transform: `${(0, getCompoundBoundaryStyles_1.getCompoundTransform)(compoundSettings)}` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none', cursor: hasClickTriggers ? 'pointer' : 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none' }) }, triggers, { children: [(0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: Object.assign({ transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none' }, (scale !== undefined ? { transform: `scale(${scale})` } : {})), children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, transformOrigin: transformOrigin, children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange, isInCompound: true }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
75
+ ${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, compoundSettings, layoutParams]) => {
76
+ const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
77
+ const scaleAnchor = area.scaleAnchor;
78
+ return (`
79
+ .item-${item.id}-inner {
80
+ width: 100%;
81
+ height: 100%;
82
+ transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
83
+ transform: scale(${area.scale});
84
+ }
85
+ .item-${item.id} {
86
+ position: absolute;
87
+ top: ${(0, getCompoundBoundaryStyles_1.getCompoundTop)(compoundSettings, area.top)};
88
+ left: ${(0, getCompoundBoundaryStyles_1.getCompoundLeft)(compoundSettings, area.left)};
89
+ transition: opacity 0.2s linear 0.1s;
90
+ display: ${hidden ? 'none' : 'block'};
91
+ width: ${sizingAxis.x === 'manual'
92
+ ? `${(0, getCompoundBoundaryStyles_1.getCompoundWidth)(compoundSettings, area.width, isRichText)}`
93
+ : 'max-content'};
94
+ height: ${sizingAxis.y === 'manual' ? `${(0, getCompoundBoundaryStyles_1.getCompoundHeight)(compoundSettings, area.height)}` : 'unset'};
95
+ transform: ${(0, getCompoundBoundaryStyles_1.getCompoundTransform)(compoundSettings)};
96
+ z-index: ${area.zIndex};
97
+ }
98
+ `);
99
+ })}
100
+ ` })] })));
101
+ };
102
+ exports.CompoundChild = CompoundChild;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CompoundItem = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const useItemAngle_1 = require("../useItemAngle");
10
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
11
+ const useRegisterResize_1 = require("../../../common/useRegisterResize");
12
+ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
13
+ const LinkWrapper_1 = require("../LinkWrapper");
14
+ const style_1 = __importDefault(require("styled-jsx/style"));
15
+ const CompoundChild_1 = require("./CompoundChild");
16
+ const useCompoundItem_1 = require("./useCompoundItem");
17
+ const utils_1 = require("../../../../utils");
18
+ const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
19
+ var _a, _b, _c, _d, _e;
20
+ const id = (0, react_1.useId)();
21
+ const { items } = item;
22
+ const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
23
+ const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
24
+ const { opacity: itemOpacity } = (0, useCompoundItem_1.useCompoundItem)(item, sectionId);
25
+ const layoutValues = [item.area, item.layoutParams];
26
+ const [ref, setRef] = (0, react_1.useState)(null);
27
+ (0, useRegisterResize_1.useRegisterResize)(ref, onResize);
28
+ const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle']);
29
+ const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_a = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _a === void 0 ? void 0 : _a.angle, itemAngle);
30
+ const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_b = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _b === void 0 ? void 0 : _b.opacity, itemOpacity);
31
+ const isInteractive = opacity !== 0 && opacity !== undefined;
32
+ (0, react_1.useEffect)(() => {
33
+ onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
34
+ }, [isInteractive, onVisibilityChange]);
35
+ return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_c = item.link) === null || _c === void 0 ? void 0 : _c.url, target: (_d = item.link) === null || _d === void 0 ? void 0 : _d.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `compound-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_e = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _e !== void 0 ? _e : 'none' }), children: items && items.map(item => ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
36
+ .compound-${item.id} {
37
+ overflow: ${item.commonParams.overflow};
38
+ position: absolute;
39
+ width: 100%;
40
+ height: 100%;
41
+ box-sizing: border-box;
42
+ }
43
+ ${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
44
+ return (`
45
+ .compound-${item.id} {
46
+ opacity: ${layoutParams.opacity};
47
+ transform: rotate(${area.angle}deg);
48
+ }
49
+ `);
50
+ })}
51
+ ` })] }) }));
52
+ };
53
+ exports.CompoundItem = CompoundItem;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCompoundItem = useCompoundItem;
4
+ const useLayoutContext_1 = require("../../useLayoutContext");
5
+ const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
6
+ const Keyframe_1 = require("../../../../sdk/types/keyframe/Keyframe");
7
+ function useCompoundItem(item, sectionId) {
8
+ const layoutId = (0, useLayoutContext_1.useLayoutContext)();
9
+ const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Opacity, (item, layoutId) => {
10
+ if (!layoutId)
11
+ return;
12
+ const layoutParams = item.layoutParams[layoutId];
13
+ return 'opacity' in layoutParams ? layoutParams.opacity : 1;
14
+ }, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
15
+ return { opacity };
16
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CustomItem = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const useCntrlContext_1 = require("../../../provider/useCntrlContext");
10
+ const style_1 = __importDefault(require("styled-jsx/style"));
11
+ const useRegisterResize_1 = require("../../../common/useRegisterResize");
12
+ const useItemAngle_1 = require("../useItemAngle");
13
+ const utils_1 = require("../../../../utils");
14
+ const CustomItem = ({ item, onResize, sectionId, interactionCtrl }) => {
15
+ var _a, _b, _c;
16
+ const sdk = (0, useCntrlContext_1.useCntrlContext)();
17
+ const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
18
+ const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
19
+ const component = sdk.customItems.get(item.commonParams.name);
20
+ const layoutValues = [item.area];
21
+ const [ref, setRef] = (0, react_1.useState)(null);
22
+ (0, useRegisterResize_1.useRegisterResize)(ref, onResize);
23
+ const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['angle']);
24
+ const angle = (_b = (_a = stateParams === null || stateParams === void 0 ? void 0 : stateParams.styles) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : itemAngle;
25
+ if (!component)
26
+ return null;
27
+ 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({}, (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), { transition: (_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _c !== void 0 ? _c : 'none' }), children: component({}) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: item.id, children: `${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area]) => {
28
+ return (`
29
+ .custom-component-${item.id} {
30
+ transform: rotate(${area.angle}deg);
31
+ height: 100%;
32
+ width: 100%;
33
+ position: absolute;
34
+ left: 0;
35
+ top: 0;
36
+ }
37
+ `);
38
+ })}` })] }));
39
+ };
40
+ exports.CustomItem = CustomItem;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
2
- import { ItemProps } from '../Item';
1
+ import type { FC } from 'react';
2
+ import type { ItemProps } from '../Item';
3
3
  import { VimeoEmbedItem as TVimeoEmbedItem } from '../../../../sdk/types/article/Item';
4
4
  export declare const VimeoEmbedItem: FC<ItemProps<TVimeoEmbedItem>>;