elit 3.0.0 → 3.0.2
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/build.d.ts +4 -12
- package/dist/build.d.ts.map +1 -0
- package/dist/chokidar.d.ts +7 -9
- package/dist/chokidar.d.ts.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +17 -4
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/dom.d.ts +7 -14
- package/dist/dom.d.ts.map +1 -0
- package/dist/el.d.ts +19 -191
- package/dist/el.d.ts.map +1 -0
- package/dist/fs.d.ts +35 -35
- package/dist/fs.d.ts.map +1 -0
- package/dist/hmr.d.ts +3 -3
- package/dist/hmr.d.ts.map +1 -0
- package/dist/http.d.ts +20 -22
- package/dist/http.d.ts.map +1 -0
- package/dist/https.d.ts +12 -15
- package/dist/https.d.ts.map +1 -0
- package/dist/index.d.ts +10 -629
- package/dist/index.d.ts.map +1 -0
- package/dist/mime-types.d.ts +9 -9
- package/dist/mime-types.d.ts.map +1 -0
- package/dist/path.d.ts +22 -19
- package/dist/path.d.ts.map +1 -0
- package/dist/router.d.ts +10 -17
- package/dist/router.d.ts.map +1 -0
- package/dist/runtime.d.ts +5 -6
- package/dist/runtime.d.ts.map +1 -0
- package/dist/server.d.ts +105 -7
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +14 -2
- package/dist/server.mjs +14 -2
- package/dist/state.d.ts +21 -27
- package/dist/state.d.ts.map +1 -0
- package/dist/style.d.ts +14 -55
- package/dist/style.d.ts.map +1 -0
- package/dist/types.d.ts +26 -240
- package/dist/types.d.ts.map +1 -0
- package/dist/ws.d.ts +14 -17
- package/dist/ws.d.ts.map +1 -0
- package/dist/wss.d.ts +16 -16
- package/dist/wss.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/build.ts +337 -0
- package/src/chokidar.ts +401 -0
- package/src/cli.ts +638 -0
- package/src/config.ts +205 -0
- package/src/dom.ts +817 -0
- package/src/el.ts +164 -0
- package/src/fs.ts +727 -0
- package/src/hmr.ts +137 -0
- package/src/http.ts +775 -0
- package/src/https.ts +411 -0
- package/src/index.ts +14 -0
- package/src/mime-types.ts +222 -0
- package/src/path.ts +493 -0
- package/src/router.ts +237 -0
- package/src/runtime.ts +97 -0
- package/src/server.ts +1290 -0
- package/src/state.ts +468 -0
- package/src/style.ts +524 -0
- package/{dist/types-Du6kfwTm.d.ts → src/types.ts} +58 -141
- package/src/ws.ts +506 -0
- package/src/wss.ts +241 -0
- package/dist/build.d.mts +0 -20
- package/dist/chokidar.d.mts +0 -134
- package/dist/dom.d.mts +0 -87
- package/dist/el.d.mts +0 -207
- package/dist/fs.d.mts +0 -255
- package/dist/hmr.d.mts +0 -38
- package/dist/http.d.mts +0 -163
- package/dist/https.d.mts +0 -108
- package/dist/index.d.mts +0 -629
- package/dist/mime-types.d.mts +0 -48
- package/dist/path.d.mts +0 -163
- package/dist/router.d.mts +0 -47
- package/dist/runtime.d.mts +0 -97
- package/dist/server.d.mts +0 -7
- package/dist/state.d.mts +0 -111
- package/dist/style.d.mts +0 -159
- package/dist/types-C0nGi6MX.d.mts +0 -346
- package/dist/types.d.mts +0 -452
- package/dist/ws.d.mts +0 -195
- package/dist/wss.d.mts +0 -108
package/src/wss.ts
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket Secure (WSS) module with unified API across runtimes
|
|
3
|
+
* Pure implementation without external dependencies
|
|
4
|
+
* Compatible with 'ws' package WSS API
|
|
5
|
+
* - Node.js: uses native WebSocket with HTTPS
|
|
6
|
+
* - Bun: uses native WebSocket with TLS
|
|
7
|
+
* - Deno: uses native WebSocket with TLS
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { EventEmitter } from 'events';
|
|
11
|
+
import type { IncomingMessage } from './http';
|
|
12
|
+
import { createServer as createHttpsServer } from './https';
|
|
13
|
+
import { WebSocket, WebSocketServer, ServerOptions, Data, ReadyState, CLOSE_CODES } from './ws';
|
|
14
|
+
import { runtime } from './runtime';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Helper: Queue callback (eliminates duplication in callback handling)
|
|
18
|
+
*/
|
|
19
|
+
function queueCallback(callback?: () => void): void {
|
|
20
|
+
if (callback) {
|
|
21
|
+
queueMicrotask(callback);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Helper: Build HTTPS options from WSS options (eliminates duplication in constructor)
|
|
27
|
+
*/
|
|
28
|
+
function buildHttpsOptions(options?: WSSServerOptions): any {
|
|
29
|
+
const httpsOptions: any = {};
|
|
30
|
+
if (options?.key) httpsOptions.key = options.key;
|
|
31
|
+
if (options?.cert) httpsOptions.cert = options.cert;
|
|
32
|
+
if (options?.ca) httpsOptions.ca = options.ca;
|
|
33
|
+
if (options?.passphrase) httpsOptions.passphrase = options.passphrase;
|
|
34
|
+
if (options?.rejectUnauthorized !== undefined) httpsOptions.rejectUnauthorized = options.rejectUnauthorized;
|
|
35
|
+
if (options?.requestCert !== undefined) httpsOptions.requestCert = options.requestCert;
|
|
36
|
+
return httpsOptions;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Helper: Emit close event with optional callback (eliminates duplication in close method)
|
|
41
|
+
*/
|
|
42
|
+
function emitCloseWithCallback(emitter: EventEmitter, callback?: (err?: Error) => void): void {
|
|
43
|
+
emitter.emit('close');
|
|
44
|
+
queueCallback(callback as any);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* WSS Server options (extends WebSocket ServerOptions with TLS)
|
|
49
|
+
*/
|
|
50
|
+
export interface WSSServerOptions extends ServerOptions {
|
|
51
|
+
// TLS/SSL options
|
|
52
|
+
key?: string | Buffer;
|
|
53
|
+
cert?: string | Buffer;
|
|
54
|
+
ca?: string | Buffer;
|
|
55
|
+
passphrase?: string;
|
|
56
|
+
rejectUnauthorized?: boolean;
|
|
57
|
+
requestCert?: boolean;
|
|
58
|
+
|
|
59
|
+
// HTTPS server
|
|
60
|
+
httpsServer?: any;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* WebSocket Secure client class
|
|
65
|
+
*/
|
|
66
|
+
export class WSSClient extends WebSocket {
|
|
67
|
+
constructor(address: string | URL, protocols?: string | string[], options?: any) {
|
|
68
|
+
// Convert ws:// to wss://
|
|
69
|
+
const urlString = typeof address === 'string' ? address : address.toString();
|
|
70
|
+
const secureUrl = urlString.replace(/^ws:\/\//i, 'wss://');
|
|
71
|
+
|
|
72
|
+
super(secureUrl, protocols, options);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* WebSocket Secure Server class
|
|
78
|
+
*/
|
|
79
|
+
export class WSSServer extends EventEmitter {
|
|
80
|
+
public clients: Set<WebSocket> = new Set();
|
|
81
|
+
public options: WSSServerOptions;
|
|
82
|
+
public path: string;
|
|
83
|
+
|
|
84
|
+
private _httpsServer: any;
|
|
85
|
+
private _wsServer!: WebSocketServer;
|
|
86
|
+
|
|
87
|
+
constructor(options?: WSSServerOptions, callback?: () => void) {
|
|
88
|
+
super();
|
|
89
|
+
this.options = options || {};
|
|
90
|
+
this.path = options?.path || '/';
|
|
91
|
+
|
|
92
|
+
if (runtime === 'node') {
|
|
93
|
+
// Node.js - create HTTPS server with WebSocket upgrade
|
|
94
|
+
if (options?.httpsServer) {
|
|
95
|
+
this._httpsServer = options.httpsServer;
|
|
96
|
+
this._setupServer(callback);
|
|
97
|
+
} else if (options?.noServer) {
|
|
98
|
+
// No server mode - user will call handleUpgrade manually
|
|
99
|
+
this._wsServer = new WebSocketServer({ noServer: true });
|
|
100
|
+
queueCallback(callback);
|
|
101
|
+
} else {
|
|
102
|
+
// Create new HTTPS server
|
|
103
|
+
this._httpsServer = createHttpsServer(buildHttpsOptions(options));
|
|
104
|
+
this._setupServer(callback);
|
|
105
|
+
|
|
106
|
+
if (options?.port) {
|
|
107
|
+
this._httpsServer.listen(options.port, options.host, callback);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
// Bun/Deno - WebSocket server with TLS
|
|
112
|
+
this._wsServer = new WebSocketServer(options);
|
|
113
|
+
queueCallback(callback);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private _setupServer(callback?: () => void): void {
|
|
118
|
+
// Create WebSocket server attached to HTTPS server
|
|
119
|
+
this._wsServer = new WebSocketServer({
|
|
120
|
+
...this.options,
|
|
121
|
+
server: this._httpsServer,
|
|
122
|
+
noServer: false
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Forward events from underlying WebSocket server
|
|
126
|
+
this._wsServer.on('connection', (client: WebSocket, request: IncomingMessage) => {
|
|
127
|
+
if (this.options.clientTracking !== false) {
|
|
128
|
+
this.clients.add(client);
|
|
129
|
+
client.on('close', () => {
|
|
130
|
+
this.clients.delete(client);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
this.emit('connection', client, request);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
this._wsServer.on('error', (error: Error) => {
|
|
137
|
+
this.emit('error', error);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (!this.options?.port) {
|
|
141
|
+
queueCallback(callback);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Handle HTTP upgrade for WebSocket
|
|
147
|
+
*/
|
|
148
|
+
handleUpgrade(request: IncomingMessage, socket: any, head: Buffer, callback: (client: WebSocket) => void): void {
|
|
149
|
+
if (this._wsServer) {
|
|
150
|
+
this._wsServer.handleUpgrade(request, socket, head, callback);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Check if server should handle request
|
|
156
|
+
*/
|
|
157
|
+
shouldHandle(request: IncomingMessage): boolean {
|
|
158
|
+
if (this._wsServer) {
|
|
159
|
+
return this._wsServer.shouldHandle(request);
|
|
160
|
+
}
|
|
161
|
+
if (this.path && request.url !== this.path) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Close the server
|
|
169
|
+
*/
|
|
170
|
+
close(callback?: (err?: Error) => void): void {
|
|
171
|
+
this.clients.forEach(client => client.close());
|
|
172
|
+
this.clients.clear();
|
|
173
|
+
|
|
174
|
+
if (this._wsServer) {
|
|
175
|
+
this._wsServer.close(() => {
|
|
176
|
+
if (this._httpsServer) {
|
|
177
|
+
this._httpsServer.close(callback);
|
|
178
|
+
} else {
|
|
179
|
+
emitCloseWithCallback(this, callback);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
} else if (this._httpsServer) {
|
|
183
|
+
this._httpsServer.close(callback);
|
|
184
|
+
} else {
|
|
185
|
+
emitCloseWithCallback(this, callback);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Get server address
|
|
191
|
+
*/
|
|
192
|
+
address(): { port: number; family: string; address: string } | null {
|
|
193
|
+
if (this._httpsServer && this._httpsServer.address) {
|
|
194
|
+
return this._httpsServer.address();
|
|
195
|
+
}
|
|
196
|
+
if (this._wsServer) {
|
|
197
|
+
return this._wsServer.address();
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Create WebSocket Secure client
|
|
205
|
+
*/
|
|
206
|
+
export function createWSSClient(address: string | URL, protocols?: string | string[], options?: any): WSSClient {
|
|
207
|
+
return new WSSClient(address, protocols, options);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Create WebSocket Secure server
|
|
212
|
+
*/
|
|
213
|
+
export function createWSSServer(options?: WSSServerOptions, callback?: () => void): WSSServer {
|
|
214
|
+
return new WSSServer(options, callback);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get current runtime
|
|
219
|
+
*/
|
|
220
|
+
export function getRuntime(): 'node' | 'bun' | 'deno' {
|
|
221
|
+
return runtime;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Re-export types and constants from ws module
|
|
226
|
+
*/
|
|
227
|
+
export type { ServerOptions, Data };
|
|
228
|
+
export { ReadyState, CLOSE_CODES };
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Default export
|
|
232
|
+
*/
|
|
233
|
+
export default {
|
|
234
|
+
WSSClient,
|
|
235
|
+
WSSServer,
|
|
236
|
+
createWSSClient,
|
|
237
|
+
createWSSServer,
|
|
238
|
+
ReadyState,
|
|
239
|
+
CLOSE_CODES,
|
|
240
|
+
getRuntime,
|
|
241
|
+
};
|
package/dist/build.d.mts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { B as BuildOptions, j as BuildResult } from './types-C0nGi6MX.mjs';
|
|
2
|
-
import './http.mjs';
|
|
3
|
-
import 'node:events';
|
|
4
|
-
import './ws.mjs';
|
|
5
|
-
import 'events';
|
|
6
|
-
import 'http';
|
|
7
|
-
import 'ws';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Build module for bundling applications
|
|
11
|
-
* Pure implementation with cross-runtime support
|
|
12
|
-
* Compatible with standard build tools API
|
|
13
|
-
* - Node.js: uses esbuild
|
|
14
|
-
* - Bun: uses Bun.build
|
|
15
|
-
* - Deno: uses Deno.emit
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
19
|
-
|
|
20
|
-
export { BuildOptions, BuildResult, build };
|
package/dist/chokidar.d.mts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* File watcher module with unified API across runtimes
|
|
5
|
-
* Pure implementation without external dependencies
|
|
6
|
-
* Compatible with 'chokidar' package API
|
|
7
|
-
* - Node.js: uses native fs.watch
|
|
8
|
-
* - Bun: uses native fs.watch with enhancements
|
|
9
|
-
* - Deno: uses Deno.watchFs
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Watch options
|
|
14
|
-
*/
|
|
15
|
-
interface WatchOptions {
|
|
16
|
-
/**
|
|
17
|
-
* Indicates whether the process should continue to run as long as files are being watched.
|
|
18
|
-
* If set to false, the process will continue running even if the watcher is closed.
|
|
19
|
-
*/
|
|
20
|
-
persistent?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Indicates whether to watch files that don't have read permissions.
|
|
23
|
-
*/
|
|
24
|
-
ignorePermissionErrors?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* A function that takes one parameter (the path of the file/directory)
|
|
27
|
-
* and returns true to ignore or false to watch.
|
|
28
|
-
*/
|
|
29
|
-
ignored?: string | RegExp | ((path: string) => boolean);
|
|
30
|
-
/**
|
|
31
|
-
* If set to false, only the parent directory will be watched for new files.
|
|
32
|
-
*/
|
|
33
|
-
ignoreInitial?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* If set to true, symlinks will be followed.
|
|
36
|
-
*/
|
|
37
|
-
followSymlinks?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Interval of file system polling (in milliseconds).
|
|
40
|
-
*/
|
|
41
|
-
interval?: number;
|
|
42
|
-
/**
|
|
43
|
-
* Interval of file system polling for binary files (in milliseconds).
|
|
44
|
-
*/
|
|
45
|
-
binaryInterval?: number;
|
|
46
|
-
/**
|
|
47
|
-
* If set to true, will provide fs.Stats object as second argument
|
|
48
|
-
* in add, addDir, and change events.
|
|
49
|
-
*/
|
|
50
|
-
alwaysStat?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* If set, limits how many levels of subdirectories will be traversed.
|
|
53
|
-
*/
|
|
54
|
-
depth?: number;
|
|
55
|
-
/**
|
|
56
|
-
* By default, add event fires when a file first appears on disk.
|
|
57
|
-
* Setting this will wait for the write to finish before firing.
|
|
58
|
-
*/
|
|
59
|
-
awaitWriteFinish?: boolean | {
|
|
60
|
-
stabilityThreshold?: number;
|
|
61
|
-
pollInterval?: number;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* If set to true, will use fs.watchFile() (polling) instead of fs.watch().
|
|
65
|
-
*/
|
|
66
|
-
usePolling?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to use fsevents watching on macOS (if available).
|
|
69
|
-
*/
|
|
70
|
-
useFsEvents?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* The base path to watch.
|
|
73
|
-
*/
|
|
74
|
-
cwd?: string;
|
|
75
|
-
/**
|
|
76
|
-
* Whether to disable globbing.
|
|
77
|
-
*/
|
|
78
|
-
disableGlobbing?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Automatically filter out artifacts that occur when using editors.
|
|
81
|
-
*/
|
|
82
|
-
atomic?: boolean | number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* FSWatcher class - Compatible with chokidar
|
|
86
|
-
*/
|
|
87
|
-
declare class FSWatcher extends EventEmitter {
|
|
88
|
-
private _watcher;
|
|
89
|
-
private _closed;
|
|
90
|
-
private _watched;
|
|
91
|
-
constructor(options?: WatchOptions);
|
|
92
|
-
options: WatchOptions;
|
|
93
|
-
/**
|
|
94
|
-
* Add paths to be watched
|
|
95
|
-
*/
|
|
96
|
-
add(paths: string | string[]): FSWatcher;
|
|
97
|
-
/**
|
|
98
|
-
* Stop watching paths
|
|
99
|
-
*/
|
|
100
|
-
unwatch(paths: string | string[]): FSWatcher;
|
|
101
|
-
/**
|
|
102
|
-
* Close the watcher
|
|
103
|
-
*/
|
|
104
|
-
close(): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Get watched paths
|
|
107
|
-
*/
|
|
108
|
-
getWatched(): {
|
|
109
|
-
[directory: string]: string[];
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Internal method to set native watcher
|
|
113
|
-
* @internal
|
|
114
|
-
*/
|
|
115
|
-
_setWatcher(watcher: any): void;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Watch files and directories
|
|
119
|
-
*/
|
|
120
|
-
declare function watch(paths: string | string[], options?: WatchOptions): FSWatcher;
|
|
121
|
-
/**
|
|
122
|
-
* Get current runtime
|
|
123
|
-
*/
|
|
124
|
-
declare function getRuntime(): 'node' | 'bun' | 'deno';
|
|
125
|
-
/**
|
|
126
|
-
* Default export
|
|
127
|
-
*/
|
|
128
|
-
declare const _default: {
|
|
129
|
-
watch: typeof watch;
|
|
130
|
-
FSWatcher: typeof FSWatcher;
|
|
131
|
-
getRuntime: typeof getRuntime;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export { FSWatcher, type WatchOptions, _default as default, getRuntime, watch };
|
package/dist/dom.d.mts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Props, Children, VNode, Child, StateOptions, State, VirtualListController, JsonNode, VNodeJson } from './types.mjs';
|
|
2
|
-
import 'node:events';
|
|
3
|
-
import 'events';
|
|
4
|
-
import 'http';
|
|
5
|
-
import 'ws';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Elit - DomNode Core Class
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare class DomNode {
|
|
12
|
-
private elementCache;
|
|
13
|
-
createElement(tagName: string, props?: Props, children?: Children): VNode;
|
|
14
|
-
renderToDOM(vNode: Child, parent: HTMLElement | SVGElement | DocumentFragment): void;
|
|
15
|
-
render(rootElement: string | HTMLElement, vNode: VNode): HTMLElement;
|
|
16
|
-
batchRender(rootElement: string | HTMLElement, vNodes: VNode[]): HTMLElement;
|
|
17
|
-
renderChunked(rootElement: string | HTMLElement, vNodes: VNode[], chunkSize?: number, onProgress?: (current: number, total: number) => void): HTMLElement;
|
|
18
|
-
renderToHead(...vNodes: Array<VNode | VNode[]>): HTMLHeadElement | null;
|
|
19
|
-
addStyle(cssText: string): HTMLStyleElement;
|
|
20
|
-
addMeta(attrs: Record<string, string>): HTMLMetaElement;
|
|
21
|
-
addLink(attrs: Record<string, string>): HTMLLinkElement;
|
|
22
|
-
setTitle(text: string): string;
|
|
23
|
-
createState<T>(initialValue: T, options?: StateOptions): State<T>;
|
|
24
|
-
computed<T extends any[], R>(states: {
|
|
25
|
-
[K in keyof T]: State<T[K]>;
|
|
26
|
-
}, computeFn: (...values: T) => R): State<R>;
|
|
27
|
-
effect(stateFn: () => void): void;
|
|
28
|
-
createVirtualList<T>(container: HTMLElement, items: T[], renderItem: (item: T, index: number) => VNode, itemHeight?: number, bufferSize?: number): VirtualListController;
|
|
29
|
-
lazy<T extends any[], R>(loadFn: () => Promise<(...args: T) => R>): (...args: T) => Promise<R | VNode>;
|
|
30
|
-
cleanupUnusedElements(root: HTMLElement): number;
|
|
31
|
-
renderToString(vNode: Child, options?: {
|
|
32
|
-
pretty?: boolean;
|
|
33
|
-
indent?: number;
|
|
34
|
-
}): string;
|
|
35
|
-
private resolveStateValue;
|
|
36
|
-
private isReactiveWrapper;
|
|
37
|
-
private unwrapReactive;
|
|
38
|
-
private escapeHtml;
|
|
39
|
-
private isSelfClosingTag;
|
|
40
|
-
private propsToAttributes;
|
|
41
|
-
private styleToString;
|
|
42
|
-
private isState;
|
|
43
|
-
private reactiveNodes;
|
|
44
|
-
private createReactiveChild;
|
|
45
|
-
jsonToVNode(json: JsonNode | string | number | boolean | null | undefined | State<any>): Child;
|
|
46
|
-
vNodeJsonToVNode(json: VNodeJson | State<any>): Child;
|
|
47
|
-
renderJson(rootElement: string | HTMLElement, json: JsonNode): HTMLElement;
|
|
48
|
-
renderVNode(rootElement: string | HTMLElement, json: VNodeJson): HTMLElement;
|
|
49
|
-
renderJsonToString(json: JsonNode, options?: {
|
|
50
|
-
pretty?: boolean;
|
|
51
|
-
indent?: number;
|
|
52
|
-
}): string;
|
|
53
|
-
renderVNodeToString(json: VNodeJson, options?: {
|
|
54
|
-
pretty?: boolean;
|
|
55
|
-
indent?: number;
|
|
56
|
-
}): string;
|
|
57
|
-
renderToHTMLDocument(vNode: Child, options?: {
|
|
58
|
-
title?: string;
|
|
59
|
-
meta?: Array<Record<string, string>>;
|
|
60
|
-
links?: Array<Record<string, string>>;
|
|
61
|
-
scripts?: Array<{
|
|
62
|
-
src?: string;
|
|
63
|
-
content?: string;
|
|
64
|
-
async?: boolean;
|
|
65
|
-
defer?: boolean;
|
|
66
|
-
type?: string;
|
|
67
|
-
}>;
|
|
68
|
-
styles?: Array<{
|
|
69
|
-
href?: string;
|
|
70
|
-
content?: string;
|
|
71
|
-
}>;
|
|
72
|
-
lang?: string;
|
|
73
|
-
head?: string;
|
|
74
|
-
bodyAttrs?: Record<string, string>;
|
|
75
|
-
pretty?: boolean;
|
|
76
|
-
}): string;
|
|
77
|
-
getElementCache(): WeakMap<Element, boolean>;
|
|
78
|
-
}
|
|
79
|
-
declare const dom: DomNode;
|
|
80
|
-
declare const render: (rootElement: string | HTMLElement, vNode: VNode) => HTMLElement;
|
|
81
|
-
declare const renderToString: (vNode: Child, options?: {
|
|
82
|
-
pretty?: boolean;
|
|
83
|
-
indent?: number;
|
|
84
|
-
}) => string;
|
|
85
|
-
declare const mount: (rootElement: string | HTMLElement, vNode: VNode) => HTMLElement;
|
|
86
|
-
|
|
87
|
-
export { DomNode, dom, mount, render, renderToString };
|
package/dist/el.d.mts
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { ElementFactory } from './types.mjs';
|
|
2
|
-
import 'node:events';
|
|
3
|
-
import 'events';
|
|
4
|
-
import 'http';
|
|
5
|
-
import 'ws';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Elit - Element Factories
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare const createElementFactory: (tag: string) => ElementFactory;
|
|
12
|
-
declare const tags: readonly ["html", "head", "body", "title", "base", "link", "meta", "style", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "slot", "template"];
|
|
13
|
-
declare const svgTags: readonly ["svg", "circle", "rect", "path", "line", "polyline", "polygon", "ellipse", "g", "text", "tspan", "defs", "linearGradient", "radialGradient", "stop", "pattern", "mask", "clipPath", "use", "symbol", "marker", "image", "foreignObject", "animate", "animateTransform", "animateMotion", "set", "filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feFlood", "feGaussianBlur", "feMorphology", "feOffset", "feSpecularLighting", "feTile", "feTurbulence"];
|
|
14
|
-
declare const mathTags: readonly ["math", "mi", "mn", "mo", "ms", "mtext", "mrow", "mfrac", "msqrt", "mroot", "msub", "msup"];
|
|
15
|
-
type Elements = {
|
|
16
|
-
[K in typeof tags[number]]: ElementFactory;
|
|
17
|
-
} & {
|
|
18
|
-
[K in typeof svgTags[number] as `svg${Capitalize<K>}`]: ElementFactory;
|
|
19
|
-
} & {
|
|
20
|
-
[K in typeof mathTags[number] as `math${Capitalize<K>}`]: ElementFactory;
|
|
21
|
-
} & {
|
|
22
|
-
varElement: ElementFactory;
|
|
23
|
-
};
|
|
24
|
-
declare const elements: Partial<Elements>;
|
|
25
|
-
declare const html: ElementFactory;
|
|
26
|
-
declare const head: ElementFactory;
|
|
27
|
-
declare const body: ElementFactory;
|
|
28
|
-
declare const title: ElementFactory;
|
|
29
|
-
declare const base: ElementFactory;
|
|
30
|
-
declare const link: ElementFactory;
|
|
31
|
-
declare const meta: ElementFactory;
|
|
32
|
-
declare const style: ElementFactory;
|
|
33
|
-
declare const address: ElementFactory;
|
|
34
|
-
declare const article: ElementFactory;
|
|
35
|
-
declare const aside: ElementFactory;
|
|
36
|
-
declare const footer: ElementFactory;
|
|
37
|
-
declare const header: ElementFactory;
|
|
38
|
-
declare const h1: ElementFactory;
|
|
39
|
-
declare const h2: ElementFactory;
|
|
40
|
-
declare const h3: ElementFactory;
|
|
41
|
-
declare const h4: ElementFactory;
|
|
42
|
-
declare const h5: ElementFactory;
|
|
43
|
-
declare const h6: ElementFactory;
|
|
44
|
-
declare const main: ElementFactory;
|
|
45
|
-
declare const nav: ElementFactory;
|
|
46
|
-
declare const section: ElementFactory;
|
|
47
|
-
declare const blockquote: ElementFactory;
|
|
48
|
-
declare const dd: ElementFactory;
|
|
49
|
-
declare const div: ElementFactory;
|
|
50
|
-
declare const dl: ElementFactory;
|
|
51
|
-
declare const dt: ElementFactory;
|
|
52
|
-
declare const figcaption: ElementFactory;
|
|
53
|
-
declare const figure: ElementFactory;
|
|
54
|
-
declare const hr: ElementFactory;
|
|
55
|
-
declare const li: ElementFactory;
|
|
56
|
-
declare const ol: ElementFactory;
|
|
57
|
-
declare const p: ElementFactory;
|
|
58
|
-
declare const pre: ElementFactory;
|
|
59
|
-
declare const ul: ElementFactory;
|
|
60
|
-
declare const a: ElementFactory;
|
|
61
|
-
declare const abbr: ElementFactory;
|
|
62
|
-
declare const b: ElementFactory;
|
|
63
|
-
declare const bdi: ElementFactory;
|
|
64
|
-
declare const bdo: ElementFactory;
|
|
65
|
-
declare const br: ElementFactory;
|
|
66
|
-
declare const cite: ElementFactory;
|
|
67
|
-
declare const code: ElementFactory;
|
|
68
|
-
declare const data: ElementFactory;
|
|
69
|
-
declare const dfn: ElementFactory;
|
|
70
|
-
declare const em: ElementFactory;
|
|
71
|
-
declare const i: ElementFactory;
|
|
72
|
-
declare const kbd: ElementFactory;
|
|
73
|
-
declare const mark: ElementFactory;
|
|
74
|
-
declare const q: ElementFactory;
|
|
75
|
-
declare const rp: ElementFactory;
|
|
76
|
-
declare const rt: ElementFactory;
|
|
77
|
-
declare const ruby: ElementFactory;
|
|
78
|
-
declare const s: ElementFactory;
|
|
79
|
-
declare const samp: ElementFactory;
|
|
80
|
-
declare const small: ElementFactory;
|
|
81
|
-
declare const span: ElementFactory;
|
|
82
|
-
declare const strong: ElementFactory;
|
|
83
|
-
declare const sub: ElementFactory;
|
|
84
|
-
declare const sup: ElementFactory;
|
|
85
|
-
declare const time: ElementFactory;
|
|
86
|
-
declare const u: ElementFactory;
|
|
87
|
-
declare const wbr: ElementFactory;
|
|
88
|
-
declare const area: ElementFactory;
|
|
89
|
-
declare const audio: ElementFactory;
|
|
90
|
-
declare const img: ElementFactory;
|
|
91
|
-
declare const map: ElementFactory;
|
|
92
|
-
declare const track: ElementFactory;
|
|
93
|
-
declare const video: ElementFactory;
|
|
94
|
-
declare const embed: ElementFactory;
|
|
95
|
-
declare const iframe: ElementFactory;
|
|
96
|
-
declare const object: ElementFactory;
|
|
97
|
-
declare const param: ElementFactory;
|
|
98
|
-
declare const picture: ElementFactory;
|
|
99
|
-
declare const portal: ElementFactory;
|
|
100
|
-
declare const source: ElementFactory;
|
|
101
|
-
declare const canvas: ElementFactory;
|
|
102
|
-
declare const noscript: ElementFactory;
|
|
103
|
-
declare const script: ElementFactory;
|
|
104
|
-
declare const del: ElementFactory;
|
|
105
|
-
declare const ins: ElementFactory;
|
|
106
|
-
declare const caption: ElementFactory;
|
|
107
|
-
declare const col: ElementFactory;
|
|
108
|
-
declare const colgroup: ElementFactory;
|
|
109
|
-
declare const table: ElementFactory;
|
|
110
|
-
declare const tbody: ElementFactory;
|
|
111
|
-
declare const td: ElementFactory;
|
|
112
|
-
declare const tfoot: ElementFactory;
|
|
113
|
-
declare const th: ElementFactory;
|
|
114
|
-
declare const thead: ElementFactory;
|
|
115
|
-
declare const tr: ElementFactory;
|
|
116
|
-
declare const button: ElementFactory;
|
|
117
|
-
declare const datalist: ElementFactory;
|
|
118
|
-
declare const fieldset: ElementFactory;
|
|
119
|
-
declare const form: ElementFactory;
|
|
120
|
-
declare const input: ElementFactory;
|
|
121
|
-
declare const label: ElementFactory;
|
|
122
|
-
declare const legend: ElementFactory;
|
|
123
|
-
declare const meter: ElementFactory;
|
|
124
|
-
declare const optgroup: ElementFactory;
|
|
125
|
-
declare const option: ElementFactory;
|
|
126
|
-
declare const output: ElementFactory;
|
|
127
|
-
declare const progress: ElementFactory;
|
|
128
|
-
declare const select: ElementFactory;
|
|
129
|
-
declare const textarea: ElementFactory;
|
|
130
|
-
declare const details: ElementFactory;
|
|
131
|
-
declare const dialog: ElementFactory;
|
|
132
|
-
declare const menu: ElementFactory;
|
|
133
|
-
declare const summary: ElementFactory;
|
|
134
|
-
declare const slot: ElementFactory;
|
|
135
|
-
declare const template: ElementFactory;
|
|
136
|
-
declare const svgSvg: ElementFactory;
|
|
137
|
-
declare const svgCircle: ElementFactory;
|
|
138
|
-
declare const svgRect: ElementFactory;
|
|
139
|
-
declare const svgPath: ElementFactory;
|
|
140
|
-
declare const svgLine: ElementFactory;
|
|
141
|
-
declare const svgPolyline: ElementFactory;
|
|
142
|
-
declare const svgPolygon: ElementFactory;
|
|
143
|
-
declare const svgEllipse: ElementFactory;
|
|
144
|
-
declare const svgG: ElementFactory;
|
|
145
|
-
declare const svgText: ElementFactory;
|
|
146
|
-
declare const svgTspan: ElementFactory;
|
|
147
|
-
declare const svgDefs: ElementFactory;
|
|
148
|
-
declare const svgLinearGradient: ElementFactory;
|
|
149
|
-
declare const svgRadialGradient: ElementFactory;
|
|
150
|
-
declare const svgStop: ElementFactory;
|
|
151
|
-
declare const svgPattern: ElementFactory;
|
|
152
|
-
declare const svgMask: ElementFactory;
|
|
153
|
-
declare const svgClipPath: ElementFactory;
|
|
154
|
-
declare const svgUse: ElementFactory;
|
|
155
|
-
declare const svgSymbol: ElementFactory;
|
|
156
|
-
declare const svgMarker: ElementFactory;
|
|
157
|
-
declare const svgImage: ElementFactory;
|
|
158
|
-
declare const svgForeignObject: ElementFactory;
|
|
159
|
-
declare const svgAnimate: ElementFactory;
|
|
160
|
-
declare const svgAnimateTransform: ElementFactory;
|
|
161
|
-
declare const svgAnimateMotion: ElementFactory;
|
|
162
|
-
declare const svgSet: ElementFactory;
|
|
163
|
-
declare const svgFilter: ElementFactory;
|
|
164
|
-
declare const svgFeBlend: ElementFactory;
|
|
165
|
-
declare const svgFeColorMatrix: ElementFactory;
|
|
166
|
-
declare const svgFeComponentTransfer: ElementFactory;
|
|
167
|
-
declare const svgFeComposite: ElementFactory;
|
|
168
|
-
declare const svgFeConvolveMatrix: ElementFactory;
|
|
169
|
-
declare const svgFeDiffuseLighting: ElementFactory;
|
|
170
|
-
declare const svgFeDisplacementMap: ElementFactory;
|
|
171
|
-
declare const svgFeFlood: ElementFactory;
|
|
172
|
-
declare const svgFeGaussianBlur: ElementFactory;
|
|
173
|
-
declare const svgFeMorphology: ElementFactory;
|
|
174
|
-
declare const svgFeOffset: ElementFactory;
|
|
175
|
-
declare const svgFeSpecularLighting: ElementFactory;
|
|
176
|
-
declare const svgFeTile: ElementFactory;
|
|
177
|
-
declare const svgFeTurbulence: ElementFactory;
|
|
178
|
-
declare const mathMath: ElementFactory;
|
|
179
|
-
declare const mathMi: ElementFactory;
|
|
180
|
-
declare const mathMn: ElementFactory;
|
|
181
|
-
declare const mathMo: ElementFactory;
|
|
182
|
-
declare const mathMs: ElementFactory;
|
|
183
|
-
declare const mathMtext: ElementFactory;
|
|
184
|
-
declare const mathMrow: ElementFactory;
|
|
185
|
-
declare const mathMfrac: ElementFactory;
|
|
186
|
-
declare const mathMsqrt: ElementFactory;
|
|
187
|
-
declare const mathMroot: ElementFactory;
|
|
188
|
-
declare const mathMsub: ElementFactory;
|
|
189
|
-
declare const mathMsup: ElementFactory;
|
|
190
|
-
declare const varElement: ElementFactory;
|
|
191
|
-
declare const el: Partial<Elements>;
|
|
192
|
-
|
|
193
|
-
declare const doc: any;
|
|
194
|
-
declare const getEl: any;
|
|
195
|
-
declare const getEls: any;
|
|
196
|
-
declare const createEl: any;
|
|
197
|
-
declare const createSvgEl: any;
|
|
198
|
-
declare const createMathEl: any;
|
|
199
|
-
declare const fragment: any;
|
|
200
|
-
declare const textNode: any;
|
|
201
|
-
declare const commentNode: any;
|
|
202
|
-
declare const getElId: any;
|
|
203
|
-
declare const getElClass: any;
|
|
204
|
-
declare const getElTag: any;
|
|
205
|
-
declare const getElName: any;
|
|
206
|
-
|
|
207
|
-
export { a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, commentNode, createEl, createElementFactory, createMathEl, createSvgEl, data, datalist, dd, del, details, dfn, dialog, div, dl, doc, dt, el, elements, em, embed, fieldset, figcaption, figure, footer, form, fragment, getEl, getElClass, getElId, getElName, getElTag, getEls, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, img, input, ins, kbd, label, legend, li, link, main, map, mark, mathMath, mathMfrac, mathMi, mathMn, mathMo, mathMroot, mathMrow, mathMs, mathMsqrt, mathMsub, mathMsup, mathMtext, menu, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, portal, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, slot, small, source, span, strong, style, sub, summary, sup, svgAnimate, svgAnimateMotion, svgAnimateTransform, svgCircle, svgClipPath, svgDefs, svgEllipse, svgFeBlend, svgFeColorMatrix, svgFeComponentTransfer, svgFeComposite, svgFeConvolveMatrix, svgFeDiffuseLighting, svgFeDisplacementMap, svgFeFlood, svgFeGaussianBlur, svgFeMorphology, svgFeOffset, svgFeSpecularLighting, svgFeTile, svgFeTurbulence, svgFilter, svgForeignObject, svgG, svgImage, svgLine, svgLinearGradient, svgMarker, svgMask, svgPath, svgPattern, svgPolygon, svgPolyline, svgRadialGradient, svgRect, svgSet, svgStop, svgSvg, svgSymbol, svgText, svgTspan, svgUse, table, tbody, td, template, textNode, textarea, tfoot, th, thead, time, title, tr, track, u, ul, varElement, video, wbr };
|