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.
- package/README.md +48 -116
- package/dist/bin/hightjs.js +51 -23
- package/dist/builder.js +139 -4
- package/dist/client/DefaultNotFound.d.ts +1 -1
- package/dist/client/DefaultNotFound.js +72 -46
- package/dist/client/client.d.ts +3 -0
- package/dist/{client.js → client/client.js} +4 -4
- package/dist/client/entry.client.js +39 -29
- package/dist/global/global.d.ts +117 -0
- package/dist/{auth/types.js → global/global.js} +0 -1
- package/dist/helpers.js +80 -2
- package/dist/hotReload.js +2 -2
- package/dist/index.js +16 -16
- package/dist/loaders.d.ts +1 -0
- package/dist/loaders.js +46 -0
- package/dist/renderer.js +158 -4
- package/dist/types.d.ts +44 -0
- package/package.json +36 -31
- package/.idea/HightJS.iml +0 -9
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/copilotDiffState.xml +0 -67
- package/.idea/inspectionProfiles/Project_Default.xml +0 -13
- package/.idea/libraries/test_package.xml +0 -9
- package/.idea/libraries/ts_commonjs_default_export.xml +0 -9
- package/.idea/misc.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/dist/auth/client.d.ts +0 -24
- package/dist/auth/client.js +0 -146
- package/dist/auth/components.d.ts +0 -29
- package/dist/auth/components.js +0 -100
- package/dist/auth/core.d.ts +0 -55
- package/dist/auth/core.js +0 -189
- package/dist/auth/index.d.ts +0 -7
- package/dist/auth/index.js +0 -45
- package/dist/auth/jwt.d.ts +0 -41
- package/dist/auth/jwt.js +0 -185
- package/dist/auth/providers/credentials.d.ts +0 -60
- package/dist/auth/providers/credentials.js +0 -97
- package/dist/auth/providers/discord.d.ts +0 -63
- package/dist/auth/providers/discord.js +0 -190
- package/dist/auth/providers/google.d.ts +0 -63
- package/dist/auth/providers/google.js +0 -186
- package/dist/auth/providers/index.d.ts +0 -2
- package/dist/auth/providers/index.js +0 -35
- package/dist/auth/providers.d.ts +0 -3
- package/dist/auth/providers.js +0 -26
- package/dist/auth/react/index.d.ts +0 -6
- package/dist/auth/react/index.js +0 -48
- package/dist/auth/react.d.ts +0 -22
- package/dist/auth/react.js +0 -199
- package/dist/auth/routes.d.ts +0 -16
- package/dist/auth/routes.js +0 -152
- package/dist/auth/types.d.ts +0 -76
- package/dist/client.d.ts +0 -3
- package/docs/README.md +0 -58
- package/docs/arquivos-especiais.md +0 -10
- package/docs/autenticacao.md +0 -212
- package/docs/checklist.md +0 -9
- package/docs/cli.md +0 -72
- package/docs/config.md +0 -216
- package/docs/estrutura.md +0 -20
- package/docs/faq.md +0 -10
- package/docs/hot-reload.md +0 -5
- package/docs/integracoes.md +0 -240
- package/docs/middlewares.md +0 -73
- package/docs/rotas-backend.md +0 -45
- package/docs/rotas-frontend.md +0 -66
- package/docs/seguranca.md +0 -8
- package/docs/websocket.md +0 -45
- package/example/certs/cert.pem +0 -20
- package/example/certs/key.pem +0 -27
- package/example/hightjs.config.ts +0 -87
- package/example/package-lock.json +0 -1174
- package/example/package.json +0 -26
- package/example/postcss.config.js +0 -8
- package/example/src/backend/auth.ts +0 -42
- package/example/src/backend/routes/auth.ts +0 -3
- package/example/src/backend/routes/version.ts +0 -13
- package/example/src/web/components/Home.tsx +0 -140
- package/example/src/web/components/LoginPage.tsx +0 -149
- package/example/src/web/globals.css +0 -5
- package/example/src/web/layout.tsx +0 -100
- package/example/src/web/routes/index.tsx +0 -13
- package/example/src/web/routes/login.tsx +0 -30
- package/example/tailwind.config.js +0 -12
- package/example/tsconfig.json +0 -15
- package/src/adapters/express.ts +0 -87
- package/src/adapters/factory.ts +0 -112
- package/src/adapters/fastify.ts +0 -104
- package/src/adapters/native.ts +0 -234
- package/src/api/console.ts +0 -305
- package/src/api/http.ts +0 -535
- package/src/auth/client.ts +0 -171
- package/src/auth/components.tsx +0 -125
- package/src/auth/core.ts +0 -215
- package/src/auth/index.ts +0 -25
- package/src/auth/jwt.ts +0 -210
- package/src/auth/providers/credentials.ts +0 -139
- package/src/auth/providers/discord.ts +0 -239
- package/src/auth/providers/google.ts +0 -234
- package/src/auth/providers/index.ts +0 -20
- package/src/auth/providers.ts +0 -20
- package/src/auth/react/index.ts +0 -25
- package/src/auth/react.tsx +0 -234
- package/src/auth/routes.ts +0 -183
- package/src/auth/types.ts +0 -108
- package/src/bin/hightjs.js +0 -222
- package/src/builder.js +0 -472
- package/src/client/DefaultNotFound.tsx +0 -84
- package/src/client/clientRouter.ts +0 -153
- package/src/client/entry.client.tsx +0 -511
- package/src/client.ts +0 -24
- package/src/components/Link.tsx +0 -38
- package/src/helpers.ts +0 -542
- package/src/hotReload.ts +0 -569
- package/src/index.ts +0 -555
- package/src/renderer.tsx +0 -263
- package/src/router.ts +0 -730
- package/src/types/framework.ts +0 -58
- package/src/types.ts +0 -207
- 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;
|