Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzb_79
uni-app
提交
514dab8e
U
uni-app
项目概览
lzb_79
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
514dab8e
编写于
7月 15, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): uni-app-plus
上级
28516be8
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
356 addition
and
151 deletion
+356
-151
packages/uni-app-plus/__tests__/service/dom/dom.spec.ts
packages/uni-app-plus/__tests__/service/dom/dom.spec.ts
+16
-14
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+12
-12
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+34
-29
packages/uni-app-plus/src/service/framework/dom/Page.ts
packages/uni-app-plus/src/service/framework/dom/Page.ts
+11
-12
packages/uni-app-plus/src/service/framework/dom/decodeActions.ts
...s/uni-app-plus/src/service/framework/dom/decodeActions.ts
+14
-14
packages/uni-app-plus/src/service/framework/dom/index.ts
packages/uni-app-plus/src/service/framework/dom/index.ts
+2
-3
packages/uni-app-plus/src/service/framework/dom/onNodeEvent.ts
...ges/uni-app-plus/src/service/framework/dom/onNodeEvent.ts
+7
-1
packages/uni-app-plus/src/service/framework/page/define.ts
packages/uni-app-plus/src/service/framework/page/define.ts
+1
-2
packages/uni-app-plus/src/service/framework/page/register.ts
packages/uni-app-plus/src/service/framework/page/register.ts
+1
-1
packages/uni-app-plus/src/view/framework/dom/components/UniCamera.ts
...i-app-plus/src/view/framework/dom/components/UniCamera.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/components/UniFunctionalPageNavigator.ts
...ew/framework/dom/components/UniFunctionalPageNavigator.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/components/UniLivePlayer.ts
...p-plus/src/view/framework/dom/components/UniLivePlayer.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/components/UniLivePusher.ts
...p-plus/src/view/framework/dom/components/UniLivePusher.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/components/UniOfficialAccount.ts
...s/src/view/framework/dom/components/UniOfficialAccount.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/components/UniOpenData.ts
...app-plus/src/view/framework/dom/components/UniOpenData.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts
...p-plus/src/view/framework/dom/elements/UniHoverElement.ts
+0
-1
packages/uni-app-plus/src/view/framework/dom/elements/UniTodoNode.ts
...i-app-plus/src/view/framework/dom/elements/UniTodoNode.ts
+7
-0
packages/uni-app-plus/src/view/framework/dom/index.ts
packages/uni-app-plus/src/view/framework/dom/index.ts
+6
-6
packages/uni-app-plus/src/view/framework/dom/modules/events.ts
...ges/uni-app-plus/src/view/framework/dom/modules/events.ts
+1
-1
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+23
-0
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+126
-0
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+13
-1
packages/uni-shared/src/vdom/Action.ts
packages/uni-shared/src/vdom/Action.ts
+56
-30
packages/uni-shared/src/vdom/constants.ts
packages/uni-shared/src/vdom/constants.ts
+1
-0
packages/uni-shared/src/vdom/index.ts
packages/uni-shared/src/vdom/index.ts
+1
-0
未找到文件。
packages/uni-app-plus/__tests__/service/dom/dom.spec.ts
浏览文件 @
514dab8e
import
{
encodeEvent
,
encodeTag
,
UniEventListener
}
from
'
@dcloudio/uni-shared
'
import
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
CreateAction
,
encodeEvent
,
encodeTag
,
InsertAction
,
SetAttributeAction
,
UniEventListener
,
}
from
'
@dcloudio/uni-shared
'
import
{
createPageNode
}
from
'
../../../src/service/framework/dom/Page
'
import
{
createElement
,
createTextNode
,
withModifiers
,
}
from
'
../../../../uni-app-vue/lib/service.runtime.esm
'
import
{
InsertAction
,
ACTION_TYPE_INSERT
,
SetAttributeAction
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ACTION_TYPE_REMOVE
,
CreateAction
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_REMOVE_EVENT
,
}
from
'
../../../src/PageAction
'
import
{
EventModifierFlags
}
from
'
@dcloudio/uni-shared
'
describe
(
'
dom
'
,
()
=>
{
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
514dab8e
...
...
@@ -986,6 +986,18 @@ var serviceContext = (function (vue) {
}
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache = Object.create(null);
return (str) => {
...
...
@@ -8208,18 +8220,6 @@ var serviceContext = (function (vue) {
const INVOKE_VIEW_API = 'invokeViewApi';
const INVOKE_SERVICE_API = 'invokeServiceApi';
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function onNodeEvent(nodeId, evt, pageNode) {
pageNode.fireEvent(nodeId, evt);
}
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
514dab8e
...
...
@@ -270,6 +270,17 @@
function decodeAttr(name) {
return DECODED_ATTR_MAP[name] || name;
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache2 = Object.create(null);
return (str) => {
...
...
@@ -5820,17 +5831,6 @@
});
}
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
class UniNode {
constructor(id2, tag, parentNodeId, element) {
this.isMounted = false;
...
...
@@ -14443,9 +14443,14 @@
super(id2, "uni-button", Button, parentNodeId, nodeJson);
}
}
class UniCamera extends UniNode {
constructor(id2) {
super(id2, "uni-camera");
class UniTodoNode extends UniNode {
constructor(id2, tag, parentNodeId) {
super(id2, tag, parentNodeId);
}
}
class UniCamera extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-camera", parentNodeId);
}
}
var canvas = "uni-canvas {\n width: 300px;\n height: 150px;\n display: block;\n position: relative;\n}\n\nuni-canvas > .uni-canvas-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n";
...
...
@@ -14873,9 +14878,9 @@
super(id2, "uni-form", Form, parentNodeId, nodeJson, "span");
}
}
class UniFunctionalPageNavigator extends UniNode {
constructor(id2) {
super(id2, "uni-functional-page-navigator");
class UniFunctionalPageNavigator extends Uni
Todo
Node {
constructor(id2
, parentNodeId
) {
super(id2, "uni-functional-page-navigator"
, parentNodeId
);
}
}
var icon = "uni-icon {\n display: inline-block;\n font-size: 0;\n box-sizing: border-box;\n}\n\nuni-icon[hidden] {\n display: none;\n}\n";
...
...
@@ -14902,14 +14907,14 @@
super(id2, "uni-label", Label, parentNodeId, nodeJson);
}
}
class UniLivePlayer extends UniNode {
constructor(id2) {
super(id2, "uni-live-player");
class UniLivePlayer extends Uni
Todo
Node {
constructor(id2
, parentNodeId
) {
super(id2, "uni-live-player"
, parentNodeId
);
}
}
class UniLivePusher extends UniNode {
constructor(id2) {
super(id2, "uni-live-pusher");
class UniLivePusher extends Uni
Todo
Node {
constructor(id2
, parentNodeId
) {
super(id2, "uni-live-pusher"
, parentNodeId
);
}
}
var Map$1 = /* @__PURE__ */ defineBuiltInComponent({
...
...
@@ -14938,14 +14943,14 @@
super(id2, "uni-navigator", Navigator, parentNodeId, nodeJson);
}
}
class UniOfficialAccount extends UniNode {
constructor(id2) {
super(id2, "uni-official-account");
class UniOfficialAccount extends Uni
Todo
Node {
constructor(id2
, parentNodeId
) {
super(id2, "uni-official-account"
, parentNodeId
);
}
}
class UniOpenData extends UniNode {
constructor(id2) {
super(id2, "uni-open-data");
class UniOpenData extends Uni
Todo
Node {
constructor(id2
, parentNodeId
) {
super(id2, "uni-open-data"
, parentNodeId
);
}
}
var Picker = /* @__PURE__ */ defineBuiltInComponent({
...
...
packages/uni-app-plus/src/service/framework/dom/Page.ts
浏览文件 @
514dab8e
...
...
@@ -7,24 +7,23 @@ import {
formatLog
,
UniEvent
,
UniNodeJSON
,
}
from
'
@dcloudio/uni-shared
'
import
{
PageCreateAction
,
PageCreatedAction
,
PageAction
,
PageNodeOptions
,
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
CreateAction
,
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_REMOVE_EVENT
,
}
from
'
../../../PageAction
'
PageAction
,
PageCreateAction
,
PageCreatedAction
,
PageNodeOptions
,
}
from
'
@dcloudio/uni-shared
'
import
{
VD_SYNC
}
from
'
../../../constants
'
export
default
class
UniPageNode
extends
UniNode
implements
IUniPageNode
{
...
...
packages/uni-app-plus/src/service/framework/dom/decodeActions.ts
浏览文件 @
514dab8e
import
{
decodeTag
}
from
'
@dcloudio/uni-shared
'
import
{
CreateAction
,
InsertAction
,
RemoveAction
,
SetAttributeAction
,
RemoveAttributeAction
,
SetTextAction
,
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
AddEventAction
,
CreateAction
,
decodeTag
,
InsertAction
,
PageAction
,
PageCreateAction
,
PageCreatedAction
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
AddEventAction
,
RemoveAction
,
RemoveAttributeAction
,
RemoveEventAction
,
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_REMOVE_EVENT
,
}
from
'
../../../PageAction
'
SetAttributeAction
,
SetTextAction
,
}
from
'
@dcloudio/uni-shared
'
function
decodePageCreateAction
([,
pageCreateData
]:
PageCreateAction
)
{
return
[
'
pageCreate
'
,
pageCreateData
]
...
...
packages/uni-app-plus/src/service/framework/dom/index.ts
浏览文件 @
514dab8e
import
{
getPageById
}
from
'
@dcloudio/uni-core
'
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
ACTION_TYPE_EVENT
,
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
ACTION_TYPE_EVENT
,
EventAction
}
from
'
../../../PageAction
'
import
{
onNodeEvent
}
from
'
./onNodeEvent
'
import
{
EventAction
,
onNodeEvent
}
from
'
./onNodeEvent
'
import
UniPageNode
from
'
./Page
'
export
function
onVdSync
(
actions
:
EventAction
[],
pageId
:
string
)
{
...
...
packages/uni-app-plus/src/service/framework/dom/onNodeEvent.ts
浏览文件 @
514dab8e
import
{
UniEvent
}
from
'
@dcloudio/uni-shared
'
import
{
ACTION_TYPE_EVENT
,
UniEvent
}
from
'
@dcloudio/uni-shared
'
import
UniPageNode
from
'
./Page
'
export
type
EventAction
=
[
typeof
ACTION_TYPE_EVENT
,
Parameters
<
typeof
onNodeEvent
>
[
0
],
Parameters
<
typeof
onNodeEvent
>
[
1
]
]
export
function
onNodeEvent
(
nodeId
:
number
,
evt
:
UniEvent
,
...
...
packages/uni-app-plus/src/service/framework/page/define.ts
浏览文件 @
514dab8e
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
{
once
,
PageNodeOptions
}
from
'
@dcloudio/uni-shared
'
import
{
createApp
,
DefineComponent
}
from
'
vue
'
import
{
createPageNode
}
from
'
../dom/Page
'
import
{
setupPage
}
from
'
./setup
'
import
__vuePlugin
from
'
../plugin
'
import
{
PageNodeOptions
}
from
'
../../../PageAction
'
export
type
VuePageComponent
=
DefineComponent
<
PageProps
>
...
...
packages/uni-app-plus/src/service/framework/page/register.ts
浏览文件 @
514dab8e
...
...
@@ -4,6 +4,7 @@ import {
formatLog
,
NAVBAR_HEIGHT
,
ON_REACH_BOTTOM_DISTANCE
,
PageNodeOptions
,
}
from
'
@dcloudio/uni-shared
'
import
{
initPageInternalInstance
}
from
'
@dcloudio/uni-core
'
...
...
@@ -11,7 +12,6 @@ import { initEntry } from '../app/initEntry'
import
{
initRouteOptions
}
from
'
./routeOptions
'
import
{
createWebview
,
initWebview
}
from
'
../webview
'
import
{
createPage
}
from
'
./define
'
import
{
PageNodeOptions
}
from
'
../../../PageAction
'
import
{
getStatusbarHeight
}
from
'
../../../helpers/statusBar
'
import
tabBar
from
'
../app/tabBar
'
import
{
addCurrentPage
}
from
'
./getCurrentPages
'
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniCamera.ts
浏览文件 @
514dab8e
import
{
Uni
Node
}
from
'
../elements/Uni
Node
'
import
{
Uni
TodoNode
}
from
'
../elements/UniTodo
Node
'
export
class
UniCamera
extends
UniNode
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-camera
'
)
export
class
UniCamera
extends
Uni
Todo
Node
{
constructor
(
id
:
number
,
parentNodeId
:
number
)
{
super
(
id
,
'
uni-camera
'
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniFunctionalPageNavigator.ts
浏览文件 @
514dab8e
import
{
Uni
Node
}
from
'
../elements/Uni
Node
'
import
{
Uni
TodoNode
}
from
'
../elements/UniTodo
Node
'
export
class
UniFunctionalPageNavigator
extends
UniNode
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-functional-page-navigator
'
)
export
class
UniFunctionalPageNavigator
extends
Uni
Todo
Node
{
constructor
(
id
:
number
,
parentNodeId
:
number
)
{
super
(
id
,
'
uni-functional-page-navigator
'
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniLivePlayer.ts
浏览文件 @
514dab8e
import
{
Uni
Node
}
from
'
../elements/Uni
Node
'
import
{
Uni
TodoNode
}
from
'
../elements/UniTodo
Node
'
export
class
UniLivePlayer
extends
UniNode
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-live-player
'
)
export
class
UniLivePlayer
extends
Uni
Todo
Node
{
constructor
(
id
:
number
,
parentNodeId
:
number
)
{
super
(
id
,
'
uni-live-player
'
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniLivePusher.ts
浏览文件 @
514dab8e
import
{
Uni
Node
}
from
'
../elements/Uni
Node
'
import
{
Uni
TodoNode
}
from
'
../elements/UniTodo
Node
'
export
class
UniLivePusher
extends
UniNode
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-live-pusher
'
)
export
class
UniLivePusher
extends
Uni
Todo
Node
{
constructor
(
id
:
number
,
parentNodeId
:
number
)
{
super
(
id
,
'
uni-live-pusher
'
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniOfficialAccount.ts
浏览文件 @
514dab8e
import
{
Uni
Node
}
from
'
../elements/Uni
Node
'
import
{
Uni
TodoNode
}
from
'
../elements/UniTodo
Node
'
export
class
UniOfficialAccount
extends
UniNode
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-official-account
'
)
export
class
UniOfficialAccount
extends
Uni
Todo
Node
{
constructor
(
id
:
number
,
parentNodeId
:
number
)
{
super
(
id
,
'
uni-official-account
'
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniOpenData.ts
浏览文件 @
514dab8e
import
{
Uni
Node
}
from
'
../elements/Uni
Node
'
import
{
Uni
TodoNode
}
from
'
../elements/UniTodo
Node
'
export
class
UniOpenData
extends
UniNode
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-open-data
'
)
export
class
UniOpenData
extends
Uni
Todo
Node
{
constructor
(
id
:
number
,
parentNodeId
:
number
)
{
super
(
id
,
'
uni-open-data
'
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts
浏览文件 @
514dab8e
import
{
formatLog
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniCustomElement
}
from
'
../components
'
import
{
UniElement
}
from
'
./UniElement
'
interface
HoverProps
{
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniTodoNode.ts
0 → 100644
浏览文件 @
514dab8e
import
{
UniNode
}
from
'
../elements/UniNode
'
export
class
UniTodoNode
extends
UniNode
{
constructor
(
id
:
number
,
tag
:
string
,
parentNodeId
:
number
)
{
super
(
id
,
tag
,
parentNodeId
)
}
}
packages/uni-app-plus/src/view/framework/dom/index.ts
浏览文件 @
514dab8e
import
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_INSERT
,
PageAction
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
PageAction
,
}
from
'
../../../PageAction
'
}
from
'
@dcloudio/uni-shared
'
import
{
$
,
createElement
,
onPageCreate
,
onPageCreated
}
from
'
./page
'
import
{
flushPostActionJobs
}
from
'
./scheduler
'
...
...
packages/uni-app-plus/src/view/framework/dom/modules/events.ts
浏览文件 @
514dab8e
...
...
@@ -6,9 +6,9 @@ import {
formatLog
,
EventModifierFlags
,
normalizeEventType
,
ACTION_TYPE_EVENT
,
}
from
'
@dcloudio/uni-shared
'
import
{
VD_SYNC
}
from
'
../../../../constants
'
import
{
ACTION_TYPE_EVENT
}
from
'
../../../../PageAction
'
import
{
UniCustomElement
}
from
'
../components
'
export
function
patchEvent
(
el
:
UniCustomElement
,
name
:
string
,
flag
:
number
)
{
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
514dab8e
...
...
@@ -904,6 +904,18 @@ function decodeTag(tag) {
return
(
DECODED_COMPONENT_ARR
[
tag
]
||
tag
);
}
const
ACTION_TYPE_PAGE_CREATE
=
1
;
const
ACTION_TYPE_PAGE_CREATED
=
2
;
const
ACTION_TYPE_CREATE
=
3
;
const
ACTION_TYPE_INSERT
=
4
;
const
ACTION_TYPE_REMOVE
=
5
;
const
ACTION_TYPE_SET_ATTRIBUTE
=
6
;
const
ACTION_TYPE_REMOVE_ATTRIBUTE
=
7
;
const
ACTION_TYPE_ADD_EVENT
=
8
;
const
ACTION_TYPE_REMOVE_EVENT
=
9
;
const
ACTION_TYPE_SET_TEXT
=
10
;
const
ACTION_TYPE_EVENT
=
20
;
function
cache
(
fn
)
{
const
cache
=
Object
.
create
(
null
);
return
(
str
)
=>
{
...
...
@@ -1014,6 +1026,17 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
exports
.
ACTION_TYPE_ADD_EVENT
=
ACTION_TYPE_ADD_EVENT
;
exports
.
ACTION_TYPE_CREATE
=
ACTION_TYPE_CREATE
;
exports
.
ACTION_TYPE_EVENT
=
ACTION_TYPE_EVENT
;
exports
.
ACTION_TYPE_INSERT
=
ACTION_TYPE_INSERT
;
exports
.
ACTION_TYPE_PAGE_CREATE
=
ACTION_TYPE_PAGE_CREATE
;
exports
.
ACTION_TYPE_PAGE_CREATED
=
ACTION_TYPE_PAGE_CREATED
;
exports
.
ACTION_TYPE_REMOVE
=
ACTION_TYPE_REMOVE
;
exports
.
ACTION_TYPE_REMOVE_ATTRIBUTE
=
ACTION_TYPE_REMOVE_ATTRIBUTE
;
exports
.
ACTION_TYPE_REMOVE_EVENT
=
ACTION_TYPE_REMOVE_EVENT
;
exports
.
ACTION_TYPE_SET_ATTRIBUTE
=
ACTION_TYPE_SET_ATTRIBUTE
;
exports
.
ACTION_TYPE_SET_TEXT
=
ACTION_TYPE_SET_TEXT
;
exports
.
BACKGROUND_COLOR
=
BACKGROUND_COLOR
;
exports
.
BUILT_IN_TAGS
=
BUILT_IN_TAGS
;
exports
.
COMPONENT_NAME_PREFIX
=
COMPONENT_NAME_PREFIX
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
514dab8e
import
{
FontFaceDescriptors
}
from
'
css-font-loading-module
'
;
export
declare
const
ACTION_TYPE_ADD_EVENT
=
8
;
export
declare
const
ACTION_TYPE_CREATE
=
3
;
export
declare
const
ACTION_TYPE_EVENT
=
20
;
export
declare
const
ACTION_TYPE_INSERT
=
4
;
export
declare
const
ACTION_TYPE_PAGE_CREATE
=
1
;
export
declare
const
ACTION_TYPE_PAGE_CREATED
=
2
;
export
declare
const
ACTION_TYPE_REMOVE
=
5
;
export
declare
const
ACTION_TYPE_REMOVE_ATTRIBUTE
=
7
;
export
declare
const
ACTION_TYPE_REMOVE_EVENT
=
9
;
export
declare
const
ACTION_TYPE_SET_ATTRIBUTE
=
6
;
export
declare
const
ACTION_TYPE_SET_TEXT
=
10
;
/**
* nodeId
* event
* flag
*/
export
declare
type
AddEventAction
=
[
typeof
ACTION_TYPE_ADD_EVENT
,
number
,
string
,
number
];
export
declare
function
addFont
(
family
:
string
,
source
:
string
,
desc
?:
FontFaceDescriptors
):
Promise
<
void
>
;
export
declare
const
BACKGROUND_COLOR
=
"
#f7f7f7
"
;
...
...
@@ -23,6 +57,20 @@ export declare const COMPONENT_PREFIX: string;
export
declare
const
COMPONENT_SELECTOR_PREFIX
=
"
uni-
"
;
/**
* nodeId
* tag
* parentNodeId
* nodeJson
*/
export
declare
type
CreateAction
=
[
typeof
ACTION_TYPE_CREATE
,
number
,
string
|
number
,
number
,
Partial
<
UniNodeJSON
>
?
];
export
declare
function
createRpx2Unit
(
unit
:
string
,
unitRatio
:
number
,
unitPrecision
:
number
):
(
val
:
string
)
=>
string
;
export
declare
const
DATA_RE
:
RegExp
;
...
...
@@ -86,6 +134,13 @@ declare interface HTMLElementWithDataset extends HTMLElement {
export
declare
function
initCustomDataset
():
void
;
/**
* nodeId
* parentNodeId
* refNodeId
*/
export
declare
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
number
,
number
,
number
];
export
declare
const
invokeArrayFns
:
(
fns
:
Function
[],
arg
?:
any
)
=>
any
;
export
declare
function
isBuiltInComponent
(
tag
:
string
):
boolean
;
...
...
@@ -146,6 +201,34 @@ declare interface Options {
complete
?:
(
res
:
any
)
=>
void
;
}
export
declare
type
PageAction
=
PageCreateAction
|
PageCreatedAction
|
PageUpdateAction
;
export
declare
type
PageCreateAction
=
[
typeof
ACTION_TYPE_PAGE_CREATE
,
PageCreateData
];
export
declare
type
PageCreatedAction
=
[
typeof
ACTION_TYPE_PAGE_CREATED
];
export
declare
interface
PageCreateData
extends
PageNodeOptions
{
}
export
declare
interface
PageNodeOptions
{
css
:
boolean
;
route
:
string
;
version
:
number
;
locale
:
string
;
platform
:
string
;
pixelRatio
:
number
;
windowWidth
:
number
;
disableScroll
:
boolean
;
onPageScroll
:
boolean
;
onPageReachBottom
:
boolean
;
onReachBottomDistance
:
number
;
statusbarHeight
:
number
;
windowTop
:
number
;
windowBottom
:
number
;
}
export
declare
type
PageUpdateAction
=
CreateAction
|
InsertAction
|
RemoveAction
|
AddEventAction
|
RemoveEventAction
|
SetAttributeAction
|
RemoveAttributeAction
|
SetTextAction
;
export
declare
function
parseEventName
(
name
:
string
):
[
string
,
EventListenerOptions
|
undefined
];
/**
...
...
@@ -172,6 +255,31 @@ export declare function plusReady(callback: () => void): void;
export
declare
const
PRIMARY_COLOR
=
"
#007aff
"
;
/**
* nodeId
*/
export
declare
type
RemoveAction
=
[
typeof
ACTION_TYPE_REMOVE
,
number
];
/**
* nodeId
* name
*/
export
declare
type
RemoveAttributeAction
=
[
typeof
ACTION_TYPE_REMOVE_ATTRIBUTE
,
number
,
string
];
/**
* nodeId
* event
*/
export
declare
type
RemoveEventAction
=
[
typeof
ACTION_TYPE_REMOVE_EVENT
,
number
,
string
];
export
declare
function
removeLeadingSlash
(
str
:
string
):
string
;
export
declare
const
RESPONSIVE_MIN_WIDTH
=
768
;
...
...
@@ -187,6 +295,24 @@ export { scrollTo_2 as scrollTo }
export
declare
const
SELECTED_COLOR
=
"
#0062cc
"
;
/**
* nodeId
* name
* value
*/
export
declare
type
SetAttributeAction
=
[
typeof
ACTION_TYPE_SET_ATTRIBUTE
,
number
,
string
,
unknown
];
/**
* nodeId
* text
*/
export
declare
type
SetTextAction
=
[
typeof
ACTION_TYPE_SET_TEXT
,
number
,
string
];
export
declare
function
stringifyQuery
(
obj
?:
Record
<
string
,
any
>
,
encodeStr
?:
typeof
encodeURIComponent
):
string
;
export
declare
const
TABBAR_HEIGHT
=
50
;
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
514dab8e
...
...
@@ -900,6 +900,18 @@ function decodeTag(tag) {
return
(
DECODED_COMPONENT_ARR
[
tag
]
||
tag
);
}
const
ACTION_TYPE_PAGE_CREATE
=
1
;
const
ACTION_TYPE_PAGE_CREATED
=
2
;
const
ACTION_TYPE_CREATE
=
3
;
const
ACTION_TYPE_INSERT
=
4
;
const
ACTION_TYPE_REMOVE
=
5
;
const
ACTION_TYPE_SET_ATTRIBUTE
=
6
;
const
ACTION_TYPE_REMOVE_ATTRIBUTE
=
7
;
const
ACTION_TYPE_ADD_EVENT
=
8
;
const
ACTION_TYPE_REMOVE_EVENT
=
9
;
const
ACTION_TYPE_SET_TEXT
=
10
;
const
ACTION_TYPE_EVENT
=
20
;
function
cache
(
fn
)
{
const
cache
=
Object
.
create
(
null
);
return
(
str
)
=>
{
...
...
@@ -1010,4 +1022,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
export
{
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventModifierFlags
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
ON_REACH_BOTTOM_DISTANCE
,
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
,
addFont
,
cache
,
cacheStringFunction
,
callOptions
,
createRpx2Unit
,
debounce
,
decode
,
decodeAttr
,
decodeEvent
,
decodeTag
,
decodedQuery
,
defaultRpx2Unit
,
encodeAttr
,
encodeEvent
,
encodeTag
,
formatDateTime
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
initCustomDataset
,
invokeArrayFns
,
isBuiltInComponent
,
isCustomElement
,
isNativeTag
,
isServiceCustomElement
,
isServiceNativeTag
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventModifierFlags
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
ON_REACH_BOTTOM_DISTANCE
,
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
,
addFont
,
cache
,
cacheStringFunction
,
callOptions
,
createRpx2Unit
,
debounce
,
decode
,
decodeAttr
,
decodeEvent
,
decodeTag
,
decodedQuery
,
defaultRpx2Unit
,
encodeAttr
,
encodeEvent
,
encodeTag
,
formatDateTime
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
initCustomDataset
,
invokeArrayFns
,
isBuiltInComponent
,
isCustomElement
,
isNativeTag
,
isServiceCustomElement
,
isServiceNativeTag
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
packages/uni-
app-plus/src/Page
Action.ts
→
packages/uni-
shared/src/vdom/
Action.ts
浏览文件 @
514dab8e
import
{
onNodeEvent
}
from
'
./service/framework/dom/onNodeEvent
'
import
{
createElement
}
from
'
./view/framework/dom/page
'
import
{
UniElement
}
from
'
./view/framework/dom/elements/UniElement
'
import
{
UniNodeJSON
}
from
'
./Node
'
export
const
ACTION_TYPE_PAGE_CREATE
=
1
export
const
ACTION_TYPE_PAGE_CREATED
=
2
...
...
@@ -37,53 +35,81 @@ export interface PageCreateData extends PageNodeOptions {}
export
type
PageCreateAction
=
[
typeof
ACTION_TYPE_PAGE_CREATE
,
PageCreateData
]
export
type
PageCreatedAction
=
[
typeof
ACTION_TYPE_PAGE_CREATED
]
export
type
EventAction
=
[
typeof
ACTION_TYPE_EVENT
,
Parameters
<
typeof
onNodeEvent
>
[
0
],
Parameters
<
typeof
onNodeEvent
>
[
1
]
]
/**
* nodeId
* tag
* parentNodeId
* nodeJson
*/
export
type
CreateAction
=
[
typeof
ACTION_TYPE_CREATE
,
...
Parameters
<
typeof
createElement
>
]
type
NodeAction
<
T
extends
Parameters
<
any
>>
=
[
/* nodeId */
number
,
...
T
]
export
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
insert
'
]
>>
]
export
type
RemoveAction
=
[
typeof
ACTION_TYPE_REMOVE
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
remove
'
]
>>
number
,
string
|
number
,
number
,
Partial
<
UniNodeJSON
>
?
]
/**
* nodeId
* parentNodeId
* refNodeId
*/
export
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
number
,
number
,
number
]
/**
* nodeId
*/
export
type
RemoveAction
=
[
typeof
ACTION_TYPE_REMOVE
,
number
]
/**
* nodeId
* event
* flag
*/
export
type
AddEventAction
=
[
typeof
ACTION_TYPE_ADD_EVENT
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
addEvent
'
]
>>
number
,
string
,
number
]
/**
* nodeId
* event
*/
export
type
RemoveEventAction
=
[
typeof
ACTION_TYPE_REMOVE_EVENT
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
removeEvent
'
]
>>
number
,
string
]
/**
* nodeId
* name
* value
*/
export
type
SetAttributeAction
=
[
typeof
ACTION_TYPE_SET_ATTRIBUTE
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
setAttr
'
]
>>
number
,
string
,
unknown
]
/**
* nodeId
* name
*/
export
type
RemoveAttributeAction
=
[
typeof
ACTION_TYPE_REMOVE_ATTRIBUTE
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
removeAttr
'
]
>>
number
,
string
]
export
type
SetTextAction
=
[
typeof
ACTION_TYPE_SET_TEXT
,
...
NodeAction
<
Parameters
<
UniElement
<
any
>
[
'
setText
'
]
>>
]
/**
* nodeId
* text
*/
export
type
SetTextAction
=
[
typeof
ACTION_TYPE_SET_TEXT
,
number
,
string
]
export
type
PageUpdateAction
=
|
CreateAction
...
...
packages/uni-shared/src/vdom/constants.ts
0 → 100644
浏览文件 @
514dab8e
export
const
ACTION_MINIFY
=
true
packages/uni-shared/src/vdom/index.ts
浏览文件 @
514dab8e
...
...
@@ -20,3 +20,4 @@ export { UniTextNode } from './Text'
export
{
encodeAttr
,
encodeEvent
,
encodeTag
}
from
'
./encode
'
export
{
decodeAttr
,
decodeEvent
,
decodeTag
}
from
'
./decode
'
export
{
EventModifierFlags
}
from
'
./encode
'
export
*
from
'
./Action
'
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录