Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
0d315a3e
U
uni-app
项目概览
MuGuiLin
/
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0d315a3e
编写于
9月 19, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): compiler
上级
a8b1f299
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
219 addition
and
105 deletion
+219
-105
packages/uni-app/dist/uni-app.cjs.js
packages/uni-app/dist/uni-app.cjs.js
+20
-0
packages/uni-app/dist/uni-app.d.ts
packages/uni-app/dist/uni-app.d.ts
+4
-0
packages/uni-app/dist/uni-app.es.js
packages/uni-app/dist/uni-app.es.js
+20
-2
packages/uni-app/src/index.ts
packages/uni-app/src/index.ts
+6
-1
packages/uni-app/src/uts.ts
packages/uni-app/src/uts.ts
+22
-1
packages/uni-cli-shared/src/resolve.ts
packages/uni-cli-shared/src/resolve.ts
+17
-13
packages/uni-components/dist/components.js
packages/uni-components/dist/components.js
+15
-7
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+21
-11
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+39
-12
packages/uni-uts-vite/src/plugins/v1.ts
packages/uni-uts-vite/src/plugins/v1.ts
+25
-9
packages/uni-uts-vite/src/utils/compiler/index.ts
packages/uni-uts-vite/src/utils/compiler/index.ts
+2
-14
packages/uni-uts-vite/src/utils/compiler/kotlin.ts
packages/uni-uts-vite/src/utils/compiler/kotlin.ts
+2
-4
packages/uni-uts-vite/src/utils/compiler/swift.ts
packages/uni-uts-vite/src/utils/compiler/swift.ts
+1
-29
packages/uni-uts-vite/src/utils/compiler/utils.ts
packages/uni-uts-vite/src/utils/compiler/utils.ts
+25
-2
packages/uts-darwin-arm64/uts.darwin-arm64.node
packages/uts-darwin-arm64/uts.darwin-arm64.node
+0
-0
packages/uts-darwin-x64/uts.darwin-x64.node
packages/uts-darwin-x64/uts.darwin-x64.node
+0
-0
packages/uts-win32-ia32-msvc/uts.win32-ia32-msvc.node
packages/uts-win32-ia32-msvc/uts.win32-ia32-msvc.node
+0
-0
packages/uts-win32-x64-msvc/uts.win32-x64-msvc.node
packages/uts-win32-x64-msvc/uts.win32-x64-msvc.node
+0
-0
未找到文件。
packages/uni-app/dist/uni-app.cjs.js
浏览文件 @
0d315a3e
...
...
@@ -283,12 +283,32 @@ function initUtsProxyClass({ package: pkg, class: cls, constructor: { params: co
return
Reflect
.
get
(
target
,
name
,
receiver
);
},
});
}
function
initUtsPackageName
(
name
,
is_uni_modules
)
{
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
os
.
name
===
'
Android
'
)
{
return
'
uts.sdk.
'
+
(
is_uni_modules
?
'
modules.
'
:
''
)
+
name
;
}
return
''
;
}
function
initUtsClassName
(
name
,
is_uni_modules
)
{
if
(
typeof
plus
===
'
undefined
'
)
{
return
''
;
}
if
(
plus
.
os
.
name
===
'
Android
'
)
{
return
'
IndexKt
'
;
}
if
(
plus
.
os
.
name
===
'
iOS
'
)
{
return
'
UTSSDK
'
+
(
is_uni_modules
?
'
Modules
'
:
''
)
+
shared
.
capitalize
(
name
);
}
return
''
;
}
exports
.
formatAppLog
=
formatAppLog
;
exports
.
formatH5Log
=
formatH5Log
;
exports
.
getCurrentSubNVue
=
getCurrentSubNVue
;
exports
.
getSsrGlobalData
=
getSsrGlobalData
;
exports
.
initUtsClassName
=
initUtsClassName
;
exports
.
initUtsPackageName
=
initUtsPackageName
;
exports
.
initUtsProxyClass
=
initUtsProxyClass
;
exports
.
initUtsProxyFunction
=
initUtsProxyFunction
;
exports
.
onAddToFavorites
=
onAddToFavorites
;
...
...
packages/uni-app/dist/uni-app.d.ts
浏览文件 @
0d315a3e
...
...
@@ -39,6 +39,10 @@ export declare function getCurrentSubNVue(): any;
export
declare
function
getSsrGlobalData
():
any
;
export
declare
function
initUtsClassName
(
name
:
string
,
is_uni_modules
:
boolean
):
string
;
export
declare
function
initUtsPackageName
(
name
:
string
,
is_uni_modules
:
boolean
):
string
;
export
declare
function
initUtsProxyClass
({
package
:
pkg
,
class
:
cls
,
constructor
:
{
params
:
constructorParams
},
methods
,
props
,
staticProps
,
staticMethods
,
}:
ProxyClassOptions
):
any
;
export
declare
const
initUtsProxyFunction
:
typeof
initUtsStaticMethod
;
...
...
packages/uni-app/dist/uni-app.es.js
浏览文件 @
0d315a3e
import
{
shallowRef
,
ref
,
getCurrentInstance
,
isInSSRComponentSetup
,
injectHook
}
from
'
vue
'
;
import
{
hasOwn
,
isString
,
extend
,
isPlainObject
}
from
'
@vue/shared
'
;
import
{
hasOwn
,
isString
,
extend
,
capitalize
,
isPlainObject
}
from
'
@vue/shared
'
;
import
{
sanitise
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR
,
ON_SHOW
,
ON_HIDE
,
ON_LAUNCH
,
ON_ERROR
,
ON_THEME_CHANGE
,
ON_PAGE_NOT_FOUND
,
ON_UNHANDLE_REJECTION
,
ON_INIT
,
ON_LOAD
,
ON_READY
,
ON_UNLOAD
,
ON_RESIZE
,
ON_BACK_PRESS
,
ON_PAGE_SCROLL
,
ON_TAB_ITEM_TAP
,
ON_REACH_BOTTOM
,
ON_PULL_DOWN_REFRESH
,
ON_SAVE_EXIT_STATE
,
ON_SHARE_TIMELINE
,
ON_ADD_TO_FAVORITES
,
ON_SHARE_APP_MESSAGE
,
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
}
from
'
@dcloudio/uni-shared
'
;
function
getSSRDataType
()
{
...
...
@@ -251,6 +251,24 @@ function initUtsProxyClass({ package: pkg, class: cls, constructor: { params: co
return
Reflect
.
get
(
target
,
name
,
receiver
);
},
});
}
function
initUtsPackageName
(
name
,
is_uni_modules
)
{
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
os
.
name
===
'
Android
'
)
{
return
'
uts.sdk.
'
+
(
is_uni_modules
?
'
modules.
'
:
''
)
+
name
;
}
return
''
;
}
function
initUtsClassName
(
name
,
is_uni_modules
)
{
if
(
typeof
plus
===
'
undefined
'
)
{
return
''
;
}
if
(
plus
.
os
.
name
===
'
Android
'
)
{
return
'
IndexKt
'
;
}
if
(
plus
.
os
.
name
===
'
iOS
'
)
{
return
'
UTSSDK
'
+
(
is_uni_modules
?
'
Modules
'
:
''
)
+
capitalize
(
name
);
}
return
''
;
}
export
{
formatAppLog
,
formatH5Log
,
getCurrentSubNVue
,
getSsrGlobalData
,
initUtsProxyClass
,
initUtsProxyFunction
,
onAddToFavorites
,
onBackPress
,
onError
,
onHide
,
onInit
,
onLaunch
,
onLoad
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onResize
,
onSaveExitState
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
requireNativePlugin
,
resolveEasycom
,
shallowSsrRef
,
ssrRef
};
export
{
formatAppLog
,
formatH5Log
,
getCurrentSubNVue
,
getSsrGlobalData
,
initUts
ClassName
,
initUtsPackageName
,
initUts
ProxyClass
,
initUtsProxyFunction
,
onAddToFavorites
,
onBackPress
,
onError
,
onHide
,
onInit
,
onLaunch
,
onLoad
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onResize
,
onSaveExitState
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
requireNativePlugin
,
resolveEasycom
,
shallowSsrRef
,
ssrRef
};
packages/uni-app/src/index.ts
浏览文件 @
0d315a3e
...
...
@@ -3,4 +3,9 @@ export * from './api'
export
*
from
'
./hbx
'
export
*
from
'
./utils
'
export
*
from
'
./apiLifecycle
'
export
{
initUtsProxyClass
,
initUtsProxyFunction
}
from
'
./uts
'
export
{
initUtsProxyClass
,
initUtsProxyFunction
,
initUtsClassName
,
initUtsPackageName
,
}
from
'
./uts
'
packages/uni-app/src/uts.ts
浏览文件 @
0d315a3e
import
{
isPlainObject
,
hasOwn
,
extend
}
from
'
@vue/shared
'
import
{
isPlainObject
,
hasOwn
,
extend
,
capitalize
}
from
'
@vue/shared
'
declare
const
uni
:
any
declare
const
plus
:
any
let
callbackId
=
1
let
proxy
:
any
const
callbacks
:
Record
<
string
,
Function
>
=
{}
...
...
@@ -283,3 +284,23 @@ export function initUtsProxyClass({
},
})
}
export
function
initUtsPackageName
(
name
:
string
,
is_uni_modules
:
boolean
)
{
if
(
typeof
plus
!==
'
undefined
'
&&
plus
.
os
.
name
===
'
Android
'
)
{
return
'
uts.sdk.
'
+
(
is_uni_modules
?
'
modules.
'
:
''
)
+
name
}
return
''
}
export
function
initUtsClassName
(
name
:
string
,
is_uni_modules
:
boolean
)
{
if
(
typeof
plus
===
'
undefined
'
)
{
return
''
}
if
(
plus
.
os
.
name
===
'
Android
'
)
{
return
'
IndexKt
'
}
if
(
plus
.
os
.
name
===
'
iOS
'
)
{
return
'
UTSSDK
'
+
(
is_uni_modules
?
'
Modules
'
:
''
)
+
capitalize
(
name
)
}
return
''
}
packages/uni-cli-shared/src/resolve.ts
浏览文件 @
0d315a3e
...
...
@@ -131,23 +131,27 @@ export function resolveUtsModule(
const
parts
=
normalizePath
(
id
).
split
(
'
/
'
)
const
parentDir
=
parts
[
parts
.
length
-
2
]
if
(
parentDir
===
'
uni_modules
'
||
parentDir
===
'
utssdk
'
)
{
const
index
=
path
.
resolve
(
id
,
'
index.uts
'
)
const
resolvePlatformDir
=
(
p
:
typeof
process
.
env
.
UNI_UTS_PLATFORM
)
=>
{
return
path
.
resolve
(
id
,
parentDir
===
'
uni_modules
'
?
'
utssdk
'
:
''
,
p
)
}
// 未指定具体的平台
if
(
platform
===
'
app
'
)
{
platform
=
'
app-android
'
}
let
index
=
resolveUtsFile
(
resolvePlatformDir
(
platform
))
if
(
index
)
{
return
index
}
index
=
path
.
resolve
(
id
,
'
index.uts
'
)
if
(
fs
.
existsSync
(
index
))
{
return
index
}
if
(
parentDir
===
'
uni_modules
'
&&
!
fs
.
existsSync
(
path
.
join
(
id
,
'
utssdk
'
))
)
{
// uni_modules/test-plugin/utssdk不存在
return
// 如果是 android 或 ios,本平台没有,则查找一下另一个平台
if
(
platform
===
'
app-android
'
)
{
return
resolveUtsFile
(
resolvePlatformDir
(
'
app-ios
'
))
}
else
if
(
platform
===
'
app-ios
'
)
{
return
resolveUtsFile
(
resolvePlatformDir
(
'
app-android
'
))
}
const
platformDir
=
path
.
resolve
(
id
,
parentDir
===
'
uni_modules
'
?
'
utssdk
'
:
''
,
platform
)
return
resolveUtsFile
(
platformDir
)
}
}
}
...
...
packages/uni-components/dist/components.js
浏览文件 @
0d315a3e
...
...
@@ -2246,6 +2246,14 @@ const nvuePickerViewProps = extend({}, pickerViewProps, {
height
:
{
type
:
[
Number
,
String
],
default
:
0
},
maskTopStyle
:
{
type
:
String
,
default
:
""
},
maskBottomStyle
:
{
type
:
String
,
default
:
""
}
});
var
PickerView
=
defineComponent
({
...
...
@@ -2371,7 +2379,8 @@ var PickerViewColumn = defineComponent({
const
getPickerViewColumn
=
inject
(
"
getPickerViewColumn
"
);
const
current
=
getPickerViewColumn
(
instance
);
const
indicatorStyle
=
computed
(()
=>
getStyle
(
pickerViewProps2
.
indicatorStyle
));
const
maskStyle
=
computed
(()
=>
getStyle
(
pickerViewProps2
.
maskStyle
));
const
maskTopStyle
=
computed
(()
=>
getStyle
(
pickerViewProps2
.
maskTopStyle
));
const
maskBottomStyle
=
computed
(()
=>
getStyle
(
pickerViewProps2
.
maskBottomStyle
));
let
indicatorHeight
=
ref
(
0
);
indicatorHeight
.
value
=
getHeight
(
indicatorStyle
.
value
);
let
pickerViewHeight
=
ref
(
0
);
...
...
@@ -2445,18 +2454,17 @@ var PickerViewColumn = defineComponent({
paddingBottom
:
`
${
padding
}
px`
}
},
[
createScrollViewChild
(
children
)])]),
createVNode
(
"
u-scalable
"
,
{
"
class
"
:
"
uni-picker-view-mask
"
,
"
style
"
:
maskStyle
.
value
"
class
"
:
"
uni-picker-view-mask
"
},
[
createVNode
(
"
u-scalable
"
,
{
"
class
"
:
"
uni-picker-view-mask uni-picker-view-mask-top
"
,
"
style
"
:
{
"
style
"
:
extend
({},
maskTopStyle
.
value
,
{
bottom
:
maskPosition
}
}
)
},
null
),
createVNode
(
"
u-scalable
"
,
{
"
class
"
:
"
uni-picker-view-mask uni-picker-view-mask-bottom
"
,
"
style
"
:
{
"
style
"
:
extend
({},
maskBottomStyle
.
value
,
{
top
:
maskPosition
}
}
)
},
null
)]),
createVNode
(
"
u-scalable
"
,
{
"
ref
"
:
indicatorRef
,
"
class
"
:
"
uni-picker-view-indicator
"
,
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
0d315a3e
...
...
@@ -6344,7 +6344,8 @@ const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperCon
onMouseover
:
(
event
)
=>
navigationHover
(
event
,
"
over
"
),
onMouseout
:
(
event
)
=>
navigationHover
(
event
,
"
out
"
)
};
function
navigationClick
(
type
)
{
function
navigationClick
(
$event
,
type
)
{
$event
.
stopPropagation
();
const
swiperItemLength
=
swiperContext
.
value
.
length
;
let
_current
=
state
.
current
;
switch
(
type
)
{
...
...
@@ -6364,7 +6365,9 @@ const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperCon
onSwiperDotClick
(
_current
);
}
const
createNavigationSVG
=
()
=>
createSvgIconVNode
(
ICON_PATH_BACK
,
props2
.
navigationColor
,
26
);
const
_mouseMove
=
(
e2
)
=>
{
let
setHideNavigationTimer
;
const
_mousemove
=
(
e2
)
=>
{
clearTimeout
(
setHideNavigationTimer
);
const
{
clientX
,
clientY
...
...
@@ -6377,22 +6380,29 @@ const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperCon
width
,
height
}
=
rootRef
.
value
.
getBoundingClientRect
();
let
hide
=
false
;
if
(
props2
.
vertical
)
{
hide
Navigation
.
value
=
!
(
clientY
-
top
<
height
/
3
||
bottom
-
clientY
<
height
/
3
);
hide
=
!
(
clientY
-
top
<
height
/
3
||
bottom
-
clientY
<
height
/
3
);
}
else
{
hide
Navigation
.
value
=
!
(
clientX
-
left
<
width
/
3
||
right
-
clientX
<
width
/
3
);
hide
=
!
(
clientX
-
left
<
width
/
3
||
right
-
clientX
<
width
/
3
);
}
if
(
hide
)
{
return
setHideNavigationTimer
=
setTimeout
(()
=>
{
hideNavigation
.
value
=
hide
;
},
300
);
}
hideNavigation
.
value
=
hide
;
};
const
_mouse
Out
=
()
=>
{
const
_mouse
leave
=
()
=>
{
hideNavigation
.
value
=
true
;
};
function
swiperAddMouseEvent
()
{
if
(
rootRef
.
value
)
{
rootRef
.
value
.
removeEventListener
(
"
mousemove
"
,
_mouse
M
ove
);
rootRef
.
value
.
removeEventListener
(
"
mouse
out
"
,
_mouseOut
);
rootRef
.
value
.
removeEventListener
(
"
mousemove
"
,
_mouse
m
ove
);
rootRef
.
value
.
removeEventListener
(
"
mouse
leave
"
,
_mouseleave
);
if
(
isNavigationAuto
)
{
rootRef
.
value
.
addEventListener
(
"
mousemove
"
,
_mouse
M
ove
);
rootRef
.
value
.
addEventListener
(
"
mouse
out
"
,
_mouseOut
);
rootRef
.
value
.
addEventListener
(
"
mousemove
"
,
_mouse
m
ove
);
rootRef
.
value
.
addEventListener
(
"
mouse
leave
"
,
_mouseleave
);
}
}
}
...
...
@@ -6406,12 +6416,12 @@ const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperCon
"
class
"
:
[
"
uni-swiper-navigation uni-swiper-navigation-prev
"
,
shared
.
extend
({
"
uni-swiper-navigation-disabled
"
:
prevDisabled
},
navigationClass
)],
"
onClick
"
:
(
)
=>
navigationClick
(
"
prev
"
)
"
onClick
"
:
(
e2
)
=>
navigationClick
(
e2
,
"
prev
"
)
},
navigationAttr
),
[
createNavigationSVG
()],
16
,
[
"
onClick
"
]),
vue
.
createVNode
(
"
div
"
,
vue
.
mergeProps
({
"
class
"
:
[
"
uni-swiper-navigation uni-swiper-navigation-next
"
,
shared
.
extend
({
"
uni-swiper-navigation-disabled
"
:
nextDisabled
},
navigationClass
)],
"
onClick
"
:
(
)
=>
navigationClick
(
"
next
"
)
"
onClick
"
:
(
e2
)
=>
navigationClick
(
e2
,
"
next
"
)
},
navigationAttr
),
[
createNavigationSVG
()],
16
,
[
"
onClick
"
])]);
}
return
null
;
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
0d315a3e
...
...
@@ -13339,7 +13339,8 @@ const useSwiperNavigation = (rootRef, props2, state2, onSwiperDotClick, swiperCo
onMouseover: (event) => navigationHover(event, "over"),
onMouseout: (event) => navigationHover(event, "out")
};
function navigationClick(type) {
function navigationClick($event, type) {
$event.stopPropagation();
const swiperItemLength = swiperContext.value.length;
let _current = state2.current;
switch (type) {
...
...
@@ -13359,7 +13360,9 @@ const useSwiperNavigation = (rootRef, props2, state2, onSwiperDotClick, swiperCo
onSwiperDotClick(_current);
}
const createNavigationSVG = () => createSvgIconVNode(ICON_PATH_BACK, props2.navigationColor, 26);
const _mouseMove = (e2) => {
let setHideNavigationTimer;
const _mousemove = (e2) => {
clearTimeout(setHideNavigationTimer);
const {
clientX,
clientY
...
...
@@ -13372,22 +13375,29 @@ const useSwiperNavigation = (rootRef, props2, state2, onSwiperDotClick, swiperCo
width,
height
} = rootRef.value.getBoundingClientRect();
let hide = false;
if (props2.vertical) {
hide
Navigation.value
= !(clientY - top < height / 3 || bottom - clientY < height / 3);
hide = !(clientY - top < height / 3 || bottom - clientY < height / 3);
} else {
hide
Navigation.value
= !(clientX - left < width / 3 || right - clientX < width / 3);
hide = !(clientX - left < width / 3 || right - clientX < width / 3);
}
if (hide) {
return setHideNavigationTimer = setTimeout(() => {
hideNavigation.value = hide;
}, 300);
}
hideNavigation.value = hide;
};
const _mouse
Out
= () => {
const _mouse
leave
= () => {
hideNavigation.value = true;
};
function swiperAddMouseEvent() {
if (rootRef.value) {
rootRef.value.removeEventListener("mousemove", _mouse
M
ove);
rootRef.value.removeEventListener("mouse
out", _mouseOut
);
rootRef.value.removeEventListener("mousemove", _mouse
m
ove);
rootRef.value.removeEventListener("mouse
leave", _mouseleave
);
if (isNavigationAuto) {
rootRef.value.addEventListener("mousemove", _mouse
M
ove);
rootRef.value.addEventListener("mouse
out", _mouseOut
);
rootRef.value.addEventListener("mousemove", _mouse
m
ove);
rootRef.value.addEventListener("mouse
leave", _mouseleave
);
}
}
}
...
...
@@ -13402,12 +13412,12 @@ const useSwiperNavigation = (rootRef, props2, state2, onSwiperDotClick, swiperCo
"class": ["uni-swiper-navigation uni-swiper-navigation-prev", extend({
"uni-swiper-navigation-disabled": prevDisabled
}, navigationClass)],
"onClick": (
) => navigationClick(
"prev")
"onClick": (
e2) => navigationClick(e2,
"prev")
}, navigationAttr), [createNavigationSVG()], 16, ["onClick"]), createVNode("div", mergeProps({
"class": ["uni-swiper-navigation uni-swiper-navigation-next", extend({
"uni-swiper-navigation-disabled": nextDisabled
}, navigationClass)],
"onClick": (
) => navigationClick(
"next")
"onClick": (
e2) => navigationClick(e2,
"next")
}, navigationAttr), [createNavigationSVG()], 16, ["onClick"])]);
}
return null;
...
...
@@ -17857,6 +17867,20 @@ var ImagePreview = /* @__PURE__ */ defineSystemComponent({
function onChange2(event) {
indexRef.value = event.detail.current;
}
const closeBtnStyle = {
position: "absolute",
"box-sizing": "border-box",
top: "0",
left: "0",
width: "60px",
height: "44px",
padding: "6px",
"line-height": "32px",
"font-size": "26px",
color: "white",
"text-align": "center",
cursor: "pointer"
};
return () => {
let _slot;
return createVNode("div", {
...
...
@@ -17873,6 +17897,7 @@ var ImagePreview = /* @__PURE__ */ defineSystemComponent({
},
"onClick": onClick
}, [createVNode(Swiper, {
"navigation": "auto",
"current": indexRef.value,
"onChange": onChange2,
"indicator-dots": false,
...
...
@@ -17891,7 +17916,9 @@ var ImagePreview = /* @__PURE__ */ defineSystemComponent({
}))) ? _slot : {
default: () => [_slot],
_: 1
}, 8, ["current", "onChange"])], 8, ["onClick"]);
}, 8, ["current", "onChange"]), createVNode("div", {
"style": closeBtnStyle
}, [createSvgIconVNode(ICON_PATH_CLOSE, "#ffffff", 26)], 4)], 8, ["onClick"]);
};
}
});
...
...
packages/uni-uts-vite/src/plugins/v1.ts
浏览文件 @
0d315a3e
...
...
@@ -15,6 +15,10 @@ import {
VariableDeclaration
,
}
from
'
../../types/types
'
import
{
getCompiler
}
from
'
../utils/compiler
'
import
{
createResolveTypeReferenceName
,
resolvePackage
,
}
from
'
../utils/compiler/utils
'
export
function
uniUtsV1Plugin
():
Plugin
{
let
isFirst
=
true
...
...
@@ -28,6 +32,7 @@ export function uniUtsV1Plugin(): Plugin {
}
// 目前仅支持 app-android|app-ios
if
(
process
.
env
.
UNI_UTS_PLATFORM
!==
'
app
'
&&
process
.
env
.
UNI_UTS_PLATFORM
!==
'
app-android
'
&&
process
.
env
.
UNI_UTS_PLATFORM
!==
'
app-ios
'
)
{
...
...
@@ -37,12 +42,11 @@ export function uniUtsV1Plugin(): Plugin {
if
(
path
.
extname
(
filename
)
!==
'
.uts
'
)
{
return
}
const
{
compile
,
parsePackage
,
createResolveTypeReferenceName
}
=
getCompiler
(
process
.
env
.
UNI_UTS_PLATFORM
===
'
app-ios
'
?
'
swift
'
:
'
kotlin
'
)
const
pkg
=
parsePackage
(
filename
)
if
(
!
pkg
.
class
)
{
const
{
compile
}
=
getCompiler
(
process
.
env
.
UNI_UTS_PLATFORM
===
'
app-ios
'
?
'
swift
'
:
'
kotlin
'
)
const
pkg
=
resolvePackage
(
filename
)
if
(
!
pkg
)
{
return
}
// 懒加载 uts 编译器
...
...
@@ -50,11 +54,23 @@ export function uniUtsV1Plugin(): Plugin {
const
{
parse
}
=
require
(
'
@dcloudio/uts
'
)
const
ast
=
await
parse
(
preJs
(
code
),
{
noColor
:
isInHBuilderX
()
})
code
=
`
import { initUtsProxyClass, initUtsProxyFunction } from '@dcloudio/uni-app'
const pkg = '
${
pkg
.
package
}
'
const cls = '
${
pkg
.
class
}
'
import { initUtsProxyClass, initUtsProxyFunction, initUtsPackageName, initUtsClassName } from '@dcloudio/uni-app'
const name = '
${
pkg
.
name
}
'
const is_uni_modules =
${
pkg
.
is_uni_modules
}
const pkg = initUtsPackageName(name, is_uni_modules)
const cls = initUtsClassName(name, is_uni_modules)
${
genProxyCode
(
ast
,
createResolveTypeReferenceName
(
pkg
.
namespace
,
ast
))}
`
// 平台不匹配,不走平台代码编译,仅生成js代码
if
(
process
.
env
.
UNI_UTS_PLATFORM
===
'
app
'
||
(
process
.
env
.
UNI_UTS_PLATFORM
===
'
app-android
'
&&
id
.
includes
(
'
app-ios
'
))
||
(
process
.
env
.
UNI_UTS_PLATFORM
===
'
app-ios
'
&&
id
.
includes
(
'
app-android
'
))
)
{
return
code
}
const
res
=
await
compile
(
id
)
if
(
process
.
env
.
UNI_UTS_PLATFORM
===
'
app-android
'
)
{
if
(
!
isFirst
&&
res
)
{
...
...
packages/uni-uts-vite/src/utils/compiler/index.ts
浏览文件 @
0d315a3e
import
{
compileKotlin
,
parseKotlinPackage
,
createKotlinResolveTypeReferenceName
,
}
from
'
./kotlin
'
import
{
compileSwift
,
parseSwiftPackage
,
createSwiftResolveTypeReferenceName
,
}
from
'
./swift
'
import
{
compileKotlin
}
from
'
./kotlin
'
import
{
compileSwift
}
from
'
./swift
'
export
function
getCompiler
(
type
:
'
kotlin
'
|
'
swift
'
)
{
if
(
type
===
'
swift
'
)
{
return
{
compile
:
compileSwift
,
parsePackage
:
parseSwiftPackage
,
createResolveTypeReferenceName
:
createSwiftResolveTypeReferenceName
,
}
}
return
{
compile
:
compileKotlin
,
parsePackage
:
parseKotlinPackage
,
createResolveTypeReferenceName
:
createKotlinResolveTypeReferenceName
,
}
}
packages/uni-uts-vite/src/utils/compiler/kotlin.ts
浏览文件 @
0d315a3e
...
...
@@ -27,15 +27,13 @@ export function createKotlinResolveTypeReferenceName(
return
(
name
:
string
)
=>
name
}
export
function
parseKotlinPackage
(
filename
:
string
)
{
function
parseKotlinPackage
(
filename
:
string
)
{
const
res
=
resolvePackage
(
filename
)
if
(
!
res
)
{
return
{
package
:
''
,
namespace
:
''
,
class
:
''
}
return
{
package
:
''
}
}
return
{
package
:
'
uts.sdk.
'
+
(
res
.
is_uni_modules
?
'
modules.
'
:
''
)
+
res
.
name
,
namespace
:
''
,
class
:
'
IndexKt
'
,
}
}
...
...
packages/uni-uts-vite/src/utils/compiler/swift.ts
浏览文件 @
0d315a3e
import
{
isInHBuilderX
,
resolveSourceMapPath
}
from
'
@dcloudio/uni-cli-shared
'
import
{
capitalize
}
from
'
@vue/shared
'
import
{
Module
,
ModuleItem
}
from
'
../../../types/types
'
import
{
genUTSPlatformResource
,
getUtsCompiler
,
resolvePackage
}
from
'
./utils
'
function
resolveTypeAliasDeclNames
(
items
:
ModuleItem
[])
{
const
names
:
string
[]
=
[]
items
.
forEach
((
item
)
=>
{
if
(
item
.
type
===
'
TsTypeAliasDeclaration
'
)
{
names
.
push
(
item
.
id
.
value
)
}
})
return
names
}
export
function
createSwiftResolveTypeReferenceName
(
namespace
:
string
,
ast
:
Module
)
{
const
names
=
resolveTypeAliasDeclNames
(
ast
.
body
)
return
(
name
:
string
)
=>
{
if
(
names
.
includes
(
name
))
{
return
namespace
+
capitalize
(
name
)
}
return
name
}
}
export
function
parseSwiftPackage
(
filename
:
string
)
{
function
parseSwiftPackage
(
filename
:
string
)
{
const
res
=
resolvePackage
(
filename
)
if
(
!
res
)
{
return
{
package
:
''
,
namespace
:
''
,
class
:
''
,
}
}
const
namespace
=
'
UTSSDK
'
+
(
res
.
is_uni_modules
?
'
Modules
'
:
''
)
+
capitalize
(
res
.
name
)
return
{
package
:
''
,
namespace
,
class
:
namespace
+
'
IndexSwift
'
,
}
}
...
...
packages/uni-uts-vite/src/utils/compiler/utils.ts
浏览文件 @
0d315a3e
...
...
@@ -2,7 +2,8 @@ import path from 'path'
import
fs
from
'
fs-extra
'
import
type
{
parse
,
bundle
,
UtsTarget
}
from
'
@dcloudio/uts
'
import
{
normalizePath
}
from
'
@dcloudio/uni-cli-shared
'
import
{
camelize
}
from
'
@vue/shared
'
import
{
camelize
,
capitalize
}
from
'
@vue/shared
'
import
{
Module
,
ModuleItem
}
from
'
../../../types/types
'
export
function
getUtsCompiler
():
{
parse
:
typeof
parse
...
...
@@ -21,9 +22,11 @@ export function resolvePackage(filename: string) {
?
parts
.
findIndex
((
part
)
=>
part
===
'
uni_modules
'
)
:
parts
.
findIndex
((
part
)
=>
part
===
'
utssdk
'
)
if
(
index
>
-
1
)
{
const
name
=
camelize
(
parts
[
index
+
1
])
return
{
is_uni_modules
:
isUniModules
,
name
:
camelize
(
parts
[
index
+
1
]),
name
,
namespace
:
'
UTSSDK
'
+
(
isUniModules
?
'
Modules
'
:
''
)
+
capitalize
(
name
),
}
}
}
...
...
@@ -110,3 +113,23 @@ export function resolveUTSPlatformFile(
}
return
platformFile
}
function
resolveTypeAliasDeclNames
(
items
:
ModuleItem
[])
{
const
names
:
string
[]
=
[]
items
.
forEach
((
item
)
=>
{
if
(
item
.
type
===
'
TsTypeAliasDeclaration
'
)
{
names
.
push
(
item
.
id
.
value
)
}
})
return
names
}
export
function
createResolveTypeReferenceName
(
namespace
:
string
,
ast
:
Module
)
{
const
names
=
resolveTypeAliasDeclNames
(
ast
.
body
)
return
(
name
:
string
)
=>
{
if
(
names
.
includes
(
name
))
{
return
namespace
+
capitalize
(
name
)
}
return
name
}
}
packages/uts-darwin-arm64/uts.darwin-arm64.node
浏览文件 @
0d315a3e
无法预览此类型文件
packages/uts-darwin-x64/uts.darwin-x64.node
浏览文件 @
0d315a3e
无法预览此类型文件
packages/uts-win32-ia32-msvc/uts.win32-ia32-msvc.node
浏览文件 @
0d315a3e
无法预览此类型文件
packages/uts-win32-x64-msvc/uts.win32-x64-msvc.node
浏览文件 @
0d315a3e
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录