pb-sxp-ui 1.19.8 → 1.19.10
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/index.cjs +90 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -2
- package/dist/index.js +90 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +90 -4
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.js +25 -4
- package/es/core/hooks/useVisibleHeight.d.ts +1 -0
- package/es/core/hooks/useVisibleHeight.js +52 -0
- package/lib/core/components/SxpPageRender/index.js +25 -4
- package/lib/core/hooks/useVisibleHeight.d.ts +1 -0
- package/lib/core/hooks/useVisibleHeight.js +56 -0
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1068,7 +1068,10 @@ a:active {
|
|
|
1068
1068
|
flex: 1;
|
|
1069
1069
|
height: 100vh;
|
|
1070
1070
|
overflow-y: auto;
|
|
1071
|
-
padding: 18px;
|
|
1071
|
+
padding-top: 18px;
|
|
1072
|
+
padding-left: 18px;
|
|
1073
|
+
padding-right: 18px;
|
|
1074
|
+
padding-bottom: calc(18px + env(safe-area-inset-bottom));
|
|
1072
1075
|
}
|
|
1073
1076
|
.waterfallFlow__title {
|
|
1074
1077
|
text-align: center;
|
|
@@ -1547,6 +1550,7 @@ a:active {
|
|
|
1547
1550
|
top: 0;
|
|
1548
1551
|
left: 0;
|
|
1549
1552
|
right: 0;
|
|
1553
|
+
bottom: env(safe-area-inset-bottom);
|
|
1550
1554
|
width: 100%;
|
|
1551
1555
|
-webkit-box-sizing: border-box;
|
|
1552
1556
|
box-sizing: border-box;
|
|
@@ -2458,7 +2462,7 @@ button.swiper-pagination-bullet {
|
|
|
2458
2462
|
left: 0;
|
|
2459
2463
|
top: 0;
|
|
2460
2464
|
right: 0;
|
|
2461
|
-
bottom:
|
|
2465
|
+
bottom: env(safe-area-inset-bottom);
|
|
2462
2466
|
z-index: 100;
|
|
2463
2467
|
-webkit-box-orient: vertical;
|
|
2464
2468
|
-webkit-box-direction: normal;
|
package/dist/index.js
CHANGED
|
@@ -18978,6 +18978,70 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
18978
18978
|
};
|
|
18979
18979
|
var NavBack$1 = memo(NavBack);
|
|
18980
18980
|
|
|
18981
|
+
const useVisibleHeight = () => {
|
|
18982
|
+
const [visibleHeight, setVisibleHeight] = useState(0);
|
|
18983
|
+
const getVisibleContentHeight = () => {
|
|
18984
|
+
// 方法优先级:
|
|
18985
|
+
// 1. visualViewport.height (最准确)
|
|
18986
|
+
// 2. window.innerHeight (次之)
|
|
18987
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
18988
|
+
if (typeof window === 'undefined')
|
|
18989
|
+
return 0;
|
|
18990
|
+
let height = window.innerHeight;
|
|
18991
|
+
// 优先使用 visualViewport
|
|
18992
|
+
if (window.visualViewport) {
|
|
18993
|
+
height = window.visualViewport.height;
|
|
18994
|
+
}
|
|
18995
|
+
// 验证高度合理性
|
|
18996
|
+
if (height <= 0 || height > window.screen.height) {
|
|
18997
|
+
height = window.innerHeight;
|
|
18998
|
+
}
|
|
18999
|
+
// 最终 fallback
|
|
19000
|
+
if (height <= 0) {
|
|
19001
|
+
height = document.documentElement.clientHeight;
|
|
19002
|
+
}
|
|
19003
|
+
return height;
|
|
19004
|
+
};
|
|
19005
|
+
const updateHeight = useCallback(() => {
|
|
19006
|
+
const height = getVisibleContentHeight();
|
|
19007
|
+
setVisibleHeight(height);
|
|
19008
|
+
}, []);
|
|
19009
|
+
useEffect(() => {
|
|
19010
|
+
// 初始计算
|
|
19011
|
+
updateHeight();
|
|
19012
|
+
// 事件监听
|
|
19013
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19014
|
+
events.forEach((event) => {
|
|
19015
|
+
window.addEventListener(event, updateHeight);
|
|
19016
|
+
});
|
|
19017
|
+
// visualViewport 监听(最重要)
|
|
19018
|
+
if (window.visualViewport) {
|
|
19019
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19020
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19021
|
+
}
|
|
19022
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
19023
|
+
if ('virtualKeyboard' in navigator) {
|
|
19024
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19025
|
+
}
|
|
19026
|
+
// 定期检查(应对某些特殊情况)
|
|
19027
|
+
const interval = setInterval(updateHeight, 1000);
|
|
19028
|
+
return () => {
|
|
19029
|
+
events.forEach((event) => {
|
|
19030
|
+
window.removeEventListener(event, updateHeight);
|
|
19031
|
+
});
|
|
19032
|
+
if (window.visualViewport) {
|
|
19033
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19034
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19035
|
+
}
|
|
19036
|
+
if ('virtualKeyboard' in navigator) {
|
|
19037
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19038
|
+
}
|
|
19039
|
+
clearInterval(interval);
|
|
19040
|
+
};
|
|
19041
|
+
}, [updateHeight]);
|
|
19042
|
+
return visibleHeight;
|
|
19043
|
+
};
|
|
19044
|
+
|
|
18981
19045
|
/*
|
|
18982
19046
|
* @Author: binruan@chatlabs.com
|
|
18983
19047
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19006,6 +19070,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19006
19070
|
const fbcRef = useRef('');
|
|
19007
19071
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5, pixelPvStatusRef } = useSxpDataSource();
|
|
19008
19072
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19073
|
+
const visibleHeight = useVisibleHeight();
|
|
19009
19074
|
const isShowFingerTip = useMemo(() => {
|
|
19010
19075
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19011
19076
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19174,9 +19239,24 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19174
19239
|
}
|
|
19175
19240
|
return minusHeight;
|
|
19176
19241
|
}, [globalConfig]);
|
|
19242
|
+
const getHeightWithSafeArea = () => {
|
|
19243
|
+
// 获取窗口高度
|
|
19244
|
+
// 动态检测安全区域
|
|
19245
|
+
const detector = document.createElement('div');
|
|
19246
|
+
detector.style.position = 'fixed';
|
|
19247
|
+
detector.style.bottom = '0';
|
|
19248
|
+
detector.style.left = '0';
|
|
19249
|
+
detector.style.paddingBottom = 'env(safe-area-inset-bottom)';
|
|
19250
|
+
detector.style.visibility = 'hidden';
|
|
19251
|
+
document.body.appendChild(detector);
|
|
19252
|
+
const computedStyle = window.getComputedStyle(detector);
|
|
19253
|
+
const safeAreaBottom = parseFloat(computedStyle.paddingBottom) || 0;
|
|
19254
|
+
document.body.removeChild(detector);
|
|
19255
|
+
return safeAreaBottom;
|
|
19256
|
+
};
|
|
19177
19257
|
const height = useMemo(() => {
|
|
19178
|
-
return
|
|
19179
|
-
}, [minusHeight,
|
|
19258
|
+
return visibleHeight - minusHeight - tagHeight;
|
|
19259
|
+
}, [minusHeight, visibleHeight, tagHeight]);
|
|
19180
19260
|
const visList = useMemo(() => {
|
|
19181
19261
|
var _a;
|
|
19182
19262
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -19317,6 +19397,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19317
19397
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19318
19398
|
top += minusHeight;
|
|
19319
19399
|
}
|
|
19400
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19401
|
+
top += getHeightWithSafeArea();
|
|
19402
|
+
}
|
|
19320
19403
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19321
19404
|
return (React.createElement(LikeButton$1, { key: rec.position, activeIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon, unActicveIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
|
|
19322
19405
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19551,6 +19634,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19551
19634
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19552
19635
|
top += minusHeight;
|
|
19553
19636
|
}
|
|
19637
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19638
|
+
top += getHeightWithSafeArea();
|
|
19639
|
+
}
|
|
19554
19640
|
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton$1, { style: {
|
|
19555
19641
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19556
19642
|
visibility: ((_c = (_b = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
|
@@ -19653,10 +19739,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19653
19739
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19654
19740
|
React.createElement(WaterFall$1, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
|
19655
19741
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19656
|
-
openMultiPosts && (React.createElement(MultiPosts$2, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } }))))),
|
|
19742
|
+
openMultiPosts && (React.createElement(MultiPosts$2, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0, bottom: 'env(safe-area-inset-bottom)' } }))))),
|
|
19657
19743
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19658
19744
|
position: 'fixed',
|
|
19659
|
-
bottom:
|
|
19745
|
+
bottom: 'env(safe-area-inset-bottom)',
|
|
19660
19746
|
left: 0,
|
|
19661
19747
|
right: 0,
|
|
19662
19748
|
width: '100%',
|