render-core 1.4.5 → 1.4.6
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/index.d.ts +22 -35
- package/index.js +41 -53
- package/kernel/delivery/delivery.js +2 -1
- package/kernel/router/router.d.ts +2 -2
- package/kernel/router/router.js +18 -13
- package/package.json +1 -1
- package/system/generic/render/RenderGeneric.d.ts +7 -2
- package/system/recorder/table1/system_t_1.d.ts +1 -0
- package/system/recorder/table1/system_t_1.js +2 -1
- package/xboot/Entrance.d.ts +7 -2
- package/xboot/Entrance.js +13 -6
package/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { PluginGeneric } from "./tension/generic/plugin/PluginGeneric";
|
|
|
4
4
|
import { HooksGeneric } from "./tension/generic/plugin/hooks/HooksGeneric";
|
|
5
5
|
import { AbstractComponent } from "./tension/prototype/AbstractComponent";
|
|
6
6
|
import { PrefaceGeneric } from "./tension/generic/plugin/preface/PrefaceGeneric";
|
|
7
|
+
import { RouterGeneric } from "./tension/generic/router/RouterGeneric";
|
|
7
8
|
/**
|
|
8
9
|
* This class is used to prototype the properties type
|
|
9
10
|
*/
|
|
@@ -17,14 +18,15 @@ export declare class PropertyType {
|
|
|
17
18
|
/**
|
|
18
19
|
*
|
|
19
20
|
*/
|
|
20
|
-
export declare abstract class
|
|
21
|
-
|
|
21
|
+
export declare abstract class AbstractPlugin implements PluginGeneric {
|
|
22
|
+
plugin(preface: PrefaceGeneric, hooks: HooksGeneric): void;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
*
|
|
25
26
|
*/
|
|
26
|
-
export declare abstract class
|
|
27
|
-
|
|
27
|
+
export declare abstract class AbstractRouter implements RouterGeneric {
|
|
28
|
+
getComponent(): Component;
|
|
29
|
+
getPathVariable(): Map<string, any>;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Here is the template class for render component!
|
|
@@ -46,52 +48,37 @@ export declare class Component extends AbstractComponent {
|
|
|
46
48
|
afterRender?: () => void;
|
|
47
49
|
});
|
|
48
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* This func is used to extend window environment
|
|
53
|
+
* @param on
|
|
54
|
+
* @param func
|
|
55
|
+
*/
|
|
56
|
+
export declare function extend_window(on: string, func: any): void;
|
|
49
57
|
/**
|
|
50
58
|
* This proto is the application proto.
|
|
51
59
|
*/
|
|
52
|
-
export declare class RenderJS
|
|
60
|
+
export declare class RenderJS implements RenderGeneric {
|
|
53
61
|
contextController: ContextController;
|
|
54
62
|
constructor();
|
|
55
63
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @param name
|
|
58
|
-
* @param func
|
|
59
|
-
*/
|
|
60
|
-
static registerElement(name: string, func: any): void;
|
|
61
|
-
setRouteTable(value: {
|
|
62
|
-
routeMode: string;
|
|
63
|
-
table: [
|
|
64
|
-
{
|
|
65
|
-
path: string;
|
|
66
|
-
component: Component;
|
|
67
|
-
}
|
|
68
|
-
];
|
|
69
|
-
}): void;
|
|
70
|
-
setRouteMode(value: boolean): void;
|
|
71
|
-
/**
|
|
72
|
-
* This func is the plugin entry to third vendor
|
|
64
|
+
* This func is used to execute plugins
|
|
73
65
|
*/
|
|
74
66
|
use_plugin(plugin: PluginGeneric): void;
|
|
75
67
|
/**
|
|
76
|
-
*
|
|
68
|
+
* This unc is used to register component to system
|
|
77
69
|
* @param component
|
|
78
70
|
*/
|
|
79
|
-
|
|
71
|
+
add_tag(component: Component): void;
|
|
80
72
|
/**
|
|
81
|
-
* This
|
|
82
|
-
* @return void
|
|
73
|
+
* This func is used to work under the route mode
|
|
83
74
|
*/
|
|
84
|
-
|
|
75
|
+
listen(): void;
|
|
85
76
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @param component
|
|
88
|
-
* @private
|
|
77
|
+
* This func is used to work under the directive render mode
|
|
89
78
|
*/
|
|
90
|
-
|
|
79
|
+
render(component: Component, mounter: string): void;
|
|
91
80
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @param root
|
|
94
|
-
* @private
|
|
81
|
+
* This func is used to work under the weave mode
|
|
95
82
|
*/
|
|
96
|
-
|
|
83
|
+
weave(mounter: string): void;
|
|
97
84
|
}
|
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
|
-
import {
|
|
16
|
+
import { render_for_listen, render_for_render, render_for_weave } from "./xboot/entrance";
|
|
17
17
|
import { registerTagLib } from "./xboot/tagProcessor";
|
|
18
18
|
import { HooksAction } from "./tension/prototype/HooksAction";
|
|
19
19
|
import { ContextController } from "./system/prototype/ContextController";
|
|
@@ -21,7 +21,6 @@ import { AbstractComponent } from "./tension/prototype/AbstractComponent";
|
|
|
21
21
|
import { set_context_controller } from "./system/recorder/table0/system_func_0";
|
|
22
22
|
import { PrefaceAction } from "./tension/prototype/PrefaceAction";
|
|
23
23
|
import { SystemInitPlugin } from "./tension/SystemInitPlugin";
|
|
24
|
-
import { get_route_mode, set_path_variable, set_router_mode } from "./system/recorder/table1/system_func_1";
|
|
25
24
|
/**
|
|
26
25
|
* This class is used to prototype the properties type
|
|
27
26
|
*/
|
|
@@ -34,25 +33,29 @@ export { PropertyType };
|
|
|
34
33
|
/**
|
|
35
34
|
*
|
|
36
35
|
*/
|
|
37
|
-
var
|
|
38
|
-
function
|
|
36
|
+
var AbstractPlugin = /** @class */ (function () {
|
|
37
|
+
function AbstractPlugin() {
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
AbstractPlugin.prototype.plugin = function (preface, hooks) {
|
|
41
40
|
};
|
|
42
|
-
return
|
|
41
|
+
return AbstractPlugin;
|
|
43
42
|
}());
|
|
44
|
-
export {
|
|
43
|
+
export { AbstractPlugin };
|
|
45
44
|
/**
|
|
46
45
|
*
|
|
47
46
|
*/
|
|
48
|
-
var
|
|
49
|
-
function
|
|
47
|
+
var AbstractRouter = /** @class */ (function () {
|
|
48
|
+
function AbstractRouter() {
|
|
50
49
|
}
|
|
51
|
-
|
|
50
|
+
AbstractRouter.prototype.getComponent = function () {
|
|
51
|
+
return undefined;
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
AbstractRouter.prototype.getPathVariable = function () {
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
return AbstractRouter;
|
|
54
57
|
}());
|
|
55
|
-
export {
|
|
58
|
+
export { AbstractRouter };
|
|
56
59
|
/**
|
|
57
60
|
* Here is the template class for render component!
|
|
58
61
|
*/
|
|
@@ -64,75 +67,60 @@ var Component = /** @class */ (function (_super) {
|
|
|
64
67
|
return Component;
|
|
65
68
|
}(AbstractComponent));
|
|
66
69
|
export { Component };
|
|
70
|
+
/**
|
|
71
|
+
* This func is used to extend window environment
|
|
72
|
+
* @param on
|
|
73
|
+
* @param func
|
|
74
|
+
*/
|
|
75
|
+
export function extend_window(on, func) {
|
|
76
|
+
Reflect.set(window, on, func);
|
|
77
|
+
}
|
|
67
78
|
/**
|
|
68
79
|
* This proto is the application proto.
|
|
69
80
|
*/
|
|
70
|
-
var RenderJS = /** @class */ (function (
|
|
71
|
-
__extends(RenderJS, _super);
|
|
81
|
+
var RenderJS = /** @class */ (function () {
|
|
72
82
|
function RenderJS() {
|
|
73
|
-
var _this = _super.call(this) || this;
|
|
74
83
|
/* initiate the page controller */
|
|
75
|
-
|
|
84
|
+
this.contextController = new ContextController({
|
|
76
85
|
boxMode: false,
|
|
77
86
|
});
|
|
78
87
|
/* init the basis extension */
|
|
79
|
-
|
|
80
|
-
return _this;
|
|
88
|
+
this.use_plugin(new SystemInitPlugin());
|
|
81
89
|
}
|
|
82
90
|
/**
|
|
83
|
-
*
|
|
84
|
-
* @param name
|
|
85
|
-
* @param func
|
|
86
|
-
*/
|
|
87
|
-
RenderJS.registerElement = function (name, func) {
|
|
88
|
-
Reflect.set(window, name, func);
|
|
89
|
-
};
|
|
90
|
-
RenderJS.prototype.setRouteTable = function (value) {
|
|
91
|
-
set_path_variable(value);
|
|
92
|
-
};
|
|
93
|
-
RenderJS.prototype.setRouteMode = function (value) {
|
|
94
|
-
set_router_mode(value);
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* This func is the plugin entry to third vendor
|
|
91
|
+
* This func is used to execute plugins
|
|
98
92
|
*/
|
|
99
93
|
RenderJS.prototype.use_plugin = function (plugin) {
|
|
100
94
|
plugin.plugin(new PrefaceAction(), new HooksAction());
|
|
101
95
|
};
|
|
102
96
|
/**
|
|
103
|
-
*
|
|
97
|
+
* This unc is used to register component to system
|
|
104
98
|
* @param component
|
|
105
99
|
*/
|
|
106
|
-
RenderJS.prototype.
|
|
100
|
+
RenderJS.prototype.add_tag = function (component) {
|
|
107
101
|
registerTagLib(component);
|
|
108
102
|
};
|
|
109
103
|
/**
|
|
110
|
-
* This
|
|
111
|
-
* @return void
|
|
104
|
+
* This func is used to work under the route mode
|
|
112
105
|
*/
|
|
113
|
-
RenderJS.prototype.
|
|
106
|
+
RenderJS.prototype.listen = function () {
|
|
114
107
|
set_context_controller(this.contextController);
|
|
115
|
-
|
|
116
|
-
this.spa_run(component);
|
|
117
|
-
else
|
|
118
|
-
this.mpa_run(root);
|
|
108
|
+
render_for_listen();
|
|
119
109
|
};
|
|
120
110
|
/**
|
|
121
|
-
*
|
|
122
|
-
* @param component
|
|
123
|
-
* @private
|
|
111
|
+
* This func is used to work under the directive render mode
|
|
124
112
|
*/
|
|
125
|
-
RenderJS.prototype.
|
|
126
|
-
|
|
113
|
+
RenderJS.prototype.render = function (component, mounter) {
|
|
114
|
+
set_context_controller(this.contextController);
|
|
115
|
+
render_for_render(component, mounter);
|
|
127
116
|
};
|
|
128
117
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @param root
|
|
131
|
-
* @private
|
|
118
|
+
* This func is used to work under the weave mode
|
|
132
119
|
*/
|
|
133
|
-
RenderJS.prototype.
|
|
134
|
-
|
|
120
|
+
RenderJS.prototype.weave = function (mounter) {
|
|
121
|
+
set_context_controller(this.contextController);
|
|
122
|
+
render_for_weave(mounter);
|
|
135
123
|
};
|
|
136
124
|
return RenderJS;
|
|
137
|
-
}(
|
|
125
|
+
}());
|
|
138
126
|
export { RenderJS };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextController } from "../../system/prototype/ContextController";
|
|
2
2
|
import { isUnKnown } from "../../system/utility/checkUtility";
|
|
3
|
-
import { get_tag_library } from "../../system/recorder/table0/system_func_0";
|
|
3
|
+
import { get_tag_library, set_context_controller } from "../../system/recorder/table0/system_func_0";
|
|
4
4
|
import { init_renderer } from "../renderer/initRender";
|
|
5
5
|
import { post_renderer } from "../renderer/postRender";
|
|
6
6
|
import { raw_renderer } from "../renderer/rawRender";
|
|
@@ -23,6 +23,7 @@ export function direct_delivery(protoTypeComponent) {
|
|
|
23
23
|
var context = new ContextController({
|
|
24
24
|
boxMode: true
|
|
25
25
|
});
|
|
26
|
+
set_context_controller(context);
|
|
26
27
|
var webview = document.querySelector("webview");
|
|
27
28
|
raw_renderer(protoTypeComponent, webview.parentNode, webview, context);
|
|
28
29
|
}
|
|
@@ -7,6 +7,6 @@ export declare function router_listener_with_router(view: HTMLElement): void;
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* @param component
|
|
10
|
-
* @param
|
|
10
|
+
* @param mounter
|
|
11
11
|
*/
|
|
12
|
-
export declare function router_listener_without_router(component: Component,
|
|
12
|
+
export declare function router_listener_without_router(component: Component, mounter: HTMLElement): void;
|
package/kernel/router/router.js
CHANGED
|
@@ -7,26 +7,31 @@ import { set_path_variable } from "../../system/recorder/table1/system_func_1";
|
|
|
7
7
|
* @param view
|
|
8
8
|
*/
|
|
9
9
|
export function router_listener_with_router(view) {
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
if (!get_system_ext_router())
|
|
11
|
+
console.log("Router not supported");
|
|
12
|
+
else {
|
|
13
|
+
if (view !== null) {
|
|
14
|
+
var controller = get_context_controller();
|
|
15
|
+
var router = get_system_ext_router();
|
|
16
|
+
var component = router.getComponent();
|
|
17
|
+
var variable = router.getPathVariable();
|
|
18
|
+
set_path_variable(variable);
|
|
19
|
+
spa_delivery(component, view.parentNode, view, controller);
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
console.log("Without view element to render");
|
|
16
23
|
}
|
|
17
|
-
else
|
|
18
|
-
console.log("Without view element to render");
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
*
|
|
22
27
|
* @param component
|
|
23
|
-
* @param
|
|
28
|
+
* @param mounter
|
|
24
29
|
*/
|
|
25
|
-
export function router_listener_without_router(component,
|
|
26
|
-
if (
|
|
30
|
+
export function router_listener_without_router(component, mounter) {
|
|
31
|
+
if (mounter !== null) {
|
|
27
32
|
var controller = get_context_controller();
|
|
28
|
-
spa_delivery(component,
|
|
33
|
+
spa_delivery(component, mounter.parentNode, mounter, controller);
|
|
29
34
|
}
|
|
30
35
|
else
|
|
31
|
-
console.log("Without
|
|
36
|
+
console.log("Without mounter element to render");
|
|
32
37
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluginGeneric } from "../../../tension/generic/plugin/PluginGeneric";
|
|
2
|
+
import { Component } from "../../../index";
|
|
2
3
|
export interface RenderGeneric {
|
|
3
|
-
use_plugin(plugin:
|
|
4
|
+
use_plugin(plugin: PluginGeneric): void;
|
|
5
|
+
add_tag(component: Component): void;
|
|
6
|
+
listen(): void;
|
|
7
|
+
render(component: Component, mounter: string): void;
|
|
8
|
+
weave(mounter: string): void;
|
|
4
9
|
}
|
package/xboot/Entrance.d.ts
CHANGED
|
@@ -3,9 +3,14 @@ import { Component } from "../index";
|
|
|
3
3
|
* The entrance of render
|
|
4
4
|
* @param root
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function render_for_weave(root?: string): void;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare function render_for_listen(): void;
|
|
7
11
|
/**
|
|
8
12
|
*
|
|
9
13
|
* @param component
|
|
14
|
+
* @param mounter
|
|
10
15
|
*/
|
|
11
|
-
export declare function
|
|
16
|
+
export declare function render_for_render(component: Component, mounter: string): void;
|
package/xboot/Entrance.js
CHANGED
|
@@ -6,7 +6,7 @@ import { router_listener_with_router, router_listener_without_router } from "../
|
|
|
6
6
|
* The entrance of render
|
|
7
7
|
* @param root
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function render_for_weave(root) {
|
|
10
10
|
//获取styleLib对象
|
|
11
11
|
get_tag_library().forEach(function (component) {
|
|
12
12
|
themeStyle(component, get_style_library());
|
|
@@ -32,16 +32,23 @@ export function render_for_mpa(root) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export function render_for_listen() {
|
|
39
|
+
get_tag_library().forEach(function (component) {
|
|
40
|
+
themeStyle(component, get_style_library());
|
|
41
|
+
});
|
|
42
|
+
router_listener_with_router(document.querySelector("webview"));
|
|
43
|
+
}
|
|
35
44
|
/**
|
|
36
45
|
*
|
|
37
46
|
* @param component
|
|
47
|
+
* @param mounter
|
|
38
48
|
*/
|
|
39
|
-
export function
|
|
49
|
+
export function render_for_render(component, mounter) {
|
|
40
50
|
get_tag_library().forEach(function (component) {
|
|
41
51
|
themeStyle(component, get_style_library());
|
|
42
52
|
});
|
|
43
|
-
|
|
44
|
-
router_listener_with_router(document.querySelector("webview"));
|
|
45
|
-
else
|
|
46
|
-
router_listener_without_router(component, document.querySelector("webview"));
|
|
53
|
+
router_listener_without_router(component, document.getElementById(mounter));
|
|
47
54
|
}
|