render-core 1.0.98 → 1.0.100

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.
@@ -0,0 +1,3 @@
1
+ export declare class ContextController {
2
+ constructor();
3
+ }
@@ -0,0 +1,6 @@
1
+ var ContextController = /** @class */ (function () {
2
+ function ContextController() {
3
+ }
4
+ return ContextController;
5
+ }());
6
+ export { ContextController };
@@ -0,0 +1,3 @@
1
+ export interface RenderTip {
2
+ use(callable: any): void;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,14 +1,6 @@
1
- import { ComponentController } from "../../../class/controller/componentController";
2
1
  /**
3
2
  * 绑定数据模型
4
3
  * @param nodes
5
4
  * @param data
6
5
  */
7
6
  export declare function resolver_model(nodes: HTMLCollection, data: {}): void;
8
- /**
9
- *
10
- * @param nodes
11
- * @param data
12
- * @param controller
13
- */
14
- export declare function bindModelForUpdater(nodes: HTMLCollection, data: {}, controller: ComponentController): void;
@@ -1,4 +1,3 @@
1
- import { locateInputAddress } from "../../utility/sectionUtility";
2
1
  /**
3
2
  * 绑定数据模型
4
3
  * @param nodes
@@ -11,7 +10,7 @@ export function resolver_model(nodes, data) {
11
10
  nodes[i].removeAttribute("v-model");
12
11
  var tagName = nodes[i].tagName;
13
12
  nodes[i].setAttribute("name", dataName);
14
- if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
13
+ if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA" || tagName === "DATALIST") {
15
14
  var listener = function (evt) {
16
15
  if (!evt.target.hasAttribute("flag")) {
17
16
  //Get the event element
@@ -44,57 +43,3 @@ export function resolver_model(nodes, data) {
44
43
  resolver_model(nodes[i].children, data);
45
44
  }
46
45
  }
47
- /**
48
- *
49
- * @param nodes
50
- * @param data
51
- * @param controller
52
- */
53
- export function bindModelForUpdater(nodes, data, controller) {
54
- for (var i = 0; i < nodes.length; i++) {
55
- if (nodes[i].hasAttribute("v-model")) {
56
- var dataName = nodes[i].getAttribute("v-model");
57
- nodes[i].removeAttribute("v-model");
58
- var tagName = nodes[i].tagName;
59
- nodes[i].setAttribute("name", dataName);
60
- // @ts-ignore
61
- nodes[i].setAttribute("value", data[dataName]);
62
- if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
63
- nodes[i].setAttribute("name", dataName);
64
- // @ts-ignore
65
- nodes[i].setAttribute("value", data[dataName]);
66
- //光标定位
67
- var listener = function (evt) {
68
- if (!evt.target.hasAttribute("flag")) {
69
- //Get the event element
70
- var element = evt.target;
71
- //Get the name attribute
72
- var dataName_2 = element.name;
73
- Reflect.set(this, "origin", {
74
- cpn: element.getAttribute("cpn"),
75
- tag: element.nodeName,
76
- name: element.getAttribute("name")
77
- });
78
- //Update the value
79
- this[dataName_2] = element.value;
80
- }
81
- };
82
- var compositionstart = function (evt) {
83
- evt.target.setAttribute("flag", "false");
84
- };
85
- var compositionend = function (evt) {
86
- evt.target.setAttribute("flag", "true");
87
- var element = evt.target;
88
- var dataName = element.name;
89
- this[dataName] = element.value;
90
- };
91
- nodes[i].addEventListener("input", listener.bind(data));
92
- nodes[i].addEventListener("compositionstart", compositionstart);
93
- nodes[i].addEventListener("compositionend", compositionend.bind(data));
94
- // @ts-ignore
95
- locateInputAddress(controller);
96
- }
97
- }
98
- bindModelForUpdater(nodes[i].children, data, controller);
99
- }
100
- }
@@ -1,6 +1,6 @@
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";
1
+ import { inject, injectComputed, injectMethod, injectWatcher } from "../inject/inject";
2
+ import { getProxyObject } from "../proxy/getProxy";
3
+ import { getCodeSpaceForCommit, getCodeSpaceForProperty, getCodeSpaceForPublish, getCommitMethod, getPublishMethod, getSetterMethod } from "../utility/injectUtility";
4
4
  /**
5
5
  * This function is used to initiate the component controller object.
6
6
  * @param controller
@@ -1,4 +1,4 @@
1
- import { checkStyleLabel } from "../../core/utility/styleUtility";
1
+ import { checkStyleLabel } from "../utility/styleUtility";
2
2
  /**
3
3
  * 加载自定义标签样式
4
4
  * @param tag
@@ -1,9 +1,9 @@
1
1
  import { ComponentController } from "../../class/controller/componentController";
2
- import { controllerCycleTypeTwo } from "../../library/lifecycle/controllerCycle";
3
- import { afterCmd, cmd } from "../../library/cmd/cmd";
4
- import { mount } from "../../library/lifecycle/mount";
2
+ import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
3
+ import { afterCmd, cmdUtility } from "../utility/cmdUtility";
4
+ import { mount } from "../lifecycle/mount";
5
5
  import { injectRefs } from "../inject/inject";
6
- import { afterMethodsTypeOne } from "../../library/lifecycle/afterMethods";
6
+ import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
7
7
  import { findComponent } from "./delivery";
8
8
  import { resolver_solt } from "../cmd/solt/v-solt";
9
9
  /**
@@ -25,7 +25,7 @@ export function post_render(proto, parent, child, link, tagTemplate) {
25
25
  var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
26
26
  beforeRender();
27
27
  //解析指令
28
- cmd(tagTemplate, proto, controller);
28
+ cmdUtility(tagTemplate, proto, controller);
29
29
  //beforeMount
30
30
  var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
31
31
  beforeMount();
@@ -1,9 +1,9 @@
1
1
  import { ComponentController } from "../../class/controller/componentController";
2
- import { controllerCycleTypeOne } from "../../library/lifecycle/controllerCycle";
3
- import { afterCmd, cmd } from "../../library/cmd/cmd";
4
- import { mount } from "../../library/lifecycle/mount";
2
+ import { controllerCycleTypeOne } from "../lifecycle/controllerCycle";
3
+ import { afterCmd, cmdUtility } from "../utility/cmdUtility";
4
+ import { mount } from "../lifecycle/mount";
5
5
  import { injectRefs } from "../inject/inject";
6
- import { afterMethodsTypeOne } from "../../library/lifecycle/afterMethods";
6
+ import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
7
7
  import { findComponent } from "./delivery";
8
8
  import { resolver_solt } from "../cmd/solt/v-solt";
9
9
  /**
@@ -25,7 +25,7 @@ export function init_render(proto, parent, child, link, tagTemplate) {
25
25
  var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
26
26
  beforeRender();
27
27
  //内存中数据渲染
28
- cmd(tagTemplate, proto, controller);
28
+ cmdUtility(tagTemplate, proto, controller);
29
29
  //beforeMount
30
30
  var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
31
31
  beforeMount();
@@ -1,9 +1,9 @@
1
1
  import { ComponentController } from "../../class/controller/componentController";
2
- import { controllerCycleTypeTwo } from "../../library/lifecycle/controllerCycle";
3
- import { afterCmd, cmd } from "../../library/cmd/cmd";
4
- import { mount } from "../../library/lifecycle/mount";
2
+ import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
3
+ import { afterCmd, cmdUtility } from "../utility/cmdUtility";
4
+ import { mount } from "../lifecycle/mount";
5
5
  import { injectRefs } from "../inject/inject";
6
- import { afterMethodsTypeTwo } from "../../library/lifecycle/afterMethods";
6
+ import { afterMethodsTypeTwo } from "../lifecycle/afterMethods";
7
7
  import { findComponent } from "./delivery";
8
8
  import { resolver_solt } from "../cmd/solt/v-solt";
9
9
  /**
@@ -25,7 +25,7 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
25
25
  var beforeRender = proto.getBeforeRender().bind(controller.raw_data);
26
26
  beforeRender();
27
27
  //解析指令
28
- cmd(tagTemplate, proto, controller);
28
+ cmdUtility(tagTemplate, proto, controller);
29
29
  //beforeMount
30
30
  var beforeMount = proto.getBeforeMount().bind(controller.raw_data);
31
31
  beforeMount();
@@ -1,8 +1,9 @@
1
- import { afterCmd, cmdForUpdate } from "../../library/cmd/cmd";
1
+ import { afterCmd, cmdUtility, } from "../utility/cmdUtility";
2
2
  import { injectRefs } from "../inject/inject";
3
3
  import { findComponent } from "./delivery";
4
4
  import { getTemplate } from "../utility/templateUtility";
5
- import { bindModelForUpdater } from "../cmd/react/v-model";
5
+ import { resolver_model } from "../cmd/react/v-model";
6
+ import { locateInputAddress } from "../utility/sectionUtility";
6
7
  /**
7
8
  * 更新渲染方法
8
9
  * @param controller
@@ -16,7 +17,7 @@ export function update_Render(controller) {
16
17
  var beforeRender = controller.proto.getBeforeRender().bind(controller.raw_data);
17
18
  beforeRender();
18
19
  //解析指令
19
- cmdForUpdate(tagTemplate, controller.proto, controller);
20
+ cmdUtility(tagTemplate, controller.proto, controller);
20
21
  //beforeUnmount
21
22
  var beforeUnmount = controller.proto.getBeforeUnmount().bind(controller.raw_data);
22
23
  beforeUnmount();
@@ -37,8 +38,9 @@ export function update_Render(controller) {
37
38
  //afterRender
38
39
  var afterRender = controller.proto.getAfterRender().bind(controller.raw_data);
39
40
  afterRender();
41
+ resolver_model(controller.root.children, controller.proxyForMethods);
40
42
  //获取定位
41
- bindModelForUpdater(controller.root.children, controller.proxyForMethods, controller);
43
+ locateInputAddress(controller);
42
44
  //深度渲染
43
45
  findComponent(controller.root.children, controller);
44
46
  }
@@ -1,4 +1,4 @@
1
- import metaTagLib from "../../runtime/database/metaTagLib";
1
+ import metaTagLib from "../../runtime/metaTagLib";
2
2
  export function isUnKnown(element) {
3
3
  return !metaTagLib.some(function (ele) { return ele == element; });
4
4
  }
@@ -6,7 +6,7 @@ import { ComponentController } from "../../class/controller/componentController"
6
6
  * @param proto
7
7
  * @param controller
8
8
  */
9
- export declare function cmd(tagTemplate: Element, proto: Component, controller: ComponentController): void;
9
+ export declare function cmdUtility(tagTemplate: Element, proto: Component, controller: ComponentController): void;
10
10
  /**
11
11
  * This function is used to resolver those commands which should be executed after mount.
12
12
  * @param templateSpace
@@ -14,10 +14,3 @@ export declare function cmd(tagTemplate: Element, proto: Component, controller:
14
14
  * @param controller
15
15
  */
16
16
  export declare function afterCmd(templateSpace: ParentNode, proto: Component, controller: ComponentController): void;
17
- /**
18
- *
19
- * @param tagTemplate
20
- * @param proto
21
- * @param controller
22
- */
23
- export declare function cmdForUpdate(tagTemplate: Element, proto: Component, controller: ComponentController): void;
@@ -0,0 +1,57 @@
1
+ import { addLabel } from "./miscUtility";
2
+ import { resolver_event } from "../cmd/method/v-on";
3
+ import { resolver_html } from "../cmd/data/v-html";
4
+ import { resolver_txt } from "../cmd/data/v-txt";
5
+ import { resolver_model } from "../cmd/react/v-model";
6
+ import { resolver_bind } from "../cmd/property/v-bind";
7
+ import { resolver_show } from "../cmd/justify/v-show";
8
+ import { resolver_render } from "../cmd/justify/v-render";
9
+ import { resolver_if } from "../cmd/justify/v-if";
10
+ import { resolver_switch } from "../cmd/justify/v-switch";
11
+ import { resolver_for_each, resolver_for_of } from "../cmd/loop/v-for";
12
+ import { extract_solt } from "../cmd/solt/v-solt";
13
+ import { resolver_experssion } from "../cmd/data/v-el";
14
+ /**
15
+ * This function is used to resolver those commands which should be executed before mount.
16
+ * @param tagTemplate
17
+ * @param proto
18
+ * @param controller
19
+ */
20
+ export function cmdUtility(tagTemplate, proto, controller) {
21
+ //给所有元素添加上npm=tag标志
22
+ addLabel(tagTemplate.children, proto.getName());
23
+ //将元素事件绑定到元素上
24
+ resolver_event(tagTemplate.children, proto.getMethods(), controller.proxyForMethods);
25
+ //渲染html
26
+ resolver_html(tagTemplate.children, controller.proxyForMethods, controller);
27
+ //渲染text
28
+ resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
29
+ //绑定数据
30
+ resolver_model(tagTemplate.children, controller.proxyForMethods);
31
+ //渲染属性
32
+ resolver_bind(tagTemplate.children, controller.proxyForMethods);
33
+ //solt
34
+ extract_solt(tagTemplate.children, controller);
35
+ }
36
+ /**
37
+ * This function is used to resolver those commands which should be executed after mount.
38
+ * @param templateSpace
39
+ * @param proto
40
+ * @param controller
41
+ */
42
+ export function afterCmd(templateSpace, proto, controller) {
43
+ //v-show
44
+ resolver_show(templateSpace.children, controller.proxyForMethods);
45
+ //v-render
46
+ resolver_render(templateSpace.children, controller.proxyForMethods);
47
+ //v-if
48
+ resolver_if(templateSpace.children, controller.proxyForMethods);
49
+ //v-switch
50
+ resolver_switch(templateSpace.children, controller.proxyForMethods);
51
+ //v-for-each
52
+ resolver_for_each(templateSpace.children, controller.proxyForMethods);
53
+ //v-for-of
54
+ resolver_for_of(templateSpace.children, controller.proxyForMethods);
55
+ //v-el
56
+ resolver_experssion(controller.root, controller.proxyForMethods, controller);
57
+ }
@@ -1,4 +1,4 @@
1
- import { loadStyle } from "../../library/loader/loader";
1
+ import { loadStyle } from "../loader/loader";
2
2
  // @ts-ignore
3
3
  import { sessionStorageEngin_read } from "render-status/read/read";
4
4
  /**
@@ -1,2 +1,15 @@
1
+ /**
2
+ *
3
+ * @param baseRoot
4
+ * @param temp
5
+ * @param index
6
+ * @param data
7
+ */
1
8
  export declare function extractForArray(baseRoot: ParentNode, temp: Node, index: number, data: any): void;
9
+ /**
10
+ *
11
+ * @param baseRoot
12
+ * @param temp
13
+ * @param data
14
+ */
2
15
  export declare function extractForMap(baseRoot: ParentNode, temp: Node, data: any): void;
@@ -1,7 +1,20 @@
1
1
  import { part_render_array, part_render_map } from "../render/partRender";
2
+ /**
3
+ *
4
+ * @param baseRoot
5
+ * @param temp
6
+ * @param index
7
+ * @param data
8
+ */
2
9
  export function extractForArray(baseRoot, temp, index, data) {
3
10
  part_render_array(baseRoot, temp, index, data);
4
11
  }
12
+ /**
13
+ *
14
+ * @param baseRoot
15
+ * @param temp
16
+ * @param data
17
+ */
5
18
  export function extractForMap(baseRoot, temp, data) {
6
19
  part_render_map(baseRoot, temp, data);
7
20
  }
package/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Component } from "./class/component/component";
2
2
  import { routerController } from "render-security/class/Router";
3
3
  import { PageController } from "./class/controller/pageController";
4
+ import { RenderTip } from "./class/tips/renderTip";
4
5
  /**
5
6
  * This class is the application class.
6
7
  */
7
- export declare class RenderJS {
8
+ export declare class RenderJS implements RenderTip {
8
9
  readonly config: {};
9
10
  readonly tagLib: Map<string, Component>;
10
11
  readonly styleLib: Map<string, Map<string, string>>;
@@ -23,6 +24,11 @@ export declare class RenderJS {
23
24
  * @param component
24
25
  */
25
26
  addTag(component: Component | Component[]): void;
27
+ /**
28
+ *
29
+ * @param callable
30
+ */
31
+ use(callable: any): void;
26
32
  /**
27
33
  * This method is the boster method of the render.
28
34
  */
package/index.js CHANGED
@@ -37,6 +37,13 @@ var RenderJS = /** @class */ (function () {
37
37
  RenderJS.prototype.addTag = function (component) {
38
38
  registerTagLib(this, component);
39
39
  };
40
+ /**
41
+ *
42
+ * @param callable
43
+ */
44
+ RenderJS.prototype.use = function (callable) {
45
+ callable(this);
46
+ };
40
47
  /**
41
48
  * This method is the boster method of the render.
42
49
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "render-core",
3
- "version": "1.0.98",
3
+ "version": "1.0.100",
4
4
  "description": "The core of render-js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,77 +0,0 @@
1
- import { addLabel } from "../../core/utility/miscUtility";
2
- import { resolver_event } from "../../core/cmd/method/v-on";
3
- import { resolver_html } from "../../core/cmd/data/v-html";
4
- import { resolver_txt } from "../../core/cmd/data/v-txt";
5
- import { resolver_model } from "../../core/cmd/react/v-model";
6
- import { resolver_bind } from "../../core/cmd/property/v-bind";
7
- import { resolver_show } from "../../core/cmd/justify/v-show";
8
- import { resolver_render } from "../../core/cmd/justify/v-render";
9
- import { resolver_if } from "../../core/cmd/justify/v-if";
10
- import { resolver_switch } from "../../core/cmd/justify/v-switch";
11
- import { resolver_for_each, resolver_for_of } from "../../core/cmd/loop/v-for";
12
- import { extract_solt } from "../../core/cmd/solt/v-solt";
13
- import { resolver_experssion } from "../../core/cmd/data/v-el";
14
- /**
15
- * This function is used to resolver those commands which should be executed before mount.
16
- * @param tagTemplate
17
- * @param proto
18
- * @param controller
19
- */
20
- export function cmd(tagTemplate, proto, controller) {
21
- //给所有元素添加上npm=tag标志
22
- addLabel(tagTemplate.children, proto.getName());
23
- //将元素事件绑定到元素上
24
- resolver_event(tagTemplate.children, proto.getMethods(), controller.proxyForMethods);
25
- //渲染html
26
- resolver_html(tagTemplate.children, controller.proxyForMethods, controller);
27
- //渲染text
28
- resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
29
- //绑定数据
30
- resolver_model(tagTemplate.children, controller.proxyForMethods);
31
- //渲染属性
32
- resolver_bind(tagTemplate.children, controller.proxyForMethods);
33
- //solt
34
- extract_solt(tagTemplate.children, controller);
35
- }
36
- /**
37
- * This function is used to resolver those commands which should be executed after mount.
38
- * @param templateSpace
39
- * @param proto
40
- * @param controller
41
- */
42
- export function afterCmd(templateSpace, proto, controller) {
43
- //v-show
44
- resolver_show(templateSpace.children, controller.proxyForMethods);
45
- //v-render
46
- resolver_render(templateSpace.children, controller.proxyForMethods);
47
- //v-if
48
- resolver_if(templateSpace.children, controller.proxyForMethods);
49
- //v-switch
50
- resolver_switch(templateSpace.children, controller.proxyForMethods);
51
- //v-for-each
52
- resolver_for_each(templateSpace.children, controller.proxyForMethods);
53
- //v-for-of
54
- resolver_for_of(templateSpace.children, controller.proxyForMethods);
55
- //v-el
56
- resolver_experssion(controller.root, controller.proxyForMethods, controller);
57
- }
58
- /**
59
- *
60
- * @param tagTemplate
61
- * @param proto
62
- * @param controller
63
- */
64
- export function cmdForUpdate(tagTemplate, proto, controller) {
65
- //给所有元素添加上npm=tag标志
66
- addLabel(tagTemplate.children, proto.getName());
67
- //将元素事件绑定到元素上
68
- resolver_event(tagTemplate.children, proto.getMethods(), controller.proxyForMethods);
69
- //渲染html
70
- resolver_html(tagTemplate.children, controller.proxyForMethods, controller);
71
- //渲染text
72
- resolver_txt(tagTemplate.children, controller.proxyForMethods, controller);
73
- //v-show
74
- resolver_show(tagTemplate.children, controller.proxyForMethods);
75
- //v-render
76
- resolver_render(tagTemplate.children, controller.proxyForMethods);
77
- }
File without changes
File without changes
File without changes
File without changes
File without changes