vortez 5.0.0-dev.18 → 5.0.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 (136) hide show
  1. package/.gitignore +11 -4
  2. package/README.md +699 -177
  3. package/build/Template/Compiler.d.ts +70 -0
  4. package/build/Template/Compiler.js +135 -0
  5. package/build/Template/Compiler.js.map +1 -0
  6. package/build/Template/StreamCompiler.d.ts +16 -0
  7. package/build/Template/StreamCompiler.js +54 -0
  8. package/build/Template/StreamCompiler.js.map +1 -0
  9. package/build/Template/Template.d.ts +49 -0
  10. package/build/Template/Template.js +77 -0
  11. package/build/Template/Template.js.map +1 -0
  12. package/build/Vortez.d.ts +2 -1
  13. package/build/Vortez.js +2 -1
  14. package/build/Vortez.js.map +1 -1
  15. package/build/beta/JwtManager/JwtError.d.ts +8 -0
  16. package/build/beta/JwtManager/JwtError.js +10 -0
  17. package/build/beta/JwtManager/JwtError.js.map +1 -0
  18. package/build/beta/JwtManager/JwtManager.d.ts +3 -0
  19. package/build/beta/JwtManager/JwtManager.js +24 -7
  20. package/build/beta/JwtManager/JwtManager.js.map +1 -1
  21. package/build/server/BodyParser.d.ts +6 -0
  22. package/build/server/BodyParser.js +18 -3
  23. package/build/server/BodyParser.js.map +1 -1
  24. package/build/server/Request.d.ts +6 -4
  25. package/build/server/Request.js +15 -10
  26. package/build/server/Request.js.map +1 -1
  27. package/build/server/Response.d.ts +25 -10
  28. package/build/server/Response.js +161 -75
  29. package/build/server/Response.js.map +1 -1
  30. package/build/server/Server.d.ts +4 -4
  31. package/build/server/Server.js +34 -11
  32. package/build/server/Server.js.map +1 -1
  33. package/build/server/ServerDebug.d.ts +10 -1
  34. package/build/server/ServerDebug.js +85 -17
  35. package/build/server/ServerDebug.js.map +1 -1
  36. package/build/server/config/Config.d.ts +276 -47
  37. package/build/server/config/Config.js +70 -47
  38. package/build/server/config/Config.js.map +1 -1
  39. package/build/server/config/{ConfigLoader.d.ts → Loader.d.ts} +4 -5
  40. package/build/server/config/{ConfigLoader.js → Loader.js} +8 -11
  41. package/build/server/config/Loader.js.map +1 -0
  42. package/build/server/router/Router.d.ts +88 -31
  43. package/build/server/router/Router.js +113 -51
  44. package/build/server/router/Router.js.map +1 -1
  45. package/build/server/router/algorithm/Algorithm.d.ts +39 -0
  46. package/build/server/router/algorithm/Algorithm.js +20 -0
  47. package/build/server/router/algorithm/Algorithm.js.map +1 -0
  48. package/build/server/router/algorithm/FIFO.d.ts +15 -0
  49. package/build/server/router/algorithm/FIFO.js +24 -0
  50. package/build/server/router/algorithm/FIFO.js.map +1 -0
  51. package/build/server/router/algorithm/Tree.d.ts +38 -0
  52. package/build/server/router/algorithm/Tree.js +126 -0
  53. package/build/server/router/algorithm/Tree.js.map +1 -0
  54. package/build/server/router/middleware/HttpMiddleware.js +1 -1
  55. package/build/server/router/middleware/HttpMiddleware.js.map +1 -1
  56. package/build/server/router/middleware/WsMiddleware.js +1 -1
  57. package/build/server/router/middleware/WsMiddleware.js.map +1 -1
  58. package/build/server/security/PathSecurity.d.ts +45 -0
  59. package/build/server/security/PathSecurity.js +108 -0
  60. package/build/server/security/PathSecurity.js.map +1 -0
  61. package/build/server/websocket/Websocket.js +4 -1
  62. package/build/server/websocket/Websocket.js.map +1 -1
  63. package/build/utilities/ConsoleUI.d.ts +2 -1
  64. package/build/utilities/ConsoleUI.js +2 -1
  65. package/build/utilities/ConsoleUI.js.map +1 -1
  66. package/build/utilities/DebugUI.d.ts +1 -1
  67. package/build/utilities/DebugUI.js +1 -1
  68. package/build/utilities/Encoding.d.ts +22 -0
  69. package/build/utilities/Encoding.js +26 -0
  70. package/build/utilities/Encoding.js.map +1 -0
  71. package/build/utilities/Env.js +7 -2
  72. package/build/utilities/Env.js.map +1 -1
  73. package/build/utilities/File.d.ts +10 -0
  74. package/build/utilities/File.js +19 -0
  75. package/build/utilities/File.js.map +1 -0
  76. package/build/utilities/Flatten.d.ts +73 -0
  77. package/build/utilities/Flatten.js +76 -0
  78. package/build/utilities/Flatten.js.map +1 -0
  79. package/build/utilities/Object.d.ts +16 -0
  80. package/build/utilities/Object.js +48 -0
  81. package/build/utilities/Object.js.map +1 -0
  82. package/build/utilities/Path.d.ts +31 -11
  83. package/build/utilities/Path.js +48 -15
  84. package/build/utilities/Path.js.map +1 -1
  85. package/build/utilities/Time.d.ts +21 -0
  86. package/build/utilities/Time.js +25 -0
  87. package/build/utilities/Time.js.map +1 -0
  88. package/build/utilities/Utilities.d.ts +50 -92
  89. package/build/utilities/Utilities.js +56 -71
  90. package/build/utilities/Utilities.js.map +1 -1
  91. package/build/utilities/schema/Introspection.d.ts +24 -0
  92. package/build/utilities/schema/Introspection.js +87 -0
  93. package/build/utilities/schema/Introspection.js.map +1 -0
  94. package/build/utilities/schema/JSONSchema.d.ts +68 -0
  95. package/build/utilities/schema/JSONSchema.js +13 -0
  96. package/build/utilities/schema/JSONSchema.js.map +1 -0
  97. package/build/utilities/schema/Schema.d.ts +253 -0
  98. package/build/utilities/schema/Schema.js +241 -0
  99. package/build/utilities/schema/Schema.js.map +1 -0
  100. package/build/utilities/schema/SchemaError.d.ts +10 -0
  101. package/build/utilities/schema/SchemaError.js +13 -0
  102. package/build/utilities/schema/SchemaError.js.map +1 -0
  103. package/build/utilities/schema/Validator.d.ts +94 -0
  104. package/build/utilities/schema/Validator.js +246 -0
  105. package/build/utilities/schema/Validator.js.map +1 -0
  106. package/changes.md +4 -0
  107. package/docs/ARCHITECTURE.md +142 -0
  108. package/global/style/template/error.css +29 -0
  109. package/global/style/template/folder.css +79 -0
  110. package/global/{Style/Template/Template.css → style/template/template.css} +60 -68
  111. package/global/template/error.vhtml +29 -0
  112. package/global/template/folder.vhtml +54 -0
  113. package/package.json +2 -2
  114. package/build/Template.d.ts +0 -46
  115. package/build/Template.js +0 -81
  116. package/build/Template.js.map +0 -1
  117. package/build/server/config/ConfigLoader.js.map +0 -1
  118. package/build/server/config/ConfigValidator.d.ts +0 -71
  119. package/build/server/config/ConfigValidator.js +0 -131
  120. package/build/server/config/ConfigValidator.js.map +0 -1
  121. package/examples/in-docs.js +0 -96
  122. package/global/Style/Template/Error.css +0 -30
  123. package/global/Style/Template/Folder.css +0 -77
  124. package/global/Template/Error.vhtml +0 -29
  125. package/global/Template/Folder.vhtml +0 -41
  126. package/tests/Template/template.js +0 -18
  127. package/tests/Template/template.txt +0 -13
  128. package/tests/Template/template.vhtml +0 -23
  129. package/tests/debug.js +0 -34
  130. package/tests/jwtManager/jwtManager.js +0 -342
  131. package/tests/test.js +0 -131
  132. package/tests/test.vhtml +0 -14
  133. package/tests/utilities.js +0 -28
  134. package/tests/websocket.vhtml +0 -86
  135. /package/global/{Source/Logo_960.png → source/logo_960.png} +0 -0
  136. /package/global/{Source/Logo_SM_960.png → source/logo_SM_960.png} +0 -0
@@ -1,71 +0,0 @@
1
- /**
2
- * @author NetFeez <netfeez.dev@gmail.com>
3
- * @description add the config validator to use in the config loader.
4
- * @license Apache-2.0
5
- */
6
- import Config from "./Config.js";
7
- export declare class ConfigValidator {
8
- /**
9
- * Validates the config.
10
- * @param config - The config to validate.
11
- * @returns The validated config.
12
- */
13
- static validate(config: Config.options): Config.Main;
14
- /**
15
- * Validates the host.
16
- * @param host - The host to validate.
17
- * @returns The validated host.
18
- */
19
- static validateHost(host: unknown): string;
20
- /**
21
- * Validates the port.
22
- * @param port - The port to validate.
23
- * @returns The validated port.
24
- */
25
- static validatePort(port: unknown): number;
26
- /**
27
- * Validates the templates.
28
- * @param templates - The templates to validate.
29
- * @returns The validated templates.
30
- */
31
- static validateTemplates(templates: unknown): Config.Templates;
32
- /**
33
- * Validates the ssl.
34
- * @param ssl - The ssl to validate.
35
- * @returns The validated ssl.
36
- */
37
- static validateSSL(ssl: unknown): Config.SSLOptions | null;
38
- /**
39
- * Validates a string value.
40
- * @param value - The value to validate.
41
- * @param defaultValue - The default value to use if the value is not a string.
42
- * @param fieldName - The name of the field being validated.
43
- * @returns The validated string value.
44
- */
45
- private static validateString;
46
- /**
47
- * Validates a number value.
48
- * @param value - The value to validate.
49
- * @param defaultValue - The default value to use if the value is not a number.
50
- * @param fieldName - The name of the field being validated.
51
- * @returns The validated number value.
52
- */
53
- private static validateNumber;
54
- /**
55
- * Validates a number value within a given range.
56
- * @param value - The value to validate.
57
- * @param min - The minimum value of the range.
58
- * @param max - The maximum value of the range.
59
- */
60
- private static validateRange;
61
- /**
62
- * Validates a number value within a given range.
63
- * @param value - The value to validate.
64
- * @param min - The minimum value of the range.
65
- * @param max - The maximum value of the range.
66
- * @param defaultValue - The default value to use if the value is not a number or is out of range.
67
- */
68
- private static validateNumberInRange;
69
- }
70
- export declare namespace ConfigValidator { }
71
- export default ConfigValidator;
@@ -1,131 +0,0 @@
1
- /**
2
- * @author NetFeez <netfeez.dev@gmail.com>
3
- * @description add the config validator to use in the config loader.
4
- * @license Apache-2.0
5
- */
6
- import Config from "./Config.js";
7
- import Logger from "../../logger/Logger.js";
8
- const logger = new Logger({ prefix: 'Config' });
9
- export class ConfigValidator {
10
- /**
11
- * Validates the config.
12
- * @param config - The config to validate.
13
- * @returns The validated config.
14
- */
15
- static validate(config) {
16
- const { host, port, ssl, templates } = config;
17
- return {
18
- host: this.validateHost(host),
19
- port: this.validatePort(port),
20
- ssl: this.validateSSL(ssl),
21
- templates: this.validateTemplates(templates)
22
- };
23
- }
24
- /**
25
- * Validates the host.
26
- * @param host - The host to validate.
27
- * @returns The validated host.
28
- */
29
- static validateHost(host) {
30
- return this.validateString(host, 'localhost', 'host');
31
- }
32
- /**
33
- * Validates the port.
34
- * @param port - The port to validate.
35
- * @returns The validated port.
36
- */
37
- static validatePort(port) {
38
- return this.validateNumberInRange(port, 0, 65535, Config.DEFAULT.port, 'port');
39
- }
40
- /**
41
- * Validates the templates.
42
- * @param templates - The templates to validate.
43
- * @returns The validated templates.
44
- */
45
- static validateTemplates(templates) {
46
- if (!templates || typeof templates !== 'object') {
47
- logger.warn('templates must be an object, using defaults');
48
- return Config.DEFAULT.templates;
49
- }
50
- const defTemplates = Config.DEFAULT.templates;
51
- const templatesP = templates;
52
- const result = {};
53
- for (const key in defTemplates) {
54
- result[key] = templatesP[key] != null ? templatesP[key] : defTemplates[key];
55
- }
56
- return result;
57
- }
58
- /**
59
- * Validates the ssl.
60
- * @param ssl - The ssl to validate.
61
- * @returns The validated ssl.
62
- */
63
- static validateSSL(ssl) {
64
- if (!ssl || typeof ssl !== 'object') {
65
- return null;
66
- }
67
- const sslP = ssl;
68
- const { pubKey, privKey, port = 443 } = sslP;
69
- if (typeof pubKey !== 'string') {
70
- logger.warn('ssl.pubKey must be a string, skipping ssl');
71
- return Config.DEFAULT.ssl;
72
- }
73
- if (typeof privKey !== 'string') {
74
- logger.warn('ssl.privKey must be a string, skipping ssl');
75
- return Config.DEFAULT.ssl;
76
- }
77
- const validPort = this.validateNumberInRange(port, 0, 65535, 443, 'ssl.port');
78
- return { pubKey, privKey, port: validPort };
79
- }
80
- /**
81
- * Validates a string value.
82
- * @param value - The value to validate.
83
- * @param defaultValue - The default value to use if the value is not a string.
84
- * @param fieldName - The name of the field being validated.
85
- * @returns The validated string value.
86
- */
87
- static validateString(value, defaultValue, fieldName) {
88
- if (typeof value === 'string')
89
- return value;
90
- logger.warn(`${fieldName} must be a string, using default: ${defaultValue}`);
91
- return defaultValue;
92
- }
93
- /**
94
- * Validates a number value.
95
- * @param value - The value to validate.
96
- * @param defaultValue - The default value to use if the value is not a number.
97
- * @param fieldName - The name of the field being validated.
98
- * @returns The validated number value.
99
- */
100
- static validateNumber(value, defaultValue, fieldName) {
101
- if (typeof value === 'number')
102
- return value;
103
- logger.warn(`${fieldName} must be a number, using default: ${defaultValue}`);
104
- return defaultValue;
105
- }
106
- /**
107
- * Validates a number value within a given range.
108
- * @param value - The value to validate.
109
- * @param min - The minimum value of the range.
110
- * @param max - The maximum value of the range.
111
- */
112
- static validateRange(value, min, max, defaultValue, fieldName) {
113
- if (value >= min && value <= max)
114
- return value;
115
- logger.warn(`${fieldName} must be between ${min} and ${max}, using default: ${defaultValue}`);
116
- return defaultValue;
117
- }
118
- /**
119
- * Validates a number value within a given range.
120
- * @param value - The value to validate.
121
- * @param min - The minimum value of the range.
122
- * @param max - The maximum value of the range.
123
- * @param defaultValue - The default value to use if the value is not a number or is out of range.
124
- */
125
- static validateNumberInRange(value, min, max, defaultValue, fieldName) {
126
- const num = this.validateNumber(value, defaultValue, fieldName);
127
- return this.validateRange(num, min, max, defaultValue, fieldName);
128
- }
129
- }
130
- export default ConfigValidator;
131
- //# sourceMappingURL=ConfigValidator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConfigValidator.js","sourceRoot":"","sources":["../../../src/server/config/ConfigValidator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEhD,MAAM,OAAO,eAAe;IACxB;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,MAAsB;QACzC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC9C,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YAC7B,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YAC7B,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAC1B,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;SAC/C,CAAC;IACN,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,IAAa;QACpC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,IAAa;QACpC,OAAO,IA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E,YAAoB,EAAE,SAAiB;QAClH,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IACtE,CAAC;CACJ;AAED,eAAe,eAAe,CAAC"}
@@ -1,96 +0,0 @@
1
- //@ts-check
2
- // en caso de haber instalado el modulo desde npm usar:
3
- // import Vortez from 'vortez';
4
- import Vortez from '../build/Vortez.js';
5
-
6
- const server = new Vortez(3000, undefined, {
7
- privKey: "",
8
- pubKey: "",
9
- port: 443
10
- });
11
-
12
- // | RULE PARAMS EXAMPLE |
13
- server.addAction('ALL', '/User/$UserID/Post/$PostID', (request, response) => {
14
- response.sendJson({
15
- url: request.url,
16
- ruleParams: request.ruleParams
17
- });
18
- /* Esto devolverá lo siguiente si la ruta fuera /User/111111/Post/222222
19
- {
20
- "Url": "/User/111111/Post/222222"
21
- "RuleParams": {
22
- "UserID": "111111",
23
- "PostID": "222222"
24
- }
25
- }
26
- */
27
- });
28
-
29
- // | AUTH EXEC EXAMPLE |
30
- server.addFile('/FileWA', 'changes.md', (Request) => {
31
- return Request.queryParams.has('Auth') && Request.queryParams.get('Auth') == 'AuthYes'
32
- });
33
-
34
- // | FOLDER RULE EXAMPLE |
35
- server.addFolder('/MyFolder', 'Test');
36
-
37
- // | FILE RULE EXAMPLE |
38
- server.addFile('/MyFile', 'changes.md');
39
-
40
- // | ACTION RULE EXAMPLE |
41
-
42
- server.addAction('GET', '/', (request, response) => {
43
- if (request.cookies.has('User_ID')) {
44
- response.send("El User_ID que estas usando es:" + request.cookies.get('User_ID'));
45
- } else {
46
- response.sendFile('./ErrorUsuario.html');
47
- }
48
- }
49
- );
50
-
51
- // | WBB SOCKET RULE EXAMPLE |
52
-
53
- const Conexiones = new Set();
54
- server.addWebSocket('/Test/WS-Chat', (request, socket) => {
55
- console.log('[WS] CM: Conexión nueva')
56
- Conexiones.forEach((Usuario) => Usuario.Send("Un usuario se conecto"));
57
- Conexiones.add(socket);
58
- socket.on('finish', () => Conexiones.delete(socket));
59
- socket.on('error', (error) => console.log('[WS-Error]:', error));
60
- socket.on('message', (data, info) => {
61
- //console.log(Info.OPCode);
62
- if (info.opCode == 1) {
63
- console.log('[WS] MSS:', data.toString());
64
- Conexiones.forEach((Usuario) => {
65
- if (Usuario !== socket) Usuario.Send(data.toString());
66
- });
67
- } else if (info.opCode == 8) {
68
- Conexiones.forEach((Usuario) => Usuario.Send("Un usuario se desconecto"));
69
- }
70
- });
71
- });
72
-
73
- // | ADD RULE METHOD EXAMPLE |
74
- server.addRules(
75
- /*
76
- este constructor acepta 5 parámetros para crearse correctamente:
77
- Tipo, Método, UrlRule, Content, AuthExec.
78
- AuthExec es opcional.
79
- */
80
- new Vortez.Rule('Folder', 'GET', '/MyFolder2/', 'Test/', () => true),
81
- new Vortez.Rule('File', 'GET', '/MyFile2/*', 'changes.md', () => true),
82
- new Vortez.Rule('Action', 'GET', '/2', (request, response) => {
83
- if (request.cookies.has('User_ID')) {
84
- response.send("El User_ID que estas usando es:" + request.cookies.get('User_ID'));
85
- } else {
86
- response.sendFile('./ErrorUsuario.html');
87
- }
88
- }),
89
- new Vortez.Rule('Action', 'GET', '/2', (request, response) => {
90
- if (request.cookies.has('User_ID')) {
91
- response.send("El User_ID que estas usando es:" + request.cookies.get('User_ID'));
92
- } else {
93
- response.sendFile('./ErrorUsuario.html');
94
- }
95
- })
96
- );
@@ -1,30 +0,0 @@
1
- #Error {
2
- --Color_Fondo: rgb(255,180,220);
3
- --Color_Código: rgb(255,0,0);
4
- --Color_Mensaje: rgb(0,0,0);
5
- --Color_Fondo_Imagen: rgba(255,0,0,0.1);
6
- }
7
- #Error {
8
- background: var(--Color_Fondo);
9
- height: 100%;
10
- position: fixed;
11
- width: 100%;
12
- overflow: visible;
13
- }
14
- #Error .Información {
15
- text-align: center;
16
- width: 90%;
17
- overflow: visible;
18
- }
19
- #Error .Código {
20
- color: var(--Color_Código);
21
- font-size: 3em;
22
- }
23
- #Error .Mensaje {
24
- color: var(--Color_Mensaje);
25
- font-size: 1em;
26
- margin-bottom: 1em;
27
- }
28
- #Error .Carga {
29
- width: 30%;
30
- }
@@ -1,77 +0,0 @@
1
- #Carpeta {
2
- --Color_Fondo: rgb(255,180,220);
3
- --Color_Fondo_Contenido: rgba(255,0,0,0.1);
4
- --Color_Fondo_Atrás: rgba(180,220,255,0.5);
5
- --Color_Fondo_Atrás_Acción: rgba(180,220,255,0.75);
6
- --Color_Fondo_Búsqueda: rgba(255,180,220,0.5);
7
- --Color_Fondo_Búsqueda_Acción: rgba(255,180,220,0.75);
8
- --Color_Fondo_Elemento: rgba(220,255,180,0.25);
9
- --Color_Fondo_Elemento_Acción: rgba(220,255,180,0.5);
10
- --Color_Borde_Búsqueda_Acción: rgb(180,220,255);
11
- }
12
- #Carpeta {
13
- align-items: center;
14
- background: var(--Color_Fondo);
15
- height: 100%;
16
- overflow: visible scroll;
17
- position: fixed;
18
- width: 100%;
19
- }
20
- #Carpeta .Contenido {
21
- background: var(--Color_Fondo_Contenido);
22
- border-radius: 2em;
23
- margin-top: 2em;
24
- padding: 2em;
25
- text-align: center;
26
- width: 70%;
27
- }
28
- #Carpeta .Opciones {
29
- display: flex;
30
- text-align: start;
31
- }
32
- #Carpeta #Carpeta_Cambiar {
33
- cursor: pointer;
34
- }
35
- #Carpeta .Atrás,
36
- #Carpeta #Carpeta_Ruta,
37
- #Carpeta #Carpeta_Cambiar {
38
- background: var(--Color_Fondo_Atrás);
39
- border-radius: 1em;
40
- color: rgb(0,0,0);
41
- display: inline-block;
42
- margin: 0.5em;
43
- padding: 1em;
44
- text-decoration: none;
45
- }
46
- #Carpeta #Carpeta_Ruta,
47
- #Carpeta #Carpeta_Cambiar {
48
- background: var(--Color_Fondo_Búsqueda);
49
- border: none;
50
- }
51
- #Carpeta .Lista {
52
- list-style: none;
53
- }
54
- #Carpeta .Elemento {
55
- background: var(--Color_Fondo_Elemento);
56
- border-radius: 1em;
57
- color: rgb(0,0,0);
58
- display: block;
59
- margin: 0.25em;
60
- padding: 1em;
61
- text-decoration: none;
62
- }
63
- #Carpeta .Atrás:hover {
64
- background: var(--Color_Fondo_Atrás_Acción);
65
- }
66
- #Carpeta #Carpeta_Ruta:focus {
67
- border: var(--Color_Borde_Búsqueda_Acción) 3px double;
68
- margin: calc(0.5em - 3px);
69
- outline: none;
70
- }
71
- #Carpeta #Carpeta_Ruta:focus,
72
- #Carpeta #Carpeta_Cambiar:hover {
73
- background: var(--Color_Fondo_Búsqueda_Acción);
74
- }
75
- #Carpeta .Elemento:hover {
76
- background: var(--Color_Fondo_Elemento_Acción);
77
- }
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="es">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <link rel="stylesheet" href="/NetFeez-Labs:Global/Style/Template/Template.css">
8
- <title>[SV-C] - ${status}</title>
9
- </head>
10
- <body>
11
- <div id="Error" class="Centrar-X Centrar-Y">
12
- <div class="Información">
13
- <h1 class="Código">Error: ${status}</h1>
14
- <p class="Mensaje">${message}</p>
15
- <div class="Centrar-X Centrar-Y">
16
- <div class="Carga">
17
- <div class="C_Fondo"></div>
18
- <div class="C_Fondo2"></div>
19
- <picture>
20
- <source srcset="/NetFeez-Labs:Global/Source/Logo_SM_960.png"/>
21
- <source srcset="/favicon.ico"/>
22
- <img class="C_Logo">
23
- </picture>
24
- </div>
25
- </div>
26
- </div>
27
- </div>
28
- </body>
29
- </html>
@@ -1,41 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="es">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <link rel="stylesheet" href="/NetFeez-Labs:Global/Style/Template/Template.css">
8
- <title>[SA-ML] - Dir</title>
9
- </head>
10
- <body>
11
- <div id="Carpeta" class="Centrar-X">
12
- <div class="Contenido">
13
- <h1 class="Ruta">Carpeta: ${Url}</h1>
14
- <div class="Opciones">
15
- <a class="Atrás" href="${Url}../">Atrás</a>
16
- <input id="Carpeta_Ruta" type="search" placeholder="Cambiar de ruta... ${Url}" value="${Url}"/>
17
- <input id="Carpeta_Cambiar"type="button" value="Cambiar Ruta"/>
18
- </div>
19
- <ul class="Lista">
20
- $(folder,, name) {
21
- <li>
22
- <a class="Elemento" href="${Url}%name%">%name%</a>
23
- </li>
24
- }
25
- </ul>
26
- </div>
27
- <script>
28
- const Carpeta_Cambiar = document.querySelector('#Carpeta_Cambiar');
29
- const Carpeta_Ruta = document.querySelector('#Carpeta_Ruta');
30
- Carpeta_Cambiar.addEventListener('click', () => {
31
- window.location.href = Carpeta_Ruta.value;
32
- });
33
- Carpeta_Ruta.addEventListener('keydown', (Evento) => {
34
- Carpeta_Ruta.value.length <= '${Url}'.length && Evento.key == 'Backspace'
35
- ? Evento.preventDefault()
36
- : false;
37
- })
38
- </script>
39
- </div>
40
- </body>
41
- </html>
@@ -1,18 +0,0 @@
1
- import Template from "../../build/Template.js";
2
-
3
- console.log(await Template.load('tests/Template/template.txt', {
4
- tittle: "Hola mundo",
5
- users: {
6
- diego: true,
7
- juan: false,
8
- pedro: true,
9
- maria: false,
10
- jorge: true
11
- }
12
- }))
13
- console.log('----------------------------------------')
14
- console.log(await Template.load('tests/Template/template.vhtml', {
15
- Titulo: 'Titulo de la prueba',
16
- Des: 'Descripción xD',
17
- Tests: ["algo", "algo2"]
18
- }));
@@ -1,13 +0,0 @@
1
- <h1>${tittle}<h1>
2
- <table>
3
- <tr>
4
- <th>user</th>
5
- <th>isInvited</th>
6
- </tr>
7
- $(users, user, isInvited) {
8
- <tr>
9
- <td>%user%</td>
10
- <td>%isInvited%</td>
11
- </tr>
12
- }
13
- </table>
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>${Titulo}</title>
7
- </head>
8
- <body>
9
- ${Des}
10
- <table>
11
- <tr>
12
- <th>Test</th>
13
- <th>Enlace</th>
14
- </tr>
15
- $(Tests) {
16
- <tr>
17
- <td>%key%</td>
18
- <td><a href="%value%">%value%</a></td>
19
- </tr>
20
- }
21
- </table>
22
- </body>
23
- </html>
package/tests/debug.js DELETED
@@ -1,34 +0,0 @@
1
- /// @ts-check
2
-
3
- import { Logger } from "../build/Vortez.js";
4
-
5
- const Debug = Logger.Debug;
6
-
7
- Debug.log('Hello world');
8
- Debug.log([
9
- 'Prueba de envió de multiples datos',
10
- 'Para saber el comportamiento'
11
- ]);
12
-
13
- const X = Debug.getInstance('_Debug');
14
-
15
- X.log('Prueba para ver si creando una instancia con una ID existente se devuelve la instancia con dicha ID');
16
- X.log('Prueba para ver si no se crea un archivo diferente con ID igual');
17
-
18
- const Y = Debug.getInstance('SEA', {
19
- show: false
20
- });
21
-
22
- Y.log('Prueba para verificar que no se muestra en consola si se inicializa con EnConsola = false');
23
-
24
- Debug.showAll = true;
25
-
26
- Y.log('Prueba para verificar que al cambiar el atributo MostrarTodo a true se muestran incluso los Debug con EnConsola = false');
27
-
28
- Debug.showAll = false;
29
-
30
- Y.log('Prueba para ver si vuelven a ocultarse los mensajes en consola de los EnConsola = false después de poner MostrarTodo nuevamente en false');
31
-
32
- Debug.log('Fin de la prueba');
33
-
34
- export default true;