hightjs 0.4.0 → 0.5.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 (125) hide show
  1. package/README.md +48 -116
  2. package/dist/bin/hightjs.js +51 -23
  3. package/dist/builder.js +139 -4
  4. package/dist/client/DefaultNotFound.d.ts +1 -1
  5. package/dist/client/DefaultNotFound.js +72 -46
  6. package/dist/client/client.d.ts +3 -0
  7. package/dist/{client.js → client/client.js} +4 -4
  8. package/dist/client/entry.client.js +39 -29
  9. package/dist/global/global.d.ts +117 -0
  10. package/dist/{auth/types.js → global/global.js} +0 -1
  11. package/dist/helpers.js +80 -2
  12. package/dist/hotReload.js +2 -2
  13. package/dist/index.js +16 -16
  14. package/dist/loaders.d.ts +1 -0
  15. package/dist/loaders.js +46 -0
  16. package/dist/renderer.js +158 -4
  17. package/dist/types.d.ts +44 -0
  18. package/package.json +36 -31
  19. package/.idea/HightJS.iml +0 -9
  20. package/.idea/copilot.data.migration.agent.xml +0 -6
  21. package/.idea/copilot.data.migration.ask.xml +0 -6
  22. package/.idea/copilot.data.migration.ask2agent.xml +0 -6
  23. package/.idea/copilot.data.migration.edit.xml +0 -6
  24. package/.idea/copilotDiffState.xml +0 -67
  25. package/.idea/inspectionProfiles/Project_Default.xml +0 -13
  26. package/.idea/libraries/test_package.xml +0 -9
  27. package/.idea/libraries/ts_commonjs_default_export.xml +0 -9
  28. package/.idea/misc.xml +0 -7
  29. package/.idea/modules.xml +0 -8
  30. package/.idea/vcs.xml +0 -6
  31. package/dist/auth/client.d.ts +0 -24
  32. package/dist/auth/client.js +0 -146
  33. package/dist/auth/components.d.ts +0 -29
  34. package/dist/auth/components.js +0 -100
  35. package/dist/auth/core.d.ts +0 -55
  36. package/dist/auth/core.js +0 -189
  37. package/dist/auth/index.d.ts +0 -7
  38. package/dist/auth/index.js +0 -45
  39. package/dist/auth/jwt.d.ts +0 -41
  40. package/dist/auth/jwt.js +0 -185
  41. package/dist/auth/providers/credentials.d.ts +0 -60
  42. package/dist/auth/providers/credentials.js +0 -97
  43. package/dist/auth/providers/discord.d.ts +0 -63
  44. package/dist/auth/providers/discord.js +0 -190
  45. package/dist/auth/providers/google.d.ts +0 -63
  46. package/dist/auth/providers/google.js +0 -186
  47. package/dist/auth/providers/index.d.ts +0 -2
  48. package/dist/auth/providers/index.js +0 -35
  49. package/dist/auth/providers.d.ts +0 -3
  50. package/dist/auth/providers.js +0 -26
  51. package/dist/auth/react/index.d.ts +0 -6
  52. package/dist/auth/react/index.js +0 -48
  53. package/dist/auth/react.d.ts +0 -22
  54. package/dist/auth/react.js +0 -199
  55. package/dist/auth/routes.d.ts +0 -16
  56. package/dist/auth/routes.js +0 -152
  57. package/dist/auth/types.d.ts +0 -76
  58. package/dist/client.d.ts +0 -3
  59. package/docs/README.md +0 -58
  60. package/docs/arquivos-especiais.md +0 -10
  61. package/docs/autenticacao.md +0 -212
  62. package/docs/checklist.md +0 -9
  63. package/docs/cli.md +0 -72
  64. package/docs/config.md +0 -216
  65. package/docs/estrutura.md +0 -20
  66. package/docs/faq.md +0 -10
  67. package/docs/hot-reload.md +0 -5
  68. package/docs/integracoes.md +0 -240
  69. package/docs/middlewares.md +0 -73
  70. package/docs/rotas-backend.md +0 -45
  71. package/docs/rotas-frontend.md +0 -66
  72. package/docs/seguranca.md +0 -8
  73. package/docs/websocket.md +0 -45
  74. package/example/certs/cert.pem +0 -20
  75. package/example/certs/key.pem +0 -27
  76. package/example/hightjs.config.ts +0 -87
  77. package/example/package-lock.json +0 -1174
  78. package/example/package.json +0 -26
  79. package/example/postcss.config.js +0 -8
  80. package/example/src/backend/auth.ts +0 -42
  81. package/example/src/backend/routes/auth.ts +0 -3
  82. package/example/src/backend/routes/version.ts +0 -13
  83. package/example/src/web/components/Home.tsx +0 -140
  84. package/example/src/web/components/LoginPage.tsx +0 -149
  85. package/example/src/web/globals.css +0 -5
  86. package/example/src/web/layout.tsx +0 -100
  87. package/example/src/web/routes/index.tsx +0 -13
  88. package/example/src/web/routes/login.tsx +0 -30
  89. package/example/tailwind.config.js +0 -12
  90. package/example/tsconfig.json +0 -15
  91. package/src/adapters/express.ts +0 -87
  92. package/src/adapters/factory.ts +0 -112
  93. package/src/adapters/fastify.ts +0 -104
  94. package/src/adapters/native.ts +0 -234
  95. package/src/api/console.ts +0 -305
  96. package/src/api/http.ts +0 -535
  97. package/src/auth/client.ts +0 -171
  98. package/src/auth/components.tsx +0 -125
  99. package/src/auth/core.ts +0 -215
  100. package/src/auth/index.ts +0 -25
  101. package/src/auth/jwt.ts +0 -210
  102. package/src/auth/providers/credentials.ts +0 -139
  103. package/src/auth/providers/discord.ts +0 -239
  104. package/src/auth/providers/google.ts +0 -234
  105. package/src/auth/providers/index.ts +0 -20
  106. package/src/auth/providers.ts +0 -20
  107. package/src/auth/react/index.ts +0 -25
  108. package/src/auth/react.tsx +0 -234
  109. package/src/auth/routes.ts +0 -183
  110. package/src/auth/types.ts +0 -108
  111. package/src/bin/hightjs.js +0 -222
  112. package/src/builder.js +0 -472
  113. package/src/client/DefaultNotFound.tsx +0 -84
  114. package/src/client/clientRouter.ts +0 -153
  115. package/src/client/entry.client.tsx +0 -511
  116. package/src/client.ts +0 -24
  117. package/src/components/Link.tsx +0 -38
  118. package/src/helpers.ts +0 -542
  119. package/src/hotReload.ts +0 -569
  120. package/src/index.ts +0 -555
  121. package/src/renderer.tsx +0 -263
  122. package/src/router.ts +0 -730
  123. package/src/types/framework.ts +0 -58
  124. package/src/types.ts +0 -207
  125. package/tsconfig.json +0 -17
@@ -1,84 +0,0 @@
1
- /*
2
- * This file is part of the HightJS Project.
3
- * Copyright (c) 2025 itsmuzin
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import React from 'react';
18
-
19
- export default function DefaultNotFound() {
20
- return (
21
- <div style={{
22
- fontFamily: 'system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
23
- height: '100vh',
24
- textAlign: 'center',
25
- display: 'flex',
26
- flexDirection: 'column',
27
- alignItems: 'center',
28
- justifyContent: 'center'
29
- }}>
30
- <div>
31
- <style dangerouslySetInnerHTML={{
32
- __html: `
33
- body {
34
- color: #000;
35
- /* Alterado de cor sólida para gradiente */
36
- background: linear-gradient(to bottom, #e9e9e9, #ffffff);
37
- margin: 0;
38
- }
39
-
40
- .next-error-h1 {
41
- border-right: 1px solid rgba(0, 0, 0, .3);
42
- }
43
-
44
- @media (prefers-color-scheme: dark) {
45
- body {
46
- color: #fff;
47
- /* Alterado de cor sólida para gradiente escuro */
48
- background: linear-gradient(to bottom, #222, #000);
49
- }
50
-
51
- .next-error-h1 {
52
- border-right: 1px solid rgba(255, 255, 255, .3);
53
- }
54
- }
55
- `
56
- }} />
57
- <h1
58
- className="next-error-h1"
59
- style={{
60
- display: 'inline-block',
61
- margin: '0px 20px 0px 0px',
62
- padding: '0px 23px 0px 0px',
63
- fontSize: '24px',
64
- fontWeight: '500',
65
- verticalAlign: 'top',
66
- lineHeight: '49px'
67
- }}
68
- >
69
- 404
70
- </h1>
71
- <div style={{ display: 'inline-block' }}>
72
- <h2 style={{
73
- fontSize: '14px',
74
- fontWeight: '400',
75
- lineHeight: '49px',
76
- margin: '0px'
77
- }}>
78
- This page cannot be found.
79
- </h2>
80
- </div>
81
- </div>
82
- </div>
83
- );
84
- }
@@ -1,153 +0,0 @@
1
- /*
2
- * This file is part of the HightJS Project.
3
- * Copyright (c) 2025 itsmuzin
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- // Sistema de roteamento do lado do cliente para hweb-sdk
18
-
19
- export interface RouterEvents {
20
- beforeNavigate?: (url: string) => boolean | Promise<boolean>;
21
- afterNavigate?: (url: string) => void;
22
- }
23
-
24
- class Router {
25
- private events: RouterEvents = {};
26
- private listeners: Set<() => void> = new Set();
27
-
28
- /**
29
- * Navega para uma nova rota
30
- */
31
- async push(url: string): Promise<void> {
32
- // Callback antes de navegar
33
- if (this.events.beforeNavigate) {
34
- const shouldProceed = await this.events.beforeNavigate(url);
35
- if (shouldProceed === false) return;
36
- }
37
-
38
- // Atualiza a URL na barra de endereço
39
- window.history.pushState({ path: url }, '', url);
40
-
41
- // Dispara evento para o roteador capturar de forma assíncrona
42
- setTimeout(() => this.triggerNavigation(), 0);
43
-
44
- // Callback após navegar
45
- if (this.events.afterNavigate) {
46
- this.events.afterNavigate(url);
47
- }
48
- }
49
-
50
- /**
51
- * Substitui a entrada atual do histórico
52
- */
53
- async replace(url: string): Promise<void> {
54
- // Callback antes de navegar
55
- if (this.events.beforeNavigate) {
56
- const shouldProceed = await this.events.beforeNavigate(url);
57
- if (shouldProceed === false) return;
58
- }
59
-
60
- // Substitui a URL atual no histórico
61
- window.history.replaceState({ path: url }, '', url);
62
-
63
- // Dispara evento para o roteador capturar de forma assíncrona
64
- setTimeout(() => this.triggerNavigation(), 0);
65
-
66
- // Callback após navegar
67
- if (this.events.afterNavigate) {
68
- this.events.afterNavigate(url);
69
- }
70
- }
71
-
72
- /**
73
- * Volta uma página no histórico
74
- */
75
- back(): void {
76
- window.history.back();
77
- }
78
-
79
- /**
80
- * Avança uma página no histórico
81
- */
82
- forward(): void {
83
- window.history.forward();
84
- }
85
-
86
- /**
87
- * Recarrega a página atual (re-renderiza o componente)
88
- */
89
- refresh(): void {
90
- setTimeout(() => this.triggerNavigation(), 0);
91
- }
92
-
93
- /**
94
- * Obtém a URL atual
95
- */
96
- get pathname(): string {
97
- return window.location.pathname;
98
- }
99
-
100
- /**
101
- * Obtém os query parameters atuais
102
- */
103
- get query(): URLSearchParams {
104
- return new URLSearchParams(window.location.search);
105
- }
106
-
107
- /**
108
- * Obtém a URL completa atual
109
- */
110
- get url(): string {
111
- return window.location.href;
112
- }
113
-
114
- /**
115
- * Adiciona event listeners para eventos de roteamento
116
- */
117
- on(events: RouterEvents): void {
118
- this.events = { ...this.events, ...events };
119
- }
120
-
121
- /**
122
- * Remove event listeners
123
- */
124
- off(): void {
125
- this.events = {};
126
- }
127
-
128
- /**
129
- * Adiciona um listener para mudanças de rota
130
- */
131
- subscribe(listener: () => void): () => void {
132
- this.listeners.add(listener);
133
- return () => this.listeners.delete(listener);
134
- }
135
-
136
- /**
137
- * Dispara evento de navegação para todos os listeners
138
- */
139
- private triggerNavigation(): void {
140
- // Dispara o evento nativo para o roteador do hweb capturar
141
- window.dispatchEvent(new PopStateEvent('popstate'));
142
-
143
- // Notifica todos os listeners customizados
144
- this.listeners.forEach(listener => listener());
145
- }
146
-
147
- }
148
-
149
- // Instância singleton do router
150
- export const router = new Router();
151
-
152
- // Para compatibilidade, também exporta como default
153
- export default router;