@gxpl/sdk 0.0.6 → 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/index.js +45 -0
- 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 +15 -27
- 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}/cli.js +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,227 @@
|
|
|
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.VideoItem = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
10
|
+
const LinkWrapper_1 = require("../LinkWrapper");
|
|
11
|
+
const useFileItem_1 = require("./useFileItem");
|
|
12
|
+
const useItemAngle_1 = require("../useItemAngle");
|
|
13
|
+
const useCntrlContext_1 = require("../../../provider/useCntrlContext");
|
|
14
|
+
const useRegisterResize_1 = require("../../../common/useRegisterResize");
|
|
15
|
+
const useLayoutContext_1 = require("../../useLayoutContext");
|
|
16
|
+
const ScrollPlaybackVideo_1 = require("../../ScrollPlaybackVideo");
|
|
17
|
+
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
18
|
+
const useVideoFx_1 = require("../../../utils/effects/useVideoFx");
|
|
19
|
+
const useElementRect_1 = require("../../../utils/useElementRect");
|
|
20
|
+
const useItemFXData_1 = require("../../../common/useItemFXData");
|
|
21
|
+
const getFill_1 = require("../../../utils/getFill");
|
|
22
|
+
const utils_1 = require("../../../../utils");
|
|
23
|
+
const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
25
|
+
const id = (0, react_1.useId)();
|
|
26
|
+
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
27
|
+
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
28
|
+
const { radius: itemRadius, strokeWidth: itemStrokeWidth, strokeFill: itemStrokeFill, opacity: itemOpacity, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
29
|
+
const [isVideoPlaying, setIsVideoPlaying] = (0, react_1.useState)(false);
|
|
30
|
+
const isScrollPausedRef = (0, react_1.useRef)(false);
|
|
31
|
+
const [userPaused, setUserPaused] = (0, react_1.useState)(false);
|
|
32
|
+
const [isVideoInteracted, setIsVideoInteracted] = (0, react_1.useState)(false);
|
|
33
|
+
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
34
|
+
const [ref, setRef] = (0, react_1.useState)(null);
|
|
35
|
+
const [videoRef, setVideoRef] = (0, react_1.useState)(null);
|
|
36
|
+
const fxCanvas = (0, react_1.useRef)(null);
|
|
37
|
+
const { url, hasGLEffect } = item.commonParams;
|
|
38
|
+
const isInitialRef = (0, react_1.useRef)(true);
|
|
39
|
+
const area = layoutId ? item.area[layoutId] : null;
|
|
40
|
+
const layoutParams = layoutId ? item.layoutParams[layoutId] : null;
|
|
41
|
+
const exemplary = (_a = layouts === null || layouts === void 0 ? void 0 : layouts.find(l => l.id === layoutId)) === null || _a === void 0 ? void 0 : _a.exemplary;
|
|
42
|
+
const width = area && exemplary ? area.width * exemplary : 0;
|
|
43
|
+
const height = area && exemplary ? area.height * exemplary : 0;
|
|
44
|
+
const { controlsValues, fragmentShader } = (0, useItemFXData_1.useItemFXData)(item, sectionId);
|
|
45
|
+
const rect = (0, useElementRect_1.useElementRect)(ref);
|
|
46
|
+
const rectWidth = Math.floor((_b = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _b !== void 0 ? _b : 0);
|
|
47
|
+
const rectHeight = Math.floor((_c = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _c !== void 0 ? _c : 0);
|
|
48
|
+
const scrollPlayback = layoutParams ? layoutParams.scrollPlayback : null;
|
|
49
|
+
const layoutValues = [item.area, item.layoutParams];
|
|
50
|
+
const hasScrollPlayback = scrollPlayback !== null;
|
|
51
|
+
const wrapperStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['angle', 'opacity', 'blur']);
|
|
52
|
+
const videoStateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeWidth', 'radius']);
|
|
53
|
+
const stateStrokeFillParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['strokeFill']);
|
|
54
|
+
const stateStrokeFillLayers = (_d = stateStrokeFillParams === null || stateStrokeFillParams === void 0 ? void 0 : stateStrokeFillParams.styles) === null || _d === void 0 ? void 0 : _d.strokeFill;
|
|
55
|
+
const strokeSolidTransition = (_e = stateStrokeFillParams === null || stateStrokeFillParams === void 0 ? void 0 : stateStrokeFillParams.transition) !== null && _e !== void 0 ? _e : 'none';
|
|
56
|
+
const angle = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_f = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _f === void 0 ? void 0 : _f.angle, itemAngle);
|
|
57
|
+
const opacity = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_g = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _g === void 0 ? void 0 : _g.opacity, itemOpacity);
|
|
58
|
+
const blur = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_h = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _h === void 0 ? void 0 : _h.blur, itemBlur);
|
|
59
|
+
const strokeWidth = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_j = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _j === void 0 ? void 0 : _j.strokeWidth, itemStrokeWidth);
|
|
60
|
+
const radius = (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)((_k = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.styles) === null || _k === void 0 ? void 0 : _k.radius, itemRadius);
|
|
61
|
+
const strokeValue = stateStrokeFillLayers
|
|
62
|
+
? (0, getStyleFromItemStateAndParams_1.getStyleFromItemStateAndParams)(stateStrokeFillLayers[0], itemStrokeFill === null || itemStrokeFill === void 0 ? void 0 : itemStrokeFill[0])
|
|
63
|
+
: itemStrokeFill === null || itemStrokeFill === void 0 ? void 0 : itemStrokeFill[0];
|
|
64
|
+
const stroke = strokeValue
|
|
65
|
+
? (_l = (0, getFill_1.getFill)(strokeValue)) !== null && _l !== void 0 ? _l : 'transparent'
|
|
66
|
+
: 'transparent';
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
68
|
+
isInitialRef.current = false;
|
|
69
|
+
}, []);
|
|
70
|
+
const isFXAllowed = (0, useVideoFx_1.useVideoFx)(fxCanvas.current, !!(hasGLEffect && !isInitialRef.current), {
|
|
71
|
+
videoUrl: url,
|
|
72
|
+
fragmentShader,
|
|
73
|
+
controls: controlsValues
|
|
74
|
+
}, width, height);
|
|
75
|
+
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
76
|
+
const inlineStyles = Object.assign(Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), (strokeWidth !== undefined ? { borderWidth: `${strokeWidth * 100}vw` } : {})), { transition: (_m = videoStateParams === null || videoStateParams === void 0 ? void 0 : videoStateParams.transition) !== null && _m !== void 0 ? _m : 'none' });
|
|
77
|
+
const isInteractive = opacity !== 0;
|
|
78
|
+
(0, react_1.useEffect)(() => {
|
|
79
|
+
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
80
|
+
}, [isInteractive, onVisibilityChange]);
|
|
81
|
+
(0, react_1.useEffect)(() => {
|
|
82
|
+
if (!layoutParams || !videoRef || layoutParams.play !== 'on-click' || !ref)
|
|
83
|
+
return;
|
|
84
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
85
|
+
if (userPaused || !isVideoInteracted)
|
|
86
|
+
return;
|
|
87
|
+
if (entry.isIntersecting) {
|
|
88
|
+
isScrollPausedRef.current = false;
|
|
89
|
+
videoRef.play();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
isScrollPausedRef.current = true;
|
|
93
|
+
videoRef.pause();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
observer.observe(ref);
|
|
97
|
+
return () => observer.disconnect();
|
|
98
|
+
}, [layoutParams, videoRef, ref, userPaused, isVideoInteracted]);
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_o = item.link) === null || _o === void 0 ? void 0 : _o.url, target: (_p = item.link) === null || _p === void 0 ? void 0 : _p.target, children: [(0, jsx_runtime_1.jsxs)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), (strokeValue ? Object.assign({ '--stroke-background': stroke }, (strokeValue.type === 'image' ? {
|
|
100
|
+
'--stroke-background-position': 'center',
|
|
101
|
+
'--stroke-background-size': strokeValue.behavior === 'repeat' ? `${strokeValue.backgroundSize}%` : strokeValue.behavior,
|
|
102
|
+
'--stroke-background-repeat': strokeValue.behavior === 'repeat' ? 'repeat' : 'no-repeat'
|
|
103
|
+
} : {})) : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_q = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _q !== void 0 ? _q : 'none' }), children: [hasScrollPlayback && ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.commonParams.url, playbackParams: scrollPlayback, style: inlineStyles, className: `video video-playback-wrapper video-${item.id}` })), hasGLEffect && isFXAllowed && ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `video-canvas video-${item.id}`, width: rectWidth, height: rectHeight })), !hasScrollPlayback && !hasGLEffect && layoutParams && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { poster: (_r = item.commonParams.coverUrl) !== null && _r !== void 0 ? _r : '', ref: setVideoRef, autoPlay: layoutParams.play === 'auto', preload: "auto", onClick: () => {
|
|
104
|
+
setIsVideoInteracted(true);
|
|
105
|
+
}, muted: layoutParams.muted, onPlay: () => {
|
|
106
|
+
setIsVideoPlaying(true);
|
|
107
|
+
setUserPaused(false);
|
|
108
|
+
}, onPause: () => {
|
|
109
|
+
if (!isScrollPausedRef.current) {
|
|
110
|
+
setUserPaused(true);
|
|
111
|
+
}
|
|
112
|
+
setIsVideoPlaying(false);
|
|
113
|
+
}, onMouseEnter: () => {
|
|
114
|
+
if (!videoRef || layoutParams.play !== 'on-hover')
|
|
115
|
+
return;
|
|
116
|
+
videoRef.play();
|
|
117
|
+
}, onMouseLeave: () => {
|
|
118
|
+
if (!videoRef || layoutParams.play !== 'on-hover')
|
|
119
|
+
return;
|
|
120
|
+
videoRef.pause();
|
|
121
|
+
}, loop: true, controls: layoutParams.controls, playsInline: true, className: `video video-${item.id}`, style: inlineStyles, children: (0, jsx_runtime_1.jsx)("source", { src: item.commonParams.url }) }), (layoutParams.play === 'on-click' || layoutParams.play === 'on-hover') && item.commonParams.coverUrl && !isVideoInteracted && ((0, jsx_runtime_1.jsx)("img", { onMouseEnter: () => {
|
|
122
|
+
if (!videoRef || layoutParams.play !== 'on-hover')
|
|
123
|
+
return;
|
|
124
|
+
setIsVideoInteracted(true);
|
|
125
|
+
videoRef.play();
|
|
126
|
+
}, src: (_s = item.commonParams.coverUrl) !== null && _s !== void 0 ? _s : '', className: `video-cover-${item.id}`, onClick: () => {
|
|
127
|
+
if (!videoRef)
|
|
128
|
+
return;
|
|
129
|
+
setIsVideoInteracted(true);
|
|
130
|
+
videoRef.play();
|
|
131
|
+
} })), (layoutParams.play === 'on-click' && !layoutParams.controls && ((0, jsx_runtime_1.jsx)("div", { className: `video-overlay-${item.id}`, onClick: () => {
|
|
132
|
+
if (!videoRef)
|
|
133
|
+
return;
|
|
134
|
+
setIsVideoInteracted(true);
|
|
135
|
+
if (isVideoPlaying) {
|
|
136
|
+
videoRef.pause();
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
videoRef.play();
|
|
140
|
+
}
|
|
141
|
+
} })))] })), (0, jsx_runtime_1.jsx)("div", { className: `video-border-${item.id}`, style: Object.assign({ position: 'absolute', inset: 0, borderRadius: 'inherit', pointerEvents: 'none', zIndex: 2, WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)', WebkitMaskComposite: 'xor', maskComposite: 'exclude' }, (strokeWidth !== 0 && strokeValue ? Object.assign(Object.assign(Object.assign({}, (strokeWidth ? { padding: `${strokeWidth * 100}vw` } : {})), (strokeValue.type === 'solid' ? { transition: strokeSolidTransition, background: stroke } : {})), (strokeValue.type === 'image' ? {
|
|
142
|
+
backgroundPosition: 'center',
|
|
143
|
+
backgroundSize: strokeValue.behavior === 'repeat' ? `${strokeValue.backgroundSize}%` : strokeValue.behavior,
|
|
144
|
+
backgroundRepeat: strokeValue.behavior === 'repeat' ? 'repeat' : 'no-repeat'
|
|
145
|
+
} : {
|
|
146
|
+
background: stroke,
|
|
147
|
+
})) : { background: stroke })) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
148
|
+
.video-wrapper-${item.id} {
|
|
149
|
+
position: absolute;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 100%;
|
|
153
|
+
box-sizing: border-box;
|
|
154
|
+
opacity: ${opacity};
|
|
155
|
+
}
|
|
156
|
+
.video-overlay-${item.id} {
|
|
157
|
+
position: absolute;
|
|
158
|
+
top: 0;
|
|
159
|
+
left: 0;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 100%;
|
|
163
|
+
}
|
|
164
|
+
.video-cover-${item.id} {
|
|
165
|
+
position: absolute;
|
|
166
|
+
top: 0;
|
|
167
|
+
left: 0;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
width: 100%;
|
|
170
|
+
height: 100%;
|
|
171
|
+
object-fit: cover;
|
|
172
|
+
}
|
|
173
|
+
.video {
|
|
174
|
+
width: 100%;
|
|
175
|
+
height: 100%;
|
|
176
|
+
box-sizing: border-box;
|
|
177
|
+
opacity: 1;
|
|
178
|
+
object-fit: cover;
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
border-style: solid;
|
|
181
|
+
}
|
|
182
|
+
.video-${item.id} {
|
|
183
|
+
border-radius: ${radius !== undefined ? `${radius * 100}vw` : '0'};
|
|
184
|
+
}
|
|
185
|
+
.video-playback-wrapper {
|
|
186
|
+
display: flex;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
}
|
|
189
|
+
.video-canvas {
|
|
190
|
+
border: solid;
|
|
191
|
+
width: 100%;
|
|
192
|
+
height: 100%;
|
|
193
|
+
pointer-events: none;
|
|
194
|
+
border-width: 0;
|
|
195
|
+
box-sizing: border-box;
|
|
196
|
+
}
|
|
197
|
+
${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
|
|
198
|
+
return (`
|
|
199
|
+
.video-wrapper-${item.id} {
|
|
200
|
+
opacity: ${layoutParams.opacity};
|
|
201
|
+
transform: rotate(${area.angle}deg);
|
|
202
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
203
|
+
${layoutParams.blur !== 0 ? 'will-change: transform;' : ''}
|
|
204
|
+
}
|
|
205
|
+
.video-${item.id} {
|
|
206
|
+
border: solid;
|
|
207
|
+
border-color: transparent;
|
|
208
|
+
border-width: ${layoutParams.strokeWidth * 100}vw;
|
|
209
|
+
border-radius: ${layoutParams.radius * 100}vw;
|
|
210
|
+
}
|
|
211
|
+
.video-border-${item.id} {
|
|
212
|
+
position: absolute;
|
|
213
|
+
inset: 0;
|
|
214
|
+
border-radius: inherit;
|
|
215
|
+
pointer-events: none;
|
|
216
|
+
z-index: 2;
|
|
217
|
+
-webkit-mask:
|
|
218
|
+
linear-gradient(#fff 0 0) content-box,
|
|
219
|
+
linear-gradient(#fff 0 0);
|
|
220
|
+
-webkit-mask-composite: xor;
|
|
221
|
+
mask-composite: exclude;
|
|
222
|
+
}
|
|
223
|
+
`);
|
|
224
|
+
})}
|
|
225
|
+
` })] }));
|
|
226
|
+
};
|
|
227
|
+
exports.VideoItem = VideoItem;
|
|
@@ -3,6 +3,6 @@ export declare function useFileItem(item: ImageItem | VideoItem, sectionId: stri
|
|
|
3
3
|
radius: number | undefined;
|
|
4
4
|
strokeWidth: number | undefined;
|
|
5
5
|
opacity: number | undefined;
|
|
6
|
-
strokeFill: import(
|
|
6
|
+
strokeFill: import("../../../../sdk/types/article/Item").FillLayer[] | undefined;
|
|
7
7
|
blur: number | undefined;
|
|
8
8
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFileItem = useFileItem;
|
|
4
|
+
const Keyframe_1 = require("../../../../sdk/types/keyframe/Keyframe");
|
|
5
|
+
const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
|
|
6
|
+
const useLayoutContext_1 = require("../../useLayoutContext");
|
|
7
|
+
const DEFAULT_FILL = [
|
|
8
|
+
{
|
|
9
|
+
id: 'default',
|
|
10
|
+
type: 'solid',
|
|
11
|
+
value: 'rgba(0, 0, 0, 1)',
|
|
12
|
+
blendMode: 'normal'
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
function useFileItem(item, sectionId) {
|
|
16
|
+
const layoutId = (0, useLayoutContext_1.useLayoutContext)();
|
|
17
|
+
const radius = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.BorderRadius, (item, layoutId) => {
|
|
18
|
+
if (!layoutId)
|
|
19
|
+
return;
|
|
20
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
21
|
+
return 'radius' in layoutParams ? layoutParams.radius : 0;
|
|
22
|
+
}, (animator, scroll, value) => value !== undefined ? animator.getRadius({ radius: value }, scroll).radius : undefined, sectionId, [layoutId]);
|
|
23
|
+
const strokeWidth = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.BorderWidth, (item, layoutId) => {
|
|
24
|
+
if (!layoutId)
|
|
25
|
+
return;
|
|
26
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
27
|
+
return 'strokeWidth' in layoutParams ? layoutParams.strokeWidth : 0;
|
|
28
|
+
}, (animator, scroll, value) => value !== undefined ? animator.getBorderWidth({ borderWidth: value }, scroll).borderWidth : undefined, sectionId, [layoutId]);
|
|
29
|
+
const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Opacity, (item, layoutId) => {
|
|
30
|
+
if (!layoutId)
|
|
31
|
+
return;
|
|
32
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
33
|
+
return 'opacity' in layoutParams ? layoutParams.opacity : 1;
|
|
34
|
+
}, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
|
|
35
|
+
const strokeFill = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.BorderFill, (item, layoutId) => {
|
|
36
|
+
if (!layoutId)
|
|
37
|
+
return;
|
|
38
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
39
|
+
return 'strokeFill' in layoutParams ? layoutParams.strokeFill : DEFAULT_FILL;
|
|
40
|
+
}, (animator, scroll, value) => value ? animator.getBorderFill(value, scroll) : undefined, sectionId, [layoutId]);
|
|
41
|
+
const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, Keyframe_1.KeyframeType.Blur, (item, layoutId) => {
|
|
42
|
+
if (!layoutId)
|
|
43
|
+
return;
|
|
44
|
+
const layoutParams = item.layoutParams[layoutId];
|
|
45
|
+
return 'blur' in layoutParams ? layoutParams.blur : 0;
|
|
46
|
+
}, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
|
|
47
|
+
return { radius, strokeWidth, opacity, strokeFill, blur };
|
|
48
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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.GroupItem = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const Item_1 = require("../Item");
|
|
10
|
+
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
11
|
+
const LinkWrapper_1 = require("../LinkWrapper");
|
|
12
|
+
const useRegisterResize_1 = require("../../../common/useRegisterResize");
|
|
13
|
+
const useCntrlContext_1 = require("../../../provider/useCntrlContext");
|
|
14
|
+
const useItemAngle_1 = require("../useItemAngle");
|
|
15
|
+
const useGroupItem_1 = require("./useGroupItem");
|
|
16
|
+
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
17
|
+
const CompoundChild_1 = require("../CompoundItem/CompoundChild");
|
|
18
|
+
const utils_1 = require("../../../../utils");
|
|
19
|
+
const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, isInCompound }) => {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21
|
+
const id = (0, react_1.useId)();
|
|
22
|
+
const { items } = item;
|
|
23
|
+
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
24
|
+
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
25
|
+
const { opacity: itemOpacity, blur: itemBlur } = (0, useGroupItem_1.useGroupItem)(item, sectionId);
|
|
26
|
+
const layoutValues = [item.area, item.layoutParams];
|
|
27
|
+
const [ref, setRef] = (0, react_1.useState)(null);
|
|
28
|
+
(0, useRegisterResize_1.useRegisterResize)(ref, onResize);
|
|
29
|
+
const stateParams = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['opacity', 'angle', 'blur']);
|
|
30
|
+
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);
|
|
31
|
+
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);
|
|
32
|
+
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);
|
|
33
|
+
const isInteractive = opacity !== 0 && opacity !== undefined;
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
36
|
+
}, [isInteractive, onVisibilityChange]);
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: (_d = item.link) === null || _d === void 0 ? void 0 : _d.url, target: (_e = item.link) === null || _e === void 0 ? void 0 : _e.target, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `group-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign({}, (opacity !== undefined ? { opacity } : {})), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { transition: (_f = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _f !== void 0 ? _f : 'none', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: sectionId, isParentVisible: isInteractive, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
38
|
+
.group-${item.id} {
|
|
39
|
+
position: absolute;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, layoutParams]) => {
|
|
45
|
+
return (`
|
|
46
|
+
.group-${item.id} {
|
|
47
|
+
opacity: ${layoutParams.opacity};
|
|
48
|
+
filter: ${layoutParams.blur !== 0 ? `blur(${layoutParams.blur * 100}vw)` : 'unset'};
|
|
49
|
+
transform: rotate(${area.angle}deg);
|
|
50
|
+
}
|
|
51
|
+
`);
|
|
52
|
+
})}
|
|
53
|
+
` })] }) }));
|
|
54
|
+
};
|
|
55
|
+
exports.GroupItem = GroupItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGroupItem = useGroupItem;
|
|
4
|
+
const Keyframe_1 = require("../../../../sdk/types/keyframe/Keyframe");
|
|
5
|
+
const useKeyframeValue_1 = require("../../../common/useKeyframeValue");
|
|
6
|
+
const useLayoutContext_1 = require("../../useLayoutContext");
|
|
7
|
+
function useGroupItem(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 { opacity, blur };
|
|
22
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
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.Item = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
10
|
+
const useCntrlContext_1 = require("../../provider/useCntrlContext");
|
|
11
|
+
const useItemScale_1 = require("./useItemScale");
|
|
12
|
+
const ScaleAnchorMap_1 = require("../../utils/ScaleAnchorMap");
|
|
13
|
+
const useSectionHeightMap_1 = require("../Section/useSectionHeightMap");
|
|
14
|
+
const getItemTopStyle_1 = require("../../utils/getItemTopStyle");
|
|
15
|
+
const useStickyItemTop_1 = require("./useStickyItemTop");
|
|
16
|
+
const getAnchoredItemTop_1 = require("../../utils/getAnchoredItemTop");
|
|
17
|
+
const useLayoutContext_1 = require("../useLayoutContext");
|
|
18
|
+
const ArticleRectContext_1 = require("../../provider/ArticleRectContext");
|
|
19
|
+
const useExemplary_1 = require("../../common/useExemplary");
|
|
20
|
+
const KeyframesContext_1 = require("../../provider/KeyframesContext");
|
|
21
|
+
const useItemInteractionCtrl_1 = require("../../interactions/useItemInteractionCtrl");
|
|
22
|
+
const isItemType_1 = require("../../utils/isItemType");
|
|
23
|
+
const RichTextWrapper_1 = require("./RichTextWrapper");
|
|
24
|
+
const itemsMap_1 = require("./itemsMap");
|
|
25
|
+
const useItemTriggers_1 = require("./useItemTriggers");
|
|
26
|
+
const useSizing_1 = require("./useSizing");
|
|
27
|
+
const useItemPointerEvents_1 = require("./useItemPointerEvents");
|
|
28
|
+
const useItemArea_1 = require("./useItemArea");
|
|
29
|
+
const useDraggable_1 = require("./useDraggable");
|
|
30
|
+
const ArticleItemType_1 = require("../../../sdk/types/article/ArticleItemType");
|
|
31
|
+
const ItemArea_1 = require("../../../sdk/types/article/ItemArea");
|
|
32
|
+
const utils_1 = require("../../../utils");
|
|
33
|
+
const stickyFix = `
|
|
34
|
+
-webkit-transform: translate3d(0, 0, 0);
|
|
35
|
+
transform: translate3d(0, 0, 0);
|
|
36
|
+
`;
|
|
37
|
+
const noop = () => null;
|
|
38
|
+
const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGroup = false }) => {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
40
|
+
const itemWrapperRef = (0, react_1.useRef)(null);
|
|
41
|
+
const itemInnerRef = (0, react_1.useRef)(null);
|
|
42
|
+
const rectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
|
|
43
|
+
const keyframesRepo = (0, react_1.useContext)(KeyframesContext_1.KeyframesContext);
|
|
44
|
+
const id = (0, react_1.useId)();
|
|
45
|
+
const keyframes = (0, react_1.useMemo)(() => keyframesRepo.getItemKeyframes(item.id), [keyframesRepo, item.id]);
|
|
46
|
+
const { layouts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
47
|
+
const layout = (0, useLayoutContext_1.useLayoutContext)();
|
|
48
|
+
const exemplary = (0, useExemplary_1.useExemplary)();
|
|
49
|
+
const { handleVisibilityChange, allowPointerEvents } = (0, useItemPointerEvents_1.useItemPointerEvents)((_a = item.commonParams.pointerEvents) !== null && _a !== void 0 ? _a : 'when_visible', isParentVisible);
|
|
50
|
+
const [wrapperHeight, setWrapperHeight] = (0, react_1.useState)(undefined);
|
|
51
|
+
const [itemHeight, setItemHeight] = (0, react_1.useState)(undefined);
|
|
52
|
+
const itemScale = (0, useItemScale_1.useItemScale)(item, sectionId);
|
|
53
|
+
const interactionCtrl = (0, useItemInteractionCtrl_1.useItemInteractionCtrl)(item.id);
|
|
54
|
+
const triggers = (0, useItemTriggers_1.useItemTriggers)(interactionCtrl);
|
|
55
|
+
const [position, setPosition] = (0, react_1.useState)({ x: 0, y: 0 });
|
|
56
|
+
const [isDraggingActive, setIsDraggingActive] = (0, react_1.useState)(false);
|
|
57
|
+
const wrapperStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['top', 'left']);
|
|
58
|
+
const innerStateProps = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getState(['width', 'height', 'scale']);
|
|
59
|
+
const { width, height, top, left } = (0, useItemArea_1.useItemArea)(item, sectionId, {
|
|
60
|
+
top: (_b = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _b === void 0 ? void 0 : _b.top,
|
|
61
|
+
left: (_c = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _c === void 0 ? void 0 : _c.left,
|
|
62
|
+
width: (_d = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _d === void 0 ? void 0 : _d.width,
|
|
63
|
+
height: (_e = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _e === void 0 ? void 0 : _e.height
|
|
64
|
+
});
|
|
65
|
+
const sectionHeight = (0, useSectionHeightMap_1.useSectionHeightData)(sectionId);
|
|
66
|
+
const stickyTop = (0, useStickyItemTop_1.useStickyItemTop)(item, sectionId, (_f = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.styles) === null || _f === void 0 ? void 0 : _f.top);
|
|
67
|
+
const layoutValues = [item.area, item.hidden];
|
|
68
|
+
layoutValues.push(item.sticky);
|
|
69
|
+
layoutValues.push(sectionHeight);
|
|
70
|
+
if (item.layoutParams) {
|
|
71
|
+
layoutValues.push(item.layoutParams);
|
|
72
|
+
}
|
|
73
|
+
const sizingAxis = (0, useSizing_1.useSizing)(item);
|
|
74
|
+
const ItemComponent = itemsMap_1.itemsMap[item.type] || noop;
|
|
75
|
+
const sectionTop = rectObserver ? rectObserver.getSectionTop(sectionId) : 0;
|
|
76
|
+
const layoutParams = layout ? item.layoutParams[layout] : undefined;
|
|
77
|
+
const isDraggable = layoutParams && 'isDraggable' in layoutParams ? layoutParams.isDraggable : undefined;
|
|
78
|
+
(0, useDraggable_1.useDraggable)({ draggableRef: itemInnerRef.current, isEnabled: isDraggable !== null && isDraggable !== void 0 ? isDraggable : false }, ({ startX, startY, currentX, currentY, lastX, lastY, drag }) => {
|
|
79
|
+
const item = itemInnerRef.current;
|
|
80
|
+
if (!item)
|
|
81
|
+
return;
|
|
82
|
+
if (drag) {
|
|
83
|
+
setIsDraggingActive(true);
|
|
84
|
+
setPosition({
|
|
85
|
+
x: (currentX - startX) + lastX,
|
|
86
|
+
y: (currentY - startY) + lastY
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
setIsDraggingActive(false);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const handleItemResize = (height) => {
|
|
94
|
+
if (!layout)
|
|
95
|
+
return;
|
|
96
|
+
const sticky = item.sticky[layout];
|
|
97
|
+
if (!sticky || stickyTop === undefined || !articleHeight) {
|
|
98
|
+
setWrapperHeight(undefined);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const itemArticleOffset = sectionTop / window.innerWidth + stickyTop;
|
|
102
|
+
const maxStickyTo = articleHeight - itemArticleOffset - height;
|
|
103
|
+
const end = sticky.to !== undefined
|
|
104
|
+
? Math.min(maxStickyTo, sticky.to)
|
|
105
|
+
: articleHeight - itemArticleOffset - height;
|
|
106
|
+
const wrapperHeight = end - sticky.from + height;
|
|
107
|
+
setItemHeight(height);
|
|
108
|
+
setWrapperHeight(wrapperHeight);
|
|
109
|
+
};
|
|
110
|
+
const isRichText = (0, isItemType_1.isItemType)(item, ArticleItemType_1.ArticleItemType.RichText);
|
|
111
|
+
const anchorSide = layout ? item.area[layout].anchorSide : ItemArea_1.AnchorSide.Top;
|
|
112
|
+
const positionType = layout ? item.area[layout].positionType : ItemArea_1.PositionType.ScreenBased;
|
|
113
|
+
const isScreenBasedBottom = positionType === ItemArea_1.PositionType.ScreenBased && anchorSide === ItemArea_1.AnchorSide.Bottom;
|
|
114
|
+
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;
|
|
115
|
+
const hasClickTriggers = (_j = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getHasTrigger(item.id, 'click')) !== null && _j !== void 0 ? _j : false;
|
|
116
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `item-wrapper-${item.id}`, ref: itemWrapperRef, onTransitionEnd: (e) => {
|
|
117
|
+
var _a;
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
(_a = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.handleTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(interactionCtrl, e.propertyName);
|
|
120
|
+
}, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (top !== undefined ? { top: isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(top, anchorSide) } : {})), (left !== undefined ? { left: `${left * 100}vw` } : {})), (top !== undefined ? { bottom: isScreenBasedBottom ? `${-top * 100}vw` : 'unset' } : {})), (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), { transition: (_k = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _k !== void 0 ? _k : 'none' }), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: {
|
|
121
|
+
opacity: (keyframes.length !== 0 && !layout) ? 0 : 1,
|
|
122
|
+
top: `${stickyTop * 100}vw`,
|
|
123
|
+
height: isRichText && itemHeight !== undefined ? `${itemHeight * 100}vw` : 'unset',
|
|
124
|
+
}, children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: `item-${item.id}-inner`, ref: itemInnerRef, style: Object.assign(Object.assign(Object.assign({ top: `${position.y}px`, left: `${position.x}px` }, ((width !== undefined && height !== undefined)
|
|
125
|
+
? {
|
|
126
|
+
width: `${sizingAxis.x === 'manual'
|
|
127
|
+
? isRichText
|
|
128
|
+
? `${width * exemplary}px`
|
|
129
|
+
: `${width * 100}vw`
|
|
130
|
+
: 'max-content'}`,
|
|
131
|
+
height: `${sizingAxis.y === 'manual' ? `${height * 100}vw` : 'unset'}`
|
|
132
|
+
}
|
|
133
|
+
: {})), (scale !== undefined ? { transform: `scale(${scale})`, WebkitTransform: `scale(${scale})` } : {})), { transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none', cursor: isDraggingActive
|
|
134
|
+
? 'grabbing'
|
|
135
|
+
: isDraggable
|
|
136
|
+
? 'grab'
|
|
137
|
+
: hasClickTriggers
|
|
138
|
+
? 'pointer'
|
|
139
|
+
: 'unset', pointerEvents: allowPointerEvents ? 'auto' : 'none', userSelect: isDraggable ? 'none' : 'unset', WebkitUserSelect: isDraggable ? 'none' : 'unset', MozUserSelect: isDraggable ? 'none' : 'unset', msUserSelect: isDraggable ? 'none' : 'unset' }) }, triggers, { children: (0, jsx_runtime_1.jsx)(ItemComponent, { item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) })) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
140
|
+
${(0, utils_1.getLayoutStyles)(layouts, layoutValues, ([area, hidden, sticky, sectionHeight, layoutParams]) => {
|
|
141
|
+
const sizingAxis = (0, useSizing_1.parseSizing)(layoutParams.sizing);
|
|
142
|
+
const isScreenBasedBottom = area.positionType === ItemArea_1.PositionType.ScreenBased && area.anchorSide === ItemArea_1.AnchorSide.Bottom;
|
|
143
|
+
const scaleAnchor = area.scaleAnchor;
|
|
144
|
+
return (`
|
|
145
|
+
.item-${item.id} {
|
|
146
|
+
position: ${sticky ? 'sticky' : 'absolute'};
|
|
147
|
+
top: ${sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(area.top - sticky.from, sectionHeight, area.anchorSide)}` : 0};
|
|
148
|
+
transition: opacity 0.2s linear 0.1s;
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
display: ${hidden ? 'none' : 'block'};
|
|
151
|
+
height: fit-content;
|
|
152
|
+
}
|
|
153
|
+
.item-${item.id}-inner {
|
|
154
|
+
width: ${sizingAxis.x === 'manual'
|
|
155
|
+
? `${area.width * 100}vw`
|
|
156
|
+
: 'max-content'};
|
|
157
|
+
height: ${sizingAxis.y === 'manual' ? `${area.height * 100}vw` : 'unset'};
|
|
158
|
+
transform-origin: ${ScaleAnchorMap_1.ScaleAnchorMap[scaleAnchor]};
|
|
159
|
+
transform: scale(${area.scale});
|
|
160
|
+
position: relative;
|
|
161
|
+
}
|
|
162
|
+
.item-wrapper-${item.id} {
|
|
163
|
+
position: ${area.positionType === ItemArea_1.PositionType.ScreenBased ? 'fixed' : 'absolute'};
|
|
164
|
+
z-index: ${area.zIndex};
|
|
165
|
+
${!isInGroup && stickyFix}
|
|
166
|
+
pointer-events: none;
|
|
167
|
+
bottom: ${isScreenBasedBottom ? `${-area.top * 100}vw` : 'unset'};
|
|
168
|
+
top: ${isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(area.top, area.anchorSide)};
|
|
169
|
+
left: ${area.left * 100}vw;
|
|
170
|
+
}
|
|
171
|
+
`);
|
|
172
|
+
})}
|
|
173
|
+
` })] }));
|
|
174
|
+
};
|
|
175
|
+
exports.Item = Item;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinkWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const LinkWrapper = ({ url, children, target }) => {
|
|
6
|
+
const validUrl = url && buildValidUrl(url);
|
|
7
|
+
const targetParams = target === '_blank' ? { target, rel: 'noreferrer' } : {};
|
|
8
|
+
return url ? ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: validUrl }, targetParams, { children: children }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
9
|
+
};
|
|
10
|
+
exports.LinkWrapper = LinkWrapper;
|
|
11
|
+
function buildValidUrl(url) {
|
|
12
|
+
const prefixes = [
|
|
13
|
+
'http://',
|
|
14
|
+
'https://',
|
|
15
|
+
'/',
|
|
16
|
+
'mailto:',
|
|
17
|
+
'tel:',
|
|
18
|
+
'file:',
|
|
19
|
+
'ftp:',
|
|
20
|
+
'javascript',
|
|
21
|
+
'#'
|
|
22
|
+
];
|
|
23
|
+
const protocolCheck = prefixes.some(prefix => url.startsWith(prefix));
|
|
24
|
+
if (protocolCheck)
|
|
25
|
+
return url;
|
|
26
|
+
return `//${url}`;
|
|
27
|
+
}
|