pds-dev-kit-web-test 2.4.20 → 2.4.21
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/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +3 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ScrollAnimation.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ScrollAnimation.js +9 -5
- package/package.json +1 -1
@@ -73,7 +73,7 @@ function TextPropToAnim(props) {
|
|
73
73
|
var json = JSON.parse(props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT);
|
74
74
|
var hasAllProp = validateAnimationProps(json);
|
75
75
|
if (!hasAllProp) {
|
76
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "MUST HAVE ALL PROPS: scrollId, totalImages, baseURL, type, startShowingImages, endShowingImages," }));
|
76
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "MUST HAVE ALL PROPS: scrollId, totalImages, baseURL, type, startShowingImages, endShowingImages, bodySelector" }));
|
77
77
|
}
|
78
78
|
return (0, jsx_runtime_1.jsx)(ScrollAnimation_1.default, __assign({}, json));
|
79
79
|
}
|
@@ -84,7 +84,8 @@ var validateAnimationProps = function (json) {
|
|
84
84
|
'baseURL',
|
85
85
|
'type',
|
86
86
|
'startShowingImages',
|
87
|
-
'endShowingImages'
|
87
|
+
'endShowingImages',
|
88
|
+
'bodySelector'
|
88
89
|
];
|
89
90
|
return requiredProps.every(function (prop) { return prop in json; });
|
90
91
|
};
|
@@ -1,3 +1,3 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
declare const AirpodsAnimation: ({ scrollId, totalImages, baseURL, type, startShowingImages, endShowingImages }: any) => JSX.Element;
|
2
|
+
declare const AirpodsAnimation: ({ bodySelector, scrollId, totalImages, baseURL, type, startShowingImages, endShowingImages }: any) => JSX.Element;
|
3
3
|
export default AirpodsAnimation;
|
@@ -52,15 +52,19 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
52
|
/* eslint-disable no-plusplus */
|
53
53
|
var react_1 = require("react");
|
54
54
|
var AirpodsAnimation = function (_a) {
|
55
|
-
var scrollId = _a.scrollId, totalImages = _a.totalImages, baseURL = _a.baseURL, type = _a.type, startShowingImages = _a.startShowingImages, endShowingImages = _a.endShowingImages;
|
55
|
+
var bodySelector = _a.bodySelector, scrollId = _a.scrollId, totalImages = _a.totalImages, baseURL = _a.baseURL, type = _a.type, startShowingImages = _a.startShowingImages, endShowingImages = _a.endShowingImages;
|
56
56
|
var canvasRef = (0, react_1.useRef)(null);
|
57
57
|
var _b = (0, react_1.useState)([]), images = _b[0], setImages = _b[1];
|
58
58
|
var _c = (0, react_1.useState)(0), loadedImages = _c[0], setLoadedImages = _c[1];
|
59
59
|
var _d = (0, react_1.useState)(0), currentFrameIndex = _d[0], setCurrentFrameIndex = _d[1];
|
60
|
-
var
|
61
|
-
var box = document.querySelector(
|
60
|
+
var _e = (0, react_1.useState)(function () {
|
61
|
+
var box = document.querySelector(bodySelector);
|
62
62
|
return box;
|
63
|
-
})[0];
|
63
|
+
}), mainBody = _e[0], setMainBody = _e[1];
|
64
|
+
(0, react_1.useEffect)(function () {
|
65
|
+
var box = document.querySelector(bodySelector);
|
66
|
+
setMainBody(box);
|
67
|
+
}, [bodySelector]);
|
64
68
|
(0, react_1.useEffect)(function () {
|
65
69
|
var loadImage = function (i) {
|
66
70
|
return new Promise(function (resolve) {
|
@@ -127,7 +131,7 @@ var AirpodsAnimation = function (_a) {
|
|
127
131
|
return function () {
|
128
132
|
mainBody.removeEventListener('scroll', handleScroll);
|
129
133
|
};
|
130
|
-
}, [totalImages, images, startShowingImages, endShowingImages]);
|
134
|
+
}, [totalImages, images, startShowingImages, endShowingImages, mainBody]);
|
131
135
|
(0, react_1.useEffect)(function () {
|
132
136
|
if (images.length === totalImages) {
|
133
137
|
render();
|