Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
155c0f71
U
uni-app
项目概览
genary
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
155c0f71
编写于
5月 21, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: build
上级
98622ff5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
243 addition
and
57 deletion
+243
-57
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+243
-57
未找到文件。
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
155c0f71
...
...
@@ -300,27 +300,27 @@ function initLongPress() {
window.addEventListener("touchend", clearLongPressTimer, passiveOptions$2);
window.addEventListener("touchcancel", clearLongPressTimer, passiveOptions$2);
}
var attrs = ["top", "left", "right", "bottom"];
var inited$
1
;
var elementComputedStyle = {};
var support;
function getSupport() {
var attrs
$1
= ["top", "left", "right", "bottom"];
var inited$
2
;
var elementComputedStyle
$1
= {};
var support
$1
;
function getSupport
$1
() {
if (!("CSS" in window) || typeof CSS.supports != "function") {
support = "";
support
$1
= "";
} else if (CSS.supports("top: env(safe-area-inset-top)")) {
support = "env";
support
$1
= "env";
} else if (CSS.supports("top: constant(safe-area-inset-top)")) {
support = "constant";
support
$1
= "constant";
} else {
support = "";
support
$1
= "";
}
return support;
return support
$1
;
}
function init() {
support
= typeof support === "string" ? support : getSupport
();
if (!support) {
attrs.forEach(function(attr2) {
elementComputedStyle[attr2] = 0;
function init
$1
() {
support
$1 = typeof support$1 === "string" ? support$1 : getSupport$1
();
if (!support
$1
) {
attrs
$1
.forEach(function(attr2) {
elementComputedStyle
$1
[attr2] = 0;
});
return;
}
...
...
@@ -364,7 +364,7 @@ function init() {
height: "200px",
boxSizing: "border-box",
overflow: "hidden",
paddingBottom: support + "(safe-area-inset-" + attr2 + ")"
paddingBottom: support
$1
+ "(safe-area-inset-" + attr2 + ")"
};
setStyle(a1, aStyle);
setStyle(a2, aStyle);
...
...
@@ -395,13 +395,13 @@ function init() {
a1.scrollTop = a2.scrollTop = MAX;
a1LastScrollTop = a1.scrollTop;
a2LastScrollTop = a2.scrollTop;
attrChange(attr2);
attrChange
$1
(attr2);
}
a1.addEventListener("scroll", onScroll, passiveEvents);
a2.addEventListener("scroll", onScroll, passiveEvents);
});
var computedStyle = getComputedStyle(a1);
Object.defineProperty(elementComputedStyle, attr2, {
Object.defineProperty(elementComputedStyle
$1
, attr2, {
configurable: true,
get: function() {
return parseFloat(computedStyle.paddingBottom);
...
...
@@ -419,73 +419,73 @@ function init() {
overflow: "hidden",
visibility: "hidden"
});
attrs.forEach(function(key) {
attrs
$1
.forEach(function(key) {
addChild(parentDiv, key);
});
document.body.appendChild(parentDiv);
parentReady();
inited$
1
= true;
inited$
2
= true;
}
function getAttr(attr2) {
if (!inited$
1
) {
init();
function getAttr
$1
(attr2) {
if (!inited$
2
) {
init
$1
();
}
return elementComputedStyle[attr2];
return elementComputedStyle
$1
[attr2];
}
var changeAttrs = [];
function attrChange(attr2) {
if (!changeAttrs.length) {
var changeAttrs
$1
= [];
function attrChange
$1
(attr2) {
if (!changeAttrs
$1
.length) {
setTimeout(function() {
var style = {};
changeAttrs.forEach(function(attr3) {
style[attr3] = elementComputedStyle[attr3];
changeAttrs
$1
.forEach(function(attr3) {
style[attr3] = elementComputedStyle
$1
[attr3];
});
changeAttrs.length = 0;
callbacks$
3
.forEach(function(callback) {
changeAttrs
$1
.length = 0;
callbacks$
4
.forEach(function(callback) {
callback(style);
});
}, 0);
}
changeAttrs.push(attr2);
changeAttrs
$1
.push(attr2);
}
var callbacks$
3
= [];
function onChange(callback) {
if (!getSupport()) {
var callbacks$
4
= [];
function onChange
$1
(callback) {
if (!getSupport
$1
()) {
return;
}
if (!inited$
1
) {
init();
if (!inited$
2
) {
init
$1
();
}
if (typeof callback === "function") {
callbacks$
3
.push(callback);
callbacks$
4
.push(callback);
}
}
function offChange(callback) {
var index2 = callbacks$
3
.indexOf(callback);
function offChange
$1
(callback) {
var index2 = callbacks$
4
.indexOf(callback);
if (index2 >= 0) {
callbacks$
3
.splice(index2, 1);
callbacks$
4
.splice(index2, 1);
}
}
var safeAreaInsets = {
var safeAreaInsets
$1
= {
get support() {
return (typeof support
=== "string" ? support : getSupport
()).length != 0;
return (typeof support
$1 === "string" ? support$1 : getSupport$1
()).length != 0;
},
get top() {
return getAttr("top");
return getAttr
$1
("top");
},
get left() {
return getAttr("left");
return getAttr
$1
("left");
},
get right() {
return getAttr("right");
return getAttr
$1
("right");
},
get bottom() {
return getAttr("bottom");
return getAttr
$1
("bottom");
},
onChange,
offChange
onChange
: onChange$1
,
offChange
: offChange$1
};
var out
= safeAreaInsets
;
var out
$1 = safeAreaInsets$1
;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
...
...
@@ -497,10 +497,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
top: top ? top + out
$1
.top : 0,
bottom: bottom ? bottom + out
$1
.bottom : 0,
left: left ? left + out
$1
.left : 0,
right: right ? right + out
$1
.right : 0
};
}
function updateCssVar(cssVars) {
...
...
@@ -679,15 +679,15 @@ function getRealRoute(fromRoute, toRoute) {
fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
return "/" + fromRouteArray.concat(toRouteArray).join("/");
}
const callbacks$
2
= {};
const callbacks$
3
= {};
function createCallbacks(namespace) {
let scopedCallbacks = callbacks$
2
[namespace];
let scopedCallbacks = callbacks$
3
[namespace];
if (!scopedCallbacks) {
scopedCallbacks = {
id: 1,
callbacks: Object.create(null)
};
callbacks$
2
[namespace] = scopedCallbacks;
callbacks$
3
[namespace] = scopedCallbacks;
}
return {
get(id2) {
...
...
@@ -1131,6 +1131,192 @@ function initApp$1(app) {
globalProperties.$applyOptions = applyOptions;
}
}
var attrs = ["top", "left", "right", "bottom"];
var inited$1;
var elementComputedStyle = {};
var support;
function getSupport() {
if (!("CSS" in window) || typeof CSS.supports != "function") {
support = "";
} else if (CSS.supports("top: env(safe-area-inset-top)")) {
support = "env";
} else if (CSS.supports("top: constant(safe-area-inset-top)")) {
support = "constant";
} else {
support = "";
}
return support;
}
function init() {
support = typeof support === "string" ? support : getSupport();
if (!support) {
attrs.forEach(function(attr2) {
elementComputedStyle[attr2] = 0;
});
return;
}
function setStyle(el, style) {
var elStyle = el.style;
Object.keys(style).forEach(function(key) {
var val = style[key];
elStyle[key] = val;
});
}
var cbs = [];
function parentReady(callback) {
if (callback) {
cbs.push(callback);
} else {
cbs.forEach(function(cb) {
cb();
});
}
}
var passiveEvents = false;
try {
var opts = Object.defineProperty({}, "passive", {
get: function() {
passiveEvents = {passive: true};
}
});
window.addEventListener("test", null, opts);
} catch (e2) {
}
function addChild(parent, attr2) {
var a1 = document.createElement("div");
var a2 = document.createElement("div");
var a1Children = document.createElement("div");
var a2Children = document.createElement("div");
var W = 100;
var MAX = 1e4;
var aStyle = {
position: "absolute",
width: W + "px",
height: "200px",
boxSizing: "border-box",
overflow: "hidden",
paddingBottom: support + "(safe-area-inset-" + attr2 + ")"
};
setStyle(a1, aStyle);
setStyle(a2, aStyle);
setStyle(a1Children, {
transition: "0s",
animation: "none",
width: "400px",
height: "400px"
});
setStyle(a2Children, {
transition: "0s",
animation: "none",
width: "250%",
height: "250%"
});
a1.appendChild(a1Children);
a2.appendChild(a2Children);
parent.appendChild(a1);
parent.appendChild(a2);
parentReady(function() {
a1.scrollTop = a2.scrollTop = MAX;
var a1LastScrollTop = a1.scrollTop;
var a2LastScrollTop = a2.scrollTop;
function onScroll() {
if (this.scrollTop === (this === a1 ? a1LastScrollTop : a2LastScrollTop)) {
return;
}
a1.scrollTop = a2.scrollTop = MAX;
a1LastScrollTop = a1.scrollTop;
a2LastScrollTop = a2.scrollTop;
attrChange(attr2);
}
a1.addEventListener("scroll", onScroll, passiveEvents);
a2.addEventListener("scroll", onScroll, passiveEvents);
});
var computedStyle = getComputedStyle(a1);
Object.defineProperty(elementComputedStyle, attr2, {
configurable: true,
get: function() {
return parseFloat(computedStyle.paddingBottom);
}
});
}
var parentDiv = document.createElement("div");
setStyle(parentDiv, {
position: "absolute",
left: "0",
top: "0",
width: "0",
height: "0",
zIndex: "-1",
overflow: "hidden",
visibility: "hidden"
});
attrs.forEach(function(key) {
addChild(parentDiv, key);
});
document.body.appendChild(parentDiv);
parentReady();
inited$1 = true;
}
function getAttr(attr2) {
if (!inited$1) {
init();
}
return elementComputedStyle[attr2];
}
var changeAttrs = [];
function attrChange(attr2) {
if (!changeAttrs.length) {
setTimeout(function() {
var style = {};
changeAttrs.forEach(function(attr3) {
style[attr3] = elementComputedStyle[attr3];
});
changeAttrs.length = 0;
callbacks$2.forEach(function(callback) {
callback(style);
});
}, 0);
}
changeAttrs.push(attr2);
}
var callbacks$2 = [];
function onChange(callback) {
if (!getSupport()) {
return;
}
if (!inited$1) {
init();
}
if (typeof callback === "function") {
callbacks$2.push(callback);
}
}
function offChange(callback) {
var index2 = callbacks$2.indexOf(callback);
if (index2 >= 0) {
callbacks$2.splice(index2, 1);
}
}
var safeAreaInsets = {
get support() {
return (typeof support === "string" ? support : getSupport()).length != 0;
},
get top() {
return getAttr("top");
},
get left() {
return getAttr("left");
},
get right() {
return getAttr("right");
},
get bottom() {
return getAttr("bottom");
},
onChange,
offChange
};
var out = safeAreaInsets;
const pageMetaKey = PolySymbol(process.env.NODE_ENV !== "production" ? "UniPageMeta" : "upm");
function usePageMeta() {
return inject(pageMetaKey);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录