render-core 1.0.36 → 1.0.38
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/class/{apiController.d.ts → controller/apiController.d.ts} +1 -1
- package/class/{controller.d.ts → controller/controller.d.ts} +1 -1
- package/core/cmd/v-if.d.ts +1 -0
- package/core/cmd/v-if.js +2 -0
- package/core/cmd/v-show.js +5 -2
- package/{library → core}/inject/inject.d.ts +3 -3
- package/{library → core}/inject/inject.js +5 -5
- package/core/proxy/getProxy.d.ts +12 -1
- package/core/proxy/getProxy.js +25 -1
- package/core/render/PostRender.d.ts +13 -0
- package/core/render/PostRender.js +39 -0
- package/core/render/delivery.d.ts +6 -0
- package/core/render/delivery.js +42 -0
- package/core/render/initRender.d.ts +13 -6
- package/core/render/initRender.js +39 -39
- package/core/render/rawRender.d.ts +13 -0
- package/core/render/rawRender.js +39 -0
- package/core/render/updateRender.d.ts +6 -2
- package/core/render/updateRender.js +9 -5
- package/core/utility/injectUtility.d.ts +3 -3
- package/core/utility/miscUtility.d.ts +5 -0
- package/core/utility/miscUtility.js +5 -0
- package/core/utility/styleUtility.d.ts +3 -1
- package/core/utility/styleUtility.js +28 -0
- package/core/utility/templateUtility.d.ts +3 -0
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/library/cmd/cmd.d.ts +4 -4
- package/library/cmd/cmd.js +10 -0
- package/library/lifecycle/afterMethods.d.ts +17 -0
- package/library/lifecycle/afterMethods.js +24 -0
- package/library/lifecycle/controllerCycle.d.ts +6 -0
- package/library/lifecycle/controllerCycle.js +41 -0
- package/library/lifecycle/mount.d.ts +3 -0
- package/library/lifecycle/mount.js +13 -0
- package/library/loader/loader.d.ts +6 -0
- package/library/loader/loader.js +6 -0
- package/meta/app.d.ts +0 -1
- package/meta/app.js +1 -1
- package/package.json +1 -1
- package/runtime/runtime.d.ts +1 -1
- package/runtime/runtime.js +1 -1
- package/core/mixin/mixin.d.ts +0 -0
- package/core/mixin/mixin.js +0 -0
- package/library/getter/getter.d.ts +0 -1
- package/library/getter/getter.js +0 -6
- package/library/render/render.d.ts +0 -7
- package/library/render/render.js +0 -152
- package/library/setter/setter.d.ts +0 -5
- package/library/setter/setter.js +0 -23
- package/library/style/style.d.ts +0 -2
- package/library/style/style.js +0 -28
- package/library/tag/extend.d.ts +0 -14
- package/library/tag/extend.js +0 -4
- package/library/template/template.d.ts +0 -3
- /package/class/{apiComponent.d.ts → component/apiComponent.d.ts} +0 -0
- /package/class/{apiComponent.js → component/apiComponent.js} +0 -0
- /package/class/{component.d.ts → component/component.d.ts} +0 -0
- /package/class/{component.js → component/component.js} +0 -0
- /package/class/{apiController.js → controller/apiController.js} +0 -0
- /package/class/{controller.js → controller/controller.js} +0 -0
- /package/class/{pageController.d.ts → controller/pageController.d.ts} +0 -0
- /package/class/{pageController.js → controller/pageController.js} +0 -0
- /package/{library/template/template.js → core/utility/templateUtility.js} +0 -0
package/core/cmd/v-if.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function v_if(nodes: HTMLCollection, data: {}): void;
|
package/core/cmd/v-if.js
CHANGED
package/core/cmd/v-show.js
CHANGED
|
@@ -7,13 +7,16 @@ export function resolver_show(elements, data) {
|
|
|
7
7
|
if (data[dataName] instanceof Boolean) {
|
|
8
8
|
if (data[dataName] === true) {
|
|
9
9
|
// @ts-ignore
|
|
10
|
-
elements[i].style.visibility =
|
|
10
|
+
elements[i].style.visibility = "visible";
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
elements[i].style.visibility =
|
|
14
|
+
elements[i].style.visibility = "hidden";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
else {
|
|
18
|
+
console.log("v-show instruct should be used with boolean!");
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
var subElements = elements[i].children;
|
|
19
22
|
resolver_show(subElements, data);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
2
|
-
import { Component } from "../../class/component";
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { Component } from "../../class/component/component";
|
|
3
3
|
export declare function inject(controller: Controller, tagTemplate: Element): void;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function injectRefs(controller: Controller, tagTemplate: Element): void;
|
|
5
5
|
export declare function injectMethod(controller: Controller, proto: Component): void;
|
|
6
6
|
export declare function injectWatcher(controller: Controller, proto: Component): void;
|
|
7
7
|
export declare function injectComputed(controller: Controller, proto: Component): void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { getCodeSpaceForProps, getCodeSpaceForQuery, getCodeSpaceForRef, } from "
|
|
2
|
-
import { resolveProps } from "
|
|
3
|
-
import { resolve_Queries } from "
|
|
4
|
-
import { resolver_Refs } from "
|
|
1
|
+
import { getCodeSpaceForProps, getCodeSpaceForQuery, getCodeSpaceForRef, } from "../utility/injectUtility";
|
|
2
|
+
import { resolveProps } from "../resolver/props";
|
|
3
|
+
import { resolve_Queries } from "../resolver/query";
|
|
4
|
+
import { resolver_Refs } from "../cmd/v-ref";
|
|
5
5
|
export function inject(controller, tagTemplate) {
|
|
6
6
|
//注入props
|
|
7
7
|
getCodeSpaceForProps(controller.raw_data, resolveProps(Reflect.get(window, "context").crtTag, controller.proto.getProps()));
|
|
8
8
|
//注入query
|
|
9
9
|
getCodeSpaceForQuery(controller.raw_data, resolve_Queries());
|
|
10
10
|
}
|
|
11
|
-
export function
|
|
11
|
+
export function injectRefs(controller, tagTemplate) {
|
|
12
12
|
var refs = new Map();
|
|
13
13
|
resolver_Refs(controller.root.children, refs);
|
|
14
14
|
getCodeSpaceForRef(controller.raw_data, refs);
|
package/core/proxy/getProxy.d.ts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
/**
|
|
3
|
+
* 获取data对象的代理对象
|
|
4
|
+
* @param obj
|
|
5
|
+
* @param updater
|
|
6
|
+
*/
|
|
2
7
|
export declare function getProxyObject(obj: {}, updater: Controller): any;
|
|
8
|
+
/**
|
|
9
|
+
* 获取setter代理函数
|
|
10
|
+
* @param data
|
|
11
|
+
* @param updater
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSetter(data: {}, updater: Controller): any;
|
package/core/proxy/getProxy.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { update_Render } from "../render/updateRender";
|
|
2
|
+
/**
|
|
3
|
+
* 获取data对象的代理对象
|
|
4
|
+
* @param obj
|
|
5
|
+
* @param updater
|
|
6
|
+
*/
|
|
2
7
|
export function getProxyObject(obj, updater) {
|
|
3
8
|
//定义代理方法对象
|
|
4
9
|
var handel = {};
|
|
@@ -7,3 +12,22 @@ export function getProxyObject(obj, updater) {
|
|
|
7
12
|
//返回代理对象
|
|
8
13
|
return new Proxy(obj, handel);
|
|
9
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* 获取setter代理函数
|
|
17
|
+
* @param data
|
|
18
|
+
* @param updater
|
|
19
|
+
*/
|
|
20
|
+
export function getSetter(data, updater) {
|
|
21
|
+
var setter = function (obj, prop, value) {
|
|
22
|
+
//更新值
|
|
23
|
+
obj[prop] = value;
|
|
24
|
+
//更新前操作
|
|
25
|
+
this.proto.getBeforeUpdate();
|
|
26
|
+
//执行更新
|
|
27
|
+
update_Render(this);
|
|
28
|
+
//更新后操作
|
|
29
|
+
this.proto.getAfterUpdate();
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
32
|
+
return setter.bind(updater);
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from "../../class/component/component";
|
|
2
|
+
import { Controller } from "../../class/controller/controller";
|
|
3
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
4
|
+
import { PageController } from "../../class/controller/pageController";
|
|
5
|
+
/**
|
|
6
|
+
* 该函数用于初次渲染需要记录状态的组件
|
|
7
|
+
* @param proto
|
|
8
|
+
* @param parent
|
|
9
|
+
* @param child
|
|
10
|
+
* @param link
|
|
11
|
+
* @param tagTemplate
|
|
12
|
+
*/
|
|
13
|
+
export declare function post_render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { controllerCycleTypeTwo } from "../../library/lifecycle/controllerCycle";
|
|
3
|
+
import { cmd } from "../../library/cmd/cmd";
|
|
4
|
+
import { mount } from "../../library/lifecycle/mount";
|
|
5
|
+
import { injectRefs } from "../inject/inject";
|
|
6
|
+
import { afterMethodsTypeOne } from "../../library/lifecycle/afterMethods";
|
|
7
|
+
import { findComponent } from "./delivery";
|
|
8
|
+
/**
|
|
9
|
+
* 该函数用于初次渲染需要记录状态的组件
|
|
10
|
+
* @param proto
|
|
11
|
+
* @param parent
|
|
12
|
+
* @param child
|
|
13
|
+
* @param link
|
|
14
|
+
* @param tagTemplate
|
|
15
|
+
*/
|
|
16
|
+
export function post_render(proto, parent, child, link, tagTemplate) {
|
|
17
|
+
//获取控制对象
|
|
18
|
+
var controller = new Controller();
|
|
19
|
+
//控制对象预处理
|
|
20
|
+
controllerCycleTypeTwo(controller, proto, child, link, tagTemplate);
|
|
21
|
+
//beforeRender
|
|
22
|
+
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
23
|
+
beforeRender();
|
|
24
|
+
//解析指令
|
|
25
|
+
cmd(tagTemplate, proto, controller);
|
|
26
|
+
//beforeMount
|
|
27
|
+
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
28
|
+
beforeMount();
|
|
29
|
+
//mount
|
|
30
|
+
mount(controller, proto, parent, child, tagTemplate);
|
|
31
|
+
injectRefs(controller, tagTemplate);
|
|
32
|
+
//afterRender
|
|
33
|
+
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
34
|
+
afterRender();
|
|
35
|
+
//后处理
|
|
36
|
+
afterMethodsTypeOne(controller, child, link);
|
|
37
|
+
//深度渲染
|
|
38
|
+
findComponent(controller.root.children, controller);
|
|
39
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { Component } from "../../class/component/component";
|
|
3
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
4
|
+
import { PageController } from "../../class/controller/pageController";
|
|
5
|
+
export declare function Render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController): void;
|
|
6
|
+
export declare function findComponent(collection: HTMLCollection, link: Controller | ApiController | PageController): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isUnKnown } from "../utility/checkUtility";
|
|
2
|
+
import { init_render } from "./initRender";
|
|
3
|
+
import { post_render } from "./PostRender";
|
|
4
|
+
import { raw_render } from "./rawRender";
|
|
5
|
+
import { getTemplate } from "../utility/templateUtility";
|
|
6
|
+
import { styleResolve } from "../utility/styleUtility";
|
|
7
|
+
//渲染自定义标签
|
|
8
|
+
export function Render(proto, parent, child, link) {
|
|
9
|
+
//获得模板元素
|
|
10
|
+
var tagTemplate = getTemplate(proto);
|
|
11
|
+
//注册当前解析元素
|
|
12
|
+
Reflect.get(window, "context").crtTag = child;
|
|
13
|
+
//解析样式
|
|
14
|
+
styleResolve(proto.getName());
|
|
15
|
+
//两种渲染方式
|
|
16
|
+
if (child.hasAttribute("name")) {
|
|
17
|
+
//需要保持状态的渲染
|
|
18
|
+
if (link.link.has(child.getAttribute("name"))) {
|
|
19
|
+
//该name元素存在旧数据,是更新渲染
|
|
20
|
+
init_render(proto, parent, child, link, tagTemplate);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
//该name元素不存在旧数据,是第一次渲染
|
|
24
|
+
post_render(proto, parent, child, link, tagTemplate);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
//不需要保持状态的渲染
|
|
29
|
+
raw_render(proto, parent, child, link, tagTemplate);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//拓展标签深度渲染
|
|
33
|
+
export function findComponent(collection, link) {
|
|
34
|
+
for (var i = 0; i < collection.length; i++) {
|
|
35
|
+
if (isUnKnown(collection[i].nodeName)) {
|
|
36
|
+
Render(Reflect.get(window, "tagLib").get(collection[i].nodeName.toUpperCase()), collection[i].parentNode, collection[i], link);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
findComponent(collection[i].children, link);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ApiController } from "../../class/apiController";
|
|
4
|
-
import { PageController } from "../../class/pageController";
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Component } from "../../class/component/component";
|
|
2
|
+
import { Controller } from "../../class/controller/controller";
|
|
3
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
4
|
+
import { PageController } from "../../class/controller/pageController";
|
|
5
|
+
/**
|
|
6
|
+
* 该函数用于处理需要更更新时候,需要从父组件提取数据状态的渲染操作
|
|
7
|
+
* @param proto
|
|
8
|
+
* @param parent
|
|
9
|
+
* @param child
|
|
10
|
+
* @param link
|
|
11
|
+
* @param tagTemplate
|
|
12
|
+
*/
|
|
13
|
+
export declare function init_render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { controllerCycleTypeOne } from "../../library/lifecycle/controllerCycle";
|
|
3
|
+
import { cmd } from "../../library/cmd/cmd";
|
|
4
|
+
import { mount } from "../../library/lifecycle/mount";
|
|
5
|
+
import { injectRefs } from "../inject/inject";
|
|
6
|
+
import { afterMethodsTypeOne } from "../../library/lifecycle/afterMethods";
|
|
7
|
+
import { findComponent } from "./delivery";
|
|
8
|
+
/**
|
|
9
|
+
* 该函数用于处理需要更更新时候,需要从父组件提取数据状态的渲染操作
|
|
10
|
+
* @param proto
|
|
11
|
+
* @param parent
|
|
12
|
+
* @param child
|
|
13
|
+
* @param link
|
|
14
|
+
* @param tagTemplate
|
|
15
|
+
*/
|
|
16
|
+
export function init_render(proto, parent, child, link, tagTemplate) {
|
|
17
|
+
//获取控制对象
|
|
18
|
+
var controller = new Controller();
|
|
19
|
+
//控制对象预处理
|
|
20
|
+
controllerCycleTypeOne(controller, proto, child, link, tagTemplate);
|
|
21
|
+
//beforeRender
|
|
22
|
+
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
23
|
+
beforeRender();
|
|
24
|
+
//内存中数据渲染
|
|
25
|
+
cmd(tagTemplate, proto, controller);
|
|
26
|
+
//beforeMount
|
|
27
|
+
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
28
|
+
beforeMount();
|
|
29
|
+
//mount
|
|
30
|
+
mount(controller, proto, parent, child, tagTemplate);
|
|
31
|
+
//获取
|
|
32
|
+
injectRefs(controller, tagTemplate);
|
|
33
|
+
//afterRender
|
|
34
|
+
var afterRender = proto.getAfterRender().bind(controller.proxyForMethods);
|
|
35
|
+
afterRender();
|
|
36
|
+
//后处理
|
|
37
|
+
afterMethodsTypeOne(controller, child, link);
|
|
38
|
+
//深度渲染
|
|
39
|
+
findComponent(tagTemplate.children, controller);
|
|
40
40
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from "../../class/component/component";
|
|
2
|
+
import { Controller } from "../../class/controller/controller";
|
|
3
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
4
|
+
import { PageController } from "../../class/controller/pageController";
|
|
5
|
+
/**
|
|
6
|
+
* 该函数用于渲染不需要记录状态的组件
|
|
7
|
+
* @param proto
|
|
8
|
+
* @param parent
|
|
9
|
+
* @param child
|
|
10
|
+
* @param link
|
|
11
|
+
* @param tagTemplate
|
|
12
|
+
*/
|
|
13
|
+
export declare function raw_render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { controllerCycleTypeTwo } from "../../library/lifecycle/controllerCycle";
|
|
3
|
+
import { cmd } from "../../library/cmd/cmd";
|
|
4
|
+
import { mount } from "../../library/lifecycle/mount";
|
|
5
|
+
import { injectRefs } from "../inject/inject";
|
|
6
|
+
import { afterMethodsTypeTwo } from "../../library/lifecycle/afterMethods";
|
|
7
|
+
import { findComponent } from "./delivery";
|
|
8
|
+
/**
|
|
9
|
+
* 该函数用于渲染不需要记录状态的组件
|
|
10
|
+
* @param proto
|
|
11
|
+
* @param parent
|
|
12
|
+
* @param child
|
|
13
|
+
* @param link
|
|
14
|
+
* @param tagTemplate
|
|
15
|
+
*/
|
|
16
|
+
export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
17
|
+
//获取控制对象
|
|
18
|
+
var controller = new Controller();
|
|
19
|
+
//控制对象预处理
|
|
20
|
+
controllerCycleTypeTwo(controller, proto, child, link, tagTemplate);
|
|
21
|
+
//beforeRender
|
|
22
|
+
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
23
|
+
beforeRender();
|
|
24
|
+
//解析指令
|
|
25
|
+
cmd(tagTemplate, proto, controller);
|
|
26
|
+
//beforeMount
|
|
27
|
+
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
28
|
+
beforeMount();
|
|
29
|
+
//mount
|
|
30
|
+
mount(controller, proto, parent, child, tagTemplate);
|
|
31
|
+
injectRefs(controller, tagTemplate);
|
|
32
|
+
//afterRender
|
|
33
|
+
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
34
|
+
afterRender();
|
|
35
|
+
//后处理
|
|
36
|
+
afterMethodsTypeTwo(controller, child, link);
|
|
37
|
+
//深度渲染
|
|
38
|
+
findComponent(controller.root.children, controller);
|
|
39
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
2
|
-
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
/**
|
|
3
|
+
* 更新渲染方法
|
|
4
|
+
* @param controller
|
|
5
|
+
*/
|
|
6
|
+
export declare function update_Render(controller: Controller): void;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { bindModelForUpdater } from "../utility/miscUtility";
|
|
2
|
-
import { findComponent } from "./initRender";
|
|
3
|
-
import { getTemplate } from "../../library/template/template";
|
|
4
2
|
import { cmdForUpdate } from "../../library/cmd/cmd";
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { injectRefs } from "../inject/inject";
|
|
4
|
+
import { findComponent } from "./delivery";
|
|
5
|
+
import { getTemplate } from "../utility/templateUtility";
|
|
6
|
+
/**
|
|
7
|
+
* 更新渲染方法
|
|
8
|
+
* @param controller
|
|
9
|
+
*/
|
|
10
|
+
export function update_Render(controller) {
|
|
7
11
|
//生成DOM
|
|
8
12
|
var tagTemplate = getTemplate(controller.proto);
|
|
9
13
|
//清除保存的发布对象
|
|
@@ -27,10 +31,10 @@ export function updateRender(controller) {
|
|
|
27
31
|
while (tagTemplate.hasChildNodes()) {
|
|
28
32
|
controller.root.appendChild(tagTemplate.firstChild);
|
|
29
33
|
}
|
|
34
|
+
injectRefs(controller, tagTemplate);
|
|
30
35
|
//afterRender
|
|
31
36
|
var afterRender = controller.proto.getAfterRender().bind(controller.raw_data);
|
|
32
37
|
afterRender();
|
|
33
|
-
injectProps(controller, tagTemplate);
|
|
34
38
|
//获取定位
|
|
35
39
|
bindModelForUpdater(controller.root.children, controller.proxyForMethods);
|
|
36
40
|
//深度渲染
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
2
|
-
import { ApiController } from "../../class/apiController";
|
|
3
|
-
import { PageController } from "../../class/pageController";
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
3
|
+
import { PageController } from "../../class/controller/pageController";
|
|
4
4
|
export declare function getCodeSpaceForProps(data: {}, $props: Map<string, object>): void;
|
|
5
5
|
export declare function getCodeSpaceForQuery(data: {}, $query: Map<string, any>): void;
|
|
6
6
|
export declare function getCodeSpaceForRef(data: {}, $ref: Map<string, Element>): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { Component } from "../../class/component";
|
|
1
|
+
import { Component } from "../../class/component/component";
|
|
2
2
|
export declare function checkStyleLabel(tag: string): boolean;
|
|
3
3
|
export declare function themeStyle(component: Component, styleLib: Map<string, object>): void;
|
|
4
|
+
export declare function styleResolve(tag: string): void;
|
|
5
|
+
export declare function reloadStyle(theme: string): void;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { loadStyle } from "../../library/loader/loader";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { sessionStorageEngin_read } from "render-status/read/read";
|
|
1
4
|
export function checkStyleLabel(tag) {
|
|
2
5
|
//获取所有的style标签
|
|
3
6
|
var styles = document.getElementsByTagName("style");
|
|
@@ -21,3 +24,28 @@ export function themeStyle(component, styleLib) {
|
|
|
21
24
|
}
|
|
22
25
|
styleLib.set(component.getName().toUpperCase(), kk);
|
|
23
26
|
}
|
|
27
|
+
export function styleResolve(tag) {
|
|
28
|
+
var theme = sessionStorageEngin_read("theme");
|
|
29
|
+
if (Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme) === undefined) {
|
|
30
|
+
console.log("tag:" + tag + " has no theme " + theme);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
loadStyle(tag, theme, Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function reloadStyle(theme) {
|
|
37
|
+
Reflect.get(window, "styleLib").forEach(function (value, key) {
|
|
38
|
+
var styles = document.getElementsByTagName("style");
|
|
39
|
+
for (var i = 0; i < styles.length; i++) {
|
|
40
|
+
if (styles[i].getAttribute("tag") === key) {
|
|
41
|
+
var style = document.createElement('style');
|
|
42
|
+
var text = document.createTextNode(value.get(theme));
|
|
43
|
+
style.appendChild(text);
|
|
44
|
+
style.setAttribute("tag", key.toUpperCase());
|
|
45
|
+
style.setAttribute("theme", theme);
|
|
46
|
+
var head = document.getElementsByTagName('head')[0];
|
|
47
|
+
head.replaceChild(style, styles[i]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Component } from "./class/component";
|
|
1
|
+
import { Component } from "./class/component/component";
|
|
2
2
|
import meta from "./meta/meta";
|
|
3
3
|
import { renderHtml } from "./runtime/runtime";
|
|
4
4
|
import { themeStyle } from "./core/utility/styleUtility";
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import { redirect } from "render-security/utility/redirect";
|
|
7
|
-
import { PageController } from "./class/pageController";
|
|
7
|
+
import { PageController } from "./class/controller/pageController";
|
|
8
8
|
import { App } from "./meta/app";
|
|
9
9
|
//页面RenderJs
|
|
10
10
|
var RenderJS = /** @class */ (function () {
|
package/library/cmd/cmd.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Component } from "../../class/component";
|
|
2
|
-
import { Controller } from "../../class/controller";
|
|
3
|
-
import { ApiController } from "../../class/apiController";
|
|
4
|
-
import ApiComponent from "../../class/apiComponent";
|
|
1
|
+
import { Component } from "../../class/component/component";
|
|
2
|
+
import { Controller } from "../../class/controller/controller";
|
|
3
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
4
|
+
import ApiComponent from "../../class/component/apiComponent";
|
|
5
5
|
export declare function cmd(tagTemplate: Element, proto: Component | ApiComponent, controller: Controller | ApiController): void;
|
|
6
6
|
export declare function cmdForUpdate(tagTemplate: Element, proto: Component, controller: Controller | ApiController): void;
|
package/library/cmd/cmd.js
CHANGED
|
@@ -4,6 +4,8 @@ import { resolver_html } from "../../core/cmd/v-html";
|
|
|
4
4
|
import { resolver_txt } from "../../core/cmd/v-txt";
|
|
5
5
|
import { resolver_model } from "../../core/cmd/v-model";
|
|
6
6
|
import { resolver_bind } from "../../core/cmd/v-bind";
|
|
7
|
+
import { resolver_show } from "../../core/cmd/v-show";
|
|
8
|
+
import { resolver_render } from "../../core/cmd/v-render";
|
|
7
9
|
export function cmd(tagTemplate, proto, controller) {
|
|
8
10
|
//给所有元素添加上npm=tag标志
|
|
9
11
|
addLabel(tagTemplate.children, proto.getName());
|
|
@@ -17,6 +19,10 @@ export function cmd(tagTemplate, proto, controller) {
|
|
|
17
19
|
resolver_model(tagTemplate.children, controller.proxyForMethods);
|
|
18
20
|
//渲染属性
|
|
19
21
|
resolver_bind(tagTemplate.children, controller.proxyForMethods);
|
|
22
|
+
//v-show
|
|
23
|
+
resolver_show(tagTemplate.children, controller.proxyForMethods);
|
|
24
|
+
//v-render
|
|
25
|
+
resolver_render(tagTemplate.children, controller.proxyForMethods);
|
|
20
26
|
}
|
|
21
27
|
export function cmdForUpdate(tagTemplate, proto, controller) {
|
|
22
28
|
//给所有元素添加上npm=tag标志
|
|
@@ -29,4 +35,8 @@ export function cmdForUpdate(tagTemplate, proto, controller) {
|
|
|
29
35
|
resolver_txt(tagTemplate.children, controller.proxyForMethods);
|
|
30
36
|
//绑定数据
|
|
31
37
|
resolver_model(tagTemplate.children, controller.proxyForMethods);
|
|
38
|
+
//v-show
|
|
39
|
+
resolver_show(tagTemplate.children, controller.proxyForMethods);
|
|
40
|
+
//v-render
|
|
41
|
+
resolver_render(tagTemplate.children, controller.proxyForMethods);
|
|
32
42
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
3
|
+
import { PageController } from "../../class/controller/pageController";
|
|
4
|
+
/**
|
|
5
|
+
* 该函数用于处理渲染后操作
|
|
6
|
+
* @param controller
|
|
7
|
+
* @param child
|
|
8
|
+
* @param link
|
|
9
|
+
*/
|
|
10
|
+
export declare function afterMethodsTypeOne(controller: Controller, child: Element, link: Controller | ApiController | PageController): void;
|
|
11
|
+
/**
|
|
12
|
+
* 该函数用于处理渲染后操作
|
|
13
|
+
* @param controller
|
|
14
|
+
* @param child
|
|
15
|
+
* @param link
|
|
16
|
+
*/
|
|
17
|
+
export declare function afterMethodsTypeTwo(controller: Controller, child: Element, link: Controller | ApiController | PageController): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 该函数用于处理渲染后操作
|
|
3
|
+
* @param controller
|
|
4
|
+
* @param child
|
|
5
|
+
* @param link
|
|
6
|
+
*/
|
|
7
|
+
export function afterMethodsTypeOne(controller, child, link) {
|
|
8
|
+
//将本控制对象保存到父控制对象的发布数组中
|
|
9
|
+
link.to.push(controller);
|
|
10
|
+
//将执行空间保存到父控制对象
|
|
11
|
+
link.link.set(child.getAttribute("name"), controller.raw_data);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 该函数用于处理渲染后操作
|
|
15
|
+
* @param controller
|
|
16
|
+
* @param child
|
|
17
|
+
* @param link
|
|
18
|
+
*/
|
|
19
|
+
export function afterMethodsTypeTwo(controller, child, link) {
|
|
20
|
+
//将本控制对象保存到父控制对象的发布数组中
|
|
21
|
+
link.to.push(controller);
|
|
22
|
+
//将执行空间保存到父控制对象
|
|
23
|
+
link.link.set(child.getAttribute("name"), controller.raw_data);
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Controller } from "../../class/controller/controller";
|
|
2
|
+
import { Component } from "../../class/component/component";
|
|
3
|
+
import { ApiController } from "../../class/controller/apiController";
|
|
4
|
+
import { PageController } from "../../class/controller/pageController";
|
|
5
|
+
export declare function controllerCycleTypeOne(controller: Controller, proto: Component, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
6
|
+
export declare function controllerCycleTypeTwo(controller: Controller, proto: Component, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { inject, injectComputed, injectMethod, injectWatcher } from "../../core/inject/inject";
|
|
2
|
+
import { getProxyObject } from "../../core/proxy/getProxy";
|
|
3
|
+
import { getCodeSpaceForCommit, getCodeSpaceForProperty, getCodeSpaceForPublish, getCommitMethod, getPublishMethod, getSetterMethod } from "../../core/utility/injectUtility";
|
|
4
|
+
export function controllerCycleTypeOne(controller, proto, child, link, tagTemplate) {
|
|
5
|
+
//保持控制器模板对象
|
|
6
|
+
controller.proto = proto;
|
|
7
|
+
//复制原始数据对象到控制对象
|
|
8
|
+
controller.raw_data = link.link.get(child.getAttribute("name"));
|
|
9
|
+
//向raw_data中注入元数据
|
|
10
|
+
inject(controller, tagTemplate);
|
|
11
|
+
//数据渲染代理对象
|
|
12
|
+
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
13
|
+
injectComputed(controller, proto);
|
|
14
|
+
injectWatcher(controller, proto);
|
|
15
|
+
injectMethod(controller, proto);
|
|
16
|
+
//注入commit
|
|
17
|
+
getCodeSpaceForCommit(controller.raw_data, getCommitMethod(link));
|
|
18
|
+
//注入receiver
|
|
19
|
+
getCodeSpaceForPublish(controller.raw_data, getPublishMethod(controller));
|
|
20
|
+
//注入setter
|
|
21
|
+
getCodeSpaceForProperty(controller.raw_data, getSetterMethod(controller));
|
|
22
|
+
}
|
|
23
|
+
export function controllerCycleTypeTwo(controller, proto, child, link, tagTemplate) {
|
|
24
|
+
//保持控制器模板对象
|
|
25
|
+
controller.proto = proto;
|
|
26
|
+
//复制原始数据对象到控制对象
|
|
27
|
+
controller.raw_data = Object.create(proto.getData());
|
|
28
|
+
//向raw_data中注入元数据
|
|
29
|
+
inject(controller, tagTemplate);
|
|
30
|
+
//数据渲染代理对象
|
|
31
|
+
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
32
|
+
injectComputed(controller, proto);
|
|
33
|
+
injectWatcher(controller, proto);
|
|
34
|
+
injectMethod(controller, proto);
|
|
35
|
+
//注入commit
|
|
36
|
+
getCodeSpaceForCommit(controller.raw_data, getCommitMethod(link));
|
|
37
|
+
//注入receiver
|
|
38
|
+
getCodeSpaceForPublish(controller.raw_data, getPublishMethod(controller));
|
|
39
|
+
//注入setter
|
|
40
|
+
getCodeSpaceForProperty(controller.raw_data, getSetterMethod(controller));
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function mount(controller, proto, parent, child, tagTemplate) {
|
|
2
|
+
//mount
|
|
3
|
+
var renderSpace = document.createElement("div");
|
|
4
|
+
//给box添加样式
|
|
5
|
+
renderSpace.setAttribute("style", proto.getBoxStyle());
|
|
6
|
+
//指定渲染空间
|
|
7
|
+
controller.root = renderSpace;
|
|
8
|
+
//开始渲染
|
|
9
|
+
parent.replaceChild(renderSpace, child);
|
|
10
|
+
while (tagTemplate.hasChildNodes()) {
|
|
11
|
+
renderSpace.append(tagTemplate.firstChild);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/library/loader/loader.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { checkStyleLabel } from "../../core/utility/styleUtility";
|
|
2
|
+
/**
|
|
3
|
+
* 加载自定义标签样式
|
|
4
|
+
* @param tag
|
|
5
|
+
* @param theme
|
|
6
|
+
* @param styleData
|
|
7
|
+
*/
|
|
2
8
|
export function loadStyle(tag, theme, styleData) {
|
|
3
9
|
if (!checkStyleLabel(tag)) {
|
|
4
10
|
var style = document.createElement('style');
|
package/meta/app.d.ts
CHANGED
package/meta/app.js
CHANGED
package/package.json
CHANGED
package/runtime/runtime.d.ts
CHANGED
package/runtime/runtime.js
CHANGED
package/core/mixin/mixin.d.ts
DELETED
|
File without changes
|
package/core/mixin/mixin.js
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getGetter(data: {}): any;
|
package/library/getter/getter.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
2
|
-
import { Component } from "../../class/component";
|
|
3
|
-
import { ApiController } from "../../class/apiController";
|
|
4
|
-
import { PageController } from "../../class/pageController";
|
|
5
|
-
export declare function init_render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
6
|
-
export declare function post_render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
|
7
|
-
export declare function raw_render(proto: Component, parent: ParentNode, child: Element, link: Controller | ApiController | PageController, tagTemplate: Element): void;
|
package/library/render/render.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
2
|
-
import { getCodeSpaceForCommit, getCodeSpaceForProperty, getCodeSpaceForPublish, getCommitMethod, getPublishMethod, getSetterMethod } from "../../core/utility/injectUtility";
|
|
3
|
-
import { getProxyObject } from "../../core/proxy/getProxy";
|
|
4
|
-
import { findComponent } from "../../core/render/initRender";
|
|
5
|
-
import { inject, injectComputed, injectMethod, injectProps, injectWatcher } from "../inject/inject";
|
|
6
|
-
import { cmd } from "../cmd/cmd";
|
|
7
|
-
export function init_render(proto, parent, child, link, tagTemplate) {
|
|
8
|
-
//获取控制对象
|
|
9
|
-
var controller = new Controller();
|
|
10
|
-
//保持控制器模板对象
|
|
11
|
-
controller.proto = proto;
|
|
12
|
-
//复制原始数据对象到控制对象
|
|
13
|
-
controller.raw_data = link.link.get(child.getAttribute("name"));
|
|
14
|
-
//向raw_data中注入元数据
|
|
15
|
-
inject(controller, tagTemplate);
|
|
16
|
-
//数据渲染代理对象
|
|
17
|
-
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
18
|
-
injectComputed(controller, proto);
|
|
19
|
-
injectWatcher(controller, proto);
|
|
20
|
-
injectMethod(controller, proto);
|
|
21
|
-
//注入commit
|
|
22
|
-
getCodeSpaceForCommit(controller.raw_data, getCommitMethod(link));
|
|
23
|
-
//注入receiver
|
|
24
|
-
getCodeSpaceForPublish(controller.raw_data, getPublishMethod(controller));
|
|
25
|
-
//注入setter
|
|
26
|
-
getCodeSpaceForProperty(controller.raw_data, getSetterMethod(controller));
|
|
27
|
-
//beforeRender
|
|
28
|
-
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
29
|
-
beforeRender();
|
|
30
|
-
//解析指令
|
|
31
|
-
cmd(tagTemplate, proto, controller);
|
|
32
|
-
//beforeMount
|
|
33
|
-
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
34
|
-
beforeMount();
|
|
35
|
-
//mount
|
|
36
|
-
var renderSpace = document.createElement("div");
|
|
37
|
-
//给box添加样式
|
|
38
|
-
renderSpace.setAttribute("style", proto.getBoxStyle());
|
|
39
|
-
//指定渲染空间
|
|
40
|
-
controller.root = renderSpace;
|
|
41
|
-
//开始渲染
|
|
42
|
-
parent.replaceChild(renderSpace, child);
|
|
43
|
-
while (tagTemplate.hasChildNodes()) {
|
|
44
|
-
renderSpace.append(tagTemplate.firstChild);
|
|
45
|
-
}
|
|
46
|
-
//afterRender
|
|
47
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
48
|
-
afterRender();
|
|
49
|
-
injectProps(controller, tagTemplate);
|
|
50
|
-
//将本控制对象保存到父控制对象的发布数组中
|
|
51
|
-
link.to.push(controller);
|
|
52
|
-
//将执行空间保存到父控制对象
|
|
53
|
-
link.link.set(child.getAttribute("name"), controller.raw_data);
|
|
54
|
-
//深度渲染
|
|
55
|
-
findComponent(tagTemplate.children, controller);
|
|
56
|
-
}
|
|
57
|
-
export function post_render(proto, parent, child, link, tagTemplate) {
|
|
58
|
-
//获取控制对象
|
|
59
|
-
var controller = new Controller();
|
|
60
|
-
//保持控制器模板对象
|
|
61
|
-
controller.proto = proto;
|
|
62
|
-
//复制原始数据对象到控制对象
|
|
63
|
-
controller.raw_data = Object.create(proto.getData());
|
|
64
|
-
//向raw_data中注入元数据
|
|
65
|
-
inject(controller, tagTemplate);
|
|
66
|
-
//保持数据代理对象
|
|
67
|
-
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
68
|
-
injectComputed(controller, proto);
|
|
69
|
-
injectWatcher(controller, proto);
|
|
70
|
-
injectMethod(controller, proto);
|
|
71
|
-
//注入commit
|
|
72
|
-
getCodeSpaceForCommit(controller.raw_data, getCommitMethod(link));
|
|
73
|
-
//注入receiver
|
|
74
|
-
getCodeSpaceForPublish(controller.raw_data, getPublishMethod(controller));
|
|
75
|
-
//注入setter
|
|
76
|
-
getCodeSpaceForProperty(controller.raw_data, getSetterMethod(controller));
|
|
77
|
-
//beforeRender
|
|
78
|
-
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
79
|
-
beforeRender();
|
|
80
|
-
//解析指令
|
|
81
|
-
cmd(tagTemplate, proto, controller);
|
|
82
|
-
//beforeMount
|
|
83
|
-
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
84
|
-
beforeMount();
|
|
85
|
-
//mount
|
|
86
|
-
var renderSpace = document.createElement("div");
|
|
87
|
-
//给box添加样式
|
|
88
|
-
renderSpace.setAttribute("style", proto.getBoxStyle());
|
|
89
|
-
//指定渲染空间
|
|
90
|
-
controller.root = renderSpace;
|
|
91
|
-
//开始渲染
|
|
92
|
-
parent.replaceChild(renderSpace, child);
|
|
93
|
-
while (tagTemplate.hasChildNodes()) {
|
|
94
|
-
renderSpace.append(tagTemplate.firstChild);
|
|
95
|
-
}
|
|
96
|
-
//afterRender
|
|
97
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
98
|
-
afterRender();
|
|
99
|
-
injectProps(controller, tagTemplate);
|
|
100
|
-
link.to.push(controller);
|
|
101
|
-
//将执行空间保存到父控制对象
|
|
102
|
-
link.link.set(child.getAttribute("name"), controller.raw_data);
|
|
103
|
-
//深度渲染
|
|
104
|
-
findComponent(controller.root.children, controller);
|
|
105
|
-
}
|
|
106
|
-
export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
107
|
-
//获取控制对象
|
|
108
|
-
var controller = new Controller();
|
|
109
|
-
//保持控制对象原型对象
|
|
110
|
-
controller.proto = proto;
|
|
111
|
-
//向raw_data中注入元数据
|
|
112
|
-
inject(controller, tagTemplate);
|
|
113
|
-
//复制原始数据对象到控制对象
|
|
114
|
-
controller.raw_data = Object.create(proto.getData());
|
|
115
|
-
//数据渲染对象
|
|
116
|
-
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
117
|
-
injectComputed(controller, proto);
|
|
118
|
-
injectWatcher(controller, proto);
|
|
119
|
-
injectMethod(controller, proto);
|
|
120
|
-
//注入commit
|
|
121
|
-
getCodeSpaceForCommit(controller.raw_data, getCommitMethod(link));
|
|
122
|
-
//注入receiver
|
|
123
|
-
getCodeSpaceForPublish(controller.raw_data, getPublishMethod(controller));
|
|
124
|
-
//注入setter
|
|
125
|
-
getCodeSpaceForProperty(controller.raw_data, getSetterMethod(controller));
|
|
126
|
-
//beforeRender
|
|
127
|
-
var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
|
|
128
|
-
beforeRender();
|
|
129
|
-
//解析指令
|
|
130
|
-
cmd(tagTemplate, proto, controller);
|
|
131
|
-
//beforeMount
|
|
132
|
-
var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
|
|
133
|
-
beforeMount();
|
|
134
|
-
//mount
|
|
135
|
-
var renderSpace = document.createElement("div");
|
|
136
|
-
//给box添加样式
|
|
137
|
-
renderSpace.setAttribute("style", proto.getBoxStyle());
|
|
138
|
-
//指定渲染空间
|
|
139
|
-
controller.root = renderSpace;
|
|
140
|
-
//开始渲染
|
|
141
|
-
parent.replaceChild(renderSpace, child);
|
|
142
|
-
while (tagTemplate.hasChildNodes()) {
|
|
143
|
-
renderSpace.append(tagTemplate.firstChild);
|
|
144
|
-
}
|
|
145
|
-
//afterRender
|
|
146
|
-
var afterRender = proto.getAfterRender().bind(controller.raw_data);
|
|
147
|
-
afterRender();
|
|
148
|
-
injectProps(controller, tagTemplate);
|
|
149
|
-
link.to.push(controller);
|
|
150
|
-
//深度渲染
|
|
151
|
-
findComponent(controller.root.children, controller);
|
|
152
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Controller } from "../../class/controller";
|
|
2
|
-
import { ApiController } from "../../class/apiController";
|
|
3
|
-
export declare function getSetter(data: {}, updater: Controller): any;
|
|
4
|
-
export declare function getSetterForInject(data: {}): (obj: any, prop: any, value: any) => boolean;
|
|
5
|
-
export declare function getSetterForApi(data: {}, updater: ApiController): any;
|
package/library/setter/setter.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { updateRender } from "../../core/render/updateRender";
|
|
2
|
-
export function getSetter(data, updater) {
|
|
3
|
-
var setter = function (obj, prop, value) {
|
|
4
|
-
obj[prop] = value;
|
|
5
|
-
updateRender(this);
|
|
6
|
-
return true;
|
|
7
|
-
};
|
|
8
|
-
return setter.bind(updater);
|
|
9
|
-
}
|
|
10
|
-
export function getSetterForInject(data) {
|
|
11
|
-
return function (obj, prop, value) {
|
|
12
|
-
console.error("Meta filed can't be set value!");
|
|
13
|
-
return false;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export function getSetterForApi(data, updater) {
|
|
17
|
-
var setter = function (obj, prop, value) {
|
|
18
|
-
obj[prop] = value;
|
|
19
|
-
updateRender(this);
|
|
20
|
-
return true;
|
|
21
|
-
};
|
|
22
|
-
return setter.bind(updater);
|
|
23
|
-
}
|
package/library/style/style.d.ts
DELETED
package/library/style/style.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import { sessionStorageEngin_read } from "render-status/read/read";
|
|
3
|
-
import { loadStyle } from "../loader/loader";
|
|
4
|
-
export function styleResolve(tag) {
|
|
5
|
-
var theme = sessionStorageEngin_read("theme");
|
|
6
|
-
if (Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme) === undefined) {
|
|
7
|
-
console.log("tag:" + tag + "has no them" + theme);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
loadStyle(tag, theme, Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function reloadStyle(theme) {
|
|
14
|
-
Reflect.get(window, "styleLib").forEach(function (value, key) {
|
|
15
|
-
var styles = document.getElementsByTagName("style");
|
|
16
|
-
for (var i = 0; i < styles.length; i++) {
|
|
17
|
-
if (styles[i].getAttribute("tag") === key) {
|
|
18
|
-
var style = document.createElement('style');
|
|
19
|
-
var text = document.createTextNode(value.get(theme));
|
|
20
|
-
style.appendChild(text);
|
|
21
|
-
style.setAttribute("tag", key.toUpperCase());
|
|
22
|
-
style.setAttribute("theme", theme);
|
|
23
|
-
var head = document.getElementsByTagName('head')[0];
|
|
24
|
-
head.replaceChild(style, styles[i]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
package/library/tag/extend.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function extendTag(component: {
|
|
2
|
-
name: string;
|
|
3
|
-
template: string;
|
|
4
|
-
data?: () => {};
|
|
5
|
-
computed?: {};
|
|
6
|
-
methods?: {};
|
|
7
|
-
components?: {};
|
|
8
|
-
beforeRender?: () => void;
|
|
9
|
-
afterRender?: () => void;
|
|
10
|
-
beforeUpdate?: () => void;
|
|
11
|
-
afterUpdate?: () => void;
|
|
12
|
-
beforeMount?: () => void;
|
|
13
|
-
beforeUnmount?: () => void;
|
|
14
|
-
}): any;
|
package/library/tag/extend.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|