Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
dfed3806
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
765
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
dfed3806
编写于
8月 10, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): wxs
上级
ade726d1
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
423 addition
and
248 deletion
+423
-248
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+87
-87
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+132
-74
packages/uni-app-plus/src/view/framework/dom/modules/events.ts
...ges/uni-app-plus/src/view/framework/dom/modules/events.ts
+49
-50
packages/uni-app-plus/src/view/framework/dom/utils.ts
packages/uni-app-plus/src/view/framework/dom/utils.ts
+8
-2
packages/uni-app-plus/src/view/framework/dom/wxs.ts
packages/uni-app-plus/src/view/framework/dom/wxs.ts
+71
-0
packages/uni-app-vue/dist/service.runtime.esm.js
packages/uni-app-vue/dist/service.runtime.esm.js
+2
-0
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+19
-19
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+12
-2
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+2
-2
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+12
-2
packages/uni-shared/src/constants.ts
packages/uni-shared/src/constants.ts
+0
-2
packages/uni-shared/src/utils.ts
packages/uni-shared/src/utils.ts
+12
-0
packages/uni-vue/src/componentOptions/renderjs.ts
packages/uni-vue/src/componentOptions/renderjs.ts
+17
-8
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
dfed3806
...
...
@@ -10,79 +10,79 @@ const __uniRoutes = instanceContext.__uniRoutes;
var serviceContext = (function (vue) {
'use strict';
/*
* base64-arraybuffer
* https://github.com/niklasvh/base64-arraybuffer
*
* Copyright (c) 2012 Niklas von Hertzen
* Licensed under the MIT license.
*/
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup = /*#__PURE__*/ (function () {
const lookup = new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
return lookup
})();
function encode$3(arraybuffer) {
var bytes = new Uint8Array(arraybuffer),
i,
len = bytes.length,
base64 = '';
for (i = 0; i < len; i += 3) {
base64 += chars[bytes[i] >> 2];
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
base64 += chars[bytes[i + 2] & 63];
}
if (len % 3 === 2) {
base64 = base64.substring(0, base64.length - 1) + '=';
} else if (len % 3 === 1) {
base64 = base64.substring(0, base64.length - 2) + '==';
}
return base64
}
function decode$1(base64) {
var bufferLength = base64.length * 0.75,
len = base64.length,
i,
p = 0,
encoded1,
encoded2,
encoded3,
encoded4;
if (base64[base64.length - 1] === '=') {
bufferLength--;
if (base64[base64.length - 2] === '=') {
bufferLength--;
}
}
var arraybuffer = new ArrayBuffer(bufferLength),
bytes = new Uint8Array(arraybuffer);
for (i = 0; i < len; i += 4) {
encoded1 = lookup[base64.charCodeAt(i)];
encoded2 = lookup[base64.charCodeAt(i + 1)];
encoded3 = lookup[base64.charCodeAt(i + 2)];
encoded4 = lookup[base64.charCodeAt(i + 3)];
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
}
return arraybuffer
/*
* base64-arraybuffer
* https://github.com/niklasvh/base64-arraybuffer
*
* Copyright (c) 2012 Niklas von Hertzen
* Licensed under the MIT license.
*/
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup = /*#__PURE__*/ (function () {
const lookup = new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
return lookup
})();
function encode$3(arraybuffer) {
var bytes = new Uint8Array(arraybuffer),
i,
len = bytes.length,
base64 = '';
for (i = 0; i < len; i += 3) {
base64 += chars[bytes[i] >> 2];
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
base64 += chars[bytes[i + 2] & 63];
}
if (len % 3 === 2) {
base64 = base64.substring(0, base64.length - 1) + '=';
} else if (len % 3 === 1) {
base64 = base64.substring(0, base64.length - 2) + '==';
}
return base64
}
function decode$1(base64) {
var bufferLength = base64.length * 0.75,
len = base64.length,
i,
p = 0,
encoded1,
encoded2,
encoded3,
encoded4;
if (base64[base64.length - 1] === '=') {
bufferLength--;
if (base64[base64.length - 2] === '=') {
bufferLength--;
}
}
var arraybuffer = new ArrayBuffer(bufferLength),
bytes = new Uint8Array(arraybuffer);
for (i = 0; i < len; i += 4) {
encoded1 = lookup[base64.charCodeAt(i)];
encoded2 = lookup[base64.charCodeAt(i + 1)];
encoded3 = lookup[base64.charCodeAt(i + 2)];
encoded4 = lookup[base64.charCodeAt(i + 3)];
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
}
return arraybuffer
}
/**
...
...
@@ -1112,7 +1112,7 @@ var serviceContext = (function (vue) {
if (typeof options.complete === 'function') {
options.complete(data);
}
}
}
function debounce(fn, delay) {
let timeout;
...
...
@@ -3503,7 +3503,6 @@ var serviceContext = (function (vue) {
}
}, CreateCanvasContextProtocol);
const canvasGetImageData = defineAsyncApi(API_CANVAS_GET_IMAGE_DATA, ({ canvasId, x, y, width, height }, { resolve, reject }) => {
// onCanvasMethodCallback()
const pageId = getPageIdByVm(getCurrentPageVm());
if (!pageId) {
reject();
...
...
@@ -3536,7 +3535,6 @@ var serviceContext = (function (vue) {
}, callback);
}, CanvasGetImageDataProtocol, CanvasGetImageDataOptions);
const canvasPutImageData = defineAsyncApi(API_CANVAS_PUT_IMAGE_DATA, ({ canvasId, data, x, y, width, height }, { resolve, reject }) => {
// onCanvasMethodCallback()
var pageId = getPageIdByVm(getCurrentPageVm());
if (!pageId) {
reject();
...
...
@@ -3552,7 +3550,7 @@ var serviceContext = (function (vue) {
height,
compressed,
}, (data) => {
if (data.errMsg && data.errMsg.indexOf('fail')) {
if (data.errMsg && data.errMsg.indexOf('fail')
!== -1
) {
reject();
return;
}
...
...
@@ -3567,12 +3565,11 @@ var serviceContext = (function (vue) {
operate();
});
}
// fix ...
// fix ...
fix what?
data = Array.prototype.slice.call(data);
operate();
}, CanvasPutImageDataProtocol, CanvasPutImageDataOptions);
const canvasToTempFilePath = defineAsyncApi(API_CANVAS_TO_TEMP_FILE_PATH, ({ x = 0, y = 0, width, height, destWidth, destHeight, canvasId, fileType, quality, }, { resolve, reject }) => {
// onCanvasMethodCallback()
var pageId = getPageIdByVm(getCurrentPageVm());
if (!pageId) {
reject();
...
...
@@ -3590,7 +3587,7 @@ var serviceContext = (function (vue) {
quality,
dirname,
}, (res) => {
if (res.errMsg && res.errMsg.indexOf('fail')) {
if (res.errMsg && res.errMsg.indexOf('fail')
!== -1
) {
reject('', res);
return;
}
...
...
@@ -9363,34 +9360,37 @@ var serviceContext = (function (vue) {
if (!isArray(modules)) {
return;
}
// 使用了内部属性__scopeId
const component = instance.type.__scopeId || instance.proxy.route;
const ctx = instance.ctx;
const $wxsModules = (instance.$wxsModules ||
(instance.$wxsModules = []));
modules.forEach((module) => {
ctx[module] = proxyModule(module);
ctx[module] = proxyModule(
component,
module);
$wxsModules.push(module);
});
}
const renderjsModule = {};
function proxyModule(module) {
function proxyModule(
component,
module) {
return new Proxy(renderjsModule, {
get(_, p) {
return createModuleFunction(module, p);
return createModuleFunction(
component,
module, p);
},
});
}
function renderjsFn() { }
function createModuleFunction(module, name) {
const toJSON = () => WXS_PROTOCOL + JSON.stringify([module + '.' + name]);
function createModuleFunction(
component,
module, name) {
const toJSON = () => WXS_PROTOCOL + JSON.stringify([
component,
module + '.' + name]);
return new Proxy(renderjsFn, {
get(_, p) {
if (p === 'toJSON') {
return toJSON;
}
return createModuleFunction(module + '.' + name, p);
return createModuleFunction(
component,
module + '.' + name, p);
},
apply(_target, _thisArg, args) {
return WXS_PROTOCOL + JSON.stringify([module + '.' + name, ...args]);
return (WXS_PROTOCOL +
JSON.stringify([component, module + '.' + name, [...args]]));
},
});
}
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
dfed3806
此差异已折叠。
点击以展开。
packages/uni-app-plus/src/view/framework/dom/modules/events.ts
浏览文件 @
dfed3806
...
...
@@ -9,36 +9,49 @@ import {
}
from
'
@dcloudio/uni-shared
'
import
{
VD_SYNC
}
from
'
../../../../constants
'
import
{
UniCustomElement
}
from
'
../components
'
import
{
invokeWxs
}
from
'
../wxs
'
function
removeEventListener
(
el
:
UniCustomElement
,
type
:
string
)
{
const
listener
=
el
.
__listeners
[
type
]
if
(
listener
)
{
el
.
removeEventListener
(
type
,
listener
)
}
else
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`tag`
,
el
.
tagName
,
el
.
__id
,
'
event[
'
+
type
+
'
] not found
'
)
)
}
}
function
isEventListenerExists
(
el
:
UniCustomElement
,
type
:
string
)
{
if
(
el
.
__listeners
[
type
])
{
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`tag`
,
el
.
tagName
,
el
.
__id
,
'
event[
'
+
type
+
'
] already registered
'
)
)
}
return
true
}
}
export
function
patchEvent
(
el
:
UniCustomElement
,
name
:
string
,
flag
:
number
)
{
const
[
type
,
options
]
=
parseEventName
(
name
)
if
(
flag
===
-
1
)
{
// remove
const
listener
=
el
.
__listeners
[
type
]
if
(
listener
)
{
el
.
removeEventListener
(
type
,
listener
)
}
else
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`tag`
,
el
.
tagName
,
el
.
__id
,
'
event[
'
+
type
+
'
] not found
'
)
)
}
removeEventListener
(
el
,
type
)
}
else
{
// add
if
(
el
.
__listeners
[
type
])
{
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`tag`
,
el
.
tagName
,
el
.
__id
,
'
event[
'
+
type
+
'
] already registered
'
)
)
}
return
if
(
!
isEventListenerExists
(
el
,
type
))
{
el
.
addEventListener
(
type
,
(
el
.
__listeners
[
type
]
=
createInvoker
(
el
.
__id
,
flag
,
options
)),
options
)
}
el
.
__listeners
[
type
]
=
createInvoker
(
el
.
__id
,
flag
,
options
)
el
.
addEventListener
(
type
,
el
.
__listeners
[
type
],
options
)
}
}
...
...
@@ -81,36 +94,21 @@ export function patchWxsEvent(
const
[
type
,
options
]
=
parseEventName
(
name
)
if
(
flag
===
-
1
)
{
// remove
const
listener
=
el
.
__listeners
[
type
]
if
(
listener
)
{
el
.
removeEventListener
(
type
,
listener
)
}
else
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`tag`
,
el
.
tagName
,
el
.
__id
,
'
event[
'
+
type
+
'
] not found
'
)
)
}
removeEventListener
(
el
,
type
)
}
else
{
// add
if
(
el
.
__listeners
[
type
])
{
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`tag`
,
el
.
tagName
,
el
.
__id
,
'
event[
'
+
type
+
'
] already registered
'
)
)
}
return
if
(
!
isEventListenerExists
(
el
,
type
))
{
el
.
addEventListener
(
type
,
(
el
.
__listeners
[
type
]
=
createWxsEventInvoker
(
el
.
__id
,
wxsEvent
,
flag
,
options
)),
options
)
}
el
.
__listeners
[
type
]
=
createWxsEventInvoker
(
el
.
__id
,
wxsEvent
,
flag
,
options
)
el
.
addEventListener
(
type
,
el
.
__listeners
[
type
],
options
)
}
}
...
...
@@ -122,7 +120,8 @@ function createWxsEventInvoker(
)
{
const
invoker
=
(
evt
:
Event
)
=>
{
console
.
log
(
'
call wxsEvent
'
,
id
,
wxsEvent
,
flag
,
options
)
// const event = normalizeNativeEvent(evt)
invokeWxs
(
wxsEvent
,
[
normalizeNativeEvent
(
evt
)])
// ;(event as any).type = normalizeEventType(evt.type, options)
// UniViewJSBridge.publishHandler(VD_SYNC, [[ACTION_TYPE_EVENT, id, event]])
}
...
...
packages/uni-app-plus/src/view/framework/dom/utils.ts
浏览文件 @
dfed3806
import
{
JSON_PROTOCOL
}
from
'
@dcloudio/uni-shared
'
import
{
JSON_PROTOCOL
,
WXS_PROTOCOL
}
from
'
@dcloudio/uni-shared
'
import
{
isString
}
from
'
@vue/shared
'
import
{
invokeWxs
}
from
'
./wxs
'
const
JSON_PROTOCOL_LEN
=
JSON_PROTOCOL
.
length
export
function
decodeAttr
(
value
:
unknown
)
{
if
(
isString
(
value
)
&&
value
.
indexOf
(
JSON_PROTOCOL
)
===
0
)
{
if
(
!
isString
(
value
))
{
return
value
}
if
(
value
.
indexOf
(
JSON_PROTOCOL
)
===
0
)
{
value
=
JSON
.
parse
(
value
.
substr
(
JSON_PROTOCOL_LEN
))
}
else
if
(
value
.
indexOf
(
WXS_PROTOCOL
)
===
0
)
{
value
=
invokeWxs
(
value
)
}
return
value
}
packages/uni-app-plus/src/view/framework/dom/wxs.ts
0 → 100644
浏览文件 @
dfed3806
import
{
isArray
}
from
'
@vue/shared
'
import
{
formatLog
,
getValueByDataPath
,
WXS_PROTOCOL
,
}
from
'
@dcloudio/uni-shared
'
declare
global
{
interface
Window
{
WxsModules
:
{
[
name
:
string
]:
Record
<
string
,
any
>
}
RenderjsModules
:
{
[
name
:
string
]:
Record
<
string
,
any
>
}
}
}
function
getWxsModule
(
component
:
string
)
{
const
{
WxsModules
,
RenderjsModules
}
=
window
let
module
=
WxsModules
&&
WxsModules
[
component
]
if
(
!
module
)
{
module
=
RenderjsModules
&&
RenderjsModules
[
component
]
}
if
(
!
module
)
{
return
console
.
error
(
formatLog
(
'
wxs or renderjs
'
,
component
+
'
not found
'
))
}
return
module
}
const
WXS_PROTOCOL_LEN
=
WXS_PROTOCOL
.
length
export
function
invokeWxs
(
value
:
string
,
invokerArgs
?:
unknown
[])
{
const
[
component
,
invoker
,
args
]
=
JSON
.
parse
(
value
.
substr
(
WXS_PROTOCOL_LEN
))
if
(
isArray
(
args
))
{
// methods
const
[
moduleName
,
mehtodName
]
=
invoker
.
split
(
'
.
'
)
if
(
invokerArgs
)
{
args
.
push
(...
invokerArgs
)
}
return
invokeWxsMethod
(
component
,
moduleName
,
mehtodName
,
args
)
}
return
getWxsProp
(
component
,
invoker
)
}
function
invokeWxsMethod
(
component
:
string
,
moduleName
:
string
,
methodName
:
string
,
args
:
unknown
[]
)
{
const
modules
=
getWxsModule
(
component
)
if
(
!
modules
)
{
return
}
const
module
=
modules
[
moduleName
]
if
(
!
module
)
{
return
console
.
error
(
formatLog
(
'
wxs
'
,
'
module
'
+
moduleName
+
'
not found
'
)
)
}
return
module
[
methodName
].
apply
(
module
,
args
)
}
function
getWxsProp
(
component
:
string
,
dataPath
:
string
)
{
const
modules
=
getWxsModule
(
component
)
if
(
!
modules
)
{
return
}
return
getValueByDataPath
(
modules
,
dataPath
)
}
packages/uni-app-vue/dist/service.runtime.esm.js
浏览文件 @
dfed3806
...
...
@@ -11835,11 +11835,13 @@ export default function vueFactory(exports) {
var
vModelText
=
{
created
(
el
,
{
value
,
modifiers
:
{
trim
,
number
}
},
vnode
)
{
el
.
value
=
value
==
null
?
''
:
value
;
el
.
_assign
=
getModelAssigner
(
vnode
);
addEventListener
(
el
,
'
input
'
,
e
=>
{
var
domValue
=
e
.
detail
.
value
;
// 从 view 层接收到新值后,赋值给 service 层元素,注意,需要临时解除 pageNode,否则赋值 value 会触发向 view 层的再次同步数据
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
dfed3806
...
...
@@ -564,7 +564,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(() => {
...
...
@@ -576,10 +576,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) {
...
...
@@ -3725,7 +3725,7 @@ const canvasPutImageData = /* @__PURE__ */ defineAsyncApi(API_CANVAS_PUT_IMAGE_D
height,
compressed
}, (data2) => {
if (data2.errMsg && data2.errMsg.indexOf("fail")) {
if (data2.errMsg && data2.errMsg.indexOf("fail")
!== -1
) {
reject();
return;
}
...
...
@@ -3763,7 +3763,7 @@ const canvasToTempFilePath = /* @__PURE__ */ defineAsyncApi(API_CANVAS_TO_TEMP_F
quality,
dirname
}, (res) => {
if (res.errMsg && res.errMsg.indexOf("fail")) {
if (res.errMsg && res.errMsg.indexOf("fail")
!== -1
) {
reject("", res);
return;
}
...
...
@@ -13156,7 +13156,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;
}
...
...
@@ -15354,7 +15354,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;
...
...
@@ -15467,12 +15467,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;
...
...
@@ -15492,10 +15492,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
}
};
});
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
dfed3806
...
...
@@ -826,6 +826,17 @@ function callOptions(options, data) {
if
(
typeof
options
.
complete
===
'
function
'
)
{
options
.
complete
(
data
);
}
}
function
getValueByDataPath
(
obj
,
path
)
{
const
parts
=
path
.
split
(
'
.
'
);
let
key
=
parts
[
0
];
if
(
!
obj
)
{
obj
=
{};
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
];
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
));
}
function
debounce
(
fn
,
delay
)
{
...
...
@@ -859,7 +870,6 @@ const DATA_RE = /^data:.*,.*/;
const
WEB_INVOKE_APPSERVICE
=
'
WEB_INVOKE_APPSERVICE
'
;
const
WXS_PROTOCOL
=
'
wxs://
'
;
const
JSON_PROTOCOL
=
'
json://
'
;
const
WXS_METHOD_SYMBOL
=
Symbol
(
'
wxs.method
'
);
// lifecycle
// App and Page
const
ON_SHOW
=
'
onShow
'
;
...
...
@@ -1057,7 +1067,6 @@ exports.UniNode = UniNode;
exports
.
UniTextAreaElement
=
UniTextAreaElement
;
exports
.
UniTextNode
=
UniTextNode
;
exports
.
WEB_INVOKE_APPSERVICE
=
WEB_INVOKE_APPSERVICE
;
exports
.
WXS_METHOD_SYMBOL
=
WXS_METHOD_SYMBOL
;
exports
.
WXS_PROTOCOL
=
WXS_PROTOCOL
;
exports
.
addFont
=
addFont
;
exports
.
cache
=
cache
;
...
...
@@ -1074,6 +1083,7 @@ exports.formatLog = formatLog;
exports
.
getCustomDataset
=
getCustomDataset
;
exports
.
getEnvLocale
=
getEnvLocale
;
exports
.
getLen
=
getLen
;
exports
.
getValueByDataPath
=
getValueByDataPath
;
exports
.
initCustomDataset
=
initCustomDataset
;
exports
.
invokeArrayFns
=
invokeArrayFns
;
exports
.
isBuiltInComponent
=
isBuiltInComponent
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
dfed3806
...
...
@@ -168,6 +168,8 @@ export declare function getEnvLocale(): string;
export
declare
function
getLen
(
str
?:
string
):
number
;
export
declare
function
getValueByDataPath
(
obj
:
any
,
path
:
string
):
unknown
;
declare
interface
HTMLElementWithDataset
extends
HTMLElement
{
__uniDataset
?:
Record
<
string
,
any
>
;
}
...
...
@@ -620,8 +622,6 @@ export declare function updateElementStyle(element: HTMLElement, styles: Partial
export
declare
const
WEB_INVOKE_APPSERVICE
=
"
WEB_INVOKE_APPSERVICE
"
;
export
declare
const
WXS_METHOD_SYMBOL
:
unique
symbol
;
export
declare
const
WXS_PROTOCOL
=
"
wxs://
"
;
export
{
}
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
dfed3806
...
...
@@ -822,6 +822,17 @@ function callOptions(options, data) {
if
(
typeof
options
.
complete
===
'
function
'
)
{
options
.
complete
(
data
);
}
}
function
getValueByDataPath
(
obj
,
path
)
{
const
parts
=
path
.
split
(
'
.
'
);
let
key
=
parts
[
0
];
if
(
!
obj
)
{
obj
=
{};
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
];
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
));
}
function
debounce
(
fn
,
delay
)
{
...
...
@@ -855,7 +866,6 @@ const DATA_RE = /^data:.*,.*/;
const
WEB_INVOKE_APPSERVICE
=
'
WEB_INVOKE_APPSERVICE
'
;
const
WXS_PROTOCOL
=
'
wxs://
'
;
const
JSON_PROTOCOL
=
'
json://
'
;
const
WXS_METHOD_SYMBOL
=
Symbol
(
'
wxs.method
'
);
// lifecycle
// App and Page
const
ON_SHOW
=
'
onShow
'
;
...
...
@@ -971,4 +981,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
JSON_PROTOCOL
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
PLUS_RE
,
PRIMARY_COLOR
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_
METHOD_SYMBOL
,
WXS_PROTOCOL
,
addFont
,
cache
,
cacheStringFunction
,
callOptions
,
createRpx2Unit
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultRpx2Unit
,
formatDateTime
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
initCustomDataset
,
invokeArrayFns
,
isBuiltInComponent
,
isCustomElement
,
isNativeTag
,
isRootHook
,
isServiceCustomElement
,
isServiceNativeTag
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
JSON_PROTOCOL
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
PLUS_RE
,
PRIMARY_COLOR
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_
PROTOCOL
,
addFont
,
cache
,
cacheStringFunction
,
callOptions
,
createRpx2Unit
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultRpx2Unit
,
formatDateTime
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
,
invokeArrayFns
,
isBuiltInComponent
,
isCustomElement
,
isNativeTag
,
isRootHook
,
isServiceCustomElement
,
isServiceNativeTag
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
packages/uni-shared/src/constants.ts
浏览文件 @
dfed3806
...
...
@@ -23,8 +23,6 @@ export const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'
export
const
WXS_PROTOCOL
=
'
wxs://
'
export
const
JSON_PROTOCOL
=
'
json://
'
export
const
WXS_METHOD_SYMBOL
=
Symbol
(
'
wxs.method
'
)
// lifecycle
// App and Page
...
...
packages/uni-shared/src/utils.ts
浏览文件 @
dfed3806
...
...
@@ -103,3 +103,15 @@ export function callOptions(
options
.
complete
(
data
)
}
}
export
function
getValueByDataPath
(
obj
:
any
,
path
:
string
):
unknown
{
const
parts
=
path
.
split
(
'
.
'
)
let
key
:
number
|
string
=
parts
[
0
]
if
(
!
obj
)
{
obj
=
{}
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
]
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
))
}
packages/uni-vue/src/componentOptions/renderjs.ts
浏览文件 @
dfed3806
...
...
@@ -17,39 +17,48 @@ export function initModules(
if
(
!
isArray
(
modules
))
{
return
}
// 使用了内部属性__scopeId
const
component
=
(
instance
.
type
as
any
).
__scopeId
||
instance
.
proxy
!
.
route
const
ctx
=
(
instance
as
any
).
ctx
const
$wxsModules
=
(
instance
.
$wxsModules
||
(
instance
.
$wxsModules
=
[]))
as
unknown
as
string
[]
modules
.
forEach
((
module
)
=>
{
ctx
[
module
]
=
proxyModule
(
module
)
ctx
[
module
]
=
proxyModule
(
component
,
module
)
$wxsModules
.
push
(
module
)
})
}
const
renderjsModule
=
{}
function
proxyModule
(
module
:
string
)
{
function
proxyModule
(
component
:
string
,
module
:
string
)
{
return
new
Proxy
(
renderjsModule
,
{
get
(
_
,
p
)
{
return
createModuleFunction
(
module
,
p
as
string
)
return
createModuleFunction
(
component
,
module
,
p
as
string
)
},
})
}
function
renderjsFn
()
{}
function
createModuleFunction
(
module
:
string
,
name
:
string
):
Function
{
const
toJSON
=
()
=>
WXS_PROTOCOL
+
JSON
.
stringify
([
module
+
'
.
'
+
name
])
function
createModuleFunction
(
component
:
string
,
module
:
string
,
name
:
string
):
Function
{
const
toJSON
=
()
=>
WXS_PROTOCOL
+
JSON
.
stringify
([
component
,
module
+
'
.
'
+
name
])
return
new
Proxy
(
renderjsFn
,
{
get
(
_
,
p
)
{
if
(
p
===
'
toJSON
'
)
{
return
toJSON
}
return
createModuleFunction
(
module
+
'
.
'
+
name
,
p
as
string
)
return
createModuleFunction
(
component
,
module
+
'
.
'
+
name
,
p
as
string
)
},
apply
(
_target
,
_thisArg
,
args
)
{
return
WXS_PROTOCOL
+
JSON
.
stringify
([
module
+
'
.
'
+
name
,
...
args
])
return
(
WXS_PROTOCOL
+
JSON
.
stringify
([
component
,
module
+
'
.
'
+
name
,
[...
args
]])
)
},
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录