render-core 1.4.31 → 1.4.32

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 (62) hide show
  1. package/index.d.ts +62 -29
  2. package/index.js +50 -44
  3. package/kernel/delivery/delivery.d.ts +4 -10
  4. package/kernel/delivery/delivery.js +4 -17
  5. package/kernel/directive/data/v-el.d.ts +1 -1
  6. package/kernel/directive/data/v-html.d.ts +1 -1
  7. package/kernel/directive/data/v-txt.d.ts +1 -1
  8. package/kernel/directive/justify/v-if.js +2 -2
  9. package/kernel/directive/slot/v-slot.d.ts +1 -1
  10. package/kernel/proxyer/getProxy.d.ts +1 -1
  11. package/kernel/renderer/initRender.d.ts +3 -3
  12. package/kernel/renderer/initRender.js +6 -5
  13. package/kernel/renderer/pageRender.d.ts +9 -0
  14. package/kernel/renderer/pageRender.js +53 -0
  15. package/kernel/renderer/postRender.d.ts +3 -3
  16. package/kernel/renderer/postRender.js +4 -3
  17. package/kernel/renderer/rawRender.d.ts +3 -3
  18. package/kernel/renderer/rawRender.js +4 -3
  19. package/kernel/renderer/updateRender.d.ts +1 -1
  20. package/kernel/router/router.d.ts +3 -9
  21. package/kernel/router/router.js +10 -30
  22. package/package.json +1 -1
  23. package/system/generic/component/ComponentGeneric.d.ts +2 -2
  24. package/system/generic/component/instance/AbstractComponent.d.ts +41 -0
  25. package/system/generic/component/instance/AbstractComponent.js +98 -0
  26. package/system/generic/controller/ControllerGeneric.d.ts +3 -3
  27. package/system/generic/controller/prototype/ContextController.d.ts +30 -0
  28. package/system/generic/controller/prototype/ContextController.js +17 -0
  29. package/system/generic/controller/prototype/HttpAction.d.ts +9 -0
  30. package/system/generic/controller/prototype/HttpAction.js +37 -0
  31. package/system/generic/data/ComputedDataGeneric.d.ts +1 -1
  32. package/system/generic/data/OriginalDataGeneric.d.ts +1 -1
  33. package/system/generic/data/WatcherDataGeneric.d.ts +1 -1
  34. package/system/generic/render/RenderGeneric.d.ts +2 -4
  35. package/system/injection/injection.d.ts +1 -1
  36. package/system/injection/injector.d.ts +5 -5
  37. package/system/lifecycle/lifeCycle.d.ts +1 -1
  38. package/system/lifecycle/mount.d.ts +3 -3
  39. package/system/lifecycle/mount.js +1 -1
  40. package/system/recorder/table0/system_func_0.d.ts +5 -5
  41. package/system/recorder/table0/system_t_0.d.ts +2 -2
  42. package/system/recorder/table1/system_func_1.d.ts +2 -0
  43. package/system/recorder/table1/system_func_1.js +6 -0
  44. package/system/recorder/table3/system_func_3.d.ts +1 -1
  45. package/system/utility/directive/cmdUtility.d.ts +3 -3
  46. package/system/utility/initiate/templateUtility.d.ts +2 -2
  47. package/system/utility/react/inputType.d.ts +1 -1
  48. package/system/utility/react/sectionUtility.d.ts +1 -1
  49. package/system/utility/style/styleUtility.d.ts +2 -2
  50. package/tension/SystemInitPlugin.js +1 -1
  51. package/tension/generic/plugin/hooks/HooksGeneric.d.ts +0 -2
  52. package/tension/generic/plugin/preface/PrefaceGeneric.d.ts +3 -3
  53. package/tension/generic/router/RouterGeneric.d.ts +6 -3
  54. package/tension/prototype/HooksAction.d.ts +0 -2
  55. package/tension/prototype/HooksAction.js +0 -4
  56. package/tension/prototype/PrefaceAction.d.ts +3 -3
  57. package/verify/directive-linter.d.ts +0 -4
  58. package/verify/directive-linter.js +152 -123
  59. package/xboot/entrance.d.ts +1 -13
  60. package/xboot/entrance.js +3 -49
  61. package/xboot/renderProcessor.d.ts +1 -1
  62. package/xboot/tagProcessor.d.ts +2 -2
@@ -1,123 +1,152 @@
1
- var BOOLEAN_CONDITION_DIRECTIVES = ["@if", "@show"];
2
- var ARRAY_ITERATION_DIRECTIVES = ["@for", "@map"];
3
- var MODEL_ELEMENT = ["INPUT", "SELECT", "TEXTAREA"];
4
- function parseTemplateForDirectives(template) {
5
- var directives = [];
6
- var lines = template.split("\n");
7
- for (var lineIndex = 0; lineIndex < lines.length; lineIndex++) {
8
- var line = lines[lineIndex];
9
- var directiveRegex = /@(\w+)(?:\s*=\s*"([^"]*)"|\s*=\s*'([^']*)')?/g;
10
- var match = void 0;
11
- while ((match = directiveRegex.exec(line)) !== null) {
12
- var directiveName = match[1];
13
- var expression = match[2] || match[3] || "";
14
- var elementMatch = line.match(/<(\w+)/);
15
- var element = elementMatch ? elementMatch[1] : "unknown";
16
- directives.push({
17
- directive: "@".concat(directiveName),
18
- expression: expression,
19
- element: element.toUpperCase(),
20
- line: lineIndex + 1,
21
- column: match.index + 1
22
- });
23
- }
24
- }
25
- return directives;
26
- }
27
- function inferType(value) {
28
- if (value === true || value === false)
29
- return "boolean";
30
- if (Array.isArray(value))
31
- return "array";
32
- if (typeof value === "number")
33
- return "number";
34
- if (typeof value === "string")
35
- return "string";
36
- if (typeof value === "object" && value !== null)
37
- return "object";
38
- if (value === null)
39
- return "null";
40
- return "unknown";
41
- }
42
- function getDataTypes(component) {
43
- var types = new Map();
44
- var data = component.getData();
45
- if (data && typeof data === "object") {
46
- Object.keys(data).forEach(function (key) {
47
- types.set(key, inferType(data[key]));
48
- });
49
- }
50
- return types;
51
- }
52
- function validateBooleanCondition(directive, component) {
53
- var dataTypes = getDataTypes(component);
54
- var actualType = dataTypes.get(directive.expression);
55
- if (actualType && actualType !== "boolean") {
56
- return {
57
- rule: "boolean-condition",
58
- message: "Directive '".concat(directive.directive, "' expects boolean but '").concat(directive.expression, "' is ").concat(actualType),
59
- line: directive.line,
60
- column: directive.column
61
- };
62
- }
63
- return null;
64
- }
65
- function validateArrayIteration(directive, component) {
66
- var dataTypes = getDataTypes(component);
67
- var actualType = dataTypes.get(directive.expression);
68
- if (actualType && actualType !== "array") {
69
- return {
70
- rule: "array-iteration",
71
- message: "Directive '".concat(directive.directive, "' expects array but '").concat(directive.expression, "' is ").concat(actualType),
72
- line: directive.line,
73
- column: directive.column
74
- };
75
- }
76
- return null;
77
- }
78
- function validateModelElement(directive, component) {
79
- if (MODEL_ELEMENT.indexOf(directive.element) === -1) {
80
- return {
81
- rule: "valid-model-element",
82
- message: "Directive '@model' can only be used on INPUT, SELECT, or TEXTAREA, but found '".concat(directive.element, "'"),
83
- line: directive.line,
84
- column: directive.column
85
- };
86
- }
87
- return null;
88
- }
89
- export function lintComponent(component) {
90
- var errors = [];
91
- var template = component.getTemplate();
92
- var directives = parseTemplateForDirectives(template);
93
- for (var _i = 0, directives_1 = directives; _i < directives_1.length; _i++) {
94
- var directive = directives_1[_i];
95
- if (BOOLEAN_CONDITION_DIRECTIVES.indexOf(directive.directive) !== -1) {
96
- var error = validateBooleanCondition(directive, component);
97
- if (error)
98
- errors.push(error);
99
- }
100
- if (ARRAY_ITERATION_DIRECTIVES.indexOf(directive.directive) !== -1) {
101
- var error = validateArrayIteration(directive, component);
102
- if (error)
103
- errors.push(error);
104
- }
105
- if (directive.directive === "@model") {
106
- var error = validateModelElement(directive, component);
107
- if (error)
108
- errors.push(error);
109
- }
110
- }
111
- return errors;
112
- }
113
- export function lintComponents(components) {
114
- var allErrors = new Map();
115
- for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
116
- var component = components_1[_i];
117
- var errors = lintComponent(component);
118
- if (errors.length > 0) {
119
- allErrors.set(component.getName(), errors);
120
- }
121
- }
122
- return allErrors;
123
- }
1
+ // import {Component} from "../index";
2
+ // import DirectiveLocation from "./generic/location";
3
+ // import LintError from "./generic/lintError";
4
+ //
5
+ // const BOOLEAN_CONDITION_DIRECTIVES = ["@if", "@show"];
6
+ // const ARRAY_ITERATION_DIRECTIVES = ["@for", "@map"];
7
+ // const MODEL_ELEMENT = ["INPUT", "SELECT", "TEXTAREA"];
8
+ //
9
+ // function parseTemplateForDirectives(template: string): DirectiveLocation[] {
10
+ // const directives: DirectiveLocation[] = [];
11
+ // const lines = template.split("\n");
12
+ //
13
+ // for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
14
+ // const line = lines[lineIndex];
15
+ //
16
+ // const directiveRegex = /@(\w+)(?:\s*=\s*"([^"]*)"|\s*=\s*'([^']*)')?/g;
17
+ // let match;
18
+ //
19
+ // while ((match = directiveRegex.exec(line)) !== null) {
20
+ // const directiveName = match[1];
21
+ // const expression = match[2] || match[3] || "";
22
+ //
23
+ // const elementMatch = line.match(/<(\w+)/);
24
+ // const element = elementMatch ? elementMatch[1] : "unknown";
25
+ //
26
+ // directives.push({
27
+ // directive: `@${directiveName}`,
28
+ // expression: expression,
29
+ // element: element.toUpperCase(),
30
+ // line: lineIndex + 1,
31
+ // column: match.index + 1
32
+ // });
33
+ // }
34
+ // }
35
+ //
36
+ // return directives;
37
+ // }
38
+ //
39
+ // function inferType(value: any): string {
40
+ // if (value === true || value === false) return "boolean";
41
+ // if (Array.isArray(value)) return "array";
42
+ // if (typeof value === "number") return "number";
43
+ // if (typeof value === "string") return "string";
44
+ // if (typeof value === "object" && value !== null) return "object";
45
+ // if (value === null) return "null";
46
+ // return "unknown";
47
+ // }
48
+ //
49
+ // function getDataTypes(component: Component): Map<string, string> {
50
+ // const types = new Map<string, string>();
51
+ // const data = component.getData();
52
+ //
53
+ // if (data && typeof data === "object") {
54
+ // Object.keys(data).forEach(function(key: string) {
55
+ // types.set(key, inferType((data as any)[key]));
56
+ // });
57
+ // }
58
+ //
59
+ // return types;
60
+ // }
61
+ //
62
+ // function validateBooleanCondition(
63
+ // directive: DirectiveLocation,
64
+ // component: Component
65
+ // ): LintError | null {
66
+ // const dataTypes = getDataTypes(component);
67
+ // const actualType = dataTypes.get(directive.expression);
68
+ //
69
+ // if (actualType && actualType !== "boolean") {
70
+ // return {
71
+ // rule: "boolean-condition",
72
+ // message: `Directive '${directive.directive}' expects boolean but '${directive.expression}' is ${actualType}`,
73
+ // line: directive.line,
74
+ // column: directive.column
75
+ // };
76
+ // }
77
+ //
78
+ // return null;
79
+ // }
80
+ //
81
+ // function validateArrayIteration(
82
+ // directive: DirectiveLocation,
83
+ // component: Component
84
+ // ): LintError | null {
85
+ // const dataTypes = getDataTypes(component);
86
+ // const actualType = dataTypes.get(directive.expression);
87
+ //
88
+ // if (actualType && actualType !== "array") {
89
+ // return {
90
+ // rule: "array-iteration",
91
+ // message: `Directive '${directive.directive}' expects array but '${directive.expression}' is ${actualType}`,
92
+ // line: directive.line,
93
+ // column: directive.column
94
+ // };
95
+ // }
96
+ //
97
+ // return null;
98
+ // }
99
+ //
100
+ // function validateModelElement(
101
+ // directive: DirectiveLocation,
102
+ // component: Component
103
+ // ): LintError | null {
104
+ // if (MODEL_ELEMENT.indexOf(directive.element) === -1) {
105
+ // return {
106
+ // rule: "valid-model-element",
107
+ // message: `Directive '@model' can only be used on INPUT, SELECT, or TEXTAREA, but found '${directive.element}'`,
108
+ // line: directive.line,
109
+ // column: directive.column
110
+ // };
111
+ // }
112
+ //
113
+ // return null;
114
+ // }
115
+ //
116
+ // export function lintComponent(component: Component): LintError[] {
117
+ // const errors: LintError[] = [];
118
+ // const template = component.getTemplate();
119
+ // const directives = parseTemplateForDirectives(template);
120
+ //
121
+ // for (const directive of directives) {
122
+ // if (BOOLEAN_CONDITION_DIRECTIVES.indexOf(directive.directive) !== -1) {
123
+ // const error = validateBooleanCondition(directive, component);
124
+ // if (error) errors.push(error);
125
+ // }
126
+ //
127
+ // if (ARRAY_ITERATION_DIRECTIVES.indexOf(directive.directive) !== -1) {
128
+ // const error = validateArrayIteration(directive, component);
129
+ // if (error) errors.push(error);
130
+ // }
131
+ //
132
+ // if (directive.directive === "@model") {
133
+ // const error = validateModelElement(directive, component);
134
+ // if (error) errors.push(error);
135
+ // }
136
+ // }
137
+ //
138
+ // return errors;
139
+ // }
140
+ //
141
+ // export function lintComponents(components: Component[]): Map<string, LintError[]> {
142
+ // const allErrors = new Map<string, LintError[]>();
143
+ //
144
+ // for (const component of components) {
145
+ // const errors = lintComponent(component);
146
+ // if (errors.length > 0) {
147
+ // allErrors.set(component.getName(), errors);
148
+ // }
149
+ // }
150
+ //
151
+ // return allErrors;
152
+ // }
@@ -1,16 +1,4 @@
1
- import { Component } from "../index";
2
- /**
3
- * The entrance of weave
4
- * @param root
5
- */
6
- export declare function render_for_weave(root?: string): void;
7
1
  /**
8
2
  * The entrance of listen
9
3
  */
10
- export declare function render_for_listen(): void;
11
- /**
12
- * The entrance of render
13
- * @param component
14
- * @param mounter
15
- */
16
- export declare function render_for_render(component: Component, mounter: string): void;
4
+ export declare function render_for_listen(params: Map<string, any>, pathParams: Map<string, any>): void;
package/xboot/entrance.js CHANGED
@@ -1,53 +1,7 @@
1
- import { themeStyle } from "../system/utility/style/styleUtility";
2
- import { renderHtml } from "./renderProcessor";
3
- import { get_context_controller, get_style_library, get_tag_library } from "../system/recorder/table0/system_func_0";
4
- import { router_listener_with_router, router_listener_without_router } from "../kernel/router/router";
5
- /**
6
- * The entrance of weave
7
- * @param root
8
- */
9
- export function render_for_weave(root) {
10
- get_tag_library().forEach(function (component) {
11
- themeStyle(component, get_style_library());
12
- });
13
- if (root == null) {
14
- //开始渲染
15
- get_context_controller().componentAttachedRootElement = document.body;
16
- renderHtml(document.children, get_context_controller());
17
- }
18
- else {
19
- var mountPoint = document.getElementById(root);
20
- if (mountPoint == null) {
21
- get_context_controller().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, get_context_controller());
26
- }
27
- else {
28
- //开始渲染
29
- get_context_controller().componentAttachedRootElement = mountPoint;
30
- renderHtml(mountPoint.children, get_context_controller());
31
- }
32
- }
33
- }
1
+ import { router_listener_with_router } from "../kernel/router/router";
34
2
  /**
35
3
  * The entrance of listen
36
4
  */
37
- export function render_for_listen() {
38
- get_tag_library().forEach(function (component) {
39
- themeStyle(component, get_style_library());
40
- });
41
- router_listener_with_router(document.querySelector("webview"));
42
- }
43
- /**
44
- * The entrance of render
45
- * @param component
46
- * @param mounter
47
- */
48
- export function render_for_render(component, mounter) {
49
- get_tag_library().forEach(function (component) {
50
- themeStyle(component, get_style_library());
51
- });
52
- router_listener_without_router(component, document.getElementById(mounter));
5
+ export function render_for_listen(params, pathParams) {
6
+ router_listener_with_router(document.body, params, pathParams);
53
7
  }
@@ -1,4 +1,4 @@
1
- import { ContextController } from "../system/prototype/ContextController";
1
+ import { ContextController } from "../system/generic/controller/prototype/ContextController";
2
2
  /**
3
3
  * This function is used to render element below the mount point.
4
4
  * @param collection
@@ -1,7 +1,7 @@
1
- import { Component } from "../index";
1
+ import { AdjustComponent, ControlComponent } from "../index";
2
2
  /**
3
3
  * This function is used to save the prototype component proto in the window object.
4
4
  * So, you can have a tip that we custom a property named 'tagLib' in the window object.
5
5
  * @param component
6
6
  */
7
- export declare function registerTagLib(component: Component | Component[]): void;
7
+ export declare function registerTagLib(component: AdjustComponent | AdjustComponent[] | ControlComponent | ControlComponent[]): void;