elit 3.5.6 → 3.5.8
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/Cargo.toml +1 -1
- package/README.md +1 -1
- package/desktop/build.rs +83 -0
- package/desktop/icon.rs +106 -0
- package/desktop/lib.rs +2 -0
- package/desktop/main.rs +235 -0
- package/desktop/native_main.rs +128 -0
- package/desktop/native_renderer/action_widgets.rs +184 -0
- package/desktop/native_renderer/app_models.rs +171 -0
- package/desktop/native_renderer/app_runtime.rs +140 -0
- package/desktop/native_renderer/container_rendering.rs +610 -0
- package/desktop/native_renderer/content_widgets.rs +634 -0
- package/desktop/native_renderer/css_models.rs +371 -0
- package/desktop/native_renderer/embedded_surfaces.rs +414 -0
- package/desktop/native_renderer/form_controls.rs +516 -0
- package/desktop/native_renderer/interaction_dispatch.rs +89 -0
- package/desktop/native_renderer/runtime_support.rs +135 -0
- package/desktop/native_renderer/utilities.rs +495 -0
- package/desktop/native_renderer/vector_drawing.rs +491 -0
- package/desktop/native_renderer.rs +4122 -0
- package/desktop/runtime/external.rs +422 -0
- package/desktop/runtime/mod.rs +67 -0
- package/desktop/runtime/quickjs.rs +106 -0
- package/desktop/window.rs +383 -0
- package/dist/build.d.ts +1 -1
- package/dist/cli.cjs +16 -2
- package/dist/cli.mjs +16 -2
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/desktop-auto-render.cjs +2370 -0
- package/dist/desktop-auto-render.d.ts +13 -0
- package/dist/desktop-auto-render.js +2341 -0
- package/dist/desktop-auto-render.mjs +2344 -0
- package/dist/render-context.cjs +118 -0
- package/dist/render-context.d.ts +39 -0
- package/dist/render-context.js +77 -0
- package/dist/render-context.mjs +87 -0
- package/dist/{server-CNgDUgSZ.d.ts → server-FCdUqabc.d.ts} +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +26 -3
- package/dist/build.d.mts +0 -20
- package/dist/chokidar.d.mts +0 -134
- package/dist/cli.d.mts +0 -81
- package/dist/config.d.mts +0 -254
- package/dist/coverage.d.mts +0 -85
- package/dist/database.d.mts +0 -52
- package/dist/desktop.d.mts +0 -68
- package/dist/dom.d.mts +0 -87
- package/dist/el.d.mts +0 -208
- package/dist/fs.d.mts +0 -255
- package/dist/hmr.d.mts +0 -38
- package/dist/http.d.mts +0 -169
- package/dist/https.d.mts +0 -108
- package/dist/index.d.mts +0 -13
- package/dist/mime-types.d.mts +0 -48
- package/dist/native.d.mts +0 -136
- package/dist/path.d.mts +0 -163
- package/dist/router.d.mts +0 -49
- package/dist/runtime.d.mts +0 -97
- package/dist/server-D0Dp4R5z.d.mts +0 -449
- package/dist/server.d.mts +0 -7
- package/dist/state.d.mts +0 -117
- package/dist/style.d.mts +0 -232
- package/dist/test-reporter.d.mts +0 -77
- package/dist/test-runtime.d.mts +0 -122
- package/dist/test.d.mts +0 -39
- package/dist/types.d.mts +0 -586
- package/dist/universal.d.mts +0 -21
- package/dist/ws.d.mts +0 -200
- package/dist/wss.d.mts +0 -108
- package/src/build.ts +0 -362
- package/src/chokidar.ts +0 -427
- package/src/cli.ts +0 -1162
- package/src/config.ts +0 -509
- package/src/coverage.ts +0 -1479
- package/src/database.ts +0 -1410
- package/src/desktop-auto-render.ts +0 -317
- package/src/desktop-cli.ts +0 -1533
- package/src/desktop.ts +0 -99
- package/src/dev-build.ts +0 -340
- package/src/dom.ts +0 -901
- package/src/el.ts +0 -183
- package/src/fs.ts +0 -609
- package/src/hmr.ts +0 -149
- package/src/http.ts +0 -856
- package/src/https.ts +0 -411
- package/src/index.ts +0 -16
- package/src/mime-types.ts +0 -222
- package/src/mobile-cli.ts +0 -2313
- package/src/native-background.ts +0 -444
- package/src/native-border.ts +0 -343
- package/src/native-canvas.ts +0 -260
- package/src/native-cli.ts +0 -414
- package/src/native-color.ts +0 -904
- package/src/native-estimation.ts +0 -194
- package/src/native-grid.ts +0 -590
- package/src/native-interaction.ts +0 -1289
- package/src/native-layout.ts +0 -568
- package/src/native-link.ts +0 -76
- package/src/native-render-support.ts +0 -361
- package/src/native-spacing.ts +0 -231
- package/src/native-state.ts +0 -318
- package/src/native-strings.ts +0 -46
- package/src/native-transform.ts +0 -120
- package/src/native-types.ts +0 -439
- package/src/native-typography.ts +0 -254
- package/src/native-units.ts +0 -441
- package/src/native-vector.ts +0 -910
- package/src/native.ts +0 -5606
- package/src/path.ts +0 -493
- package/src/pm-cli.ts +0 -2498
- package/src/preview-build.ts +0 -294
- package/src/render-context.ts +0 -138
- package/src/router.ts +0 -260
- package/src/runtime.ts +0 -97
- package/src/server.ts +0 -2294
- package/src/state.ts +0 -556
- package/src/style.ts +0 -1790
- package/src/test-globals.d.ts +0 -184
- package/src/test-reporter.ts +0 -609
- package/src/test-runtime.ts +0 -1359
- package/src/test.ts +0 -368
- package/src/types.ts +0 -381
- package/src/universal.ts +0 -81
- package/src/wapk-cli.ts +0 -3213
- package/src/workspace-package.ts +0 -102
- package/src/ws.ts +0 -648
- package/src/wss.ts +0 -241
package/src/wss.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
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
|
-
};
|