@gxpl/sdk 0.0.51 → 0.0.53
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/lib/sdk/schemas/project/Project.schema.d.ts +5 -0
- package/lib/sdk/schemas/project/Project.schema.js +2 -1
- package/lib/sdk/types/project/Project.d.ts +1 -0
- package/lib/sdk-nextjs/assets/AssetsCacheProvider.d.ts +1 -0
- package/lib/sdk-nextjs/assets/AssetsCacheProvider.js +3 -3
- package/lib/sdk-nextjs/assets/getCacheAssetKey.d.ts +1 -1
- package/lib/sdk-nextjs/assets/getCacheAssetKey.js +2 -2
- package/lib/sdk-nextjs/components/Section/Section.d.ts +1 -0
- package/lib/sdk-nextjs/components/Section/Section.js +2 -2
- package/lib/sdk-nextjs/components/Section/SectionImage.d.ts +1 -0
- package/lib/sdk-nextjs/components/Section/SectionImage.js +2 -2
- package/lib/sdk-nextjs/components/Section/SectionVideo.d.ts +1 -0
- package/lib/sdk-nextjs/components/Section/SectionVideo.js +3 -3
- package/lib/sdk-nextjs/components/Section/Sections.js +1 -1
- package/lib/sdk-nextjs/components/items/CompoundItem/CompoundChild.d.ts +1 -0
- package/lib/sdk-nextjs/components/items/CompoundItem/CompoundChild.js +2 -2
- package/lib/sdk-nextjs/components/items/CompoundItem/CompoundItem.js +2 -2
- package/lib/sdk-nextjs/components/items/FileItem/ImageItem.js +2 -2
- package/lib/sdk-nextjs/components/items/FileItem/VideoItem.js +3 -3
- package/lib/sdk-nextjs/components/items/GroupItem/GroupItem.js +2 -2
- package/lib/sdk-nextjs/components/items/Item.d.ts +2 -0
- package/lib/sdk-nextjs/components/items/Item.js +8 -11
- package/package.json +1 -1
|
@@ -404,12 +404,15 @@ export declare const ProjectSchema: z.ZodObject<{
|
|
|
404
404
|
scenesAssets: z.ZodArray<z.ZodObject<{
|
|
405
405
|
url: z.ZodString;
|
|
406
406
|
id: z.ZodString;
|
|
407
|
+
articleId: z.ZodString;
|
|
407
408
|
}, "strip", z.ZodTypeAny, {
|
|
408
409
|
url: string;
|
|
409
410
|
id: string;
|
|
411
|
+
articleId: string;
|
|
410
412
|
}, {
|
|
411
413
|
url: string;
|
|
412
414
|
id: string;
|
|
415
|
+
articleId: string;
|
|
413
416
|
}>, "many">;
|
|
414
417
|
relations: z.ZodArray<z.ZodObject<{
|
|
415
418
|
from: z.ZodString;
|
|
@@ -1051,6 +1054,7 @@ export declare const ProjectSchema: z.ZodObject<{
|
|
|
1051
1054
|
scenesAssets: {
|
|
1052
1055
|
url: string;
|
|
1053
1056
|
id: string;
|
|
1057
|
+
articleId: string;
|
|
1054
1058
|
}[];
|
|
1055
1059
|
relations: {
|
|
1056
1060
|
type: "slide" | "fade";
|
|
@@ -1202,6 +1206,7 @@ export declare const ProjectSchema: z.ZodObject<{
|
|
|
1202
1206
|
scenesAssets: {
|
|
1203
1207
|
url: string;
|
|
1204
1208
|
id: string;
|
|
1209
|
+
articleId: string;
|
|
1205
1210
|
}[];
|
|
1206
1211
|
relations: {
|
|
1207
1212
|
type: "slide" | "fade";
|
|
@@ -61,7 +61,8 @@ exports.ProjectSchema = zod_1.z.object({
|
|
|
61
61
|
}),
|
|
62
62
|
scenesAssets: zod_1.z.array(zod_1.z.object({
|
|
63
63
|
url: zod_1.z.string(),
|
|
64
|
-
id: zod_1.z.string()
|
|
64
|
+
id: zod_1.z.string(),
|
|
65
|
+
articleId: zod_1.z.string()
|
|
65
66
|
})),
|
|
66
67
|
relations: zod_1.z.array(zod_1.z.object({
|
|
67
68
|
from: zod_1.z.string().min(1),
|
|
@@ -9,15 +9,15 @@ const AssetsCacheProvider = ({ children, assets }) => {
|
|
|
9
9
|
const [videoCache, setVideoCache] = (0, react_1.useState)(new Map());
|
|
10
10
|
const [imageCache, setImageCache] = (0, react_1.useState)(new Map());
|
|
11
11
|
(0, react_1.useEffect)(() => {
|
|
12
|
-
assets.forEach(({ url, id }) => {
|
|
12
|
+
assets.forEach(({ url, id, articleId }) => {
|
|
13
13
|
if (isVideoAsset(url)) {
|
|
14
14
|
const video = getVideo(url);
|
|
15
|
-
setVideoCache(prev => prev.set((0, getCacheAssetKey_1.getCacheAssetKey)(url, id), video));
|
|
15
|
+
setVideoCache(prev => prev.set((0, getCacheAssetKey_1.getCacheAssetKey)(url, id, articleId), video));
|
|
16
16
|
}
|
|
17
17
|
if (isImageAsset(url)) {
|
|
18
18
|
const img = new Image();
|
|
19
19
|
img.src = url;
|
|
20
|
-
setImageCache(prev => prev.set((0, getCacheAssetKey_1.getCacheAssetKey)(url, id), img));
|
|
20
|
+
setImageCache(prev => prev.set((0, getCacheAssetKey_1.getCacheAssetKey)(url, id, articleId), img));
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}, [assets]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getCacheAssetKey(url: string, id: string): string;
|
|
1
|
+
export declare function getCacheAssetKey(url: string, id: string, articleId: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCacheAssetKey = getCacheAssetKey;
|
|
4
|
-
function getCacheAssetKey(url, id) {
|
|
5
|
-
return `${url}-${id}`;
|
|
4
|
+
function getCacheAssetKey(url, id, articleId) {
|
|
5
|
+
return `${url}-${id}-${articleId}`;
|
|
6
6
|
}
|
|
@@ -16,7 +16,7 @@ const SectionImage_1 = require("./SectionImage");
|
|
|
16
16
|
const checkOverflowClipSupport_1 = require("../../utils/checkOverflowClipSupport");
|
|
17
17
|
const Section_1 = require("../../../sdk/types/article/Section");
|
|
18
18
|
const DEFAULT_COLOR = 'rgba(0, 0, 0, 0)';
|
|
19
|
-
const Section = ({ section, data, children }) => {
|
|
19
|
+
const Section = ({ section, data, children, articleId }) => {
|
|
20
20
|
const id = (0, react_1.useId)();
|
|
21
21
|
const sectionRef = (0, react_1.useRef)(null);
|
|
22
22
|
const { customSections } = (0, useCntrlContext_1.useCntrlContext)();
|
|
@@ -34,7 +34,7 @@ const Section = ({ section, data, children }) => {
|
|
|
34
34
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: `section-${section.id}`, id: section.name, ref: sectionRef, children: [media && media.size !== 'none' && sectionRef.current && ((0, jsx_runtime_1.jsx)("div", { className: `section-background-overlay-${section.id}`, children: (0, jsx_runtime_1.jsxs)("div", { className: `section-background-wrapper-${section.id}`, style: {
|
|
35
35
|
transform: media.position === 'fixed' ? 'translateY(-100vh)' : 'unset',
|
|
36
36
|
height: media.position === 'fixed' ? `calc(${getSectionHeight(height)} + 200vh)` : getSectionHeight(height)
|
|
37
|
-
}, children: [media.type === 'video' && ((0, jsx_runtime_1.jsx)(SectionVideo_1.SectionVideo, { container: sectionRef.current, sectionId: section.id, media: media })), media.type === 'image' && ((0, jsx_runtime_1.jsx)(SectionImage_1.SectionImage, { media: media, sectionId: section.id }))] }, `section-background-wrapper-${section.id}`) })), children] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
37
|
+
}, children: [media.type === 'video' && ((0, jsx_runtime_1.jsx)(SectionVideo_1.SectionVideo, { container: sectionRef.current, sectionId: section.id, media: media, articleId: articleId })), media.type === 'image' && ((0, jsx_runtime_1.jsx)(SectionImage_1.SectionImage, { media: media, sectionId: section.id, articleId: articleId }))] }, `section-background-wrapper-${section.id}`) })), children] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
38
38
|
.section-${section.id} {
|
|
39
39
|
height: ${getSectionHeight(height)};
|
|
40
40
|
position: relative;
|
|
@@ -5,9 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const useCacheImage_1 = require("../../assets/useCacheImage");
|
|
7
7
|
const getCacheAssetKey_1 = require("../../assets/getCacheAssetKey");
|
|
8
|
-
const SectionImage = ({ media, sectionId }) => {
|
|
8
|
+
const SectionImage = ({ media, sectionId, articleId }) => {
|
|
9
9
|
const { url, size, position, offsetX } = media;
|
|
10
|
-
const key = (0, getCacheAssetKey_1.getCacheAssetKey)(url, sectionId);
|
|
10
|
+
const key = (0, getCacheAssetKey_1.getCacheAssetKey)(url, sectionId, articleId);
|
|
11
11
|
const [container, setContainer] = (0, react_1.useState)(null);
|
|
12
12
|
const isContainHeight = size === 'contain-height';
|
|
13
13
|
const hasOffsetX = offsetX !== null;
|
|
@@ -6,14 +6,14 @@ const react_1 = require("react");
|
|
|
6
6
|
const useCacheVideo_1 = require("../../assets/useCacheVideo");
|
|
7
7
|
const useCacheImage_1 = require("../../assets/useCacheImage");
|
|
8
8
|
const getCacheAssetKey_1 = require("../../assets/getCacheAssetKey");
|
|
9
|
-
const SectionVideo = ({ container, sectionId, media }) => {
|
|
9
|
+
const SectionVideo = ({ container, sectionId, media, articleId }) => {
|
|
10
10
|
const [video, setVideo] = (0, react_1.useState)(null);
|
|
11
11
|
const [videoWrapper, setVideoWrapper] = (0, react_1.useState)(null);
|
|
12
12
|
const [coverImageWrapper, setCoverImageWrapper] = (0, react_1.useState)(null);
|
|
13
13
|
const [isVideoWidthOverflow, setIsVideoWidthOverflow] = (0, react_1.useState)(false);
|
|
14
14
|
const { url, size, position, offsetX, coverUrl, play } = media;
|
|
15
|
-
const key = (0, getCacheAssetKey_1.getCacheAssetKey)(url, sectionId);
|
|
16
|
-
const coverKey = coverUrl ? (0, getCacheAssetKey_1.getCacheAssetKey)(coverUrl, sectionId) : null;
|
|
15
|
+
const key = (0, getCacheAssetKey_1.getCacheAssetKey)(url, sectionId, articleId);
|
|
16
|
+
const coverKey = coverUrl ? (0, getCacheAssetKey_1.getCacheAssetKey)(coverUrl, sectionId, articleId) : null;
|
|
17
17
|
const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
|
|
18
18
|
const [userPaused, setUserPaused] = (0, react_1.useState)(false);
|
|
19
19
|
const [isClickedOnCover, setIsClickedOnCover] = (0, react_1.useState)(false);
|
|
@@ -25,7 +25,7 @@ const Sections = ({ article, container }) => {
|
|
|
25
25
|
}, [articleRectObserver, container]);
|
|
26
26
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: article.sections.map((section, i) => {
|
|
27
27
|
const data = {};
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(Section_1.Section, { section: section, data: data, children: article.sections[i].items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, sectionId: section.id, articleHeight: articleHeight }, item.id))) }, section.id));
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(Section_1.Section, { articleId: article.id, section: section, data: data, children: article.sections[i].items.map(item => ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, articleId: article.id, sectionId: section.id, articleHeight: articleHeight }, item.id))) }, section.id));
|
|
29
29
|
}) }));
|
|
30
30
|
};
|
|
31
31
|
exports.Sections = Sections;
|
|
@@ -21,7 +21,7 @@ const useItemPointerEvents_1 = require("../useItemPointerEvents");
|
|
|
21
21
|
const useItemArea_1 = require("../useItemArea");
|
|
22
22
|
const ArticleItemType_1 = require("../../../../sdk/types/article/ArticleItemType");
|
|
23
23
|
const noop = () => null;
|
|
24
|
-
const CompoundChild = ({ item, sectionId, isParentVisible = true, isInFixedLayer = false }) => {
|
|
24
|
+
const CompoundChild = ({ item, sectionId, isParentVisible = true, isInFixedLayer = false, articleId }) => {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
26
26
|
const id = (0, react_1.useId)();
|
|
27
27
|
const exemplary = (0, useExemplary_1.useExemplary)();
|
|
@@ -71,7 +71,7 @@ const CompoundChild = ({ item, sectionId, isParentVisible = true, isInFixedLayer
|
|
|
71
71
|
} }, triggers, { children: [(0, jsx_runtime_1.jsx)("div", { className: `item-${item.id}-inner`, style: {
|
|
72
72
|
transition: (_l = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _l !== void 0 ? _l : 'none',
|
|
73
73
|
transform: `scale(${scale})`,
|
|
74
|
-
}, children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, transformOrigin: transformOrigin, children: (0, jsx_runtime_1.jsx)(ItemComponent, { isInFixedLayer: isInFixedLayer, item: item, sectionId: sectionId, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange, isInCompound: true }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
74
|
+
}, children: (0, jsx_runtime_1.jsx)(RichTextWrapper_1.RichTextWrapper, { isRichText: isRichText, transformOrigin: transformOrigin, children: (0, jsx_runtime_1.jsx)(ItemComponent, { articleId: articleId, isInFixedLayer: isInFixedLayer, item: item, sectionId: sectionId, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange, isInCompound: true }) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
75
75
|
.item-${item.id}-inner {
|
|
76
76
|
width: 100%;
|
|
77
77
|
height: 100%;
|
|
@@ -13,7 +13,7 @@ const LinkWrapper_1 = require("../LinkWrapper");
|
|
|
13
13
|
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
14
14
|
const CompoundChild_1 = require("./CompoundChild");
|
|
15
15
|
const useCompoundItem_1 = require("./useCompoundItem");
|
|
16
|
-
const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
16
|
+
const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, articleId }) => {
|
|
17
17
|
var _a, _b, _c;
|
|
18
18
|
const id = (0, react_1.useId)();
|
|
19
19
|
const { items } = item;
|
|
@@ -32,7 +32,7 @@ const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
|
|
|
32
32
|
opacity,
|
|
33
33
|
transform: `rotate(${angle}deg)`,
|
|
34
34
|
transition: (_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _c !== void 0 ? _c : 'none'
|
|
35
|
-
}, 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: `
|
|
35
|
+
}, children: items && items.map(item => ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { item: item, articleId: articleId, sectionId: sectionId, isParentVisible: isInteractive }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
36
36
|
.compound-${item.id} {
|
|
37
37
|
overflow: ${item.params.overflow};
|
|
38
38
|
position: absolute;
|
|
@@ -20,7 +20,7 @@ const useExemplary_1 = require("../../../common/useExemplary");
|
|
|
20
20
|
const AssetsCacheProvider_1 = require("../../../assets/AssetsCacheProvider");
|
|
21
21
|
const useCacheImage_1 = require("../../../assets/useCacheImage");
|
|
22
22
|
const getCacheAssetKey_1 = require("../../../assets/getCacheAssetKey");
|
|
23
|
-
const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
23
|
+
const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, articleId }) => {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
25
25
|
const id = (0, react_1.useId)();
|
|
26
26
|
const { radius: itemRadius, strokeWidth: itemStrokeWidth, opacity: itemOpacity, strokeFill: itemStrokeFill, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
@@ -29,7 +29,7 @@ const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
29
29
|
const [wrapperRef, setWrapperRef] = (0, react_1.useState)(null);
|
|
30
30
|
(0, useRegisterResize_1.useRegisterResize)(wrapperRef, onResize);
|
|
31
31
|
const { url, hasGLEffect } = item.params;
|
|
32
|
-
const cacheKey = (0, getCacheAssetKey_1.getCacheAssetKey)(url, item.id);
|
|
32
|
+
const cacheKey = (0, getCacheAssetKey_1.getCacheAssetKey)(url, item.id, articleId !== null && articleId !== void 0 ? articleId : '');
|
|
33
33
|
const fxCanvas = (0, react_1.useRef)(null);
|
|
34
34
|
const isInitialRef = (0, react_1.useRef)(true);
|
|
35
35
|
const { controlsValues, fragmentShader } = (0, useItemFXData_1.useItemFXData)(item, sectionId);
|
|
@@ -22,14 +22,14 @@ const AssetsCacheProvider_1 = require("../../../assets/AssetsCacheProvider");
|
|
|
22
22
|
const useCacheVideo_1 = require("../../../assets/useCacheVideo");
|
|
23
23
|
const useCacheImage_1 = require("../../../assets/useCacheImage");
|
|
24
24
|
const getCacheAssetKey_1 = require("../../../assets/getCacheAssetKey");
|
|
25
|
-
const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
25
|
+
const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, articleId }) => {
|
|
26
26
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
27
27
|
const id = (0, react_1.useId)();
|
|
28
28
|
const { radius: itemRadius, strokeWidth: itemStrokeWidth, strokeFill: itemStrokeFill, opacity: itemOpacity, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
29
29
|
const { videoCache, imageCache } = (0, react_1.useContext)(AssetsCacheProvider_1.AssetsCacheContext);
|
|
30
30
|
const [isVideoPlaying, setIsVideoPlaying] = (0, react_1.useState)(false);
|
|
31
|
-
const videoCacheKey = (0, getCacheAssetKey_1.getCacheAssetKey)(item.params.url, item.id);
|
|
32
|
-
const coverCacheKey = item.params.coverUrl ? (0, getCacheAssetKey_1.getCacheAssetKey)(item.params.coverUrl, item.id) : null;
|
|
31
|
+
const videoCacheKey = (0, getCacheAssetKey_1.getCacheAssetKey)(item.params.url, item.id, articleId !== null && articleId !== void 0 ? articleId : '');
|
|
32
|
+
const coverCacheKey = item.params.coverUrl ? (0, getCacheAssetKey_1.getCacheAssetKey)(item.params.coverUrl, item.id, articleId !== null && articleId !== void 0 ? articleId : '') : null;
|
|
33
33
|
const isScrollPausedRef = (0, react_1.useRef)(false);
|
|
34
34
|
const [userPaused, setUserPaused] = (0, react_1.useState)(false);
|
|
35
35
|
const [isVideoInteracted, setIsVideoInteracted] = (0, react_1.useState)(false);
|
|
@@ -14,7 +14,7 @@ const useItemAngle_1 = require("../useItemAngle");
|
|
|
14
14
|
const useGroupItem_1 = require("./useGroupItem");
|
|
15
15
|
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
16
16
|
const CompoundChild_1 = require("../CompoundItem/CompoundChild");
|
|
17
|
-
const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, isInCompound, isInFixedLayer }) => {
|
|
17
|
+
const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, isInCompound, isInFixedLayer, articleId }) => {
|
|
18
18
|
var _a, _b, _c, _d;
|
|
19
19
|
const id = (0, react_1.useId)();
|
|
20
20
|
const { items } = item;
|
|
@@ -30,7 +30,7 @@ const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
30
30
|
(0, react_1.useEffect)(() => {
|
|
31
31
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
32
32
|
}, [isInteractive, onVisibilityChange]);
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: item.link, 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: (_d = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _d !== void 0 ? _d : 'none', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { isInFixedLayer: isInFixedLayer, item: item, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((0, jsx_runtime_1.jsx)(Item_1.Item, { item: item, isInFixedLayer: isInFixedLayer, sectionId: sectionId, isParentVisible: isInteractive, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: item.link, 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: (_d = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _d !== void 0 ? _d : 'none', willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), children: items && items.map(item => isInCompound ? ((0, jsx_runtime_1.jsx)(CompoundChild_1.CompoundChild, { isInFixedLayer: isInFixedLayer, item: item, articleId: articleId, sectionId: sectionId, isParentVisible: isInteractive }, item.id)) : ((0, jsx_runtime_1.jsx)(Item_1.Item, { articleId: articleId, item: item, isInFixedLayer: isInFixedLayer, sectionId: sectionId, isParentVisible: isInteractive, isInGroup: true }, item.id))) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
34
34
|
.group-${item.id} {
|
|
35
35
|
position: absolute;
|
|
36
36
|
width: 100%;
|
|
@@ -5,6 +5,7 @@ export interface ItemProps<I extends ItemAny> {
|
|
|
5
5
|
item: I;
|
|
6
6
|
sectionId: string;
|
|
7
7
|
articleHeight?: number;
|
|
8
|
+
articleId?: string;
|
|
8
9
|
onResize?: (height: number) => void;
|
|
9
10
|
interactionCtrl?: ReturnType<typeof useItemInteractionCtrl>;
|
|
10
11
|
onVisibilityChange: (isVisible: boolean) => void;
|
|
@@ -14,6 +15,7 @@ export interface ItemProps<I extends ItemAny> {
|
|
|
14
15
|
export interface ItemWrapperProps {
|
|
15
16
|
item: ItemAny;
|
|
16
17
|
sectionId: string;
|
|
18
|
+
articleId?: string;
|
|
17
19
|
articleHeight?: number;
|
|
18
20
|
isInGroup?: boolean;
|
|
19
21
|
isInFixedLayer?: boolean;
|
|
@@ -32,8 +32,8 @@ const stickyFix = `
|
|
|
32
32
|
transform: translate3d(0, 0, 0);
|
|
33
33
|
`;
|
|
34
34
|
const noop = () => null;
|
|
35
|
-
const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGroup = false, isInFixedLayer = false }) => {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
35
|
+
const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGroup = false, isInFixedLayer = false, articleId }) => {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
37
37
|
const itemWrapperRef = (0, react_1.useRef)(null);
|
|
38
38
|
const itemInnerRef = (0, react_1.useRef)(null);
|
|
39
39
|
const rectObserver = (0, react_1.useContext)(ArticleRectContext_1.ArticleRectContext);
|
|
@@ -94,10 +94,8 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
|
|
|
94
94
|
};
|
|
95
95
|
const isRichText = (0, isItemType_1.isItemType)(item, ArticleItemType_1.ArticleItemType.RichText);
|
|
96
96
|
const anchorSide = (_g = item.area.anchorSide) !== null && _g !== void 0 ? _g : ItemArea_1.AnchorSide.Top;
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
const scale = (_k = (_j = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _j === void 0 ? void 0 : _j.scale) !== null && _k !== void 0 ? _k : itemScale;
|
|
100
|
-
const hasClickTriggers = (_l = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getHasTrigger(item.id, 'click')) !== null && _l !== void 0 ? _l : false;
|
|
97
|
+
const scale = (_j = (_h = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.styles) === null || _h === void 0 ? void 0 : _h.scale) !== null && _j !== void 0 ? _j : itemScale;
|
|
98
|
+
const hasClickTriggers = (_k = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.getHasTrigger(item.id, 'click')) !== null && _k !== void 0 ? _k : false;
|
|
101
99
|
const scroll = rectObserver === null || rectObserver === void 0 ? void 0 : rectObserver.scroll;
|
|
102
100
|
const realTop = item.area.positionType === ItemArea_1.PositionType.ScreenBased && isSceneTransitioning && scroll !== undefined
|
|
103
101
|
? top + scroll
|
|
@@ -106,7 +104,7 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
|
|
|
106
104
|
var _a;
|
|
107
105
|
e.stopPropagation();
|
|
108
106
|
(_a = interactionCtrl === null || interactionCtrl === void 0 ? void 0 : interactionCtrl.handleTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(interactionCtrl, e.propertyName);
|
|
109
|
-
}, style: Object.assign(Object.assign({ top:
|
|
107
|
+
}, style: Object.assign(Object.assign({ top: (0, getItemTopStyle_1.getItemTopStyle)(realTop, anchorSide), left: `${left * 100}vw` }, (wrapperHeight !== undefined ? { height: `${wrapperHeight * 100}vw` } : {})), { transition: (_l = wrapperStateProps === null || wrapperStateProps === void 0 ? void 0 : wrapperStateProps.transition) !== null && _l !== void 0 ? _l : 'none' }), children: [(0, jsx_runtime_1.jsx)("div", { suppressHydrationWarning: true, className: `item-${item.id}`, style: {
|
|
110
108
|
top: item.sticky ? (0, getAnchoredItemTop_1.getAnchoredItemTop)(stickyTop, sectionHeight, anchorSide) : 0,
|
|
111
109
|
height: isRichText && itemHeight !== undefined ? `${itemHeight * 100}vw` : 'unset'
|
|
112
110
|
}, 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)
|
|
@@ -118,13 +116,13 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
|
|
|
118
116
|
: 'max-content'}`,
|
|
119
117
|
height: `${sizingAxis.y === 'manual' ? `${height * 100}vw` : 'unset'}`
|
|
120
118
|
}
|
|
121
|
-
: {})), (scale !== undefined ? { transform: `scale(${scale})`, WebkitTransform: `scale(${scale})` } : {})), { transition: (
|
|
119
|
+
: {})), (scale !== undefined ? { transform: `scale(${scale})`, WebkitTransform: `scale(${scale})` } : {})), { transition: (_m = innerStateProps === null || innerStateProps === void 0 ? void 0 : innerStateProps.transition) !== null && _m !== void 0 ? _m : 'none', cursor: isDraggingActive
|
|
122
120
|
? 'grabbing'
|
|
123
121
|
: isDraggable
|
|
124
122
|
? 'grab'
|
|
125
123
|
: hasClickTriggers
|
|
126
124
|
? 'pointer'
|
|
127
|
-
: '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, isInFixedLayer: isInFixedLayer, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) })) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
125
|
+
: '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, { articleId: articleId, item: item, sectionId: sectionId, onResize: handleItemResize, articleHeight: articleHeight, isInFixedLayer: isInFixedLayer, interactionCtrl: interactionCtrl, onVisibilityChange: handleVisibilityChange }) })) }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
128
126
|
.item-${item.id} {
|
|
129
127
|
position: ${item.sticky ? 'sticky' : 'absolute'};
|
|
130
128
|
top: ${item.sticky ? `${(0, getAnchoredItemTop_1.getAnchoredItemTop)(item.area.top - item.sticky.from, sectionHeight, item.area.anchorSide)}` : 0};
|
|
@@ -147,8 +145,7 @@ const Item = ({ item, sectionId, articleHeight, isParentVisible = true, isInGrou
|
|
|
147
145
|
z-index: ${item.area.zIndex};
|
|
148
146
|
${!isInGroup && stickyFix}
|
|
149
147
|
pointer-events: none;
|
|
150
|
-
|
|
151
|
-
top: ${isScreenBasedBottom ? 'unset' : (0, getItemTopStyle_1.getItemTopStyle)(item.area.top, item.area.anchorSide)};
|
|
148
|
+
top: ${(0, getItemTopStyle_1.getItemTopStyle)(item.area.top, item.area.anchorSide)};
|
|
152
149
|
left: ${item.area.left * 100}vw;
|
|
153
150
|
}
|
|
154
151
|
` })] }));
|