@gxpl/sdk 0.0.15 → 0.0.17
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/types/article/Item.d.ts +12 -1
- package/lib/sdk-nextjs/components/items/CodeEmbedItem/CodeEmbedItem.js +2 -2
- package/lib/sdk-nextjs/components/items/CompoundItem/CompoundItem.js +3 -3
- package/lib/sdk-nextjs/components/items/EmbedVideoItem/VimeoEmbed.js +4 -4
- package/lib/sdk-nextjs/components/items/EmbedVideoItem/YoutubeEmbed.js +4 -4
- package/lib/sdk-nextjs/components/items/FileItem/ImageItem.js +2 -2
- package/lib/sdk-nextjs/components/items/FileItem/VideoItem.js +5 -5
- package/lib/sdk-nextjs/components/items/GroupItem/GroupItem.js +2 -2
- package/lib/sdk-nextjs/components/items/LinkWrapper.d.ts +2 -2
- package/lib/sdk-nextjs/components/items/LinkWrapper.js +22 -4
- package/lib/sdk-nextjs/components/items/RectangleItem/RectangleItem.js +3 -3
- package/lib/sdk-nextjs/utils/RichTextConverter/RichTextConverter.js +6 -6
- package/package.json +1 -1
|
@@ -193,10 +193,21 @@ export interface StickyParams {
|
|
|
193
193
|
from: number;
|
|
194
194
|
to?: number;
|
|
195
195
|
}
|
|
196
|
-
export
|
|
196
|
+
export type Link = UrlLink | ClickLink;
|
|
197
|
+
interface UrlLink {
|
|
197
198
|
url: string;
|
|
198
199
|
target: string;
|
|
199
200
|
}
|
|
201
|
+
interface UrlLink {
|
|
202
|
+
url: string;
|
|
203
|
+
target: string;
|
|
204
|
+
}
|
|
205
|
+
interface ClickLink {
|
|
206
|
+
value: string;
|
|
207
|
+
animation: 'fade' | 'slide' | 'reveal';
|
|
208
|
+
duration: number;
|
|
209
|
+
direction: 'north' | 'west' | 'south' | 'east';
|
|
210
|
+
}
|
|
200
211
|
export type VideoItem = Item<ArticleItemType.Video>;
|
|
201
212
|
export type RectangleItem = Item<ArticleItemType.Rectangle>;
|
|
202
213
|
export type ImageItem = Item<ArticleItemType.Image>;
|
|
@@ -16,7 +16,7 @@ const useCodeEmbedItem_1 = require("./useCodeEmbedItem");
|
|
|
16
16
|
const FontFaceGenerator_1 = require("../../../../sdk/FontFaceGenerator/FontFaceGenerator");
|
|
17
17
|
const useExemplary_1 = require("../../../common/useExemplary");
|
|
18
18
|
const CodeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20
20
|
const id = (0, react_1.useId)();
|
|
21
21
|
const { fonts } = (0, useCntrlContext_1.useCntrlContext)();
|
|
22
22
|
const fontGoogleTags = fonts === null || fonts === void 0 ? void 0 : fonts.google;
|
|
@@ -71,7 +71,7 @@ const CodeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
|
|
|
71
71
|
(0, react_1.useEffect)(() => {
|
|
72
72
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
73
73
|
}, [isInteractive, onVisibilityChange]);
|
|
74
|
-
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, {
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { link: item.link, children: [(0, jsx_runtime_1.jsx)("div", { className: `embed-wrapper-${item.id}`, style: Object.assign(Object.assign({ transform: `rotate(${angle}deg)` }, (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_h = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _h !== void 0 ? _h : 'none' }), ref: setRef, children: item.params.iframe ? ((0, jsx_runtime_1.jsx)("iframe", { "data-embed": item.id, className: `embed-${item.id}`, style: {
|
|
75
75
|
border: 'unset'
|
|
76
76
|
} })) : ((0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, dangerouslySetInnerHTML: { __html: html } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
77
77
|
.embed-wrapper-${item.id} {
|
|
@@ -14,7 +14,7 @@ const style_1 = __importDefault(require("styled-jsx/style"));
|
|
|
14
14
|
const CompoundChild_1 = require("./CompoundChild");
|
|
15
15
|
const useCompoundItem_1 = require("./useCompoundItem");
|
|
16
16
|
const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
17
|
-
var _a, _b, _c
|
|
17
|
+
var _a, _b, _c;
|
|
18
18
|
const id = (0, react_1.useId)();
|
|
19
19
|
const { items } = item;
|
|
20
20
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
@@ -28,10 +28,10 @@ const CompoundItem = ({ item, sectionId, onResize, interactionCtrl, onVisibility
|
|
|
28
28
|
(0, react_1.useEffect)(() => {
|
|
29
29
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
30
30
|
}, [isInteractive, onVisibilityChange]);
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, {
|
|
31
|
+
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: `compound-${item.id}`, ref: setRef, style: {
|
|
32
32
|
opacity,
|
|
33
33
|
transform: `rotate(${angle}deg)`,
|
|
34
|
-
transition: (
|
|
34
|
+
transition: (_c = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _c !== void 0 ? _c : 'none'
|
|
35
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: `
|
|
36
36
|
.compound-${item.id} {
|
|
37
37
|
overflow: ${item.params.overflow};
|
|
@@ -23,7 +23,7 @@ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromIte
|
|
|
23
23
|
const useEmbedVideoItem_1 = require("./useEmbedVideoItem");
|
|
24
24
|
const LinkWrapper_1 = require("../LinkWrapper");
|
|
25
25
|
const VimeoEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27
27
|
const id = (0, react_1.useId)();
|
|
28
28
|
const { radius: itemRadius, blur: itemBlur, opacity: itemOpacity } = (0, useEmbedVideoItem_1.useEmbedVideoItem)(item, sectionId);
|
|
29
29
|
const [iframeRef, setIframeRef] = (0, react_1.useState)(null);
|
|
@@ -110,7 +110,7 @@ const VimeoEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibili
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}, [interactionCtrl, vimeoPlayer]);
|
|
113
|
-
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, {
|
|
113
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { link: item.link, children: [(0, jsx_runtime_1.jsxs)("div", { className: `embed-video-wrapper-${item.id}`, ref: setRef, style: Object.assign(Object.assign({ opacity, transform: `rotate(${angle}deg)` }, (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_e = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _e !== void 0 ? _e : 'none' }), onMouseEnter: () => {
|
|
114
114
|
if (!vimeoPlayer || params.play !== 'on-hover')
|
|
115
115
|
return;
|
|
116
116
|
vimeoPlayer.play();
|
|
@@ -118,7 +118,7 @@ const VimeoEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibili
|
|
|
118
118
|
if (!vimeoPlayer || params.play !== 'on-hover')
|
|
119
119
|
return;
|
|
120
120
|
vimeoPlayer.pause();
|
|
121
|
-
}, children: [params.coverUrl && ((0, jsx_runtime_1.jsx)("img", { ref: setImgRef, onClick: () => onCoverClick(), src: (
|
|
121
|
+
}, children: [params.coverUrl && ((0, jsx_runtime_1.jsx)("img", { ref: setImgRef, onClick: () => onCoverClick(), src: (_f = params.coverUrl) !== null && _f !== void 0 ? _f : '', style: {
|
|
122
122
|
display: isCoverVisible ? 'block' : 'none',
|
|
123
123
|
cursor: 'pointer',
|
|
124
124
|
position: 'absolute',
|
|
@@ -135,7 +135,7 @@ const VimeoEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibili
|
|
|
135
135
|
left: '0'
|
|
136
136
|
} })), (0, jsx_runtime_1.jsx)("iframe", { ref: setIframeRef, className: "embed-video", src: validUrl || '', allow: "autoplay; fullscreen; picture-in-picture;", allowFullScreen: true, style: {
|
|
137
137
|
borderRadius: `${radius * 100}vw`,
|
|
138
|
-
transition: (
|
|
138
|
+
transition: (_g = frameStateParams === null || frameStateParams === void 0 ? void 0 : frameStateParams.transition) !== null && _g !== void 0 ? _g : 'none'
|
|
139
139
|
} })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
140
140
|
.embed-video-wrapper-${item.id} {
|
|
141
141
|
position: absolute;
|
|
@@ -15,7 +15,7 @@ const useYouTubeIframeApi_1 = require("../../../utils/Youtube/useYouTubeIframeAp
|
|
|
15
15
|
const useRegisterResize_1 = require("../../../common/useRegisterResize");
|
|
16
16
|
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
17
17
|
const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
19
|
const id = (0, react_1.useId)();
|
|
20
20
|
const { url } = item.params;
|
|
21
21
|
const params = item.params;
|
|
@@ -108,7 +108,7 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibi
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
}, [interactionCtrl, player]);
|
|
111
|
-
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, {
|
|
111
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { link: item.link, children: [(0, jsx_runtime_1.jsxs)("div", { className: `embed-youtube-video-wrapper-${item.id}`, onMouseEnter: () => {
|
|
112
112
|
if (!player || params.play !== 'on-hover')
|
|
113
113
|
return;
|
|
114
114
|
player.playVideo();
|
|
@@ -116,7 +116,7 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibi
|
|
|
116
116
|
if (!player || params.play !== 'on-hover')
|
|
117
117
|
return;
|
|
118
118
|
player.pauseVideo();
|
|
119
|
-
}, 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: (
|
|
119
|
+
}, 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: (_e = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _e !== void 0 ? _e : 'none' }), children: [params.coverUrl && ((0, jsx_runtime_1.jsx)("img", { ref: setImgRef, onClick: () => onCoverClick(), src: (_f = params.coverUrl) !== null && _f !== void 0 ? _f : '', style: {
|
|
120
120
|
display: isCoverVisible ? 'block' : 'none',
|
|
121
121
|
cursor: 'pointer',
|
|
122
122
|
position: 'absolute',
|
|
@@ -126,7 +126,7 @@ const YoutubeEmbedItem = ({ item, sectionId, onResize, interactionCtrl, onVisibi
|
|
|
126
126
|
top: '0',
|
|
127
127
|
left: '0',
|
|
128
128
|
zIndex: 1
|
|
129
|
-
}, alt: "Cover img" })), (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), { transition: (
|
|
129
|
+
}, alt: "Cover img" })), (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, ref: setDiv, style: Object.assign(Object.assign({}, (radius !== undefined ? { borderRadius: `${radius * 100}vw` } : {})), { transition: (_g = frameStateParams === null || frameStateParams === void 0 ? void 0 : frameStateParams.transition) !== null && _g !== void 0 ? _g : 'none' }) })] }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
130
130
|
.embed-youtube-video-wrapper-${item.id},
|
|
131
131
|
.embed-${item.id} {
|
|
132
132
|
position: absolute;
|
|
@@ -18,7 +18,7 @@ const useItemFXData_1 = require("../../../common/useItemFXData");
|
|
|
18
18
|
const getFill_1 = require("../../../utils/getFill");
|
|
19
19
|
const useExemplary_1 = require("../../../common/useExemplary");
|
|
20
20
|
const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
22
22
|
const id = (0, react_1.useId)();
|
|
23
23
|
const { radius: itemRadius, strokeWidth: itemStrokeWidth, opacity: itemOpacity, strokeFill: itemStrokeFill, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
24
24
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
@@ -65,7 +65,7 @@ const ImageItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
65
65
|
(0, react_1.useEffect)(() => {
|
|
66
66
|
onVisibilityChange === null || onVisibilityChange === void 0 ? void 0 : onVisibilityChange(isInteractive);
|
|
67
67
|
}, [isInteractive, onVisibilityChange]);
|
|
68
|
-
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, {
|
|
68
|
+
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: `image-wrapper-${item.id}`, ref: setWrapperRef, style: Object.assign(Object.assign({ opacity, transform: `rotate(${angle}deg)` }, (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset', transition: (_o = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _o !== void 0 ? _o : 'none' }), children: hasGLEffect && isFXAllowed
|
|
69
69
|
? ((0, jsx_runtime_1.jsx)("canvas", { style: inlineStyles, ref: fxCanvas, className: `img-canvas image-${item.id}`, width: rectWidth, height: rectHeight }))
|
|
70
70
|
: ((0, jsx_runtime_1.jsx)("img", { alt: "", className: `image image-${item.id}`, style: inlineStyles, src: item.params.url })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
71
71
|
.image-wrapper-${item.id} {
|
|
@@ -19,7 +19,7 @@ const useItemFXData_1 = require("../../../common/useItemFXData");
|
|
|
19
19
|
const getFill_1 = require("../../../utils/getFill");
|
|
20
20
|
const useExemplary_1 = require("../../../common/useExemplary");
|
|
21
21
|
const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
23
23
|
const id = (0, react_1.useId)();
|
|
24
24
|
const { radius: itemRadius, strokeWidth: itemStrokeWidth, strokeFill: itemStrokeFill, opacity: itemOpacity, blur: itemBlur } = (0, useFileItem_1.useFileItem)(item, sectionId);
|
|
25
25
|
const [isVideoPlaying, setIsVideoPlaying] = (0, react_1.useState)(false);
|
|
@@ -91,13 +91,13 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
91
91
|
observer.observe(ref);
|
|
92
92
|
return () => observer.disconnect();
|
|
93
93
|
}, [videoRef, ref, userPaused, isVideoInteracted]);
|
|
94
|
-
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, {
|
|
94
|
+
return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { link: item.link, children: [(0, jsx_runtime_1.jsxs)("div", { className: `video-wrapper-${item.id}`, ref: setRef, style: {
|
|
95
95
|
opacity,
|
|
96
96
|
transform: `rotate(${angle}deg)`,
|
|
97
97
|
filter: `blur(${blur * 100}vw)`,
|
|
98
98
|
willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset',
|
|
99
|
-
transition: (
|
|
100
|
-
}, children: [hasScrollPlayback && ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.params.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 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { poster: (
|
|
99
|
+
transition: (_o = wrapperStateParams === null || wrapperStateParams === void 0 ? void 0 : wrapperStateParams.transition) !== null && _o !== void 0 ? _o : 'none'
|
|
100
|
+
}, children: [hasScrollPlayback && ((0, jsx_runtime_1.jsx)(ScrollPlaybackVideo_1.ScrollPlaybackVideo, { sectionId: sectionId, src: item.params.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 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { poster: (_p = item.params.coverUrl) !== null && _p !== void 0 ? _p : '', ref: setVideoRef, autoPlay: params.play === 'auto', preload: "auto", onClick: () => {
|
|
101
101
|
setIsVideoInteracted(true);
|
|
102
102
|
}, muted: params.muted, onPlay: () => {
|
|
103
103
|
setIsVideoPlaying(true);
|
|
@@ -120,7 +120,7 @@ const VideoItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityCha
|
|
|
120
120
|
return;
|
|
121
121
|
setIsVideoInteracted(true);
|
|
122
122
|
videoRef.play();
|
|
123
|
-
}, src: (
|
|
123
|
+
}, src: (_q = item.params.coverUrl) !== null && _q !== void 0 ? _q : '', className: `video-cover-${item.id}`, onClick: () => {
|
|
124
124
|
if (!videoRef)
|
|
125
125
|
return;
|
|
126
126
|
setIsVideoInteracted(true);
|
|
@@ -15,7 +15,7 @@ const useGroupItem_1 = require("./useGroupItem");
|
|
|
15
15
|
const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromItemStateAndParams");
|
|
16
16
|
const CompoundChild_1 = require("../CompoundItem/CompoundChild");
|
|
17
17
|
const GroupItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange, isInCompound }) => {
|
|
18
|
-
var _a, _b, _c, _d
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
19
|
const id = (0, react_1.useId)();
|
|
20
20
|
const { items } = item;
|
|
21
21
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
@@ -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, {
|
|
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, { 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: `
|
|
34
34
|
.group-${item.id} {
|
|
35
35
|
position: absolute;
|
|
36
36
|
width: 100%;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { Link } from '../../../sdk/types/article/Item';
|
|
2
3
|
interface Props {
|
|
3
|
-
url?: string;
|
|
4
4
|
children: ReactElement | ReactNode[];
|
|
5
|
-
|
|
5
|
+
link?: Link;
|
|
6
6
|
}
|
|
7
7
|
export declare const LinkWrapper: React.FC<Props>;
|
|
8
8
|
export {};
|
|
@@ -2,10 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LinkWrapper = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
5
|
+
const TransitionMachineContext_1 = require("../../provider/TransitionMachineContext");
|
|
6
|
+
const LinkWrapper = ({ link, children }) => {
|
|
7
|
+
const actorRef = TransitionMachineContext_1.TransitionMachineContext.useActorRef();
|
|
8
|
+
const validUrl = link && 'url' in link ? buildValidUrl(link.url) : 'javascript:void(0)';
|
|
9
|
+
const targetParams = link && 'target' in link && link.target === '_blank' ? { target: link.target, rel: 'noreferrer' } : {};
|
|
10
|
+
const handleGoToScene = () => {
|
|
11
|
+
if (!actorRef || !link || !('value' in link))
|
|
12
|
+
return;
|
|
13
|
+
actorRef.send({
|
|
14
|
+
type: 'TRANSITION_TRIGGER',
|
|
15
|
+
transition: link.animation,
|
|
16
|
+
to: link.value,
|
|
17
|
+
direction: link.direction
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
if (validUrl) {
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: validUrl }, targetParams, { children: children })));
|
|
22
|
+
}
|
|
23
|
+
if (link && 'value' in link) {
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("a", { onClick: handleGoToScene, role: "button", children: children }));
|
|
25
|
+
}
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
9
27
|
};
|
|
10
28
|
exports.LinkWrapper = LinkWrapper;
|
|
11
29
|
function buildValidUrl(url) {
|
|
@@ -15,7 +15,7 @@ const getStyleFromItemStateAndParams_1 = require("../../../utils/getStyleFromIte
|
|
|
15
15
|
const getFill_1 = require("../../../utils/getFill");
|
|
16
16
|
const areFillsVisible_1 = require("../../../utils/areFillsVisible/areFillsVisible");
|
|
17
17
|
const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilityChange }) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
19
19
|
const id = (0, react_1.useId)();
|
|
20
20
|
const { fill: itemFill, radius: itemRadius, strokeWidth: itemStrokeWidth, strokeFill: itemStrokeFill, blur: itemBlur, backdropBlur: itemBackdropBlur } = (0, useRectangleItem_1.useRectangleItem)(item, sectionId);
|
|
21
21
|
const itemAngle = (0, useItemAngle_1.useItemAngle)(item, sectionId);
|
|
@@ -40,13 +40,13 @@ const RectangleItem = ({ item, sectionId, onResize, interactionCtrl, onVisibilit
|
|
|
40
40
|
const stroke = strokeFill
|
|
41
41
|
? (_h = (0, getFill_1.getFill)(strokeFill)) !== null && _h !== void 0 ? _h : 'transparent'
|
|
42
42
|
: 'transparent';
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, {
|
|
43
|
+
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: `rectangle-${item.id}`, ref: setRef, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (strokeFill ? Object.assign({ borderColor: stroke, borderWidth: strokeWidth !== undefined ? `${strokeWidth * 100}vw` : 0, borderRadius: radius !== undefined ? `${radius * 100}vw` : 'inherit', borderStyle: 'solid' }, (strokeFill.type === 'image' ? {
|
|
44
44
|
backgroundPosition: 'center',
|
|
45
45
|
backgroundSize: strokeFill.behavior === 'repeat' ? `${strokeFill.backgroundSize}%` : strokeFill.behavior,
|
|
46
46
|
backgroundRepeat: strokeFill.behavior === 'repeat' ? 'repeat' : 'no-repeat'
|
|
47
47
|
} : {})) : {})), { borderRadius: `${radius * 100}vw` }), (angle !== undefined ? { transform: `rotate(${angle}deg)` } : {})), (blur !== undefined ? { filter: `blur(${blur * 100}vw)` } : {})), { willChange: blur !== 0 && blur !== undefined ? 'transform' : 'unset' }), (backdropFilterValue !== undefined
|
|
48
48
|
? { backdropFilter: backdropFilterValue, WebkitBackdropFilter: backdropFilterValue }
|
|
49
|
-
: {})), { transition: (
|
|
49
|
+
: {})), { transition: (_j = stateParams === null || stateParams === void 0 ? void 0 : stateParams.transition) !== null && _j !== void 0 ? _j : 'none' }), children: itemFill && itemFill.map((fill, i) => {
|
|
50
50
|
var _a, _b;
|
|
51
51
|
const stateFillLayer = stateFillLayers === null || stateFillLayers === void 0 ? void 0 : stateFillLayers.find((layer) => layer.id === fill.id);
|
|
52
52
|
const value = stateFillLayer
|
|
@@ -13,7 +13,7 @@ exports.FontStyles = {
|
|
|
13
13
|
};
|
|
14
14
|
class RichTextConverter {
|
|
15
15
|
toHtml(richText, exemplary) {
|
|
16
|
-
var _a, _b, _c, _d, _e;
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
17
17
|
const { text, blocks = [] } = richText.params;
|
|
18
18
|
const root = [];
|
|
19
19
|
const styleRules = [];
|
|
@@ -72,7 +72,7 @@ class RichTextConverter {
|
|
|
72
72
|
offset = entity.end;
|
|
73
73
|
}
|
|
74
74
|
if (entity.link) {
|
|
75
|
-
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { url: entity.link, target: entity.target, children: entityKids }, entity.start));
|
|
75
|
+
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: { url: entity.link, target: (_e = entity.target) !== null && _e !== void 0 ? _e : '_self', animation: (_f = entity.animation) !== null && _f !== void 0 ? _f : 'fade', direction: (_g = entity.direction) !== null && _g !== void 0 ? _g : 'north' }, children: entityKids }, entity.start));
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
78
|
kids.push(...entityKids);
|
|
@@ -81,7 +81,7 @@ class RichTextConverter {
|
|
|
81
81
|
kids.push(sliceSymbols(content, offset));
|
|
82
82
|
}
|
|
83
83
|
for (const styles of group) {
|
|
84
|
-
const entitiesGroups = (
|
|
84
|
+
const entitiesGroups = (_h = this.groupEntities(entities, styles)) !== null && _h !== void 0 ? _h : [];
|
|
85
85
|
for (const entitiesGroup of entitiesGroups) {
|
|
86
86
|
if (!entitiesGroup.stylesGroup)
|
|
87
87
|
continue;
|
|
@@ -147,7 +147,7 @@ class RichTextConverter {
|
|
|
147
147
|
return styleGroups;
|
|
148
148
|
}
|
|
149
149
|
groupEntities(entities, styleGroups) {
|
|
150
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
150
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
151
151
|
const entitiesGroups = [];
|
|
152
152
|
if (!entities.length && !styleGroups)
|
|
153
153
|
return;
|
|
@@ -167,7 +167,7 @@ class RichTextConverter {
|
|
|
167
167
|
const end = dividers[i + 1];
|
|
168
168
|
const entity = entities.find(e => e.start === start);
|
|
169
169
|
entitiesGroups.push(Object.assign({ stylesGroup: [], start,
|
|
170
|
-
end }, (entity && { link: (_b = (_a = entity.data) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '', target: (_d = (_c = entity.data) === null || _c === void 0 ? void 0 : _c.target) !== null && _d !== void 0 ? _d : '_self' })));
|
|
170
|
+
end }, (entity && { link: (_b = (_a = entity.data) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '', target: (_d = (_c = entity.data) === null || _c === void 0 ? void 0 : _c.target) !== null && _d !== void 0 ? _d : '_self', animation: (_f = (_e = entity.data) === null || _e === void 0 ? void 0 : _e.animation) !== null && _f !== void 0 ? _f : 'fade', direction: (_h = (_g = entity.data) === null || _g === void 0 ? void 0 : _g.direction) !== null && _h !== void 0 ? _h : 'north' })));
|
|
171
171
|
}
|
|
172
172
|
return entitiesGroups;
|
|
173
173
|
}
|
|
@@ -194,7 +194,7 @@ class RichTextConverter {
|
|
|
194
194
|
const end = entityDividers[i + 1];
|
|
195
195
|
const entity = entities.find(e => e.start === start);
|
|
196
196
|
entitiesGroups.push(Object.assign({ stylesGroup: styleGroups.filter(s => s.start >= start && s.end <= end), start,
|
|
197
|
-
end }, (entity && { link: (
|
|
197
|
+
end }, (entity && { link: (_k = (_j = entity.data) === null || _j === void 0 ? void 0 : _j.url) !== null && _k !== void 0 ? _k : '', target: (_m = (_l = entity.data) === null || _l === void 0 ? void 0 : _l.target) !== null && _m !== void 0 ? _m : '_self', animation: (_p = (_o = entity.data) === null || _o === void 0 ? void 0 : _o.animation) !== null && _p !== void 0 ? _p : 'fade', direction: (_r = (_q = entity.data) === null || _q === void 0 ? void 0 : _q.direction) !== null && _r !== void 0 ? _r : 'north' })));
|
|
198
198
|
}
|
|
199
199
|
return entitiesGroups;
|
|
200
200
|
}
|