Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
f3ecd3ce
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,发现更多精彩内容 >>
提交
f3ecd3ce
编写于
7月 23, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): disable optimizeDeps
上级
2bb85994
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
63 addition
and
141 deletion
+63
-141
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+24
-54
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+20
-70
packages/uni-h5-vite/src/index.ts
packages/uni-h5-vite/src/index.ts
+2
-0
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+17
-17
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
f3ecd3ce
...
...
@@ -1769,35 +1769,6 @@ var serviceContext = (function (vue) {
}
}
const callbacks$3 = {};
function createCallbacks(namespace) {
let scopedCallbacks = callbacks$3[namespace];
if (!scopedCallbacks) {
scopedCallbacks = {
id: 1,
callbacks: Object.create(null),
};
callbacks$3[namespace] = scopedCallbacks;
}
return {
get(id) {
return scopedCallbacks.callbacks[id];
},
pop(id) {
const callback = scopedCallbacks.callbacks[id];
if (callback) {
delete scopedCallbacks.callbacks[id];
}
return callback;
},
push(callback) {
const id = scopedCallbacks.id++;
scopedCallbacks.callbacks[id] = callback;
return id;
},
};
}
let invokeViewMethodId = 0;
function publishViewMethodName() {
return getCurrentPageId() + '.' + INVOKE_VIEW_API;
...
...
@@ -2426,16 +2397,13 @@ var serviceContext = (function (vue) {
// import pako from 'pako'
//#endregion
//#region UniServiceJSBridge
const canvasEventCallbacks = createCallbacks('canvasEvent');
function operateCanvas(canvasId, pageId, type, data) {
function operateCanvas(canvasId, pageId, type, data, callback) {
UniServiceJSBridge.invokeViewMethod(`canvas.${canvasId}`, {
type,
data,
}, pageId, ({ callbackId, data }) => {
const callback = canvasEventCallbacks.pop(callbackId);
if (callback) {
}, pageId, (data) => {
if (callback)
callback(data);
}
});
}
//#endregion
...
...
@@ -2734,15 +2702,10 @@ var serviceContext = (function (vue) {
var actions = [...this.actions];
this.actions = [];
this.path = [];
var callbackId;
if (typeof callback === 'function') {
callbackId = canvasEventCallbacks.push(callback);
}
operateCanvas(this.id, this.pageId, 'actionsChanged', {
actions,
reserve,
callbackId,
});
}, callback);
}
createLinearGradient(x0, y0, x1, y1) {
return new CanvasGradient('linear', [x0, y0, x1, y1]);
...
...
@@ -3273,11 +3236,15 @@ var serviceContext = (function (vue) {
reject();
return;
}
const cId = canvasEventCallbacks.push(function (data) {
function callback(data) {
if (data.errMsg && data.errMsg.indexOf('fail') !== -1) {
reject('', data);
return;
}
let imgData = data.data;
if (imgData && imgData.length) {
if (data.compressed) {
return
Promise.resolve().then(function () { return pako_esm; }).then((pako) => {
Promise.resolve().then(function () { return pako_esm; }).then((pako) => {
imgData = pako.inflateRaw(imgData);
delete data.compressed;
data.data = new Uint8ClampedArray(imgData);
...
...
@@ -3287,14 +3254,13 @@ var serviceContext = (function (vue) {
data.data = new Uint8ClampedArray(imgData);
}
resolve(data);
}
);
}
operateCanvas(canvasId, pageId, 'getImageData', {
x,
y,
width,
height,
callbackId: cId,
});
}, callback);
}, CanvasGetImageDataProtocol, CanvasGetImageDataOptions);
const canvasPutImageData = defineAsyncApi(API_CANVAS_PUT_IMAGE_DATA, ({ canvasId, data, x, y, width, height }, { resolve, reject }) => {
// onCanvasMethodCallback()
...
...
@@ -3303,9 +3269,6 @@ var serviceContext = (function (vue) {
reject();
return;
}
const cId = canvasEventCallbacks.push(function (data) {
resolve(data);
});
let compressed;
const operate = () => {
operateCanvas(canvasId, pageId, 'putImageData', {
...
...
@@ -3315,7 +3278,12 @@ var serviceContext = (function (vue) {
width,
height,
compressed,
callbackId: cId,
}, (data) => {
if (data.errMsg && data.errMsg.indexOf('fail')) {
reject();
return;
}
resolve(data);
});
};
// iOS真机非调试模式压缩太慢暂时排除
...
...
@@ -3337,9 +3305,6 @@ var serviceContext = (function (vue) {
reject();
return;
}
const cId = canvasEventCallbacks.push(function (res) {
resolve(res);
});
const dirname = `${TEMP_PATH$1}/canvas`;
operateCanvas(canvasId, pageId, 'toTempFilePath', {
x,
...
...
@@ -3351,7 +3316,12 @@ var serviceContext = (function (vue) {
fileType,
quality,
dirname,
callbackId: cId,
}, (res) => {
if (res.errMsg && res.errMsg.indexOf('fail')) {
reject('', res);
return;
}
resolve(res);
});
}, CanvasToTempFilePathProtocol, CanvasToTempFilePathOptions);
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
f3ecd3ce
...
...
@@ -5133,14 +5133,14 @@ var __publicField = (obj, key, value) => {
style[attr3] = elementComputedStyle[attr3];
});
changeAttrs.length = 0;
callbacks
$1
.forEach(function(callback) {
callbacks.forEach(function(callback) {
callback(style);
});
}, 0);
}
changeAttrs.push(attr2);
}
var callbacks
$1
= [];
var callbacks = [];
function onChange(callback) {
if (!getSupport()) {
return;
...
...
@@ -5149,13 +5149,13 @@ var __publicField = (obj, key, value) => {
init();
}
if (typeof callback === "function") {
callbacks
$1
.push(callback);
callbacks.push(callback);
}
}
function offChange(callback) {
var index2 = callbacks
$1
.indexOf(callback);
var index2 = callbacks.indexOf(callback);
if (index2 >= 0) {
callbacks
$1
.splice(index2, 1);
callbacks.splice(index2, 1);
}
}
var safeAreaInsets = {
...
...
@@ -5342,34 +5342,6 @@ var __publicField = (obj, key, value) => {
fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
return "/" + fromRouteArray.concat(toRouteArray).join("/");
}
const callbacks = {};
function createCallbacks(namespace) {
let scopedCallbacks = callbacks[namespace];
if (!scopedCallbacks) {
scopedCallbacks = {
id: 1,
callbacks: Object.create(null)
};
callbacks[namespace] = scopedCallbacks;
}
return {
get(id2) {
return scopedCallbacks.callbacks[id2];
},
pop(id2) {
const callback = scopedCallbacks.callbacks[id2];
if (callback) {
delete scopedCallbacks.callbacks[id2];
}
return callback;
},
push(callback) {
const id2 = scopedCallbacks.id++;
scopedCallbacks.callbacks[id2] = callback;
return id2;
}
};
}
const isClickEvent = (val) => val.type === "click";
function $nne(evt) {
const { currentTarget } = evt;
...
...
@@ -5741,7 +5713,6 @@ var __publicField = (obj, key, value) => {
}
return number < 0 ? -result : result;
}, Upx2pxProtocol);
createCallbacks("canvasEvent");
({
beforeInvoke() {
initI18nShowModalMsgsOnce();
...
...
@@ -7191,14 +7162,13 @@ var __publicField = (obj, key, value) => {
}
function actionsChanged({
actions,
reserve,
callbackId
reserve
}, resolve) {
if (!actions) {
return;
}
if (actionsWaiting.value) {
_actionsDefer.push([actions, reserve
, callbackId
]);
_actionsDefer.push([actions, reserve]);
return;
}
var canvas2 = canvasRef.value;
...
...
@@ -7244,7 +7214,7 @@ var __publicField = (obj, key, value) => {
});
color = LinearGradient;
} else if (data[0] === "pattern") {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1),
callbackId,
resolve, function(image2) {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
c2d[method1] = c2d.createPattern(image2, data[2]);
}
...
...
@@ -7293,7 +7263,7 @@ var __publicField = (obj, key, value) => {
var url = dataArray[0];
var otherData = dataArray.slice(1);
_images = _images || {};
if (checkImageLoaded(url, actions.slice(index2 + 1),
callbackId,
resolve, function(image2) {
if (checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
c2d.drawImage.apply(c2d, [image2].concat([...otherData.slice(4, 8)], [...otherData.slice(0, 4)]));
}
...
...
@@ -7314,12 +7284,9 @@ var __publicField = (obj, key, value) => {
}
}
}
if (!actionsWaiting.value
&& callbackId
) {
if (!actionsWaiting.value) {
resolve({
callbackId,
data: {
errMsg: "drawCanvas:ok"
}
});
}
}
...
...
@@ -7360,7 +7327,7 @@ var __publicField = (obj, key, value) => {
}
});
}
function checkImageLoaded(src, actions,
callbackId,
resolve, fn) {
function checkImageLoaded(src, actions, resolve, fn) {
var image2 = _images[src];
if (image2.ready) {
fn(image2);
...
...
@@ -7376,7 +7343,6 @@ var __publicField = (obj, key, value) => {
_actionsDefer = [];
for (var action = actions2.shift(); action; ) {
actionsChanged({
callbackId,
actions: action[0],
reserve: action[1]
}, resolve);
...
...
@@ -7396,8 +7362,7 @@ var __publicField = (obj, key, value) => {
hidpi = true,
dataType,
quality = 1,
type = "png",
callbackId
type = "png"
}, resolve) {
const canvas2 = canvasRef.value;
let data;
...
...
@@ -7443,7 +7408,6 @@ var __publicField = (obj, key, value) => {
}
}
result = {
errMsg: "canvasGetImageData:ok",
data,
compressed,
width: destWidth,
...
...
@@ -7456,13 +7420,10 @@ var __publicField = (obj, key, value) => {
}
newCanvas.height = newCanvas.width = 0;
context.__hidpi__ = false;
if (!
callbackId
) {
if (!
resolve
) {
return result;
} else {
resolve && resolve({
callbackId,
data: result
});
resolve(result);
}
}
function putImageData({
...
...
@@ -7471,8 +7432,7 @@ var __publicField = (obj, key, value) => {
y,
width,
height,
compressed,
callbackId
compressed
}, resolve) {
try {
if (!height) {
...
...
@@ -7489,18 +7449,12 @@ var __publicField = (obj, key, value) => {
canvas2.height = canvas2.width = 0;
} catch (error) {
resolve({
callbackId,
data: {
errMsg: "canvasPutImageData:fail"
}
});
return;
}
resolve({
callbackId,
data: {
errMsg: "canvasPutImageData:ok"
}
});
}
function toTempFilePath({
...
...
@@ -7512,8 +7466,7 @@ var __publicField = (obj, key, value) => {
destHeight,
fileType,
quality,
dirname,
callbackId
dirname
}, resolve) {
const res = getImageData({
x,
...
...
@@ -7529,10 +7482,7 @@ var __publicField = (obj, key, value) => {
});
if (!res.data || !res.data.length) {
resolve({
callbackId,
data: {
errMsg: res.errMsg.replace("canvasPutImageData", "toTempFilePath")
}
});
return;
}
...
...
packages/uni-h5-vite/src/index.ts
浏览文件 @
f3ecd3ce
...
...
@@ -45,6 +45,8 @@ const UniH5Plugin: UniVitePlugin = {
},
configResolved
(
config
)
{
initLogger
(
config
)
// TODO 禁止 optimizeDeps
;(
config
as
any
).
cacheDir
=
''
},
handleHotUpdate
:
createHandleHotUpdate
(),
transformIndexHtml
:
createTransformIndexHtml
(),
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
f3ecd3ce
...
...
@@ -788,7 +788,7 @@ var safeAreaInsets = {
onChange,
offChange
};
var
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out = safeAreaInsets;
var out = safeAreaInsets;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
...
...
@@ -800,10 +800,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top : 0,
bottom: bottom ? bottom +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom : 0,
left: left ? left +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left : 0,
right: right ? right +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right : 0
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
};
}
function updateCssVar(cssVars) {
...
...
@@ -13174,7 +13174,7 @@ function normalizePageMeta(pageMeta) {
}, pageMeta.pullToRefresh));
const { type, style } = navigationBar;
if (style !== "custom" && type !== "transparent") {
pullToRefresh.offset += NAVBAR_HEIGHT +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top;
pullToRefresh.offset += NAVBAR_HEIGHT + out.top;
}
pageMeta.pullToRefresh = pullToRefresh;
}
...
...
@@ -15360,7 +15360,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight =
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top;
const statusBarHeight = out.top;
let osname;
let osversion;
let model;
...
...
@@ -15473,12 +15473,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left,
right: windowWidth -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
top:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top,
bottom: windowHeight -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom,
width: windowWidth -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
height: windowHeight -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth -
out.left -
out.right,
height: windowHeight -
out.top -
out.bottom
};
const { top: windowTop, bottom: windowBottom } = getWindowOffset();
windowHeight -= windowTop;
...
...
@@ -15498,10 +15498,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
model,
safeArea,
safeAreaInsets: {
top:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top,
right:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
bottom:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom,
left:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left
top: out.top,
right: out.right,
bottom: out.bottom,
left: out.left
}
};
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录