hightjs 0.5.3 → 0.5.4
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/dist/adapters/express.d.ts +7 -0
- package/dist/adapters/express.js +63 -0
- package/dist/adapters/factory.d.ts +23 -0
- package/dist/adapters/factory.js +122 -0
- package/dist/adapters/fastify.d.ts +25 -0
- package/dist/adapters/fastify.js +61 -0
- package/dist/adapters/native.d.ts +8 -0
- package/dist/adapters/native.js +198 -0
- package/dist/api/console.d.ts +94 -0
- package/dist/api/console.js +294 -0
- package/dist/api/http.d.ts +180 -0
- package/dist/api/http.js +469 -0
- package/dist/bin/hightjs.d.ts +2 -0
- package/dist/bin/hightjs.js +214 -0
- package/dist/builder.d.ts +32 -0
- package/dist/builder.js +581 -0
- package/dist/client/DefaultNotFound.d.ts +1 -0
- package/dist/client/DefaultNotFound.js +79 -0
- package/dist/client/client.d.ts +3 -0
- package/dist/client/client.js +24 -0
- package/dist/client/clientRouter.d.ts +58 -0
- package/dist/client/clientRouter.js +132 -0
- package/dist/client/entry.client.d.ts +1 -0
- package/dist/client/entry.client.js +455 -0
- package/dist/components/Link.d.ts +7 -0
- package/dist/components/Link.js +13 -0
- package/dist/global/global.d.ts +117 -0
- package/dist/global/global.js +17 -0
- package/dist/helpers.d.ts +20 -0
- package/dist/helpers.js +583 -0
- package/dist/hotReload.d.ts +32 -0
- package/dist/hotReload.js +545 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +494 -0
- package/dist/loaders.d.ts +1 -0
- package/dist/loaders.js +46 -0
- package/dist/renderer.d.ts +14 -0
- package/dist/renderer.js +380 -0
- package/dist/router.d.ts +101 -0
- package/dist/router.js +659 -0
- package/dist/types/framework.d.ts +37 -0
- package/dist/types/framework.js +2 -0
- package/dist/types.d.ts +192 -0
- package/dist/types.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = App;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function App() {
|
|
6
|
+
const globalStyles = `
|
|
7
|
+
|
|
8
|
+
html, body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
|
14
|
+
-webkit-font-smoothing: antialiased;
|
|
15
|
+
-moz-osx-font-smoothing: grayscale;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
*, *:before, *:after {
|
|
20
|
+
box-sizing: inherit;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
body {
|
|
24
|
+
color: #000;
|
|
25
|
+
background: linear-gradient(to bottom, #e9e9e9, #ffffff);
|
|
26
|
+
background-attachment: fixed;
|
|
27
|
+
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
min-height: 100vh;
|
|
32
|
+
text-align: center;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.error-container {
|
|
37
|
+
/* Remove qualquer estilo de "card" anterior */
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.hight-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
|
+
background: linear-gradient(to bottom, #222, #000);
|
|
48
|
+
}
|
|
49
|
+
.hight-error-h2 {
|
|
50
|
+
color: white;
|
|
51
|
+
}
|
|
52
|
+
.hight-error-h1 {
|
|
53
|
+
color: white;
|
|
54
|
+
border-right: 1px solid rgba(255, 255, 255, .3);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
// Estilos inline do seu exemplo original
|
|
59
|
+
const h1Styles = {
|
|
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
|
+
const h2ContainerStyles = {
|
|
69
|
+
display: 'inline-block',
|
|
70
|
+
verticalAlign: 'top', // Alinha com o topo do H1
|
|
71
|
+
};
|
|
72
|
+
const h2Styles = {
|
|
73
|
+
fontSize: '14px',
|
|
74
|
+
fontWeight: '400',
|
|
75
|
+
lineHeight: '49px',
|
|
76
|
+
margin: '0px'
|
|
77
|
+
};
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: globalStyles } }), (0, jsx_runtime_1.jsxs)("div", { className: "error-container", children: [(0, jsx_runtime_1.jsx)("h1", { className: "hight-error-h1", style: h1Styles, children: "404" }), (0, jsx_runtime_1.jsx)("div", { style: h2ContainerStyles, children: (0, jsx_runtime_1.jsx)("h2", { style: h2Styles, className: "hight-error-h2", children: "This page cannot be found." }) })] })] }));
|
|
79
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of the HightJS Project.
|
|
4
|
+
* Copyright (c) 2025 itsmuzin
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.router = exports.Link = void 0;
|
|
20
|
+
// Este arquivo exporta apenas código seguro para o cliente (navegador)
|
|
21
|
+
var Link_1 = require("../components/Link");
|
|
22
|
+
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
|
|
23
|
+
var clientRouter_1 = require("./clientRouter");
|
|
24
|
+
Object.defineProperty(exports, "router", { enumerable: true, get: function () { return clientRouter_1.router; } });
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface RouterEvents {
|
|
2
|
+
beforeNavigate?: (url: string) => boolean | Promise<boolean>;
|
|
3
|
+
afterNavigate?: (url: string) => void;
|
|
4
|
+
}
|
|
5
|
+
declare class Router {
|
|
6
|
+
private events;
|
|
7
|
+
private listeners;
|
|
8
|
+
/**
|
|
9
|
+
* Navega para uma nova rota
|
|
10
|
+
*/
|
|
11
|
+
push(url: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Substitui a entrada atual do histórico
|
|
14
|
+
*/
|
|
15
|
+
replace(url: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Volta uma página no histórico
|
|
18
|
+
*/
|
|
19
|
+
back(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Avança uma página no histórico
|
|
22
|
+
*/
|
|
23
|
+
forward(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Recarrega a página atual (re-renderiza o componente)
|
|
26
|
+
*/
|
|
27
|
+
refresh(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Obtém a URL atual
|
|
30
|
+
*/
|
|
31
|
+
get pathname(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Obtém os query parameters atuais
|
|
34
|
+
*/
|
|
35
|
+
get query(): URLSearchParams;
|
|
36
|
+
/**
|
|
37
|
+
* Obtém a URL completa atual
|
|
38
|
+
*/
|
|
39
|
+
get url(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Adiciona event listeners para eventos de roteamento
|
|
42
|
+
*/
|
|
43
|
+
on(events: RouterEvents): void;
|
|
44
|
+
/**
|
|
45
|
+
* Remove event listeners
|
|
46
|
+
*/
|
|
47
|
+
off(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Adiciona um listener para mudanças de rota
|
|
50
|
+
*/
|
|
51
|
+
subscribe(listener: () => void): () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Dispara evento de navegação para todos os listeners
|
|
54
|
+
*/
|
|
55
|
+
private triggerNavigation;
|
|
56
|
+
}
|
|
57
|
+
export declare const router: Router;
|
|
58
|
+
export default router;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of the HightJS Project.
|
|
4
|
+
* Copyright (c) 2025 itsmuzin
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
// Sistema de roteamento do lado do cliente para hweb-sdk
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.router = void 0;
|
|
21
|
+
class Router {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.events = {};
|
|
24
|
+
this.listeners = new Set();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Navega para uma nova rota
|
|
28
|
+
*/
|
|
29
|
+
async push(url) {
|
|
30
|
+
// Callback antes de navegar
|
|
31
|
+
if (this.events.beforeNavigate) {
|
|
32
|
+
const shouldProceed = await this.events.beforeNavigate(url);
|
|
33
|
+
if (shouldProceed === false)
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Atualiza a URL na barra de endereço
|
|
37
|
+
window.history.pushState({ path: url }, '', url);
|
|
38
|
+
// Dispara evento para o roteador capturar de forma assíncrona
|
|
39
|
+
setTimeout(() => this.triggerNavigation(), 0);
|
|
40
|
+
// Callback após navegar
|
|
41
|
+
if (this.events.afterNavigate) {
|
|
42
|
+
this.events.afterNavigate(url);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Substitui a entrada atual do histórico
|
|
47
|
+
*/
|
|
48
|
+
async replace(url) {
|
|
49
|
+
// Callback antes de navegar
|
|
50
|
+
if (this.events.beforeNavigate) {
|
|
51
|
+
const shouldProceed = await this.events.beforeNavigate(url);
|
|
52
|
+
if (shouldProceed === false)
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Substitui a URL atual no histórico
|
|
56
|
+
window.history.replaceState({ path: url }, '', url);
|
|
57
|
+
// Dispara evento para o roteador capturar de forma assíncrona
|
|
58
|
+
setTimeout(() => this.triggerNavigation(), 0);
|
|
59
|
+
// Callback após navegar
|
|
60
|
+
if (this.events.afterNavigate) {
|
|
61
|
+
this.events.afterNavigate(url);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Volta uma página no histórico
|
|
66
|
+
*/
|
|
67
|
+
back() {
|
|
68
|
+
window.history.back();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Avança uma página no histórico
|
|
72
|
+
*/
|
|
73
|
+
forward() {
|
|
74
|
+
window.history.forward();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Recarrega a página atual (re-renderiza o componente)
|
|
78
|
+
*/
|
|
79
|
+
refresh() {
|
|
80
|
+
setTimeout(() => this.triggerNavigation(), 0);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Obtém a URL atual
|
|
84
|
+
*/
|
|
85
|
+
get pathname() {
|
|
86
|
+
return window.location.pathname;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Obtém os query parameters atuais
|
|
90
|
+
*/
|
|
91
|
+
get query() {
|
|
92
|
+
return new URLSearchParams(window.location.search);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Obtém a URL completa atual
|
|
96
|
+
*/
|
|
97
|
+
get url() {
|
|
98
|
+
return window.location.href;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Adiciona event listeners para eventos de roteamento
|
|
102
|
+
*/
|
|
103
|
+
on(events) {
|
|
104
|
+
this.events = { ...this.events, ...events };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Remove event listeners
|
|
108
|
+
*/
|
|
109
|
+
off() {
|
|
110
|
+
this.events = {};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Adiciona um listener para mudanças de rota
|
|
114
|
+
*/
|
|
115
|
+
subscribe(listener) {
|
|
116
|
+
this.listeners.add(listener);
|
|
117
|
+
return () => this.listeners.delete(listener);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Dispara evento de navegação para todos os listeners
|
|
121
|
+
*/
|
|
122
|
+
triggerNavigation() {
|
|
123
|
+
// Dispara o evento nativo para o roteador do hweb capturar
|
|
124
|
+
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
125
|
+
// Notifica todos os listeners customizados
|
|
126
|
+
this.listeners.forEach(listener => listener());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Instância singleton do router
|
|
130
|
+
exports.router = new Router();
|
|
131
|
+
// Para compatibilidade, também exporta como default
|
|
132
|
+
exports.default = exports.router;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|