render-core 1.3.70 → 1.4.0

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.
Files changed (93) hide show
  1. package/controller/ComponentController.d.ts +29 -0
  2. package/controller/ComponentController.js +30 -0
  3. package/controller/ContextController.d.ts +28 -0
  4. package/controller/ContextController.js +36 -0
  5. package/core/cmd/data/v-el.d.ts +3 -2
  6. package/core/cmd/data/v-html.d.ts +3 -2
  7. package/core/cmd/data/v-txt.d.ts +3 -2
  8. package/core/cmd/react/v-change.d.ts +6 -0
  9. package/core/cmd/react/v-change.js +22 -0
  10. package/core/cmd/solt/v-solt.d.ts +5 -5
  11. package/core/cmd/solt/v-solt.js +12 -12
  12. package/core/exexutor/executor.d.ts +7 -0
  13. package/core/exexutor/executor.js +24 -0
  14. package/core/inject/inject.d.ts +3 -2
  15. package/core/inject/inject.js +12 -9
  16. package/core/inject/injection.d.ts +22 -0
  17. package/core/inject/injection.js +50 -0
  18. package/core/lifecycle/afterMethods.d.ts +4 -4
  19. package/core/lifecycle/afterMethods.js +3 -3
  20. package/core/lifecycle/controllerCycle.d.ts +16 -7
  21. package/core/lifecycle/controllerCycle.js +47 -23
  22. package/core/lifecycle/mount.d.ts +4 -3
  23. package/core/lifecycle/mount.js +25 -5
  24. package/core/proxy/getProxy.d.ts +6 -8
  25. package/core/proxy/getProxy.js +15 -31
  26. package/core/proxy/proxy.d.ts +9 -0
  27. package/core/proxy/proxy.js +26 -0
  28. package/core/render/PostRender.js +7 -7
  29. package/core/render/delivery.js +1 -1
  30. package/core/render/initRender.js +3 -3
  31. package/core/render/rawRender.js +7 -7
  32. package/core/render/updateRender.js +8 -8
  33. package/core/resolver/props.js +6 -5
  34. package/core/utility/checkUtility.js +1 -1
  35. package/core/utility/cmdUtility.d.ts +4 -3
  36. package/core/utility/cmdUtility.js +15 -15
  37. package/core/utility/injectUtility.d.ts +0 -6
  38. package/core/utility/injectUtility.js +1 -35
  39. package/core/utility/inputType.d.ts +3 -3
  40. package/core/utility/inputType.js +5 -5
  41. package/core/utility/inputUtility.d.ts +1 -0
  42. package/core/utility/inputUtility.js +8 -0
  43. package/core/utility/sectionUtility.d.ts +1 -1
  44. package/core/utility/sectionUtility.js +18 -15
  45. package/core/utility/styleUtility.d.ts +4 -3
  46. package/core/utility/styleUtility.js +17 -29
  47. package/generic/ApplicationGeneric.d.ts +4 -0
  48. package/generic/ApplicationGeneric.js +1 -0
  49. package/generic/ConfigGeneric.d.ts +3 -0
  50. package/generic/ConfigGeneric.js +1 -0
  51. package/generic/ControllerGeneric.d.ts +22 -0
  52. package/generic/ControllerGeneric.js +1 -0
  53. package/generic/RenderGeneric.d.ts +1 -1
  54. package/generic/StyleGeneric.d.ts +4 -0
  55. package/generic/StyleGeneric.js +1 -0
  56. package/generic/originalDataGeneric.d.ts +4 -0
  57. package/generic/originalDataGeneric.js +1 -0
  58. package/http/generic/HttpGeneric.d.ts +3 -1
  59. package/index.d.ts +32 -14
  60. package/index.js +53 -35
  61. package/package.json +2 -2
  62. package/proto/controller/ComponentController.d.ts +11 -8
  63. package/proto/controller/ComponentController.js +8 -6
  64. package/proto/controller/PageController.d.ts +5 -5
  65. package/proto/controller/PageController.js +3 -3
  66. package/runtime/config/RenderConfig.d.ts +12 -0
  67. package/runtime/config/RenderConfig.js +11 -0
  68. package/runtime/config/config.d.ts +4 -0
  69. package/runtime/config/config.js +4 -0
  70. package/runtime/config.d.ts +3 -0
  71. package/runtime/config.js +3 -0
  72. package/runtime/delivery.d.ts +5 -0
  73. package/runtime/delivery.js +43 -0
  74. package/runtime/{Entrance.d.ts → entrance.d.ts} +2 -1
  75. package/runtime/entrance.js +33 -0
  76. package/runtime/render/PostRender.d.ts +15 -0
  77. package/runtime/render/PostRender.js +49 -0
  78. package/runtime/render/delivery.d.ts +5 -0
  79. package/runtime/render/delivery.js +42 -0
  80. package/runtime/render/initRender.d.ts +15 -0
  81. package/runtime/render/initRender.js +46 -0
  82. package/runtime/render/rawRender.d.ts +15 -0
  83. package/runtime/render/rawRender.js +50 -0
  84. package/runtime/renderProcessor.d.ts +11 -0
  85. package/runtime/{RenderProcessor.js → renderProcessor.js} +11 -8
  86. package/runtime/tag/TagProcessor.d.ts +9 -0
  87. package/runtime/tagProcessor.js +27 -0
  88. package/runtime/update/updateRender.d.ts +10 -0
  89. package/runtime/update/updateRender.js +38 -0
  90. package/runtime/Entrance.js +0 -14
  91. package/runtime/RenderProcessor.d.ts +0 -7
  92. /package/runtime/{TagProcessor.js → tag/TagProcessor.js} +0 -0
  93. /package/runtime/{TagProcessor.d.ts → tagProcessor.d.ts} +0 -0
@@ -5,16 +5,17 @@ import { Component } from "render-refer";
5
5
  */
6
6
  export declare function checkStyleLabel(tag: string): boolean;
7
7
  /**
8
- *
8
+ * Here is the function go get all styles associated with the tag component.
9
9
  * @param component
10
10
  * @param styleLib
11
11
  */
12
12
  export declare function themeStyle(component: Component, styleLib: Map<string, object>): void;
13
13
  /**
14
- *
14
+ * Here is the function to resolve
15
15
  * @param tag
16
+ * @param styleLib
16
17
  */
17
- export declare function styleResolve(tag: string): void;
18
+ export declare function styleResolveAndLoad(tag: string, styleLib: Map<string, Map<string, string>>): void;
18
19
  /**
19
20
  *
20
21
  * @param tag
@@ -1,4 +1,5 @@
1
1
  import { loadStyle } from "../loader/loader";
2
+ import RenderConfig from "../../runtime/config/RenderConfig";
2
3
  /**
3
4
  *
4
5
  * @param tag
@@ -16,7 +17,7 @@ export function checkStyleLabel(tag) {
16
17
  return false;
17
18
  }
18
19
  /**
19
- *
20
+ * Here is the function go get all styles associated with the tag component.
20
21
  * @param component
21
22
  * @param styleLib
22
23
  */
@@ -25,53 +26,40 @@ export function themeStyle(component, styleLib) {
25
26
  var dom = document.createElement("div");
26
27
  dom.innerHTML = template;
27
28
  var styles = dom.getElementsByTagName("template")[0].content.querySelectorAll("style");
28
- var kk = new Map();
29
+ var componentStyleList = new Map();
29
30
  for (var i = 0; i < styles.length; i++) {
30
- kk.set(styles[i].getAttribute("theme"), styles[i].innerText);
31
+ componentStyleList.set(styles[i].getAttribute("theme"), styles[i].innerText);
31
32
  }
32
- styleLib.set(component.getName().toUpperCase(), kk);
33
+ styleLib.set(component.getName().toUpperCase(), componentStyleList);
33
34
  }
34
35
  /**
35
- *
36
+ * Here is the function to resolve
36
37
  * @param tag
38
+ * @param styleLib
37
39
  */
38
- export function styleResolve(tag) {
39
- var theme = sessionStorage.getItem("theme_style");
40
- if (Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme) === undefined) {
40
+ export function styleResolveAndLoad(tag, styleLib) {
41
+ //获取到启动样式
42
+ var theme = RenderConfig["defaultTheme"];
43
+ if (styleLib.get(tag.toUpperCase()).get(theme) === undefined) {
41
44
  console.log("tag:" + tag + " has no theme " + theme);
42
- if (Reflect.get(window, "styleLib").get(tag.toUpperCase()).get("default") === undefined) {
45
+ if (styleLib.get(tag.toUpperCase()).get("default") === undefined) {
43
46
  console.log("tag:" + tag + " has no theme " + "default");
44
47
  }
45
48
  else {
46
- loadStyle(tag, "default", Reflect.get(window, "styleLib").get(tag.toUpperCase()).get("default"));
49
+ loadStyle(tag, "default", styleLib.get(tag.toUpperCase()).get("default"));
47
50
  }
48
51
  }
49
52
  else {
50
- loadStyle(tag, theme, Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme));
53
+ loadStyle(tag, theme, styleLib.get(tag.toUpperCase()).get(theme));
51
54
  }
52
55
  }
53
- // /**
54
- // * 从url中获取主题参数
55
- // * @param name
56
- // */
57
- // function getUrlParam(name:string):string {
58
- // //构造一个含有目标参数的正则表达式对象
59
- // var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
60
- // //匹配目标参数
61
- // var r = window.location.search.substr(1).match(reg);
62
- // //返回参数值
63
- // if(r != null) {
64
- // return decodeURI(r[2]);
65
- // }
66
- // return undefined;
67
- // }
68
56
  /**
69
57
  *
70
58
  * @param tag
71
59
  * @param theme
72
60
  */
73
61
  export function changeStyle(tag, theme) {
74
- var styleTxt = Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme);
62
+ var styleTxt = RenderConfig["styleLib"].get(tag.toUpperCase()).get(theme);
75
63
  if (styleTxt === undefined) {
76
64
  console.log("Dont`t find this style!");
77
65
  }
@@ -91,7 +79,7 @@ export function changeStyle(tag, theme) {
91
79
  * @param theme
92
80
  */
93
81
  export function changeTheme(theme) {
94
- Reflect.get(window, "styleLib").forEach(function (value, key) {
82
+ RenderConfig["styleLib"].forEach(function (value, key) {
95
83
  var styles = document.getElementsByTagName("style");
96
84
  for (var i = 0; i < styles.length; i++) {
97
85
  if (styles[i].getAttribute("tag") === key) {
@@ -107,5 +95,5 @@ export function changeTheme(theme) {
107
95
  }
108
96
  }
109
97
  });
110
- sessionStorage.setItem("theme_style", theme);
98
+ RenderConfig["defaultTheme"] = theme;
111
99
  }
@@ -0,0 +1,4 @@
1
+ export interface ApplicationGeneric {
2
+ getVersion(): string;
3
+ getDescription(): string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface ConfigGeneric {
2
+ setDeepProxy(value: boolean): void;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ComponentController } from "../controller/ComponentController";
2
+ import { Component } from "../../render-refer/dist";
3
+ import { ContextController } from "../controller/ContextController";
4
+ export interface ControllerGeneric {
5
+ componentAttachedRootElement: ParentNode;
6
+ prototypeOfComponent: Component;
7
+ parentController: ContextController | ComponentController;
8
+ componentConfig: {
9
+ boxMode: boolean;
10
+ };
11
+ originalData: {};
12
+ dataForMethod: {};
13
+ dataForComputed: {};
14
+ salt: Map<string, any>;
15
+ lazyComponent: Map<string, {}>;
16
+ slaveComponent: ComponentController[];
17
+ method: {};
18
+ computed: {};
19
+ watcher: {};
20
+ receiver(method: string, ...args: any[]): any;
21
+ flush(): void;
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { AbstractPlugin } from "render-refer";
2
2
  export interface RenderGeneric {
3
3
  use(plugin: AbstractPlugin): void;
4
- run(): void;
4
+ run(root: string): void;
5
5
  }
@@ -0,0 +1,4 @@
1
+ export interface StyleGeneric {
2
+ changeStyle(tag: string, theme: string): void;
3
+ changeTheme(theme: string): void;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface OriginalDataGeneric {
2
+ $name?: string;
3
+ $commit?: (method: string, ...args: [any]) => void;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,4 @@
1
- export interface HTMLCollection {
1
+ export interface HttpGeneric {
2
+ relocate(position: string): void;
3
+ redirect(url: string, parameters: {}): void;
2
4
  }
package/index.d.ts CHANGED
@@ -1,16 +1,29 @@
1
- import { PageController } from "./proto/controller/PageController";
1
+ import { ContextController } from "./controller/ContextController";
2
2
  import { AbstractRenderJS, Component } from "render-refer";
3
3
  import { PluginGeneric } from "render-refer/generic/PluginGeneric";
4
4
  import { RenderGeneric } from "./generic/RenderGeneric";
5
+ export declare var Property: {
6
+ STRING: string;
7
+ INT: string;
8
+ FLOAT: string;
9
+ BOOLEAN: string;
10
+ JSON: string;
11
+ };
5
12
  /**
6
13
  * This proto is the application proto.
7
14
  */
8
15
  export declare class RenderJS extends AbstractRenderJS implements RenderGeneric {
9
16
  readonly tagLib: Map<string, Component>;
10
17
  readonly styleLib: Map<string, Map<string, string>>;
11
- private readonly application;
12
- page: PageController;
18
+ readonly rjsLib: Map<string, any>;
19
+ contextController: ContextController;
13
20
  constructor();
21
+ /**
22
+ * Inject element to the window environment.
23
+ * @param name
24
+ * @param func
25
+ */
26
+ static registerElement(name: string, func: any): void;
14
27
  /**
15
28
  * This func is the plugin entry to third vendor
16
29
  */
@@ -21,20 +34,25 @@ export declare class RenderJS extends AbstractRenderJS implements RenderGeneric
21
34
  */
22
35
  addTag(component: Component | Component[]): void;
23
36
  /**
24
- * mount some base object
25
- * @return void
37
+ * This is the method to config some system's props.
38
+ * @param prop
39
+ * @param value
40
+ */
41
+ setConfig(prop: string, value: any): void;
42
+ /**
43
+ * This is the method to get some system's props.
44
+ * @param prop
26
45
  */
27
- private mount;
46
+ getConfig(prop: string): any;
47
+ /**
48
+ * Inject something to global lib.
49
+ * @param prop
50
+ * @param value
51
+ */
52
+ injectElement(prop: string, value: any): void;
28
53
  /**
29
54
  * This method is the booster method of the render.
30
55
  * @return void
31
56
  */
32
- run(): void;
33
- init(): void;
57
+ run(root?: string): void;
34
58
  }
35
- /**
36
- * Inject element to the window environment.
37
- * @param name
38
- * @param func
39
- */
40
- export declare function registerElement(name: string, func: any): void;
package/index.js CHANGED
@@ -13,12 +13,20 @@ 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 { PageController } from "./proto/controller/PageController";
16
+ import { ContextController } from "./controller/ContextController";
17
17
  import { render } from "./runtime/Entrance";
18
- import { changeStyle, changeTheme } from "./core/utility/styleUtility";
19
- import { AppController } from "./proto/controller/AppController";
20
18
  import { AbstractRenderJS } from "render-refer";
21
- import { registerTagLib } from "./runtime/TagProcessor";
19
+ import { registerTagLib } from "./runtime/tag/TagProcessor";
20
+ import RenderConfig from "./runtime/config/RenderConfig";
21
+ import { Executor } from "./core/exexutor/executor";
22
+ //Props 解析字段
23
+ export var Property = {
24
+ STRING: 'string',
25
+ INT: 'int',
26
+ FLOAT: 'float',
27
+ BOOLEAN: 'boolean',
28
+ JSON: 'json'
29
+ };
22
30
  /**
23
31
  * This proto is the application proto.
24
32
  */
@@ -30,17 +38,27 @@ var RenderJS = /** @class */ (function (_super) {
30
38
  _this.tagLib = new Map();
31
39
  //initiate the styleLib object
32
40
  _this.styleLib = new Map();
33
- //initiate the application controller
34
- _this.application = new AppController();
41
+ //initiate the lib
42
+ _this.rjsLib = new Map();
35
43
  //initiate the page controller
36
- _this.page = new PageController();
44
+ _this.contextController = new ContextController({
45
+ boxMode: true,
46
+ });
37
47
  return _this;
38
48
  }
49
+ /**
50
+ * Inject element to the window environment.
51
+ * @param name
52
+ * @param func
53
+ */
54
+ RenderJS.registerElement = function (name, func) {
55
+ Reflect.set(window, name, func);
56
+ };
39
57
  /**
40
58
  * This func is the plugin entry to third vendor
41
59
  */
42
60
  RenderJS.prototype.use = function (plugin) {
43
- plugin.plugin(this);
61
+ plugin.plugin(this, new Executor());
44
62
  };
45
63
  /**
46
64
  * You can use the method to register your single component or an array of components.
@@ -50,41 +68,41 @@ var RenderJS = /** @class */ (function (_super) {
50
68
  registerTagLib(this, component);
51
69
  };
52
70
  /**
53
- * mount some base object
54
- * @return void
71
+ * This is the method to config some system's props.
72
+ * @param prop
73
+ * @param value
74
+ */
75
+ RenderJS.prototype.setConfig = function (prop, value) {
76
+ Reflect.set(RenderConfig, prop, value);
77
+ };
78
+ /**
79
+ * This is the method to get some system's props.
80
+ * @param prop
55
81
  */
56
- RenderJS.prototype.mount = function () {
57
- Reflect.set(window, "tagLib", this.tagLib);
58
- Reflect.set(window, "styleLib", this.styleLib);
59
- Reflect.set(window, "appSite", this.application);
60
- Reflect.set(window, "context", this.page);
82
+ RenderJS.prototype.getConfig = function (prop) {
83
+ return Reflect.get(RenderConfig, prop);
84
+ };
85
+ /**
86
+ * Inject something to global lib.
87
+ * @param prop
88
+ * @param value
89
+ */
90
+ RenderJS.prototype.injectElement = function (prop, value) {
91
+ this.rjsLib.set(prop, value);
61
92
  };
62
93
  /**
63
94
  * This method is the booster method of the render.
64
95
  * @return void
65
96
  */
66
- RenderJS.prototype.run = function () {
67
- //挂载对象
68
- this.mount();
69
- //注册函数
70
- this.registerElements("changeStyle", changeStyle);
71
- //注册函数
72
- this.registerElements("changeTheme", changeTheme);
73
- //初始化
74
- this.init();
97
+ RenderJS.prototype.run = function (root) {
98
+ this.setConfig("tagLib", this.tagLib);
99
+ this.setConfig("styleLib", this.styleLib);
100
+ this.setConfig("rjsLib", this.rjsLib);
101
+ this.setConfig("context", this.contextController);
102
+ this.setConfig("render", this);
75
103
  //execute
76
- render(this);
77
- };
78
- RenderJS.prototype.init = function () {
104
+ render(this, root);
79
105
  };
80
106
  return RenderJS;
81
107
  }(AbstractRenderJS));
82
108
  export { RenderJS };
83
- /**
84
- * Inject element to the window environment.
85
- * @param name
86
- * @param func
87
- */
88
- export function registerElement(name, func) {
89
- Reflect.set(window, name, func);
90
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "render-core",
3
- "version": "1.3.70",
3
+ "version": "1.4.0",
4
4
  "description": "The extendable javascript web framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "render-refer": "0.0.9"
20
+ "render-refer": "1.4.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "^5.8.3"
@@ -1,13 +1,16 @@
1
1
  import { Component } from "render-refer";
2
2
  export declare class ComponentController {
3
- root: ParentNode;
4
- proto: Component;
5
- mode: string;
6
- solt: Map<string, any>;
7
- link: Map<string, {}>;
8
- to: ComponentController[];
9
- raw_data: {};
10
- proxyForMethods: {};
3
+ componentAttachedRootElement: ParentNode;
4
+ prototypeOfComponent: Component;
5
+ originalData: {};
6
+ dataForMethod: {};
7
+ dataForComputed: {};
8
+ componentConfig: {
9
+ boxMode: boolean;
10
+ };
11
+ salt: Map<string, any>;
12
+ lazyComponent: Map<string, {}>;
13
+ slaveComponent: ComponentController[];
11
14
  computed: {};
12
15
  watcher: {};
13
16
  constructor();
@@ -1,13 +1,15 @@
1
1
  var ComponentController = /** @class */ (function () {
2
2
  //构造函数
3
3
  function ComponentController() {
4
- this.link = new Map();
5
- this.to = Array();
6
- this.raw_data = {};
7
- this.solt = new Map();
4
+ this.lazyComponent = new Map();
5
+ this.slaveComponent = Array();
6
+ this.originalData = {};
7
+ this.salt = new Map();
8
8
  this.computed = {};
9
9
  this.watcher = {};
10
- this.mode = "box";
10
+ this.componentConfig = {
11
+ boxMode: true
12
+ };
11
13
  }
12
14
  //接收器
13
15
  ComponentController.prototype.receiver = function (method) {
@@ -15,7 +17,7 @@ var ComponentController = /** @class */ (function () {
15
17
  for (var _i = 1; _i < arguments.length; _i++) {
16
18
  args[_i - 1] = arguments[_i];
17
19
  }
18
- return this.proto.getMethods()[method].apply(this.proxyForMethods, args);
20
+ return this.prototypeOfComponent.getMethods()[method].apply(this.dataForMethod, args);
19
21
  };
20
22
  return ComponentController;
21
23
  }());
@@ -2,11 +2,11 @@ import { ComponentController } from "./ComponentController";
2
2
  export declare class PageController {
3
3
  private methods;
4
4
  private currentTag;
5
- solt: Map<string, any>;
6
- raw_data: {};
7
- proxyForMethods: {};
8
- to: ComponentController[];
9
- link: Map<string, {}>;
5
+ salt: Map<string, any>;
6
+ originalData: {};
7
+ dataForMethod: {};
8
+ slaveComponent: ComponentController[];
9
+ lazyComponent: Map<string, {}>;
10
10
  constructor();
11
11
  /**
12
12
  *
@@ -3,10 +3,10 @@ var PageController = /** @class */ (function () {
3
3
  function PageController() {
4
4
  //注入系统方法
5
5
  this.methods = Reflect.get(window, "pageMethods");
6
- this.link = new Map();
7
- this.to = Array();
6
+ this.lazyComponent = new Map();
7
+ this.slaveComponent = Array();
8
8
  this.crtTag = null;
9
- this.solt = new Map();
9
+ this.salt = new Map();
10
10
  }
11
11
  /**
12
12
  *
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ deepProxy: boolean;
3
+ defaultTheme: string;
4
+ context: any;
5
+ render: any;
6
+ tagLib: any;
7
+ styleLib: any;
8
+ rjsLib: any;
9
+ pluginsLib: any;
10
+ crt: any;
11
+ };
12
+ export default _default;
@@ -0,0 +1,11 @@
1
+ export default {
2
+ deepProxy: true,
3
+ defaultTheme: "default",
4
+ context: null,
5
+ render: null,
6
+ tagLib: null,
7
+ styleLib: null,
8
+ rjsLib: null,
9
+ pluginsLib: null,
10
+ crt: null
11
+ };
@@ -0,0 +1,4 @@
1
+ export declare var RenderConfig: {
2
+ deepReact: boolean;
3
+ defaultTheme: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export var RenderConfig = {
2
+ deepReact: true,
3
+ defaultTheme: "default"
4
+ };
@@ -0,0 +1,3 @@
1
+ export declare var RenderConfig: {
2
+ deepReact: boolean;
3
+ };
@@ -0,0 +1,3 @@
1
+ export var RenderConfig = {
2
+ deepReact: true
3
+ };
@@ -0,0 +1,5 @@
1
+ import { ComponentController } from "../controller/ComponentController";
2
+ import { ContextController } from "../controller/ContextController";
3
+ import { Component } from "../../render-refer/dist";
4
+ export declare function delivery(protoTypeComponent: Component, componentAttachedRootElement: ParentNode, child: Element, parentController: ComponentController | ContextController, tagLib: Map<string, Component>, styleLib: Map<string, Map<string, string>>, rjsLib: Map<string, any>): void;
5
+ export declare function findComponent(collection: HTMLCollection, parentController: ComponentController | ContextController, tagLib: Map<string, Component>, styleLib: Map<string, Map<string, string>>, rjsLib: Map<string, any>): void;
@@ -0,0 +1,43 @@
1
+ import { isUnKnown } from "../core/utility/checkUtility";
2
+ import { init_render } from "./render/InitRender";
3
+ import { post_render } from "./render/PostRender";
4
+ import { raw_render } from "./render/RawRender";
5
+ import { getTemplate } from "../core/utility/templateUtility";
6
+ import { styleResolveAndLoad } from "../core/utility/styleUtility";
7
+ import RenderConfig from "./config/RenderConfig";
8
+ //渲染自定义标签
9
+ export function delivery(protoTypeComponent, componentAttachedRootElement, child, parentController, tagLib, styleLib, rjsLib) {
10
+ //获得模板元素
11
+ var tagTemplate = getTemplate(protoTypeComponent);
12
+ //加载组件样式
13
+ styleResolveAndLoad(protoTypeComponent.getName(), styleLib);
14
+ //注册当前解析元素
15
+ RenderConfig["crt"] = child;
16
+ //两种渲染方式
17
+ if (child.hasAttribute("name")) {
18
+ //需要保持状态的渲染
19
+ if (parentController.lazyComponent.has(child.getAttribute("name"))) {
20
+ //该元素存在旧数据,是更新渲染
21
+ init_render(protoTypeComponent, componentAttachedRootElement, child, parentController, tagTemplate, tagLib, styleLib, rjsLib);
22
+ }
23
+ else {
24
+ //该元素不存在旧数据,是第一次渲染
25
+ post_render(protoTypeComponent, componentAttachedRootElement, child, parentController, tagTemplate, tagLib, styleLib, rjsLib);
26
+ }
27
+ }
28
+ else {
29
+ //不需要保持状态的渲染
30
+ raw_render(protoTypeComponent, componentAttachedRootElement, child, parentController, tagTemplate, tagLib, styleLib, rjsLib);
31
+ }
32
+ }
33
+ //拓展标签深度渲染
34
+ export function findComponent(collection, parentController, tagLib, styleLib, rjsLib) {
35
+ for (var i = 0; i < collection.length; i++) {
36
+ if (isUnKnown(collection[i].nodeName)) {
37
+ delivery(tagLib.get(collection[i].nodeName.toUpperCase()), collection[i].parentNode, collection[i], parentController, tagLib, styleLib, rjsLib);
38
+ }
39
+ else {
40
+ findComponent(collection[i].children, parentController, tagLib, styleLib, rjsLib);
41
+ }
42
+ }
43
+ }
@@ -2,5 +2,6 @@ import { RenderJS } from "../index";
2
2
  /**
3
3
  * The entrance of render
4
4
  * @param renderJs
5
+ * @param root
5
6
  */
6
- export declare function render(renderJs: RenderJS): void;
7
+ export declare function render(renderJs: RenderJS, root: string): void;
@@ -0,0 +1,33 @@
1
+ import { themeStyle } from "../core/utility/styleUtility";
2
+ import { renderHtml } from "./RenderProcessor";
3
+ /**
4
+ * The entrance of render
5
+ * @param renderJs
6
+ * @param root
7
+ */
8
+ export function render(renderJs, root) {
9
+ //获取styleLib对象
10
+ renderJs.tagLib.forEach(function (component) {
11
+ themeStyle(component, renderJs.styleLib);
12
+ });
13
+ if (root == null) {
14
+ //开始渲染
15
+ renderJs.contextController.componentAttachedRootElement = document.body;
16
+ renderHtml(document.children, renderJs.contextController, renderJs.tagLib, renderJs.styleLib, renderJs.rjsLib);
17
+ }
18
+ else {
19
+ var mountPoint = document.getElementById(root);
20
+ if (mountPoint == null) {
21
+ renderJs.contextController.componentAttachedRootElement = document.body;
22
+ //开始渲染
23
+ console.warn("Mount point not found");
24
+ console.warn("Mount point was selected to body");
25
+ renderHtml(document.body.children, renderJs.contextController, renderJs.tagLib, renderJs.styleLib, renderJs.rjsLib);
26
+ }
27
+ else {
28
+ //开始渲染
29
+ renderJs.contextController.componentAttachedRootElement = mountPoint;
30
+ renderHtml(mountPoint.children, renderJs.contextController, renderJs.tagLib, renderJs.styleLib, renderJs.rjsLib);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ import { ComponentController } from "../../controller/ComponentController";
2
+ import { ContextController } from "../../controller/ContextController";
3
+ import { Component } from "../../../render-refer/dist";
4
+ /**
5
+ * 该函数用于初次渲染需要记录状态的组件
6
+ * @param protoType
7
+ * @param parent
8
+ * @param child
9
+ * @param componentController
10
+ * @param tagTemplate
11
+ * @param tagLib
12
+ * @param styleLib
13
+ * @param rjsLib
14
+ */
15
+ export declare function post_render(protoType: Component, parent: ParentNode, child: Element, componentController: ComponentController | ContextController, tagTemplate: Element, tagLib: Map<string, Component>, styleLib: Map<string, Map<string, string>>, rjsLib: Map<string, any>): void;