@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.
- package/{dist → lib}/index.d.ts +3 -4
- package/lib/sdk/FontFaceGenerator/FontFaceGenerator.js +28 -0
- package/lib/sdk/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.js +221 -0
- package/lib/sdk/VideoDecoder/VideoDecoder.js +184 -0
- package/{dist → lib}/sdk/schemas/article/Article.schema.d.ts +12 -12
- package/{dist → lib}/sdk/schemas/article/ItemBase.schema.d.ts +10 -10
- package/{dist → lib}/sdk/schemas/article/RichTextItem.schema.d.ts +30 -30
- package/{dist → lib}/sdk/schemas/article/Section.schema.d.ts +3 -3
- package/{dist → lib}/sdk/types/component/Component.d.ts +1 -1
- package/{dist → lib}/sdk/types/keyframe/Keyframe.d.ts +1 -1
- package/lib/sdk/types/project/Meta.js +2 -0
- package/lib/sdk/types/project/Page.js +2 -0
- package/lib/sdk/types/project/Project.js +2 -0
- package/lib/sdk-nextjs/common/useCurrentLayout.js +42 -0
- package/lib/sdk-nextjs/common/useExemplary.js +13 -0
- package/lib/sdk-nextjs/common/useItemFXData.js +36 -0
- package/lib/sdk-nextjs/common/useKeyframeValue.js +75 -0
- package/lib/sdk-nextjs/common/useRegisterResize.js +22 -0
- package/lib/sdk-nextjs/components/Article.js +41 -0
- package/lib/sdk-nextjs/components/ArticleWrapper.js +12 -0
- package/lib/sdk-nextjs/components/Head.js +32 -0
- package/lib/sdk-nextjs/components/Page.js +20 -0
- package/{dist → lib}/sdk-nextjs/components/ScrollPlaybackVideo.d.ts +1 -1
- package/lib/sdk-nextjs/components/ScrollPlaybackVideo.js +46 -0
- package/lib/sdk-nextjs/components/Section/Section.js +85 -0
- package/lib/sdk-nextjs/components/Section/SectionImage.js +24 -0
- package/lib/sdk-nextjs/components/Section/SectionVideo.js +91 -0
- package/lib/sdk-nextjs/components/Section/useSectionHeightMap.js +20 -0
- package/lib/sdk-nextjs/components/items/CodeEmbedItem/CodeEmbedItem.js +120 -0
- package/lib/sdk-nextjs/components/items/CodeEmbedItem/useCodeEmbedItem.js +24 -0
- package/lib/sdk-nextjs/components/items/ComponentItem/ComponentItem.js +51 -0
- package/lib/sdk-nextjs/components/items/ComponentItem/useComponentItem.js +25 -0
- package/lib/sdk-nextjs/components/items/CompoundItem/CompoundChild.js +102 -0
- package/lib/sdk-nextjs/components/items/CompoundItem/CompoundItem.js +53 -0
- package/lib/sdk-nextjs/components/items/CompoundItem/useCompoundItem.js +16 -0
- package/lib/sdk-nextjs/components/items/CustomItem/CustomItem.js +40 -0
- package/{dist → lib}/sdk-nextjs/components/items/EmbedVideoItem/VimeoEmbed.d.ts +2 -2
- package/lib/sdk-nextjs/components/items/EmbedVideoItem/VimeoEmbed.js +170 -0
- package/lib/sdk-nextjs/components/items/EmbedVideoItem/YoutubeEmbed.js +166 -0
- package/lib/sdk-nextjs/components/items/EmbedVideoItem/useEmbedVideoItem.js +29 -0
- package/lib/sdk-nextjs/components/items/FileItem/ImageItem.js +140 -0
- package/lib/sdk-nextjs/components/items/FileItem/VideoItem.js +227 -0
- package/{dist → lib}/sdk-nextjs/components/items/FileItem/useFileItem.d.ts +1 -1
- package/lib/sdk-nextjs/components/items/FileItem/useFileItem.js +48 -0
- package/lib/sdk-nextjs/components/items/GroupItem/GroupItem.js +55 -0
- package/lib/sdk-nextjs/components/items/GroupItem/useGroupItem.js +22 -0
- package/lib/sdk-nextjs/components/items/Item.js +175 -0
- package/{dist → lib}/sdk-nextjs/components/items/LinkWrapper.d.ts +1 -1
- package/lib/sdk-nextjs/components/items/LinkWrapper.js +27 -0
- package/lib/sdk-nextjs/components/items/RectangleItem/RectangleItem.js +130 -0
- package/lib/sdk-nextjs/components/items/RectangleItem/useRectangleItem.js +54 -0
- package/lib/sdk-nextjs/components/items/RichTextItem/RichTextItem.js +83 -0
- package/lib/sdk-nextjs/components/items/RichTextItem/useRichTextItem.js +12 -0
- package/lib/sdk-nextjs/components/items/RichTextWrapper.js +10 -0
- package/lib/sdk-nextjs/components/items/itemsMap.js +28 -0
- package/lib/sdk-nextjs/components/items/useDraggable.js +177 -0
- package/lib/sdk-nextjs/components/items/useItemAngle.js +10 -0
- package/lib/sdk-nextjs/components/items/useItemArea.js +21 -0
- package/lib/sdk-nextjs/components/items/useItemPointerEvents.js +23 -0
- package/lib/sdk-nextjs/components/items/useItemScale.js +12 -0
- package/lib/sdk-nextjs/components/items/useItemTriggers.js +16 -0
- package/lib/sdk-nextjs/components/items/useRichTextItemValues.js +38 -0
- package/lib/sdk-nextjs/components/items/useSizing.js +22 -0
- package/lib/sdk-nextjs/components/items/useStickyItemTop.js +17 -0
- package/lib/sdk-nextjs/components/useLayoutContext.js +9 -0
- package/{dist → lib}/sdk-nextjs/interactions/CSSPropertyNameMap.d.ts +2 -2
- package/lib/sdk-nextjs/interactions/CSSPropertyNameMap.js +38 -0
- package/lib/sdk-nextjs/interactions/InteractionsRegistry.js +355 -0
- package/lib/sdk-nextjs/interactions/ItemInteractionCtrl.js +72 -0
- package/lib/sdk-nextjs/interactions/getTransition.js +20 -0
- package/{dist → lib}/sdk-nextjs/interactions/types.d.ts +3 -3
- package/lib/sdk-nextjs/interactions/useItemInteractionCtrl.js +16 -0
- package/{dist → lib}/sdk-nextjs/provider/ArticleRectContext.d.ts +1 -1
- package/lib/sdk-nextjs/provider/ArticleRectContext.js +5 -0
- package/{dist → lib}/sdk-nextjs/provider/CntrlContext.d.ts +1 -1
- package/lib/sdk-nextjs/provider/CntrlContext.js +6 -0
- package/lib/sdk-nextjs/provider/CntrlProvider.js +10 -0
- package/lib/sdk-nextjs/provider/CntrlSdkContext.js +76 -0
- package/lib/sdk-nextjs/provider/CustomItemRegistry.js +16 -0
- package/{dist → lib}/sdk-nextjs/provider/CustomSectionRegistry.d.ts +1 -1
- package/lib/sdk-nextjs/provider/CustomSectionRegistry.js +21 -0
- package/{dist → lib}/sdk-nextjs/provider/InteractionsContext.d.ts +1 -1
- package/lib/sdk-nextjs/provider/InteractionsContext.js +52 -0
- package/{dist → lib}/sdk-nextjs/provider/Keyframes.d.ts +1 -1
- package/lib/sdk-nextjs/provider/Keyframes.js +12 -0
- package/lib/sdk-nextjs/provider/KeyframesContext.d.ts +2 -0
- package/lib/sdk-nextjs/provider/KeyframesContext.js +6 -0
- package/lib/sdk-nextjs/provider/LayoutContext.d.ts +1 -0
- package/lib/sdk-nextjs/provider/LayoutContext.js +5 -0
- package/{dist → lib}/sdk-nextjs/provider/WebGLContextManagerContext.d.ts +1 -1
- package/lib/sdk-nextjs/provider/WebGLContextManagerContext.js +6 -0
- package/lib/sdk-nextjs/provider/defaultContext.js +9 -0
- package/lib/sdk-nextjs/provider/useCntrlContext.js +9 -0
- package/lib/sdk-nextjs/utils/Animator/Animator.js +443 -0
- package/lib/sdk-nextjs/utils/ArticleRectManager/ArticleRectObserver.js +88 -0
- package/lib/sdk-nextjs/utils/ArticleRectManager/useArticleRectObserver.js +18 -0
- package/lib/sdk-nextjs/utils/ArticleRectManager/useSectionRegistry.js +14 -0
- package/lib/sdk-nextjs/utils/EventEmitter.js +37 -0
- package/lib/sdk-nextjs/utils/RichTextConverter/RichTextConverter.js +288 -0
- package/lib/sdk-nextjs/utils/ScaleAnchorMap.js +15 -0
- package/lib/sdk-nextjs/utils/Youtube/YouTubeIframeApiLoader.js +64 -0
- package/lib/sdk-nextjs/utils/Youtube/YoutubeIframeApi.js +12 -0
- package/lib/sdk-nextjs/utils/Youtube/useYouTubeIframeApi.js +13 -0
- package/lib/sdk-nextjs/utils/areFillsVisible/areFillsVisible.js +22 -0
- package/lib/sdk-nextjs/utils/binSearchInsertAt.js +35 -0
- package/lib/sdk-nextjs/utils/checkOverflowClipSupport.js +18 -0
- package/lib/sdk-nextjs/utils/effects/useImageFx.js +114 -0
- package/lib/sdk-nextjs/utils/effects/useVideoFx.js +117 -0
- package/lib/sdk-nextjs/utils/getAnchoredItemTop.js +14 -0
- package/lib/sdk-nextjs/utils/getCompoundBoundaryStyles.js +60 -0
- package/lib/sdk-nextjs/utils/getFill.js +42 -0
- package/lib/sdk-nextjs/utils/getFontFamilyValue.js +6 -0
- package/lib/sdk-nextjs/utils/getItemTopStyle.js +17 -0
- package/lib/sdk-nextjs/utils/getStyleFromItemStateAndParams.js +8 -0
- package/lib/sdk-nextjs/utils/getValidYoutubeUrl.js +33 -0
- package/lib/sdk-nextjs/utils/isItemType.js +6 -0
- package/lib/sdk-nextjs/utils/rangeMap.js +11 -0
- package/lib/sdk-nextjs/utils/useElementRect.js +24 -0
- package/lib/utils.js +30 -0
- package/package.json +3 -3
- package/dist/cli.js +0 -64
- package/dist/index.js +0 -7765
- package/dist/index.mjs +0 -7748
- package/dist/sdk/Client/Client.test.d.ts +0 -1
- package/dist/sdk/Client/__mock__/articleMock.d.ts +0 -2
- package/dist/sdk/Client/__mock__/keyframesMock.d.ts +0 -2
- package/dist/sdk/Client/__mock__/projectMock.d.ts +0 -2
- package/dist/sdk/Components/ControlSlider/ControlSlider.d.ts +0 -90
- package/dist/sdk/Components/ControlSlider/ControlSliderComponent.d.ts +0 -519
- package/dist/sdk/Components/ImageRevealSlider/ControlImageRevealSliderComponent.d.ts +0 -209
- package/dist/sdk/Components/ImageRevealSlider/ImageRevealSlider.d.ts +0 -38
- package/dist/sdk/Components/components.d.ts +0 -2
- package/dist/sdk/Components/helpers/RichTextRenderer/RichTextRenderer.d.ts +0 -6
- package/dist/sdk/Components/helpers/SvgImage/SvgImage.d.ts +0 -9
- package/dist/sdk/Components/utils/scalingValue.d.ts +0 -1
- package/dist/sdk/FontFaceGenerator/FontFaceGenerator.test.d.ts +0 -1
- package/dist/sdk/schemas/shared/FillLayer.schema.d.ts +0 -186
- package/dist/sdk-nextjs/components/LayoutStyle.d.ts +0 -9
- package/dist/sdk-nextjs/components/Section/useSectionColor.d.ts +0 -4
- package/dist/sdk-nextjs/provider/KeyframesContext.d.ts +0 -2
- package/dist/sdk-nextjs/provider/LayoutContext.d.ts +0 -1
- package/dist/sdk-nextjs/utils/StickyManager/StickyManager.d.ts +0 -10
- package/dist/sdk-nextjs/utils/areFillsVisible/areFillsVisible.test.d.ts +0 -1
- package/dist/sdk-nextjs/utils/castObject.d.ts +0 -5
- package/dist/sdk-nextjs/utils/getInvertedRanges.d.ts +0 -10
- package/dist/sdk.css +0 -1
- /package/{dist → lib}/cli.d.ts +0 -0
- /package/{dist → lib}/sdk/Client/Client.d.ts +0 -0
- /package/{dist → lib}/sdk/Client/Client.js +0 -0
- /package/{dist → lib}/sdk/FontFaceGenerator/FontFaceGenerator.d.ts +0 -0
- /package/{dist → lib}/sdk/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.d.ts +0 -0
- /package/{dist → lib}/sdk/VideoDecoder/VideoDecoder.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/article/Article.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/FillLayer.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/article/FillLayer.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/Interaction.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/article/Interaction.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/Item.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/article/Item.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/ItemArea.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/article/ItemArea.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/ItemBase.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/ItemState.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/article/ItemState.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/RichTextItem.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/article/Section.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/keyframe/Keyframes.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/keyframe/Keyframes.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/project/Layout.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/project/Layout.schema.js +0 -0
- /package/{dist → lib}/sdk/schemas/project/Project.schema.d.ts +0 -0
- /package/{dist → lib}/sdk/schemas/project/Project.schema.js +0 -0
- /package/{dist → lib}/sdk/types/article/Article.d.ts +0 -0
- /package/{dist/sdk/types/article/FX.js → lib/sdk/types/article/Article.js} +0 -0
- /package/{dist → lib}/sdk/types/article/ArticleItemType.d.ts +0 -0
- /package/{dist → lib}/sdk/types/article/ArticleItemType.js +0 -0
- /package/{dist → lib}/sdk/types/article/CompoundSettings.d.ts +0 -0
- /package/{dist/sdk/types/article/Interaction.js → lib/sdk/types/article/CompoundSettings.js} +0 -0
- /package/{dist → lib}/sdk/types/article/FX.d.ts +0 -0
- /package/{dist/sdk/types/project/Layout.js → lib/sdk/types/article/FX.js} +0 -0
- /package/{dist → lib}/sdk/types/article/Interaction.d.ts +0 -0
- /package/{dist/sdk/types/project/Meta.js → lib/sdk/types/article/Interaction.js} +0 -0
- /package/{dist → lib}/sdk/types/article/Item.d.ts +0 -0
- /package/{dist → lib}/sdk/types/article/Item.js +0 -0
- /package/{dist → lib}/sdk/types/article/ItemArea.d.ts +0 -0
- /package/{dist → lib}/sdk/types/article/ItemArea.js +0 -0
- /package/{dist → lib}/sdk/types/article/ItemState.d.ts +0 -0
- /package/{dist → lib}/sdk/types/article/ItemState.js +0 -0
- /package/{dist → lib}/sdk/types/article/RichText.d.ts +0 -0
- /package/{dist → lib}/sdk/types/article/RichText.js +0 -0
- /package/{dist → lib}/sdk/types/article/Section.d.ts +0 -0
- /package/{dist → lib}/sdk/types/article/Section.js +0 -0
- /package/{dist/sdk/types/project/Page.js → lib/sdk/types/component/Component.js} +0 -0
- /package/{dist → lib}/sdk/types/keyframe/Keyframe.js +0 -0
- /package/{dist → lib}/sdk/types/project/Fonts.d.ts +0 -0
- /package/{dist → lib}/sdk/types/project/Fonts.js +0 -0
- /package/{dist → lib}/sdk/types/project/Layout.d.ts +0 -0
- /package/{dist/sdk/types/project/Project.js → lib/sdk/types/project/Layout.js} +0 -0
- /package/{dist → lib}/sdk/types/project/Meta.d.ts +0 -0
- /package/{dist → lib}/sdk/types/project/Page.d.ts +0 -0
- /package/{dist → lib}/sdk/types/project/Project.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/common/useCurrentLayout.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/common/useExemplary.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/common/useItemFXData.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/common/useKeyframeValue.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/common/useRegisterResize.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Article.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/ArticleWrapper.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Head.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Page.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Section/Section.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Section/SectionImage.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Section/SectionVideo.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/Section/useSectionHeightMap.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/CodeEmbedItem/CodeEmbedItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/CodeEmbedItem/useCodeEmbedItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/ComponentItem/ComponentItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/ComponentItem/useComponentItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/CompoundItem/CompoundChild.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/CompoundItem/CompoundItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/CompoundItem/useCompoundItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/CustomItem/CustomItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/EmbedVideoItem/YoutubeEmbed.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/EmbedVideoItem/useEmbedVideoItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/FileItem/ImageItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/FileItem/VideoItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/GroupItem/GroupItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/GroupItem/useGroupItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/Item.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/RectangleItem/RectangleItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/RectangleItem/useRectangleItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/RichTextItem/RichTextItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/RichTextItem/useRichTextItem.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/RichTextWrapper.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/itemsMap.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useDraggable.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useItemAngle.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useItemArea.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useItemPointerEvents.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useItemScale.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useItemTriggers.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useRichTextItemValues.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useSizing.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/items/useStickyItemTop.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/components/useLayoutContext.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/interactions/InteractionsRegistry.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/interactions/ItemInteractionCtrl.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/interactions/getTransition.d.ts +0 -0
- /package/{dist/sdk/types/article/Article.js → lib/sdk-nextjs/interactions/types.js} +0 -0
- /package/{dist → lib}/sdk-nextjs/interactions/useItemInteractionCtrl.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/provider/CntrlProvider.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/provider/CntrlSdkContext.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/provider/CustomItemRegistry.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/provider/CustomItemTypes.d.ts +0 -0
- /package/{dist/sdk/types/article/CompoundSettings.js → lib/sdk-nextjs/provider/CustomItemTypes.js} +0 -0
- /package/{dist → lib}/sdk-nextjs/provider/defaultContext.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/provider/useCntrlContext.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/Animator/Animator.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/ArticleRectManager/ArticleRectObserver.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/ArticleRectManager/useArticleRectObserver.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/ArticleRectManager/useSectionRegistry.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/EventEmitter.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/RichTextConverter/RichTextConverter.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/ScaleAnchorMap.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/Youtube/YouTubeIframeApiLoader.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/Youtube/YoutubeIframeApi.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/Youtube/useYouTubeIframeApi.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/areFillsVisible/areFillsVisible.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/binSearchInsertAt.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/checkOverflowClipSupport.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/effects/useImageFx.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/effects/useVideoFx.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getAnchoredItemTop.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getCompoundBoundaryStyles.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getFill.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getFontFamilyValue.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getItemTopStyle.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getStyleFromItemStateAndParams.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/getValidYoutubeUrl.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/isItemType.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/rangeMap.d.ts +0 -0
- /package/{dist → lib}/sdk-nextjs/utils/useElementRect.d.ts +0 -0
- /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>>;
|