pds-dev-kit-web-test 0.2.15 → 0.2.16
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/src/sub/DynamicLayout/components/Section/CustomSection.d.ts +2 -1
- package/dist/src/sub/DynamicLayout/components/Section/CustomSection.js +2 -4
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.d.ts +1 -2
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.js +29 -50
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.d.ts +5 -3
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js +53 -28
- package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.d.ts +1 -4
- package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.js +3 -12
- package/dist/src/sub/DynamicLayout/mock_customSection.js +9 -1
- package/dist/src/sub/DynamicLayout/mock_samplePage.js +1334 -440
- package/dist/src/sub/DynamicLayout/nakedMocks.json +8 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +645 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1661 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.d.ts +3 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +50 -23
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.d.ts +7 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +3 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +7 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/types.d.ts +12 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.js +4 -12
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/hooks/useCLINK.js +3 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/colorUtil.js +6 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/replaceUndefinedValues.js +3 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +98 -13
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseLayoutPropArrange.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseLayoutPropArrange.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseSectionPadding.d.ts +23 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseSectionPadding.js +26 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.d.ts +5 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.js +15 -28
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.d.ts +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.js +2 -7
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/index.d.ts +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/index.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgColor.js +4 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgImage.js +3 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgOverlay.d.ts +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgOverlay.js +6 -12
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBorder.js +16 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropDivider.js +17 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropImage.js +12 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropOpacity.js +9 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.js +7 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.d.ts +2 -33
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.js +27 -16
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/types.d.ts +4 -4
- package/dist/src/sub/DynamicLayout/types.d.ts +4 -4
- package/package.json +2 -2
|
@@ -30,17 +30,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
33
|
-
var react_1 = require("react");
|
|
34
33
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
35
34
|
var CustomSectionBackground_1 = __importDefault(require("./components/CustomSectionBackground"));
|
|
36
35
|
var sectionContext_1 = require("./sectionContext");
|
|
37
36
|
function CustomSection(_a) {
|
|
38
37
|
var _b;
|
|
39
38
|
var children = _a.children, overrideStyles = _a.overrideStyles, _c = _a.isMobile, isMobile = _c === void 0 ? false : _c, props = __rest(_a, ["children", "overrideStyles", "isMobile"]);
|
|
40
|
-
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)(sectionContext_1.sectionContext.Provider, __assign({ value: __assign({}, props) }, { children: (0, jsx_runtime_1.jsxs)(S_Section, __assign({ style: overrideStyles, isIframeSection: ((_b = props.manifest) === null || _b === void 0 ? void 0 : _b.schema) === 'EXP_IFRAME', onMouseEnter: function () { return setIsHover(true); }, onMouseMove: function () { return !isHover && setIsHover(true); }, onMouseLeave: function () { return setIsHover(false); } }, { children: [(0, jsx_runtime_1.jsx)(CustomSectionBackground_1.default, { isHover: isHover, isMobile: isMobile }, void 0), children] }), void 0) }), void 0));
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(sectionContext_1.sectionContext.Provider, __assign({ value: __assign({}, props) }, { children: (0, jsx_runtime_1.jsxs)(S_Section, __assign({ style: overrideStyles, isIframeSection: ((_b = props.manifest) === null || _b === void 0 ? void 0 : _b.schema) === 'EXP_IFRAME' }, { children: [(0, jsx_runtime_1.jsx)(CustomSectionBackground_1.default, { isMobile: isMobile }, void 0), children] }), void 0) }), void 0));
|
|
42
40
|
}
|
|
43
|
-
var S_Section = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n height: ", ";\n position: relative;\n width: 100%;\n z-index: 0;\n"], ["\n box-sizing: border-box;\n height: ", ";\n position: relative;\n width: 100%;\n z-index: 0;\n"])), function (_a) {
|
|
41
|
+
var S_Section = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n height: ", ";\n justify-content: center;\n position: relative;\n width: 100%;\n z-index: 0;\n"], ["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n height: ", ";\n justify-content: center;\n position: relative;\n width: 100%;\n z-index: 0;\n"])), function (_a) {
|
|
44
42
|
var isIframeSection = _a.isIframeSection;
|
|
45
43
|
return (isIframeSection ? '100%' : 'auto');
|
|
46
44
|
});
|
|
@@ -26,81 +26,60 @@ var styled_components_1 = __importDefault(require("styled-components"));
|
|
|
26
26
|
var sectionContext_1 = require("../sectionContext");
|
|
27
27
|
var CustomSectionBackgroundMedia_1 = require("./CustomSectionBackgroundMedia");
|
|
28
28
|
function CustomSectionBackground(_a) {
|
|
29
|
-
var
|
|
29
|
+
var _b = _a.isMobile, isMobile = _b === void 0 ? false : _b;
|
|
30
30
|
var context = (0, react_1.useContext)(sectionContext_1.sectionContext);
|
|
31
31
|
var id = context.id, jsonProperties = context.jsonProperties;
|
|
32
32
|
var backgroundRef = (0, react_1.useRef)(null);
|
|
33
|
-
var backgroundOverlayRef = (0, react_1.useRef)(null);
|
|
34
33
|
var _c = jsonProperties || {}, CB_STYLE_PROP_BGOVERLAY = _c.CB_STYLE_PROP_BGOVERLAY, CB_STYLE_PROP_BGMEDIA = _c.CB_STYLE_PROP_BGMEDIA;
|
|
35
|
-
var _d = (0, util_1.parseJsonProperties)(jsonProperties, isMobile ? 'MOBILE' : 'DESKTOP'), style = _d.style,
|
|
36
|
-
var isOverlay = getIsOverlay(isMobile,
|
|
37
|
-
var isBgMedia = getIsBgMedia(isMobile,
|
|
38
|
-
var mediaType = getMediaType(isMobile,
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
var sectionOverlayElement = backgroundOverlayRef.current;
|
|
42
|
-
if (sectionElement) {
|
|
43
|
-
if (isHover && style && 'background' in style) {
|
|
44
|
-
sectionElement.style.background = style.background;
|
|
45
|
-
}
|
|
46
|
-
if (!isHover && hoverStyle && 'background' in hoverStyle) {
|
|
47
|
-
sectionElement.style.background = hoverStyle.background;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (sectionOverlayElement) {
|
|
51
|
-
if (isHover && overlayHoverStyle && 'background' in overlayHoverStyle) {
|
|
52
|
-
sectionOverlayElement.style.background = overlayHoverStyle.background;
|
|
53
|
-
}
|
|
54
|
-
if (!isHover && overlayStyle && 'background' in overlayStyle) {
|
|
55
|
-
sectionOverlayElement.style.background = overlayStyle.background;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, [isHover, style, hoverStyle, overlayStyle, overlayHoverStyle]);
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOverlay && CB_STYLE_PROP_BGOVERLAY && ((0, jsx_runtime_1.jsx)(S_CustomBackgroundOverlay, { className: "Overlay", ref: backgroundOverlayRef }, void 0)), (0, jsx_runtime_1.jsx)(S_CustomBackgroundWrapper, __assign({ className: "CustomSection", ref: backgroundRef, style: __assign(__assign(__assign(__assign({}, layout), effect), style), { visibility: isHover ? hoverStyle.visibility : style.visibility }) }, { children: isBgMedia && CB_STYLE_PROP_BGMEDIA && ((0, jsx_runtime_1.jsx)(CustomSectionBackgroundMedia_1.CustomSectionBackgroundMedia, { specs: CB_STYLE_PROP_BGMEDIA, playerId: id, mediaType: mediaType || 'NONE', isHover: isHover, device: isMobile ? 'MOBILE' : 'DESKTOP' }, void 0)) }), void 0)] }, void 0));
|
|
34
|
+
var _d = (0, util_1.parseJsonProperties)(jsonProperties, isMobile ? 'MOBILE' : 'DESKTOP'), style = _d.style, overlayStyle = _d.overlayStyle, effect = _d.effect;
|
|
35
|
+
var isOverlay = getIsOverlay(isMobile, CB_STYLE_PROP_BGOVERLAY);
|
|
36
|
+
var isBgMedia = getIsBgMedia(isMobile, CB_STYLE_PROP_BGMEDIA);
|
|
37
|
+
var mediaType = getMediaType(isMobile, CB_STYLE_PROP_BGMEDIA);
|
|
38
|
+
var _e = imageStyleDivideProvider(style), componentStyle = _e.componentStyle, wrapperStyle = _e.wrapperStyle;
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOverlay && CB_STYLE_PROP_BGOVERLAY && ((0, jsx_runtime_1.jsx)(S_CustomBackgroundOverlay, { className: "Overlay", style: __assign({}, overlayStyle) }, void 0)), (0, jsx_runtime_1.jsx)(S_CustomBackgroundWrapper, __assign({ className: "CustomSection", ref: backgroundRef, style: __assign(__assign({}, effect), wrapperStyle) }, { children: isBgMedia && CB_STYLE_PROP_BGMEDIA && ((0, jsx_runtime_1.jsx)(CustomSectionBackgroundMedia_1.CustomSectionBackgroundMedia, { specs: CB_STYLE_PROP_BGMEDIA, componentStyle: componentStyle, playerId: id, mediaType: mediaType || 'NONE', device: isMobile ? 'MOBILE' : 'DESKTOP', backgroundRef: backgroundRef }, void 0)) }), void 0)] }, void 0));
|
|
60
40
|
}
|
|
61
|
-
function getIsOverlay(isMobile,
|
|
41
|
+
function getIsOverlay(isMobile, specs) {
|
|
62
42
|
if (!specs) {
|
|
63
43
|
return false;
|
|
64
44
|
}
|
|
65
45
|
if (isMobile) {
|
|
66
|
-
return
|
|
67
|
-
? specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE:HOVER'] !== 'NONE'
|
|
68
|
-
: specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE'] !== 'NONE';
|
|
46
|
+
return specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE'] !== 'NONE';
|
|
69
47
|
}
|
|
70
|
-
return
|
|
71
|
-
? specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:HOVER'] !== 'NONE'
|
|
72
|
-
: specs.CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE !== 'NONE';
|
|
48
|
+
return specs.CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE !== 'NONE';
|
|
73
49
|
}
|
|
74
|
-
function getIsBgMedia(isMobile,
|
|
50
|
+
function getIsBgMedia(isMobile, specs) {
|
|
75
51
|
if (!specs) {
|
|
76
52
|
return false;
|
|
77
53
|
}
|
|
78
54
|
if (isMobile) {
|
|
79
|
-
return
|
|
80
|
-
? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'] !== 'NONE'
|
|
81
|
-
: specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'] !== 'NONE';
|
|
55
|
+
return specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'] !== 'NONE';
|
|
82
56
|
}
|
|
83
|
-
return
|
|
84
|
-
? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER'] !== 'NONE'
|
|
85
|
-
: specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE !== 'NONE';
|
|
57
|
+
return specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE !== 'NONE';
|
|
86
58
|
}
|
|
87
|
-
function getMediaType(isMobile,
|
|
59
|
+
function getMediaType(isMobile, specs) {
|
|
88
60
|
if (!specs) {
|
|
89
61
|
return 'NONE';
|
|
90
62
|
}
|
|
91
63
|
if (isMobile) {
|
|
92
|
-
if (isHover) {
|
|
93
|
-
return (0, isNullOrUndefined_1.default)(specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'])
|
|
94
|
-
? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER']
|
|
95
|
-
: specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'];
|
|
96
|
-
}
|
|
97
64
|
return (0, isNullOrUndefined_1.default)(specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'])
|
|
98
65
|
? specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE
|
|
99
66
|
: specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'];
|
|
100
67
|
}
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
68
|
+
return specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE;
|
|
69
|
+
}
|
|
70
|
+
function imageStyleDivideProvider(style) {
|
|
71
|
+
return {
|
|
72
|
+
componentStyle: {
|
|
73
|
+
display: style.display,
|
|
74
|
+
objectFit: style.objectFit
|
|
75
|
+
},
|
|
76
|
+
wrapperStyle: {
|
|
77
|
+
alignItems: style.alignItems,
|
|
78
|
+
visibility: style.visibility,
|
|
79
|
+
justifyContent: style.justifyContent,
|
|
80
|
+
background: style.background
|
|
81
|
+
}
|
|
82
|
+
};
|
|
104
83
|
}
|
|
105
84
|
var S_CustomBackgroundWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n overflow: hidden;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -2;\n"], ["\n align-items: center;\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n overflow: hidden;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -2;\n"])));
|
|
106
85
|
var S_CustomBackgroundOverlay = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n"], ["\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n"])));
|
package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { CSSProperties } from 'styled-components';
|
|
2
3
|
import type { Device } from '../../../../DynamicLayout/sections/CustomSection/util/types';
|
|
3
4
|
import type { CB_STYLE_PROP_BGMEDIA_SPECS } from '../../../../DynamicLayout/types';
|
|
4
5
|
declare type Props = {
|
|
5
6
|
specs: CB_STYLE_PROP_BGMEDIA_SPECS;
|
|
6
7
|
playerId: number;
|
|
7
8
|
mediaType: string;
|
|
8
|
-
|
|
9
|
+
componentStyle: CSSProperties;
|
|
9
10
|
device: Device;
|
|
11
|
+
backgroundRef: MutableRefObject<HTMLDivElement | null>;
|
|
10
12
|
};
|
|
11
|
-
export declare function CustomSectionBackgroundMedia({ specs, playerId, mediaType,
|
|
13
|
+
export declare function CustomSectionBackgroundMedia({ specs, playerId, mediaType, componentStyle, device, backgroundRef }: Props): JSX.Element;
|
|
12
14
|
export {};
|
package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js
CHANGED
|
@@ -20,41 +20,60 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.CustomSectionBackgroundMedia = void 0;
|
|
22
22
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
23
|
-
|
|
24
|
-
require("react");
|
|
23
|
+
var react_1 = require("react");
|
|
25
24
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
26
25
|
var pdsOriginal_1 = require("../../pdsOriginal");
|
|
27
26
|
var YouTubeIframe_1 = require("../../YouTubeIframe");
|
|
28
27
|
var util_1 = require("../util");
|
|
29
28
|
function CustomSectionBackgroundMedia(_a) {
|
|
30
|
-
var specs = _a.specs, playerId = _a.playerId, mediaType = _a.mediaType,
|
|
31
|
-
var _b = (0, util_1.parseSectionBackgroundMediaData)(specs, device),
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
var specs = _a.specs, playerId = _a.playerId, mediaType = _a.mediaType, componentStyle = _a.componentStyle, device = _a.device, backgroundRef = _a.backgroundRef;
|
|
30
|
+
var _b = (0, util_1.parseSectionBackgroundMediaData)(specs, device), CB_STYLE_PROP_BGMEDIA_SPEC_YSRC = _b.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC, CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY = _b.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY, CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME = _b.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME = _b.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME, CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL = _b.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT = _b.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT, CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR = _b.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR;
|
|
31
|
+
var _c = (0, react_1.useState)({ width: 0, height: 0 }), youtubeSize = _c[0], setYoutubeSize = _c[1];
|
|
32
|
+
var getResponsiveYoutubeSize = (0, react_1.useCallback)(function () {
|
|
33
|
+
var backgroundWrapper = backgroundRef.current;
|
|
34
|
+
if (!backgroundWrapper)
|
|
35
|
+
return { width: 0, height: 0 };
|
|
36
|
+
var backgroundSize = {
|
|
37
|
+
width: backgroundWrapper.getBoundingClientRect().width,
|
|
38
|
+
height: backgroundWrapper.getBoundingClientRect().height
|
|
39
|
+
};
|
|
40
|
+
var isHorizontal = backgroundSize.width / backgroundSize.height > 1;
|
|
41
|
+
var isOverRatio = backgroundSize.width / backgroundSize.height > 16 / 9;
|
|
42
|
+
var youtubeSize = isHorizontal && isOverRatio
|
|
43
|
+
? { width: backgroundSize.width, height: backgroundSize.width * (9 / 16) }
|
|
44
|
+
: { width: backgroundSize.height * (16 / 9), height: backgroundSize.height };
|
|
45
|
+
return youtubeSize;
|
|
46
|
+
}, [backgroundRef.current]);
|
|
47
|
+
var scaleType = getScaleType(String(CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT));
|
|
48
|
+
(0, react_1.useEffect)(function () {
|
|
49
|
+
if (mediaType !== 'YOUTUBE')
|
|
50
|
+
return;
|
|
51
|
+
setYoutubeSize(getResponsiveYoutubeSize());
|
|
52
|
+
}, [getResponsiveYoutubeSize, CB_STYLE_PROP_BGMEDIA_SPEC_YSRC]);
|
|
53
|
+
(0, react_1.useEffect)(function () {
|
|
54
|
+
if (mediaType !== 'YOUTUBE')
|
|
55
|
+
return;
|
|
56
|
+
function onResize() {
|
|
57
|
+
setYoutubeSize(getResponsiveYoutubeSize());
|
|
58
|
+
}
|
|
59
|
+
var element = backgroundRef.current;
|
|
60
|
+
if (!element)
|
|
61
|
+
return;
|
|
62
|
+
var observer = new ResizeObserver(function (entries) {
|
|
63
|
+
entries.forEach(function () {
|
|
64
|
+
onResize();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
observer.observe(element);
|
|
68
|
+
return function () {
|
|
69
|
+
observer.disconnect();
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
35
72
|
switch (mediaType) {
|
|
36
73
|
case 'IMAGE':
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(S_ImageWrapper, __assign({ isOverflowScroll:
|
|
38
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL
|
|
39
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, scaleType: isHover
|
|
40
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT
|
|
41
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT }, { children: (0, jsx_runtime_1.jsx)(pdsOriginal_1.ImageView, { src: isHover
|
|
42
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR
|
|
43
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR, width: "responsive", height: "responsive", scaleType: scaleType, shapeType: "rectangle" }, void 0) }), void 0));
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(S_ImageWrapper, __assign({ isOverflowScroll: !!CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, scaleType: getScaleType(String(CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT)), style: __assign({}, componentStyle) }, { children: (0, jsx_runtime_1.jsx)(pdsOriginal_1.ImageView, { src: String(CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR), width: "responsive", height: "responsive", scaleType: scaleType, shapeType: "rectangle" }, void 0) }), void 0));
|
|
44
75
|
case 'YOUTUBE':
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(S_YoutubeContainer, { children: (0, jsx_runtime_1.jsx)(YouTubeIframe_1.YouTubeIframe, { id: playerId, src:
|
|
46
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC
|
|
47
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC, loopMode: isHover
|
|
48
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY
|
|
49
|
-
? 'use'
|
|
50
|
-
: 'none'
|
|
51
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY
|
|
52
|
-
? 'use'
|
|
53
|
-
: 'none', startSeconds: isHover
|
|
54
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME
|
|
55
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, endSeconds: isHover
|
|
56
|
-
? hover.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME
|
|
57
|
-
: normal.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME }, void 0) }, void 0));
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(S_YoutubeContainer, __assign({}, youtubeSize, { children: (0, jsx_runtime_1.jsx)(YouTubeIframe_1.YouTubeIframe, { id: playerId, src: String(CB_STYLE_PROP_BGMEDIA_SPEC_YSRC), loopMode: CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY ? 'use' : 'none', startSeconds: Number(CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME), endSeconds: Number(CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME) }, void 0) }), void 0));
|
|
58
77
|
case 'NONE':
|
|
59
78
|
default:
|
|
60
79
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
|
|
@@ -87,5 +106,11 @@ var S_ImageWrapper = styled_components_1.default.div(templateObject_1 || (templa
|
|
|
87
106
|
return "height: auto;\n width: auto";
|
|
88
107
|
}
|
|
89
108
|
});
|
|
90
|
-
var S_YoutubeContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height:
|
|
109
|
+
var S_YoutubeContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: ", ";\n width: ", ";\n"], ["\n height: ", ";\n width: ", ";\n"])), function (_a) {
|
|
110
|
+
var height = _a.height;
|
|
111
|
+
return height + "px";
|
|
112
|
+
}, function (_a) {
|
|
113
|
+
var width = _a.width;
|
|
114
|
+
return width + "px";
|
|
115
|
+
});
|
|
91
116
|
var templateObject_1, templateObject_2;
|
package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.d.ts
CHANGED
|
@@ -2,8 +2,5 @@ import type { Device } from '../../../../DynamicLayout/sections/CustomSection/ut
|
|
|
2
2
|
import type { CB_STYLE_PROP_BGMEDIA_SPECS } from '../../../../DynamicLayout/types';
|
|
3
3
|
declare type SpecKeys = keyof Omit<CB_STYLE_PROP_BGMEDIA_SPECS, 'CB_STYLE_PROP_BGMEDIA_SPEC_MPLAY'>;
|
|
4
4
|
declare type ValueSetType = Partial<Record<SpecKeys, string | number | boolean | undefined>>;
|
|
5
|
-
export default function UseCustomSectionBackgroundMediaData(specs: CB_STYLE_PROP_BGMEDIA_SPECS, device: Device):
|
|
6
|
-
normal: ValueSetType;
|
|
7
|
-
hover: ValueSetType;
|
|
8
|
-
};
|
|
5
|
+
export default function UseCustomSectionBackgroundMediaData(specs: CB_STYLE_PROP_BGMEDIA_SPECS, device: Device): ValueSetType;
|
|
9
6
|
export {};
|
package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.js
CHANGED
|
@@ -29,19 +29,10 @@ var AVAILABLE_SPECS = [
|
|
|
29
29
|
];
|
|
30
30
|
function UseCustomSectionBackgroundMediaData(specs, device) {
|
|
31
31
|
return AVAILABLE_SPECS.reduce(function (acc, cur) {
|
|
32
|
-
var _a
|
|
32
|
+
var _a;
|
|
33
33
|
var baseKey = device === 'DESKTOP' ? cur : cur + ":MOBILE";
|
|
34
34
|
var value = (0, isNullOrUndefined_1.default)(specs[baseKey]) ? specs[cur] : specs[baseKey];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
: specs[baseKey + ":HOVER"];
|
|
38
|
-
return {
|
|
39
|
-
normal: __assign(__assign({}, acc.normal), (_a = {}, _a[cur] = value, _a)),
|
|
40
|
-
hover: __assign(__assign({}, acc.hover), (_b = {}, _b[cur] = hoverValue, _b))
|
|
41
|
-
};
|
|
42
|
-
}, {
|
|
43
|
-
normal: {},
|
|
44
|
-
hover: {}
|
|
45
|
-
});
|
|
35
|
+
return __assign(__assign({}, acc), (_a = {}, _a[cur] = value, _a));
|
|
36
|
+
}, {});
|
|
46
37
|
}
|
|
47
38
|
exports.default = UseCustomSectionBackgroundMediaData;
|
|
@@ -273,7 +273,15 @@ exports.customSectionMock1 = {
|
|
|
273
273
|
CB_STYLE_PROP_TEXT_SPEC_COLOR: '#fffc00eb',
|
|
274
274
|
'CB_STYLE_PROP_TEXT_SPEC_COLOR:HOVER': '#ff2727',
|
|
275
275
|
'CB_STYLE_PROP_TEXT_SPEC_COLOR:MOBILE': undefined,
|
|
276
|
-
'CB_STYLE_PROP_TEXT_SPEC_COLOR:MOBILE:HOVER': undefined
|
|
276
|
+
'CB_STYLE_PROP_TEXT_SPEC_COLOR:MOBILE:HOVER': undefined,
|
|
277
|
+
CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL: 'LEFT',
|
|
278
|
+
'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL:HOVER': 'CENTER',
|
|
279
|
+
'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL:MOBILE': undefined,
|
|
280
|
+
'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL:MOBILE:HOVER': undefined,
|
|
281
|
+
CB_STYLE_PROP_TEXT_SPEC_VERTICAL: 'TOP',
|
|
282
|
+
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:HOVER': 'CENTER',
|
|
283
|
+
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:MOBILE': undefined,
|
|
284
|
+
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:MOBILE:HOVER': undefined
|
|
277
285
|
},
|
|
278
286
|
CB_STYLE_PROP_OPACITY: {
|
|
279
287
|
CB_STYLE_PROP_OPACITY_SPEC_OPACITY: 1,
|