@joker.front/core 1.2.136 → 1.2.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -73
- package/dist/bundle.es.js +7 -11
- package/dist/bundle.js +7 -11
- package/package.json +7 -3
- package/types/component.d.ts +2 -1
- package/types/components/component.d.ts +0 -13
- package/types/components/container.d.ts +0 -15
- package/types/components/template.d.ts +0 -7
- package/types/docs/build/docs.d.ts +0 -1
- package/types/docs/build/markdown-it-demo.d.ts +0 -3
- package/types/docs/build/utils.d.ts +0 -3
- package/types/docs/common/loading.d.ts +0 -2
- package/types/docs/main.d.ts +0 -1
- package/types/eventBus.d.ts +0 -15
- package/types/filter.d.ts +0 -13
- package/types/src/component.d.ts +0 -216
- package/types/src/event-bus.d.ts +0 -15
- package/types/src/filter.d.ts +0 -13
- package/types/src/hmr.d.ts +0 -15
- package/types/src/index.d.ts +0 -10
- package/types/src/observer/dep.d.ts +0 -46
- package/types/src/observer/index.d.ts +0 -46
- package/types/src/observer/watcher.d.ts +0 -46
- package/types/src/parser/command/code.d.ts +0 -6
- package/types/src/parser/command/condition.d.ts +0 -22
- package/types/src/parser/command/for.d.ts +0 -23
- package/types/src/parser/command/section.d.ts +0 -8
- package/types/src/parser/comment.d.ts +0 -6
- package/types/src/parser/component.d.ts +0 -23
- package/types/src/parser/element.d.ts +0 -9
- package/types/src/parser/index.d.ts +0 -77
- package/types/src/parser/parser.d.ts +0 -82
- package/types/src/parser/render.d.ts +0 -86
- package/types/src/parser/text.d.ts +0 -6
- package/types/src/parser/vnode.d.ts +0 -182
- package/types/src/props.d.ts +0 -9
- package/types/src/utils/DI.d.ts +0 -15
package/README.md
CHANGED
|
@@ -1,91 +1,66 @@
|
|
|
1
|
-
# Joker
|
|
1
|
+
# Joker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Joker 是一个框架平台,旨在为所有开发场景提供支持。其中,Joker.front 是 Joker 平台下的前端开发框架,它提供标准化的前端开发标准,使用面向对象、组件化的编程模型,帮助你高效地开发用户界面。无论是简单还是复杂的界面,Joker.front 都可以轻松应对。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 什么是 Joker?
|
|
6
6
|
|
|
7
|
-
Joker.front
|
|
7
|
+
Joker 是一个框架平台,旨在为所有开发场景提供支持。其中,Joker.front 是 Joker 平台下的前端开发框架,它提供标准化的前端开发标准,使用面向对象、组件化的编程模型,帮助你高效地开发用户界面。无论是简单还是复杂的界面,Joker.front 都可以轻松应对。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Joker 是一个基于 TypeScript 构建的全能开发平台。无论是应对简单的界面开发需求,还是处理复杂的用户界面,都能展现出卓越的性能和稳定性。它涵盖了以下重要特性:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **强大的可扩展性**:Joker 提供基于组件的框架,平台设计之初就考虑到了扩展性,因此可以轻松地集成到现有的项目或系统中,支持可伸缩的 Web 应用构建,可以根据项目需求进行定制化开发。
|
|
12
|
+
- **丰富的组件库**:Joker.front 提供了一套丰富的前端组件库,包括路由、脚手架等经过精心设计和优化的功能和 UI 组件可以帮助开发者快速构建出美观且高性能的用户界面。
|
|
13
|
+
- **完善的开发工具**:为了进一步提升开发效率,Joker 还提供了一系列配套的开发工具,包括调试工具、构建工具等,这经过深思熟虑后设计出来工具旨在让开发过程变得更加顺畅,助力开发者可以准确快速的开发、构建、测试和更新代码。
|
|
14
|
+
- **Class API**:Joker 基于 Typescript 作为脚本开发标准,采用标准的 Class API 作为开发规范,更符合面向对象开发要求。
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
- **响应性**:Joker 会自动跟踪 JavaScript 状态并在其发生变化时响应式地更新 DOM,其中响应更新是即时的,不存在虚拟 DOM 的差异对比。
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
## 如何使用
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
你可以使用 Joker CLI 来创建项目,生成应用和库代码,以及执行各种持续开发任务,比如测试、打包和部署。
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
要安装 Joker CLI,请打开终端/控制台窗口,并运行如下命令:
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
```
|
|
25
|
+
pnpm i -g @joker.front/cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
1. 运行 CLI 命令 **joker create** 并提供 my-app 名称作为参数,如下所示:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
joker create my-app
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. 在 my-app 工作目录下,安装依赖
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
cd my-app
|
|
22
38
|
|
|
23
|
-
|
|
39
|
+
pnpm i
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
CLI 会创建一个新的工作区和一个简单的欢迎应用,你可以随时运行它。
|
|
24
43
|
|
|
25
|
-
|
|
44
|
+
## 运行应用
|
|
26
45
|
|
|
27
|
-
|
|
46
|
+
Joker CLI 中包含一个服务器命令 以及 构建命令,服务器命令可以方便你在本地构建和提供应用。
|
|
28
47
|
|
|
29
|
-
|
|
48
|
+
我们默认提供了`dev`和`build`两个命令,分别代表开发环境和代码构建。
|
|
30
49
|
|
|
31
|
-
|
|
50
|
+
1. 导航到 workspace 文件夹,比如 my-app。
|
|
32
51
|
|
|
33
52
|
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<p>我是一句话</p>
|
|
40
|
-
<p>
|
|
41
|
-
@变量
|
|
42
|
-
@方法(1)
|
|
43
|
-
@(1+1)
|
|
44
|
-
|
|
45
|
-
</p>
|
|
46
|
-
}
|
|
47
|
-
else if{
|
|
48
|
-
<p>我是else if</p>
|
|
49
|
-
}
|
|
50
|
-
else
|
|
51
|
-
{
|
|
52
|
-
<p>我是else</p>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@for (let i = 0; i < 数组.length; i++)
|
|
57
|
-
{
|
|
58
|
-
<p>@数组[i]</p>
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@for(let index in 数组)
|
|
63
|
-
{
|
|
64
|
-
<p>suoyin :@index value: @数组[index]</p>
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@for (let item of 对象)
|
|
69
|
-
{
|
|
70
|
-
<p>@item.a</p>
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@for (let(index, item) in 数组)
|
|
74
|
-
{
|
|
75
|
-
<p>索引:@index 项:@item</p>
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
</div>
|
|
79
|
-
<ChildrenComponent @click="组件回执方法" prop1="@变量">
|
|
80
|
-
@section("id",内容参数1,内容参数2){
|
|
81
|
-
<p>内容参数1</p>
|
|
82
|
-
<p>@父组件变量</p>
|
|
83
|
-
}
|
|
84
|
-
</ChildrenComponent>
|
|
85
|
-
|
|
86
|
-
<!--内容部分-->
|
|
87
|
-
|
|
88
|
-
@RenderSection()
|
|
89
|
-
|
|
90
|
-
@RenderSection("id",@对外传参)
|
|
53
|
+
cd my-app
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
2. 运行下列命令:
|
|
57
|
+
|
|
91
58
|
```
|
|
59
|
+
npm run dev
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
成功运行后,会开到一个简单的示例页面。
|
|
63
|
+
|
|
64
|
+
## 文档
|
|
65
|
+
|
|
66
|
+
[官网](http://www.jokers.pub)
|
package/dist/bundle.es.js
CHANGED
|
@@ -795,7 +795,7 @@ class Watcher {
|
|
|
795
795
|
this.value = newVal;
|
|
796
796
|
//这里过滤一些引用不想等,但值相等的值,只是不做响应,但不影响下次的值变更
|
|
797
797
|
//这里没有过滤掉this.value = newVal;
|
|
798
|
-
if (newVal !== oldVal && isEqual(newVal, oldVal, true)) {
|
|
798
|
+
if (newVal !== oldVal && !this.forceCallBack && isEqual(newVal, oldVal, true)) {
|
|
799
799
|
return;
|
|
800
800
|
}
|
|
801
801
|
this.updateCallBack(newVal, oldVal);
|
|
@@ -1562,6 +1562,7 @@ var Render;
|
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
1564
|
else if (attrName === "style" && isObject(attrVal)) {
|
|
1565
|
+
el.removeAttribute("style");
|
|
1565
1566
|
for (let name in attrVal) {
|
|
1566
1567
|
let isEmptyValue = false;
|
|
1567
1568
|
if (attrVal[name] === undefined || attrVal[name] === false) {
|
|
@@ -1571,14 +1572,8 @@ var Render;
|
|
|
1571
1572
|
if (isEmptyStr(val)) {
|
|
1572
1573
|
isEmptyValue = true;
|
|
1573
1574
|
}
|
|
1574
|
-
|
|
1575
|
-
if (isEmptyValue) {
|
|
1576
|
-
el.style.removeProperty(name);
|
|
1577
|
-
//@ts-ignore
|
|
1578
|
-
el.style[name] = "";
|
|
1579
|
-
continue;
|
|
1580
|
-
}
|
|
1581
|
-
else {
|
|
1575
|
+
//非空
|
|
1576
|
+
if (!isEmptyValue) {
|
|
1582
1577
|
//@ts-ignore
|
|
1583
1578
|
el.style[name] = val;
|
|
1584
1579
|
}
|
|
@@ -3171,12 +3166,13 @@ class Component {
|
|
|
3171
3166
|
* 观察值变更
|
|
3172
3167
|
* @param express
|
|
3173
3168
|
* @param callBack
|
|
3169
|
+
* @param forceCallBack 即使值相同也要强制触发callback
|
|
3174
3170
|
* @returns 销毁watcher
|
|
3175
3171
|
*/
|
|
3176
|
-
$watch(express, callBack) {
|
|
3172
|
+
$watch(express, callBack, forceCallBack) {
|
|
3177
3173
|
let watcher = new Watcher(express, (newVal, oldVal) => {
|
|
3178
3174
|
callBack(newVal, oldVal);
|
|
3179
|
-
});
|
|
3175
|
+
}, undefined, forceCallBack);
|
|
3180
3176
|
this[PRIVATE_WATCHERS].push(watcher);
|
|
3181
3177
|
return () => {
|
|
3182
3178
|
watcher.destroy();
|
package/dist/bundle.js
CHANGED
|
@@ -796,7 +796,7 @@ class Watcher {
|
|
|
796
796
|
this.value = newVal;
|
|
797
797
|
//这里过滤一些引用不想等,但值相等的值,只是不做响应,但不影响下次的值变更
|
|
798
798
|
//这里没有过滤掉this.value = newVal;
|
|
799
|
-
if (newVal !== oldVal && isEqual(newVal, oldVal, true)) {
|
|
799
|
+
if (newVal !== oldVal && !this.forceCallBack && isEqual(newVal, oldVal, true)) {
|
|
800
800
|
return;
|
|
801
801
|
}
|
|
802
802
|
this.updateCallBack(newVal, oldVal);
|
|
@@ -1563,6 +1563,7 @@ var Render;
|
|
|
1563
1563
|
}
|
|
1564
1564
|
}
|
|
1565
1565
|
else if (attrName === "style" && isObject(attrVal)) {
|
|
1566
|
+
el.removeAttribute("style");
|
|
1566
1567
|
for (let name in attrVal) {
|
|
1567
1568
|
let isEmptyValue = false;
|
|
1568
1569
|
if (attrVal[name] === undefined || attrVal[name] === false) {
|
|
@@ -1572,14 +1573,8 @@ var Render;
|
|
|
1572
1573
|
if (isEmptyStr(val)) {
|
|
1573
1574
|
isEmptyValue = true;
|
|
1574
1575
|
}
|
|
1575
|
-
|
|
1576
|
-
if (isEmptyValue) {
|
|
1577
|
-
el.style.removeProperty(name);
|
|
1578
|
-
//@ts-ignore
|
|
1579
|
-
el.style[name] = "";
|
|
1580
|
-
continue;
|
|
1581
|
-
}
|
|
1582
|
-
else {
|
|
1576
|
+
//非空
|
|
1577
|
+
if (!isEmptyValue) {
|
|
1583
1578
|
//@ts-ignore
|
|
1584
1579
|
el.style[name] = val;
|
|
1585
1580
|
}
|
|
@@ -3172,12 +3167,13 @@ class Component {
|
|
|
3172
3167
|
* 观察值变更
|
|
3173
3168
|
* @param express
|
|
3174
3169
|
* @param callBack
|
|
3170
|
+
* @param forceCallBack 即使值相同也要强制触发callback
|
|
3175
3171
|
* @returns 销毁watcher
|
|
3176
3172
|
*/
|
|
3177
|
-
$watch(express, callBack) {
|
|
3173
|
+
$watch(express, callBack, forceCallBack) {
|
|
3178
3174
|
let watcher = new Watcher(express, (newVal, oldVal) => {
|
|
3179
3175
|
callBack(newVal, oldVal);
|
|
3180
|
-
});
|
|
3176
|
+
}, undefined, forceCallBack);
|
|
3181
3177
|
this[PRIVATE_WATCHERS].push(watcher);
|
|
3182
3178
|
return () => {
|
|
3183
3179
|
watcher.destroy();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joker.front/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.138",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/bundle.js",
|
|
6
6
|
"module": "./dist/bundle.es.js",
|
|
@@ -23,15 +23,19 @@
|
|
|
23
23
|
"test:temp": "jest test/parser/cmd.spec.ts",
|
|
24
24
|
"build": "joker_build_library --sourcemap=false",
|
|
25
25
|
"release": "npm run test && npm run build && joker_release_library",
|
|
26
|
-
"release:prod":"npm run test && npm run build && npm publish --access public --registry https://registry.npmjs.org/"
|
|
26
|
+
"release:prod": "npm run test && npm run build && npm publish --access public --registry https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"author": "Zohar",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git"
|
|
32
32
|
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"joker"
|
|
35
|
+
],
|
|
36
|
+
"homepage": "jokers.pub",
|
|
33
37
|
"dependencies": {
|
|
34
|
-
"@joker.front/ast": "^1.3.
|
|
38
|
+
"@joker.front/ast": "^1.3.20"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
37
41
|
"@joker.front/library-cli": "^1.2.8",
|
package/types/component.d.ts
CHANGED
|
@@ -124,9 +124,10 @@ export declare class Component<T extends DefaultKeyVal = {}> implements ICompone
|
|
|
124
124
|
* 观察值变更
|
|
125
125
|
* @param express
|
|
126
126
|
* @param callBack
|
|
127
|
+
* @param forceCallBack 即使值相同也要强制触发callback
|
|
127
128
|
* @returns 销毁watcher
|
|
128
129
|
*/
|
|
129
|
-
$watch(express: () => any, callBack: (nv?: any, ov?: any) => void): () => void;
|
|
130
|
+
$watch(express: () => any, callBack: (nv?: any, ov?: any) => void, forceCallBack?: boolean): () => void;
|
|
130
131
|
/**
|
|
131
132
|
* 事件注册
|
|
132
133
|
* @param eventName
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component";
|
|
2
|
-
export declare class ComponentContainer extends Component {
|
|
3
|
-
template: never[];
|
|
4
|
-
propsType: {
|
|
5
|
-
name: StringConstructor;
|
|
6
|
-
data: ObjectConstructor;
|
|
7
|
-
};
|
|
8
|
-
private cache;
|
|
9
|
-
mounted(): void;
|
|
10
|
-
loadComponent(componentName: string): Promise<void>;
|
|
11
|
-
beforeDestory(): void;
|
|
12
|
-
removeCache(componentName?: string): void;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component } from "../index";
|
|
2
|
-
/**
|
|
3
|
-
* 动态组件容器
|
|
4
|
-
*/
|
|
5
|
-
export declare class ComponentContainer extends Component<{
|
|
6
|
-
name: string;
|
|
7
|
-
data: object;
|
|
8
|
-
}> {
|
|
9
|
-
template: never[];
|
|
10
|
-
private cache;
|
|
11
|
-
mounted(): void;
|
|
12
|
-
loadComponent(componentName?: string): Promise<void>;
|
|
13
|
-
beforeDestory(): void;
|
|
14
|
-
removeCache(componentName?: string): void;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/types/docs/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "@joker.front/ui/index.css";
|
package/types/eventBus.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type EventCallBackItem = {
|
|
2
|
-
callBack: EventCallBackType;
|
|
3
|
-
once?: Boolean;
|
|
4
|
-
};
|
|
5
|
-
export type EventCallBackType = (e: {
|
|
6
|
-
stopPropagation: Function;
|
|
7
|
-
callTimes: Number;
|
|
8
|
-
}, params?: any) => boolean | void;
|
|
9
|
-
export declare class EventBus<T extends string> {
|
|
10
|
-
private eventDatas;
|
|
11
|
-
on(eventName: T, callBack: EventCallBackType): void;
|
|
12
|
-
once(eventName: T, callBack: EventCallBackType): void;
|
|
13
|
-
off(eventName: T, callBack?: EventCallBackType): void;
|
|
14
|
-
trigger(eventName: T, param?: any): false | undefined;
|
|
15
|
-
}
|
package/types/filter.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type GlobalFilter = (...args: any[]) => string | void | undefined;
|
|
2
|
-
export declare const globalFilters: Record<string, GlobalFilter>;
|
|
3
|
-
/**
|
|
4
|
-
* 注册全局组件
|
|
5
|
-
* @param components 组件
|
|
6
|
-
*/
|
|
7
|
-
export declare function registerGlobalFilter(filters: Record<string, GlobalFilter>): void;
|
|
8
|
-
/**
|
|
9
|
-
* 根据注册key获取组件
|
|
10
|
-
* @param name 组件名称
|
|
11
|
-
* @returns 组件
|
|
12
|
-
*/
|
|
13
|
-
export declare function getGlobalFilter(key: string): GlobalFilter | undefined;
|
package/types/src/component.d.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { AST, IComponent, RENDER_HANDLER } from "@joker.front/ast";
|
|
2
|
-
import { NodeChangeType, ParserTemplate } from "./parser";
|
|
3
|
-
import { VNode } from "./parser/vnode";
|
|
4
|
-
import { PropType } from "./props";
|
|
5
|
-
declare const PROPS_DATA_KEY: unique symbol;
|
|
6
|
-
declare const PROPS_DATA_PROXY: unique symbol;
|
|
7
|
-
declare const PRIVATE_WATCHERS: unique symbol;
|
|
8
|
-
declare const EVENT_DATA_KEY: unique symbol;
|
|
9
|
-
declare const PARSER_TEMPLATE_TARGET: unique symbol;
|
|
10
|
-
export type TemplateType = Array<AST.Node> | ((h: typeof RENDER_HANDLER) => Array<AST.Node>);
|
|
11
|
-
export declare const SCOPE_ID: unique symbol;
|
|
12
|
-
export declare const JOKER_COMPONENT_TAG: unique symbol;
|
|
13
|
-
export type ComponentConstructor = typeof Component<any>;
|
|
14
|
-
export type ImportComponentConstructor = () => Promise<{
|
|
15
|
-
default: ComponentConstructor;
|
|
16
|
-
}>;
|
|
17
|
-
export type SectionType = {
|
|
18
|
-
asts: AST.Node[];
|
|
19
|
-
ob?: Component & Record<string, any>;
|
|
20
|
-
parser?: ParserTemplate;
|
|
21
|
-
params?: string[];
|
|
22
|
-
};
|
|
23
|
-
type DefaultKeyVal = Record<string | symbol, any>;
|
|
24
|
-
/**
|
|
25
|
-
* Joker组件
|
|
26
|
-
*/
|
|
27
|
-
export declare class Component<T extends DefaultKeyVal = {}> implements IComponent {
|
|
28
|
-
$sections: Record<string, SectionType>;
|
|
29
|
-
readonly isKeepAlive?: boolean | undefined;
|
|
30
|
-
static [JOKER_COMPONENT_TAG]: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* scopeId 配合css:Scoped
|
|
33
|
-
*/
|
|
34
|
-
[SCOPE_ID]?: string;
|
|
35
|
-
/**
|
|
36
|
-
* 可观察数据(具备劫持观察能力)
|
|
37
|
-
*/
|
|
38
|
-
model: DefaultKeyVal;
|
|
39
|
-
/**
|
|
40
|
-
* 渲染模板
|
|
41
|
-
*/
|
|
42
|
-
template?: TemplateType;
|
|
43
|
-
/**
|
|
44
|
-
* 挂载根
|
|
45
|
-
*/
|
|
46
|
-
$root: any;
|
|
47
|
-
/**
|
|
48
|
-
* 是否已睡眠
|
|
49
|
-
*/
|
|
50
|
-
isSleeped: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* 可用的声明组件
|
|
53
|
-
*/
|
|
54
|
-
components: Record<string, ComponentConstructor | ImportComponentConstructor>;
|
|
55
|
-
/**
|
|
56
|
-
* props辅助约束
|
|
57
|
-
* @example { name:"默认值",age:Number }
|
|
58
|
-
* 可以配置默认值,也可以配置为约束,类型参考PropType
|
|
59
|
-
*/
|
|
60
|
-
propsOption?: Partial<Record<keyof T, PropType | any>>;
|
|
61
|
-
private [PROPS_DATA_KEY];
|
|
62
|
-
private [PARSER_TEMPLATE_TARGET]?;
|
|
63
|
-
private [PROPS_DATA_PROXY]?;
|
|
64
|
-
private [PRIVATE_WATCHERS];
|
|
65
|
-
private [EVENT_DATA_KEY];
|
|
66
|
-
/**
|
|
67
|
-
* @param propData prop参数
|
|
68
|
-
* @param sections 渲染部分区域
|
|
69
|
-
* @param isKeepAlive 是否要保持存活,启用时再destroy时只会销毁UI部分,不会销毁数据,直到使用destroy(true)才会销毁
|
|
70
|
-
*/
|
|
71
|
-
constructor(propData?: T, $sections?: Record<string, SectionType>, isKeepAlive?: boolean | undefined);
|
|
72
|
-
/**
|
|
73
|
-
* 主动声明接受的参数
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
get props(): Readonly<Partial<T>>;
|
|
77
|
-
/**
|
|
78
|
-
* 挂载
|
|
79
|
-
* @param root
|
|
80
|
-
*/
|
|
81
|
-
$mount(root: any | VNode.Component<IComponent>): this;
|
|
82
|
-
/**
|
|
83
|
-
* 节点动画,仅支持 element及组件节点
|
|
84
|
-
*/
|
|
85
|
-
$nodeTransition(nodeOrRef: string | VNode.Node, mode: "enter" | "leave", name?: string, callBack?: Function, type?: "transition" | "animation"): void;
|
|
86
|
-
/**
|
|
87
|
-
* 销毁
|
|
88
|
-
*/
|
|
89
|
-
$destroy(force?: boolean): void;
|
|
90
|
-
/**
|
|
91
|
-
* VNode ref索引集
|
|
92
|
-
*/
|
|
93
|
-
get $refs(): Readonly<Record<string, Array<VNode.Node>>>;
|
|
94
|
-
/**
|
|
95
|
-
* 根据ref获取单个VNode
|
|
96
|
-
*/
|
|
97
|
-
$getRef<T extends VNode.Node>(ref: string): T | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* 获取相同ref的VNode集合
|
|
100
|
-
*/
|
|
101
|
-
$getRefs<T extends VNode.Node>(ref: string): Array<T> | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* 单向同步prop值,并监听变更后重新同步
|
|
104
|
-
* @param propKey 需要观察同步的props key
|
|
105
|
-
* @param modelKey 要赋值的model key,不传案prop key 进行赋值
|
|
106
|
-
* @param convertVal 值转换方法
|
|
107
|
-
*/
|
|
108
|
-
$syncProp(propKey: keyof T): void;
|
|
109
|
-
$syncProp(propKey: keyof T, modelKey: string): void;
|
|
110
|
-
$syncProp(propKey: keyof T, convertVal: (val: any) => any): void;
|
|
111
|
-
$syncProp(propKey: keyof T, modelKey: string, convertVal: (val: any) => any): void;
|
|
112
|
-
/**
|
|
113
|
-
* 根节点(虚拟DOM)
|
|
114
|
-
*/
|
|
115
|
-
get $rootVNode(): Readonly<VNode.Root> | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* 添加节点变更监听
|
|
118
|
-
* @param ref ref标记
|
|
119
|
-
* @param callBack
|
|
120
|
-
* @returns 销毁方法
|
|
121
|
-
*/
|
|
122
|
-
$watchNode(ref: string, callBack: (node: VNode.Node, type: NodeChangeType, property?: string) => void): (() => void) | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* 观察值变更
|
|
125
|
-
* @param express
|
|
126
|
-
* @param callBack
|
|
127
|
-
* @returns 销毁watcher
|
|
128
|
-
*/
|
|
129
|
-
$watch(express: () => any, callBack: (nv?: any, ov?: any) => void): () => void;
|
|
130
|
-
/**
|
|
131
|
-
* 事件注册
|
|
132
|
-
* @param eventName
|
|
133
|
-
* @param callBack
|
|
134
|
-
*/
|
|
135
|
-
$on(eventName: string, callBack: VNode.EventCallBack): void;
|
|
136
|
-
/**
|
|
137
|
-
* 事件卸载
|
|
138
|
-
* @param eventName
|
|
139
|
-
* @param callBack
|
|
140
|
-
*/
|
|
141
|
-
$off(eventName: string, callBack?: VNode.EventCallBack): void;
|
|
142
|
-
/**
|
|
143
|
-
* 触发事件
|
|
144
|
-
* @param eventName 事件名称
|
|
145
|
-
* @param param 参数
|
|
146
|
-
* @param targetEvent event
|
|
147
|
-
*/
|
|
148
|
-
$trigger(eventName: string, param?: any, targetEvent?: VNode.Event): void;
|
|
149
|
-
/**
|
|
150
|
-
* 主动渲染(仅渲染,一般适用于模板区域的热更新使用/或动态装载等复杂场景)
|
|
151
|
-
* @param newTemplate 可指定新的模板,否则按照原模板
|
|
152
|
-
* @param keepalive 渲染新模板时,是否要保留之前的存活组件(高级用法)
|
|
153
|
-
* @returns
|
|
154
|
-
*/
|
|
155
|
-
$render(newTemplate?: TemplateType, keepalive?: boolean): void;
|
|
156
|
-
/**
|
|
157
|
-
* 生命周期函数(完成初始化)
|
|
158
|
-
*/
|
|
159
|
-
protected created(): void;
|
|
160
|
-
/**
|
|
161
|
-
* 生命周期函数(完成挂载)
|
|
162
|
-
*/
|
|
163
|
-
protected mounted(): void;
|
|
164
|
-
/**
|
|
165
|
-
* 生命周期函数(销毁前)
|
|
166
|
-
*/
|
|
167
|
-
protected beforeDestroy(): void;
|
|
168
|
-
/**
|
|
169
|
-
* 睡眠时,在启用keepalive属性时才会触发该周期
|
|
170
|
-
*/
|
|
171
|
-
protected sleeped(): void;
|
|
172
|
-
/**
|
|
173
|
-
* 唤醒时,在启用keepalive属性时才会触发该周期
|
|
174
|
-
*/
|
|
175
|
-
protected wakeup(): void;
|
|
176
|
-
/**
|
|
177
|
-
* 生命周期函数(销毁后)
|
|
178
|
-
*/
|
|
179
|
-
protected destroyed(): void;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* 注册全局组件
|
|
183
|
-
* @param componentsOrName 组件名/列表
|
|
184
|
-
* @param component 组件
|
|
185
|
-
*/
|
|
186
|
-
export declare function registerGlobalComponent(componentsOrName: Record<string, ComponentConstructor> | string, component?: ComponentConstructor): void;
|
|
187
|
-
/**
|
|
188
|
-
* 根据注册key获取组件
|
|
189
|
-
* @param name 组件名称
|
|
190
|
-
* @returns 组件
|
|
191
|
-
*/
|
|
192
|
-
export declare function getGlobalComponent(key: string): ComponentConstructor | undefined;
|
|
193
|
-
/**
|
|
194
|
-
* 动态组件容器
|
|
195
|
-
*/
|
|
196
|
-
export declare class ComponentContainer extends Component<{
|
|
197
|
-
[key: string]: any;
|
|
198
|
-
name: string;
|
|
199
|
-
"transition-name": string;
|
|
200
|
-
}> {
|
|
201
|
-
template: never[];
|
|
202
|
-
private cache;
|
|
203
|
-
mounted(): void;
|
|
204
|
-
private propsVaule;
|
|
205
|
-
created(): void;
|
|
206
|
-
loadComponent(componentName?: string): Promise<void>;
|
|
207
|
-
beforeDestroy(): void;
|
|
208
|
-
removeCache(componentName?: string): void;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* 虚拟模板容器,用于进行归组,作为组件配置属性
|
|
212
|
-
*/
|
|
213
|
-
export declare class Template extends Component {
|
|
214
|
-
template: () => AST.Command[];
|
|
215
|
-
}
|
|
216
|
-
export {};
|
package/types/src/event-bus.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type EventCallBackItem = {
|
|
2
|
-
callBack: EventCallBackType;
|
|
3
|
-
once?: Boolean;
|
|
4
|
-
};
|
|
5
|
-
export type EventCallBackType = (e: {
|
|
6
|
-
stopPropagation: Function;
|
|
7
|
-
callTimes: Number;
|
|
8
|
-
}, params?: any) => boolean | void;
|
|
9
|
-
export declare class EventBus<T extends string> {
|
|
10
|
-
private eventDatas;
|
|
11
|
-
on(eventName: T, callBack: EventCallBackType): void;
|
|
12
|
-
once(eventName: T, callBack: EventCallBackType): void;
|
|
13
|
-
off(eventName: T, callBack?: EventCallBackType): void;
|
|
14
|
-
trigger(eventName: T, param?: any): false | undefined;
|
|
15
|
-
}
|
package/types/src/filter.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type GlobalFilter = (...args: any[]) => string | void | undefined;
|
|
2
|
-
export declare const globalFilters: Record<string, GlobalFilter>;
|
|
3
|
-
/**
|
|
4
|
-
* 注册全局组件
|
|
5
|
-
* @param components 组件
|
|
6
|
-
*/
|
|
7
|
-
export declare function registerGlobalFilter(filters: Record<string, GlobalFilter>): void;
|
|
8
|
-
/**
|
|
9
|
-
* 根据注册key获取组件
|
|
10
|
-
* @param name 组件名称
|
|
11
|
-
* @returns 组件
|
|
12
|
-
*/
|
|
13
|
-
export declare function getGlobalFilter(key: string): GlobalFilter | undefined;
|
package/types/src/hmr.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentConstructor, TemplateType } from "./component";
|
|
2
|
-
/**
|
|
3
|
-
* 热更新助手(热更新使用)(构建时会按需剔除)
|
|
4
|
-
*/
|
|
5
|
-
export declare let __JOKER_HMR_RUNTIME: {
|
|
6
|
-
recordRender: (id: string, template: {
|
|
7
|
-
render: TemplateType;
|
|
8
|
-
}) => void;
|
|
9
|
-
recordComponent: (id: string, component: {
|
|
10
|
-
component: ComponentConstructor;
|
|
11
|
-
}) => void;
|
|
12
|
-
record: (id: string, component: Component) => void;
|
|
13
|
-
reload: (id: string, component: ComponentConstructor) => void;
|
|
14
|
-
rerender: (id: string, template: TemplateType) => void;
|
|
15
|
-
};
|
package/types/src/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { AST, RENDER_HANDLER, createCodeFunction, createCommand, createComment, createElement, createFuntionBody, createText, createComponent } from "@joker.front/ast";
|
|
2
|
-
export * from "./component";
|
|
3
|
-
export * from "./parser/vnode";
|
|
4
|
-
export { ParserTemplate, NodeChangeType } from "./parser/index";
|
|
5
|
-
export * from "./observer/watcher";
|
|
6
|
-
export * from "./observer/index";
|
|
7
|
-
export * from "./utils/DI";
|
|
8
|
-
export * from "./hmr";
|
|
9
|
-
export * from "./event-bus";
|
|
10
|
-
export { registerGlobalFilter } from "./filter";
|