pb-sxp-ui 1.19.17 → 1.19.18
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 +59 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -11
- package/dist/index.js +59 -134
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +5 -5
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +5 -5
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +59 -134
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +5 -5
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.js +7 -31
- package/es/core/hooks/useVisibleHeight.js +26 -99
- package/lib/core/components/SxpPageRender/index.js +7 -31
- package/lib/core/hooks/useVisibleHeight.js +26 -99
- package/package.json +1 -2
package/dist/pb-ui.js
CHANGED
|
@@ -18994,111 +18994,64 @@ Made in Italy` })));
|
|
|
18994
18994
|
var NavBack$1 = React.memo(NavBack);
|
|
18995
18995
|
|
|
18996
18996
|
const useVisibleHeight = () => {
|
|
18997
|
-
var _a, _b;
|
|
18998
18997
|
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
18999
|
-
const
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
document.body.appendChild(detector);
|
|
19021
|
-
const dvhInPx = detector.clientHeight;
|
|
19022
|
-
document.body.removeChild(detector);
|
|
19023
|
-
return dvhInPx;
|
|
19024
|
-
};
|
|
19025
|
-
const getFillAvailableInPx = () => {
|
|
19026
|
-
const detector = document.createElement('div');
|
|
19027
|
-
detector.style.position = 'fixed';
|
|
19028
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19029
|
-
detector.style.left = '0';
|
|
19030
|
-
detector.style.height = '-webkit-fill-available';
|
|
19031
|
-
detector.style.visibility = 'hidden';
|
|
19032
|
-
detector.style.zIndex = '-1';
|
|
19033
|
-
document.body.appendChild(detector);
|
|
19034
|
-
const dvhInPx = detector.clientHeight;
|
|
19035
|
-
document.body.removeChild(detector);
|
|
19036
|
-
return dvhInPx;
|
|
19037
|
-
};
|
|
19038
|
-
const getHeightWithSafeArea = () => {
|
|
19039
|
-
const root = document.documentElement;
|
|
19040
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19041
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19042
|
-
const numericValue = parseInt(value) || 0;
|
|
19043
|
-
return numericValue;
|
|
19044
|
-
};
|
|
19045
|
-
const dvhToPx = (dvh) => {
|
|
19046
|
-
return Math.round((dvh / 100) * document.documentElement.clientHeight);
|
|
19047
|
-
};
|
|
19048
|
-
// 检测是否启用了系统字体缩放
|
|
19049
|
-
const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
19050
|
-
const isScaled = fontSize !== 52; // 默认 1rem = 16px
|
|
19051
|
-
// 检测是否处于 Display Zoom 模式(通过屏幕宽高比间接判断)
|
|
19052
|
-
const isZoomed = screen.width <= 375 && screen.height <= 667 && window.devicePixelRatio < 3;
|
|
19053
|
-
const systemInfo = {
|
|
19054
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19055
|
-
innerHeight: window.innerHeight,
|
|
19056
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19057
|
-
screenHeight: window.screen.height,
|
|
19058
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19059
|
-
agent: navigator.userAgent,
|
|
19060
|
-
version: '1.19.17',
|
|
19061
|
-
safeArea: getHeightWithSafeArea(),
|
|
19062
|
-
dvh: dvhToPx(100),
|
|
19063
|
-
dvhInPx: getDvhInPx(),
|
|
19064
|
-
vhInPx: getVhInPx(),
|
|
19065
|
-
fillAvailableInPx: getFillAvailableInPx(),
|
|
19066
|
-
isScaled,
|
|
19067
|
-
isZoomed,
|
|
19068
|
-
meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
|
|
18998
|
+
const getVisibleContentHeight = () => {
|
|
18999
|
+
// 方法优先级:
|
|
19000
|
+
// 1. visualViewport.height (最准确)
|
|
19001
|
+
// 2. window.innerHeight (次之)
|
|
19002
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
19003
|
+
if (typeof window === 'undefined')
|
|
19004
|
+
return 0;
|
|
19005
|
+
let height = window.innerHeight;
|
|
19006
|
+
// 优先使用 visualViewport
|
|
19007
|
+
if (window.visualViewport) {
|
|
19008
|
+
height = window.visualViewport.height;
|
|
19009
|
+
}
|
|
19010
|
+
// 验证高度合理性
|
|
19011
|
+
if (height <= 0 || height > window.screen.height) {
|
|
19012
|
+
height = window.innerHeight;
|
|
19013
|
+
}
|
|
19014
|
+
// 最终 fallback
|
|
19015
|
+
if (height <= 0) {
|
|
19016
|
+
height = document.documentElement.clientHeight;
|
|
19017
|
+
}
|
|
19018
|
+
return height;
|
|
19069
19019
|
};
|
|
19070
|
-
console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
|
|
19071
|
-
if ('fundebug' in window) {
|
|
19072
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
|
|
19073
|
-
}
|
|
19074
19020
|
const updateHeight = React.useCallback(() => {
|
|
19075
|
-
var _a
|
|
19076
|
-
const
|
|
19077
|
-
const
|
|
19078
|
-
const
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
};
|
|
19095
|
-
console.log(systemInfo, 'fundebug-resize--------------------->systemInfo');
|
|
19021
|
+
var _a;
|
|
19022
|
+
const visibleHeight = getVisibleContentHeight();
|
|
19023
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
19024
|
+
const ua = navigator.userAgent;
|
|
19025
|
+
// Instagram 检测
|
|
19026
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
19027
|
+
// Facebook 检测
|
|
19028
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
19029
|
+
// 安全检查
|
|
19030
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
19031
|
+
setVisibleHeight(visibleHeight);
|
|
19032
|
+
return;
|
|
19033
|
+
}
|
|
19034
|
+
const ratio = visibleHeight / screenHeight;
|
|
19035
|
+
const threshold = 0.9;
|
|
19036
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
19037
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
19038
|
+
// 否则使用实际内容高度
|
|
19039
|
+
const finalHeight = Math.round(ratio >= threshold ? h : visibleHeight);
|
|
19096
19040
|
if ('fundebug' in window) {
|
|
19041
|
+
const systemInfo = {
|
|
19042
|
+
ratio,
|
|
19043
|
+
h,
|
|
19044
|
+
finalHeight,
|
|
19045
|
+
visibleHeight,
|
|
19046
|
+
screenHeight,
|
|
19047
|
+
isInstagram,
|
|
19048
|
+
isFacebook,
|
|
19049
|
+
ua
|
|
19050
|
+
};
|
|
19097
19051
|
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19098
19052
|
}
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
}, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
|
|
19053
|
+
setVisibleHeight(finalHeight);
|
|
19054
|
+
}, [getVisibleContentHeight]);
|
|
19102
19055
|
React.useEffect(() => {
|
|
19103
19056
|
// 初始计算
|
|
19104
19057
|
updateHeight();
|
|
@@ -19116,8 +19069,6 @@ Made in Italy` })));
|
|
|
19116
19069
|
if ('virtualKeyboard' in navigator) {
|
|
19117
19070
|
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19118
19071
|
}
|
|
19119
|
-
// 定期检查(应对某些特殊情况)
|
|
19120
|
-
const interval = setInterval(updateHeight, 1000);
|
|
19121
19072
|
return () => {
|
|
19122
19073
|
events.forEach((event) => {
|
|
19123
19074
|
window.removeEventListener(event, updateHeight);
|
|
@@ -19129,7 +19080,6 @@ Made in Italy` })));
|
|
|
19129
19080
|
if ('virtualKeyboard' in navigator) {
|
|
19130
19081
|
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19131
19082
|
}
|
|
19132
|
-
clearInterval(interval);
|
|
19133
19083
|
};
|
|
19134
19084
|
}, [updateHeight]);
|
|
19135
19085
|
return visibleHeight;
|
|
@@ -19143,7 +19093,7 @@ Made in Italy` })));
|
|
|
19143
19093
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
|
19144
19094
|
*
|
|
19145
19095
|
*/
|
|
19146
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight
|
|
19096
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
|
19147
19097
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
19148
19098
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
|
19149
19099
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
|
@@ -19332,29 +19282,10 @@ Made in Italy` })));
|
|
|
19332
19282
|
}
|
|
19333
19283
|
return minusHeight;
|
|
19334
19284
|
}, [globalConfig]);
|
|
19335
|
-
const getHeightWithSafeArea = () => {
|
|
19336
|
-
const root = document.documentElement;
|
|
19337
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19338
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19339
|
-
const numericValue = parseInt(value) || 0;
|
|
19340
|
-
return numericValue;
|
|
19341
|
-
};
|
|
19342
|
-
const getDvhInPx = () => {
|
|
19343
|
-
const detector = document.createElement('div');
|
|
19344
|
-
detector.style.position = 'fixed';
|
|
19345
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19346
|
-
detector.style.left = '0';
|
|
19347
|
-
detector.style.height = '100dvh';
|
|
19348
|
-
detector.style.visibility = 'hidden';
|
|
19349
|
-
detector.style.zIndex = '-1';
|
|
19350
|
-
document.body.appendChild(detector);
|
|
19351
|
-
const dvhInPx = detector.clientHeight;
|
|
19352
|
-
document.body.removeChild(detector);
|
|
19353
|
-
return dvhInPx;
|
|
19354
|
-
};
|
|
19355
19285
|
const height = React.useMemo(() => {
|
|
19356
|
-
|
|
19357
|
-
|
|
19286
|
+
const h = containerHeight || visibleHeight;
|
|
19287
|
+
return h - minusHeight - tagHeight;
|
|
19288
|
+
}, [containerHeight, visibleHeight, minusHeight, tagHeight]);
|
|
19358
19289
|
const visList = React.useMemo(() => {
|
|
19359
19290
|
var _a;
|
|
19360
19291
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -19495,9 +19426,6 @@ Made in Italy` })));
|
|
|
19495
19426
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19496
19427
|
top += minusHeight;
|
|
19497
19428
|
}
|
|
19498
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19499
|
-
top += getHeightWithSafeArea();
|
|
19500
|
-
}
|
|
19501
19429
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19502
19430
|
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: {
|
|
19503
19431
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19732,9 +19660,6 @@ Made in Italy` })));
|
|
|
19732
19660
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19733
19661
|
top += minusHeight;
|
|
19734
19662
|
}
|
|
19735
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19736
|
-
top += getHeightWithSafeArea();
|
|
19737
|
-
}
|
|
19738
19663
|
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: {
|
|
19739
19664
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19740
19665
|
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',
|
|
@@ -19775,7 +19700,7 @@ Made in Italy` })));
|
|
|
19775
19700
|
isReload,
|
|
19776
19701
|
renderToggleButton
|
|
19777
19702
|
]);
|
|
19778
|
-
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
|
19703
|
+
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
|
|
19779
19704
|
(data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
19780
19705
|
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
|
|
19781
19706
|
waterFallData && (React.createElement(Navbar$1, { icon: img, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
|
@@ -19837,10 +19762,10 @@ Made in Italy` })));
|
|
|
19837
19762
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19838
19763
|
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)),
|
|
19839
19764
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19840
|
-
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
|
|
19765
|
+
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 } }))))),
|
|
19841
19766
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19842
19767
|
position: 'fixed',
|
|
19843
|
-
bottom:
|
|
19768
|
+
bottom: 0,
|
|
19844
19769
|
left: 0,
|
|
19845
19770
|
right: 0,
|
|
19846
19771
|
width: '100%',
|