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
package/example/package.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "example",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"start": "hight start --port 80",
|
|
8
|
-
"dev": "hight dev --port 80"
|
|
9
|
-
},
|
|
10
|
-
"author": "itsmuzin",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@tailwindcss/postcss": "^4.1.16",
|
|
14
|
-
"autoprefixer": "^10.4.21",
|
|
15
|
-
"hightjs": "../",
|
|
16
|
-
"postcss": "^8.5.6",
|
|
17
|
-
"react": "^19.2.0",
|
|
18
|
-
"react-dom": "^19.2.0",
|
|
19
|
-
"tailwindcss": "^4.1.16",
|
|
20
|
-
"ts-node": "^10.9.2"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/react": "^19.2.2",
|
|
24
|
-
"typescript": "^5.9.3"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {CredentialsProvider, createAuthRoutes, DiscordProvider, GoogleProvider, User} from 'hightjs/auth';
|
|
2
|
-
import type { AuthConfig } from 'hightjs/auth';
|
|
3
|
-
|
|
4
|
-
export const authConfig: AuthConfig = {
|
|
5
|
-
providers: [
|
|
6
|
-
new CredentialsProvider({
|
|
7
|
-
authorize(credentials: Record<string, string>): Promise<User | null> | User | null {
|
|
8
|
-
if (credentials.username === 'jsmith' && credentials.password === 'password123') {
|
|
9
|
-
return {
|
|
10
|
-
id: '1',
|
|
11
|
-
name: 'John Smith',
|
|
12
|
-
email: 'john.smith@gmail.com'
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return null;
|
|
16
|
-
},
|
|
17
|
-
credentials: {
|
|
18
|
-
username: { label: "Username", type: "text", placeholder: "jsmith" },
|
|
19
|
-
password: { label: "Password", type: "password" }
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
],
|
|
23
|
-
|
|
24
|
-
session: {
|
|
25
|
-
strategy: 'jwt',
|
|
26
|
-
maxAge: 24 * 60 * 60, // 24 horas
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
pages: {
|
|
30
|
-
signIn: '/login',
|
|
31
|
-
signOut: '/'
|
|
32
|
-
},
|
|
33
|
-
callbacks: {
|
|
34
|
-
async session({session, provider}) {
|
|
35
|
-
return session;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
secret: 'hweb-test-secret-key-change-in-production'
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Criar as rotas de auth automaticamente
|
|
42
|
-
export const authRoutes = createAuthRoutes(authConfig);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {BackendRouteConfig, HightJSResponse} from "hightjs";
|
|
2
|
-
|
|
3
|
-
const route: BackendRouteConfig = {
|
|
4
|
-
pattern: "/api/version",
|
|
5
|
-
GET: (request, params): HightJSResponse => {
|
|
6
|
-
return HightJSResponse.json({
|
|
7
|
-
success: true,
|
|
8
|
-
version: "1.0.0",
|
|
9
|
-
name: "HightJS Example asdadsadsadsdas"
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export default route;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {useSession} from "hightjs/auth/react"
|
|
3
|
-
import { Link } from "hightjs/client";
|
|
4
|
-
export default function Home() {
|
|
5
|
-
const { data: session, status, signOut } = useSession();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<div className="font-sans grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 bg-gradient-to-r from-black to-gray-500 text-gray-200 relative overflow-hidden">
|
|
10
|
-
<div className="absolute inset-0 -z-10 h-full w-full bg-gradient-to-r from-black to-gray-500 bg-[radial-gradient(circle_500px_at_50%_200px,#3e007555,transparent)]"></div>
|
|
11
|
-
<main className="flex flex-col gap-[32px] row-start-2 items-center sm:items-start z-10">
|
|
12
|
-
<div className="flex items-center gap-4">
|
|
13
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="38" height="38" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="text-purple-500"><path d="m12 3-8.9 5.06a4 4 0 0 0-1.1 5.44l1.1 1.94a4 4 0 0 0 5.44 1.1l8.9-5.06a4 4 0 0 0 1.1-5.44l-1.1-1.94a4 4 0 0 0-5.44-1.1z"></path></svg>
|
|
14
|
-
<h1 className="text-3xl font-bold text-purple-400 [text-shadow:_0_0_12px_theme(colors.purple.500)]">HightJS</h1>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div className="flex flex-col items-center gap-4 self-center">
|
|
18
|
-
{status === 'loading' && <p>Carregando...</p>}
|
|
19
|
-
{status === 'authenticated' && session?.user && (
|
|
20
|
-
<>
|
|
21
|
-
<p className="text-lg">Você está logado como amoraaaa <span className="font-bold text-purple-400">{session.user.name}</span>!</p>
|
|
22
|
-
<button
|
|
23
|
-
onClick={() => signOut({callbackUrl: '/'})}
|
|
24
|
-
className="rounded-full border border-solid border-transparent transition-all duration-300 flex items-center justify-center bg-purple-600 text-white gap-2 hover:bg-purple-500 font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 w-40 shadow-[0_0_15px_-3px_theme(colors.purple.600)] hover:shadow-[0_0_25px_-3px_theme(colors.purple.500)]"
|
|
25
|
-
>
|
|
26
|
-
Sair
|
|
27
|
-
</button>
|
|
28
|
-
|
|
29
|
-
</>
|
|
30
|
-
)}
|
|
31
|
-
{status === 'unauthenticated' && (
|
|
32
|
-
<Link
|
|
33
|
-
href="/login"
|
|
34
|
-
className="rounded-full border border-solid border-transparent transition-all duration-300 flex items-center justify-center bg-purple-600 text-white gap-2 hover:bg-purple-500 font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 w-40 shadow-[0_0_15px_-3px_theme(colors.purple.600)] hover:shadow-[0_0_25px_-3px_theme(colors.purple.500)]"
|
|
35
|
-
>
|
|
36
|
-
Login
|
|
37
|
-
</Link>
|
|
38
|
-
)}
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<ol className="font-mono list-inside list-decimal text-sm/6 text-center sm:text-left text-gray-400">
|
|
42
|
-
<li className="mb-2 tracking-[-.01em]">
|
|
43
|
-
Comece editando{" "}
|
|
44
|
-
<code className="bg-gray-800 border border-gray-700 font-mono font-semibold px-1 py-0.5 rounded text-purple-400">
|
|
45
|
-
src/web/routes/index.tsx
|
|
46
|
-
</code>
|
|
47
|
-
.
|
|
48
|
-
</li>
|
|
49
|
-
<li className="tracking-[-.01em]">
|
|
50
|
-
Salve e veja suas mudanças instantaneamente.
|
|
51
|
-
</li>
|
|
52
|
-
</ol>
|
|
53
|
-
|
|
54
|
-
<div className="flex gap-4 items-center flex-col sm:flex-row">
|
|
55
|
-
<a
|
|
56
|
-
className="rounded-full border border-solid border-transparent transition-all duration-300 flex items-center justify-center bg-purple-600 text-white gap-2 hover:bg-purple-500 font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:w-auto shadow-[0_0_15px_-3px_theme(colors.purple.600)] hover:shadow-[0_0_25px_-3px_theme(colors.purple.500)]"
|
|
57
|
-
href="#"
|
|
58
|
-
target="_blank"
|
|
59
|
-
rel="noopener noreferrer"
|
|
60
|
-
>
|
|
61
|
-
<svg
|
|
62
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
63
|
-
width="20"
|
|
64
|
-
height="20"
|
|
65
|
-
viewBox="0 0 24 24"
|
|
66
|
-
fill="none"
|
|
67
|
-
stroke="currentColor"
|
|
68
|
-
strokeWidth="2"
|
|
69
|
-
strokeLinecap="round"
|
|
70
|
-
strokeLinejoin="round"
|
|
71
|
-
className="lucide lucide-rocket"
|
|
72
|
-
>
|
|
73
|
-
<path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.33-.04-3.86l1.8-1.8c.44-.44.86-.92 1.22-1.44l-2.06-2.06c-.52.36-1 .78-1.44 1.22l-1.8-1.8c-1.53.74-3.02.73-3.86-.04Z" />
|
|
74
|
-
<path d="m12 15 5-5" />
|
|
75
|
-
<path d="M9 3h6v6h-6Z" />
|
|
76
|
-
<path d="M19.5 16.5c1.5-1.26 2-5 2-5s-3.74.5-5 2c-.71.84-.7 2.33.04 3.86l-1.8 1.8c-.44.44-.86.92-1.22 1.44l2.06 2.06c.52-.36 1-.78 1.44-1.22l1.8 1.8c1.53-.74 3.02-.73 3.86.04Z" />
|
|
77
|
-
</svg>
|
|
78
|
-
Fazer Deploy
|
|
79
|
-
</a>
|
|
80
|
-
<a
|
|
81
|
-
className="rounded-full border border-solid border-white/20 transition-colors flex items-center justify-center hover:bg-white/10 hover:border-white/30 font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 w-full sm:w-auto md:w-[158px] text-gray-300"
|
|
82
|
-
href="#"
|
|
83
|
-
target="_blank"
|
|
84
|
-
rel="noopener noreferrer"
|
|
85
|
-
>
|
|
86
|
-
Leia a documentação
|
|
87
|
-
</a>
|
|
88
|
-
</div>
|
|
89
|
-
</main>
|
|
90
|
-
<footer className="row-start-3 flex gap-[24px] flex-wrap items-center justify-center z-10">
|
|
91
|
-
<a
|
|
92
|
-
className="flex items-center gap-2 text-gray-400 transition-colors hover:text-purple-400 hover:underline hover:underline-offset-4"
|
|
93
|
-
href="#"
|
|
94
|
-
target="_blank"
|
|
95
|
-
rel="noopener noreferrer"
|
|
96
|
-
>
|
|
97
|
-
<img
|
|
98
|
-
aria-hidden
|
|
99
|
-
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWJvb2stb3BlbiI+PHBhdGggZD0iTTIgM3YxNGEyIDIgMCAwIDAgMiAyaDE2YTIgMiAwIDAgMCAyLTJWM20tOCAxOGExIDQgMCAwIDEtMy44LTJsMS42LTEuNmExIDQgMCAwIDEgMy44IDJ6bTggMGE0IDQgMCAwIDAgMy44LTJsLTEuNi0xLjZhNCA0IDAgMCAwLTMuOCAyeiIvPjwvc3ZnPg=="
|
|
100
|
-
alt="Ícone de arquivo"
|
|
101
|
-
width={16}
|
|
102
|
-
height={16}
|
|
103
|
-
/>
|
|
104
|
-
Aprenda
|
|
105
|
-
</a>
|
|
106
|
-
<a
|
|
107
|
-
className="flex items-center gap-2 text-gray-400 transition-colors hover:text-purple-400 hover:underline hover:underline-offset-4"
|
|
108
|
-
href="#"
|
|
109
|
-
target="_blank"
|
|
110
|
-
rel="noopener noreferrer"
|
|
111
|
-
>
|
|
112
|
-
<img
|
|
113
|
-
aria-hidden
|
|
114
|
-
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWxheW91dC10ZW1wbGF0ZSI+PHJlY3Qgd2lkdGg9IjE4IiBoZWlnaHQ9IjciIHg9IjMiIHk9IjMiIHJ4PSIyIiByeT0iMiIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjciIHg9IjMiIHk9IjE0IiByeD0iMiIgcnk9IjIiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSI3IiB4PSIxNCIgeT0iMTQiIHJ4PSIyIiByeT0iMiIvPjwvc3ZnPg=="
|
|
115
|
-
alt="Ícone de janela"
|
|
116
|
-
width={16}
|
|
117
|
-
height={16}
|
|
118
|
-
/>
|
|
119
|
-
Exemplos
|
|
120
|
-
</a>
|
|
121
|
-
<a
|
|
122
|
-
className="flex items-center gap-2 text-gray-400 transition-colors hover:text-purple-400 hover:underline hover:underline-offset-4"
|
|
123
|
-
href="#"
|
|
124
|
-
target="_blank"
|
|
125
|
-
rel="noopener noreferrer"
|
|
126
|
-
>
|
|
127
|
-
<img
|
|
128
|
-
aria-hidden
|
|
129
|
-
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWdsb2JlIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIvPjxwYXRoIGQ9Ik0xMiAyYTE0LjUgMTQuNSAwIDAgMCAwIDIwIDE0LjUgMTQuNSAwIDAgMCAwLTIweiIvPjxwYXRoIGQ9Ik0yIDEySDEybTEwIDBIMTIiLz48L3N2Zz4="
|
|
130
|
-
alt="Ícone de globo"
|
|
131
|
-
width={16}
|
|
132
|
-
height={16}
|
|
133
|
-
/>
|
|
134
|
-
Ir para hightjs.dev →
|
|
135
|
-
</a>
|
|
136
|
-
</footer>
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import React, {useState} from "react";
|
|
2
|
-
import {useSession} from "hightjs/auth/react";
|
|
3
|
-
import {router} from "hightjs/client";
|
|
4
|
-
export default function LoginPage() {
|
|
5
|
-
const [username, setUsername] = useState("");
|
|
6
|
-
const [password, setPassword] = useState("");
|
|
7
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
8
|
-
const {signIn} = useSession();
|
|
9
|
-
|
|
10
|
-
const [error, setError] = useState<string | null>(null);
|
|
11
|
-
|
|
12
|
-
const handleLogin = async (e: React.FormEvent) => {
|
|
13
|
-
e.preventDefault();
|
|
14
|
-
setIsLoading(true);
|
|
15
|
-
setError(null);
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
const result = await signIn('credentials', {
|
|
19
|
-
redirect: false,
|
|
20
|
-
username: username,
|
|
21
|
-
password: password,
|
|
22
|
-
callbackUrl: '/'
|
|
23
|
-
});
|
|
24
|
-
console.log(result)
|
|
25
|
-
if (!result || result.error) {
|
|
26
|
-
setError('Credenciais inválidas. Verifique seus dados e senha.');
|
|
27
|
-
setIsLoading(false);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
router.push("/")
|
|
31
|
-
|
|
32
|
-
} catch (err) {
|
|
33
|
-
setError('Ocorreu um erro inesperado. Tente novamente.');
|
|
34
|
-
setIsLoading(false);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div className="font-sans min-h-screen flex items-center justify-center p-8 bg-gradient-to-r from-black to-gray-500 text-gray-200 relative overflow-hidden">
|
|
41
|
-
{/* Background gradient */}
|
|
42
|
-
<div className="absolute inset-0 -z-10 h-full w-full bg-gradient-to-r from-black to-gray-500 bg-[radial-gradient(circle_500px_at_50%_200px,#3e007555,transparent)]"></div>
|
|
43
|
-
|
|
44
|
-
{/* Additional ambient lights */}
|
|
45
|
-
<div className="absolute top-1/4 left-1/4 w-72 h-72 bg-purple-500/10 rounded-full blur-3xl -z-10"></div>
|
|
46
|
-
<div className="absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl -z-10"></div>
|
|
47
|
-
|
|
48
|
-
{/* Login Container */}
|
|
49
|
-
<div className="w-full max-w-md">
|
|
50
|
-
{/* Header */}
|
|
51
|
-
<div className="text-center mb-8">
|
|
52
|
-
<div className="flex items-center justify-center gap-3 mb-4">
|
|
53
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="text-purple-500">
|
|
54
|
-
<path d="m12 3-8.9 5.06a4 4 0 0 0-1.1 5.44l1.1 1.94a4 4 0 0 0 5.44 1.1l8.9-5.06a4 4 0 0 0 1.1-5.44l-1.1-1.94a4 4 0 0 0-5.44-1.1z"></path>
|
|
55
|
-
</svg>
|
|
56
|
-
<h1 className="text-2xl font-bold text-purple-400 [text-shadow:_0_0_12px_theme(colors.purple.500)]">HightJS</h1>
|
|
57
|
-
</div>
|
|
58
|
-
<h2 className="text-xl font-medium text-gray-300 mb-2">Bem-vindo de volta</h2>
|
|
59
|
-
<p className="text-sm text-gray-400">Faça login em sua conta</p>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
{/* Glass Login Form */}
|
|
63
|
-
<div className="relative">
|
|
64
|
-
{/* Glass background */}
|
|
65
|
-
<div className="absolute inset-0 bg-white/5 backdrop-blur-xl border border-white/10 rounded-2xl shadow-2xl"></div>
|
|
66
|
-
|
|
67
|
-
{/* error */}
|
|
68
|
-
{error && (
|
|
69
|
-
<div className="relative p-4 mb-4 text-sm text-red-800 bg-red-200 rounded-lg" role="alert">
|
|
70
|
-
{error}
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
|
|
74
|
-
{/* Form content */}
|
|
75
|
-
<form onSubmit={handleLogin} className="relative p-8 space-y-6">
|
|
76
|
-
{/* Email field */}
|
|
77
|
-
<div className="space-y-2">
|
|
78
|
-
<label htmlFor="email" className="text-sm font-medium text-gray-300">
|
|
79
|
-
Usuário
|
|
80
|
-
</label>
|
|
81
|
-
<input
|
|
82
|
-
id="username"
|
|
83
|
-
type="username"
|
|
84
|
-
value={username}
|
|
85
|
-
onChange={(e) => setUsername(e.target.value)}
|
|
86
|
-
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-xl text-gray-200 placeholder-gray-400 focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 focus:outline-none backdrop-blur-sm transition-all duration-300"
|
|
87
|
-
required
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
{/* Password field */}
|
|
92
|
-
<div className="space-y-2">
|
|
93
|
-
<label htmlFor="password" className="text-sm font-medium text-gray-300">
|
|
94
|
-
Senha
|
|
95
|
-
</label>
|
|
96
|
-
<input
|
|
97
|
-
id="password"
|
|
98
|
-
type="password"
|
|
99
|
-
placeholder="••••••••"
|
|
100
|
-
value={password}
|
|
101
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
102
|
-
className="w-full px-4 py-3 bg-white/5 border border-white/10 rounded-xl text-gray-200 placeholder-gray-400 focus:border-purple-500/50 focus:ring-2 focus:ring-purple-500/20 focus:outline-none backdrop-blur-sm transition-all duration-300"
|
|
103
|
-
required
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
{/* Remember me and forgot password */}
|
|
108
|
-
<div className="flex items-center justify-between text-sm">
|
|
109
|
-
<label className="flex items-center text-gray-400 cursor-pointer">
|
|
110
|
-
<input
|
|
111
|
-
type="checkbox"
|
|
112
|
-
className="mr-2 rounded border-white/20 bg-white/5 text-purple-500 focus:ring-purple-500/20"
|
|
113
|
-
/>
|
|
114
|
-
Lembrar de mim
|
|
115
|
-
</label>
|
|
116
|
-
<a href="#" className="text-purple-400 hover:text-purple-300 transition-colors hover:underline">
|
|
117
|
-
Esqueceu a senha?
|
|
118
|
-
</a>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
{/* Login button */}
|
|
122
|
-
<button
|
|
123
|
-
type="submit"
|
|
124
|
-
disabled={isLoading}
|
|
125
|
-
className="w-full bg-purple-600 hover:bg-purple-500 text-white font-medium py-3 px-4 rounded-xl transition-all duration-300 shadow-[0_0_15px_-3px_theme(colors.purple.600)] hover:shadow-[0_0_25px_-3px_theme(colors.purple.500)] disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-purple-500/20"
|
|
126
|
-
>
|
|
127
|
-
{isLoading ? (
|
|
128
|
-
<div className="flex items-center justify-center gap-2">
|
|
129
|
-
<svg className="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
|
130
|
-
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
|
131
|
-
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
132
|
-
</svg>
|
|
133
|
-
Entrando...
|
|
134
|
-
</div>
|
|
135
|
-
) : (
|
|
136
|
-
'Entrar'
|
|
137
|
-
)}
|
|
138
|
-
</button>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
</form>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Metadata, router} from "hightjs/client"
|
|
3
|
-
import './globals.css';
|
|
4
|
-
import {AnimatePresence, motion} from "framer-motion";
|
|
5
|
-
import {SessionProvider} from "hightjs/auth/react";
|
|
6
|
-
|
|
7
|
-
interface LayoutProps {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export const metadata: Metadata = {
|
|
13
|
-
// --- Informações Básicas ---
|
|
14
|
-
// Título otimizado para abas do navegador e resultados de busca
|
|
15
|
-
title: "Hight JS | O Framework Web Rápido e Simples para React",
|
|
16
|
-
description: "O framework web mais rápido e simples para React! Comece a construir aplicações web performáticas hoje mesmo com Hight JS.",
|
|
17
|
-
keywords: ["Hight JS", "framework web", "React", "JavaScript", "TypeScript", "desenvolvimento web", "rápido", "simples", "SSR", "frontend"],
|
|
18
|
-
author: "Hight JS Team",
|
|
19
|
-
favicon: "/favicon.ico",
|
|
20
|
-
|
|
21
|
-
// --- Mobile e Viewport ---
|
|
22
|
-
// Essencial para design responsivo e boa pontuação no mobile
|
|
23
|
-
viewport: "width=device-width, initial-scale=1.0",
|
|
24
|
-
// Cor da barra de navegação em browsers mobile (ex: Chrome no Android)
|
|
25
|
-
themeColor: "#0A0A0A", // Sugestão de cor escura, ajuste conforme sua marca
|
|
26
|
-
|
|
27
|
-
// --- SEO ---
|
|
28
|
-
// URL principal do site para evitar conteúdo duplicado
|
|
29
|
-
canonical: "https://hightjs.com", // Substitua pelo seu domínio real
|
|
30
|
-
// Instruções para robôs de busca (Google, Bing, etc.)
|
|
31
|
-
robots: "index, follow",
|
|
32
|
-
|
|
33
|
-
// --- Open Graph (para Redes Sociais como Facebook, LinkedIn, Discord) ---
|
|
34
|
-
openGraph: {
|
|
35
|
-
title: "Hight JS | O Framework Web Rápido e Simples para React",
|
|
36
|
-
description: "Descubra o Hight JS, o framework web focado em performance e simplicidade para suas aplicações React.",
|
|
37
|
-
type: "website",
|
|
38
|
-
url: "https://hightjs.com", // Seu domínio real
|
|
39
|
-
// URL de uma imagem de preview (idealmente 1200x630px)
|
|
40
|
-
image: "https://hightjs.com/og-image.png",
|
|
41
|
-
siteName: "Hight JS",
|
|
42
|
-
locale: "pt_BR",
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
// --- Twitter Card (para compartilhamento no Twitter) ---
|
|
46
|
-
twitter: {
|
|
47
|
-
card: "summary_large_image", // Mostra uma imagem grande no tweet
|
|
48
|
-
site: "@hightjs_team", // Handle do Twitter do projeto (exemplo)
|
|
49
|
-
creator: "@seu_criador", // Handle do Twitter do criador (exemplo)
|
|
50
|
-
title: "Hight JS | O Framework Web Rápido e Simples para React",
|
|
51
|
-
description: "Cansado de complexidade? Conheça o Hight JS e construa sites React mais rápidos e leves.",
|
|
52
|
-
// Imagem específica para Twitter (ou pode reusar a 'og-image')
|
|
53
|
-
image: "https://hightjs.com/twitter-image.png",
|
|
54
|
-
imageAlt: "Logo e slogan do framework Hight JS",
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
// --- Ícones e Manifest (PWA) ---
|
|
58
|
-
// Ícone para dispositivos Apple (quando salvo na tela inicial)
|
|
59
|
-
appleTouchIcon: "/apple-touch-icon.png", // (ex: 180x180px)
|
|
60
|
-
// Link para o manifest de PWA (Progressive Web App)
|
|
61
|
-
manifest: "/site.webmanifest",
|
|
62
|
-
|
|
63
|
-
// --- Outros ---
|
|
64
|
-
language: "pt-BR", // Define o idioma principal da página
|
|
65
|
-
charset: "UTF-8", // Define o charset (embora geralmente setado no HTML)
|
|
66
|
-
other: {
|
|
67
|
-
// Tag útil para compatibilidade com navegadores legados (Edge/IE)
|
|
68
|
-
"X-UA-Compatible": "IE=edge"
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default function Layout({ children }: LayoutProps) {
|
|
73
|
-
const variants = {
|
|
74
|
-
hidden: { opacity: 0, y: 15 }, // Começa um pouco abaixo e invisível
|
|
75
|
-
enter: { opacity: 1, y: 0 }, // Sobe para a posição final e aparece
|
|
76
|
-
exit: { opacity: 0, y: -15 }, // Sai subindo um pouco e some
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<SessionProvider>
|
|
81
|
-
<AnimatePresence
|
|
82
|
-
mode="wait"
|
|
83
|
-
onExitComplete={() => window.scrollTo(0, 0)}
|
|
84
|
-
>
|
|
85
|
-
<motion.div
|
|
86
|
-
key={router.pathname}
|
|
87
|
-
variants={variants}
|
|
88
|
-
initial="hidden"
|
|
89
|
-
animate="enter"
|
|
90
|
-
exit="exit"
|
|
91
|
-
// Uma transição mais rápida e suave
|
|
92
|
-
transition={{ type: 'tween', ease: 'easeInOut', duration: 0.4 }}
|
|
93
|
-
>
|
|
94
|
-
{ /*// @ts-ignore*/ }
|
|
95
|
-
{children}
|
|
96
|
-
</motion.div>
|
|
97
|
-
</AnimatePresence>
|
|
98
|
-
</SessionProvider>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {RouteConfig} from "hightjs/client";
|
|
2
|
-
import Home from "../components/Home";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const config: RouteConfig = {
|
|
7
|
-
pattern: '/',
|
|
8
|
-
component: Home,
|
|
9
|
-
generateMetadata: () => ({
|
|
10
|
-
title: 'HightJS | Home'
|
|
11
|
-
})
|
|
12
|
-
};
|
|
13
|
-
export default config
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {RouteConfig, router} from "hightjs/client";
|
|
2
|
-
import {GuestOnly, useSession} from "hightjs/auth/react"
|
|
3
|
-
import React, {useState} from "react";
|
|
4
|
-
import LoginPage from "../components/LoginPage";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const wrapper = () => {
|
|
9
|
-
const session = useSession()
|
|
10
|
-
if (session.status === 'loading') {
|
|
11
|
-
return <div>Loading...</div>;
|
|
12
|
-
}
|
|
13
|
-
if (session.status === 'authenticated') {
|
|
14
|
-
router.push('/')
|
|
15
|
-
return <div>Redirecting...</div>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<LoginPage/>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const config: RouteConfig = {
|
|
24
|
-
pattern: '/login',
|
|
25
|
-
component: wrapper,
|
|
26
|
-
generateMetadata: () => ({
|
|
27
|
-
title: 'HightJS | Login'
|
|
28
|
-
})
|
|
29
|
-
};
|
|
30
|
-
export default config
|
package/example/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES6",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"jsx": "react",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"moduleResolution": "nodenext"
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"]
|
|
15
|
-
}
|
package/src/adapters/express.ts
DELETED
|
@@ -1,87 +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 type { Request as ExpressRequest, Response as ExpressResponse } from 'express';
|
|
18
|
-
import { GenericRequest, GenericResponse, FrameworkAdapter, CookieOptions } from '../types/framework';
|
|
19
|
-
|
|
20
|
-
export class ExpressAdapter implements FrameworkAdapter {
|
|
21
|
-
type = 'express' as const;
|
|
22
|
-
|
|
23
|
-
parseRequest(req: ExpressRequest): GenericRequest {
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
method: req.method,
|
|
27
|
-
url: req.url,
|
|
28
|
-
headers: req.headers as Record<string, string | string[]>,
|
|
29
|
-
body: req.body,
|
|
30
|
-
query: req.query as Record<string, any>,
|
|
31
|
-
params: req.params,
|
|
32
|
-
cookies: req.cookies || {},
|
|
33
|
-
raw: req,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
createResponse(res: ExpressResponse): GenericResponse {
|
|
38
|
-
return new ExpressResponseWrapper(res);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class ExpressResponseWrapper implements GenericResponse {
|
|
43
|
-
constructor(private res: ExpressResponse) {}
|
|
44
|
-
|
|
45
|
-
get raw() {
|
|
46
|
-
return this.res;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
status(code: number): GenericResponse {
|
|
50
|
-
this.res.status(code);
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
header(name: string, value: string): GenericResponse {
|
|
55
|
-
this.res.setHeader(name, value);
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
cookie(name: string, value: string, options?: CookieOptions): GenericResponse {
|
|
60
|
-
this.res.cookie(name, value, options || {});
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
clearCookie(name: string, options?: CookieOptions): GenericResponse {
|
|
65
|
-
// Filter out the deprecated 'expires' option to avoid Express deprecation warning
|
|
66
|
-
const { expires, ...filteredOptions } = options || {};
|
|
67
|
-
this.res.clearCookie(name, filteredOptions);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
json(data: any): void {
|
|
72
|
-
this.res.json(data);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
text(data: string): void {
|
|
76
|
-
this.res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
77
|
-
this.res.send(data);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
send(data: any): void {
|
|
81
|
-
this.res.send(data);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
redirect(url: string): void {
|
|
85
|
-
this.res.redirect(url);
|
|
86
|
-
}
|
|
87
|
-
}
|