elit 3.5.6 → 3.5.7

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.
Files changed (113) hide show
  1. package/Cargo.toml +1 -1
  2. package/README.md +1 -1
  3. package/desktop/build.rs +83 -0
  4. package/desktop/icon.rs +106 -0
  5. package/desktop/lib.rs +2 -0
  6. package/desktop/main.rs +235 -0
  7. package/desktop/native_main.rs +128 -0
  8. package/desktop/native_renderer/action_widgets.rs +184 -0
  9. package/desktop/native_renderer/app_models.rs +171 -0
  10. package/desktop/native_renderer/app_runtime.rs +140 -0
  11. package/desktop/native_renderer/container_rendering.rs +610 -0
  12. package/desktop/native_renderer/content_widgets.rs +634 -0
  13. package/desktop/native_renderer/css_models.rs +371 -0
  14. package/desktop/native_renderer/embedded_surfaces.rs +414 -0
  15. package/desktop/native_renderer/form_controls.rs +516 -0
  16. package/desktop/native_renderer/interaction_dispatch.rs +89 -0
  17. package/desktop/native_renderer/runtime_support.rs +135 -0
  18. package/desktop/native_renderer/utilities.rs +495 -0
  19. package/desktop/native_renderer/vector_drawing.rs +491 -0
  20. package/desktop/native_renderer.rs +4122 -0
  21. package/desktop/runtime/external.rs +422 -0
  22. package/desktop/runtime/mod.rs +67 -0
  23. package/desktop/runtime/quickjs.rs +106 -0
  24. package/desktop/window.rs +383 -0
  25. package/package.json +6 -3
  26. package/dist/build.d.mts +0 -20
  27. package/dist/chokidar.d.mts +0 -134
  28. package/dist/cli.d.mts +0 -81
  29. package/dist/config.d.mts +0 -254
  30. package/dist/coverage.d.mts +0 -85
  31. package/dist/database.d.mts +0 -52
  32. package/dist/desktop.d.mts +0 -68
  33. package/dist/dom.d.mts +0 -87
  34. package/dist/el.d.mts +0 -208
  35. package/dist/fs.d.mts +0 -255
  36. package/dist/hmr.d.mts +0 -38
  37. package/dist/http.d.mts +0 -169
  38. package/dist/https.d.mts +0 -108
  39. package/dist/index.d.mts +0 -13
  40. package/dist/mime-types.d.mts +0 -48
  41. package/dist/native.d.mts +0 -136
  42. package/dist/path.d.mts +0 -163
  43. package/dist/router.d.mts +0 -49
  44. package/dist/runtime.d.mts +0 -97
  45. package/dist/server-D0Dp4R5z.d.mts +0 -449
  46. package/dist/server.d.mts +0 -7
  47. package/dist/state.d.mts +0 -117
  48. package/dist/style.d.mts +0 -232
  49. package/dist/test-reporter.d.mts +0 -77
  50. package/dist/test-runtime.d.mts +0 -122
  51. package/dist/test.d.mts +0 -39
  52. package/dist/types.d.mts +0 -586
  53. package/dist/universal.d.mts +0 -21
  54. package/dist/ws.d.mts +0 -200
  55. package/dist/wss.d.mts +0 -108
  56. package/src/build.ts +0 -362
  57. package/src/chokidar.ts +0 -427
  58. package/src/cli.ts +0 -1162
  59. package/src/config.ts +0 -509
  60. package/src/coverage.ts +0 -1479
  61. package/src/database.ts +0 -1410
  62. package/src/desktop-auto-render.ts +0 -317
  63. package/src/desktop-cli.ts +0 -1533
  64. package/src/desktop.ts +0 -99
  65. package/src/dev-build.ts +0 -340
  66. package/src/dom.ts +0 -901
  67. package/src/el.ts +0 -183
  68. package/src/fs.ts +0 -609
  69. package/src/hmr.ts +0 -149
  70. package/src/http.ts +0 -856
  71. package/src/https.ts +0 -411
  72. package/src/index.ts +0 -16
  73. package/src/mime-types.ts +0 -222
  74. package/src/mobile-cli.ts +0 -2313
  75. package/src/native-background.ts +0 -444
  76. package/src/native-border.ts +0 -343
  77. package/src/native-canvas.ts +0 -260
  78. package/src/native-cli.ts +0 -414
  79. package/src/native-color.ts +0 -904
  80. package/src/native-estimation.ts +0 -194
  81. package/src/native-grid.ts +0 -590
  82. package/src/native-interaction.ts +0 -1289
  83. package/src/native-layout.ts +0 -568
  84. package/src/native-link.ts +0 -76
  85. package/src/native-render-support.ts +0 -361
  86. package/src/native-spacing.ts +0 -231
  87. package/src/native-state.ts +0 -318
  88. package/src/native-strings.ts +0 -46
  89. package/src/native-transform.ts +0 -120
  90. package/src/native-types.ts +0 -439
  91. package/src/native-typography.ts +0 -254
  92. package/src/native-units.ts +0 -441
  93. package/src/native-vector.ts +0 -910
  94. package/src/native.ts +0 -5606
  95. package/src/path.ts +0 -493
  96. package/src/pm-cli.ts +0 -2498
  97. package/src/preview-build.ts +0 -294
  98. package/src/render-context.ts +0 -138
  99. package/src/router.ts +0 -260
  100. package/src/runtime.ts +0 -97
  101. package/src/server.ts +0 -2294
  102. package/src/state.ts +0 -556
  103. package/src/style.ts +0 -1790
  104. package/src/test-globals.d.ts +0 -184
  105. package/src/test-reporter.ts +0 -609
  106. package/src/test-runtime.ts +0 -1359
  107. package/src/test.ts +0 -368
  108. package/src/types.ts +0 -381
  109. package/src/universal.ts +0 -81
  110. package/src/wapk-cli.ts +0 -3213
  111. package/src/workspace-package.ts +0 -102
  112. package/src/ws.ts +0 -648
  113. package/src/wss.ts +0 -241
package/src/chokidar.ts DELETED
@@ -1,427 +0,0 @@
1
- /**
2
- * File watcher module with unified API across runtimes
3
- * Pure implementation without external dependencies
4
- * Compatible with 'chokidar' package API
5
- * - Node.js: uses native fs.watch
6
- * - Bun: uses native fs.watch with enhancements
7
- * - Deno: uses Deno.watchFs
8
- */
9
-
10
- import { EventEmitter } from 'events';
11
- import { existsSync, statSync } from './fs';
12
- import { dirname } from './path';
13
- import { runtime } from './runtime';
14
-
15
- /**
16
- * Helper: Normalize path separators (eliminates duplication in path handling)
17
- */
18
- function normalizePath(path: string): string {
19
- return path.replace(/\\/g, '/');
20
- }
21
-
22
- /**
23
- * Helper: Emit event and all event (eliminates duplication in event emitting)
24
- */
25
- function emitEvent(watcher: FSWatcher, eventType: string, path: string): void {
26
- watcher.emit(eventType, path);
27
- watcher.emit('all', eventType, path);
28
- }
29
-
30
- /**
31
- * Helper: Check if path matches any pattern (eliminates duplication in pattern matching)
32
- */
33
- function matchesAnyPattern(path: string, patterns: string[]): boolean {
34
- return patterns.some(pattern => matchesPattern(path, pattern));
35
- }
36
-
37
- /**
38
- * Helper: Handle rename event (eliminates duplication in rename handling)
39
- */
40
- function handleRenameEvent(watcher: FSWatcher, fullPath: string, fs: any): void {
41
- try {
42
- fs.statSync(fullPath);
43
- emitEvent(watcher, 'add', fullPath);
44
- } catch {
45
- emitEvent(watcher, 'unlink', fullPath);
46
- }
47
- }
48
-
49
- /**
50
- * Helper: Setup fs.watch for Node.js/Bun (eliminates duplication in watcher setup)
51
- */
52
- function setupFsWatch(
53
- watcher: FSWatcher,
54
- baseDir: string,
55
- patterns: string[],
56
- fs: any
57
- ): void {
58
- try {
59
- const nativeWatcher = fs.watch(baseDir, { recursive: true }, (eventType: string, filename: string) => {
60
- if (!filename) return;
61
-
62
- const fullPath = normalizePath(`${baseDir}/${filename}`);
63
-
64
- // Check if the file matches any of the patterns
65
- if (!matchesAnyPattern(fullPath, patterns)) return;
66
-
67
- if (eventType === 'rename') {
68
- handleRenameEvent(watcher, fullPath, fs);
69
- } else if (eventType === 'change') {
70
- emitEvent(watcher, 'change', fullPath);
71
- }
72
- });
73
-
74
- watcher._setWatcher(nativeWatcher);
75
- // Track watched paths directly
76
- watcher['_watched'].add(baseDir);
77
-
78
- // Emit ready after a short delay
79
- queueMicrotask(() => watcher.emit('ready'));
80
- } catch (error) {
81
- watcher.emit('error', error as Error);
82
- }
83
- }
84
-
85
- /**
86
- * Watch options
87
- */
88
- export interface WatchOptions {
89
- /**
90
- * Indicates whether the process should continue to run as long as files are being watched.
91
- * If set to false, the process will continue running even if the watcher is closed.
92
- */
93
- persistent?: boolean;
94
-
95
- /**
96
- * Indicates whether to watch files that don't have read permissions.
97
- */
98
- ignorePermissionErrors?: boolean;
99
-
100
- /**
101
- * A function that takes one parameter (the path of the file/directory)
102
- * and returns true to ignore or false to watch.
103
- */
104
- ignored?: string | RegExp | ((path: string) => boolean);
105
-
106
- /**
107
- * If set to false, only the parent directory will be watched for new files.
108
- */
109
- ignoreInitial?: boolean;
110
-
111
- /**
112
- * If set to true, symlinks will be followed.
113
- */
114
- followSymlinks?: boolean;
115
-
116
- /**
117
- * Interval of file system polling (in milliseconds).
118
- */
119
- interval?: number;
120
-
121
- /**
122
- * Interval of file system polling for binary files (in milliseconds).
123
- */
124
- binaryInterval?: number;
125
-
126
- /**
127
- * If set to true, will provide fs.Stats object as second argument
128
- * in add, addDir, and change events.
129
- */
130
- alwaysStat?: boolean;
131
-
132
- /**
133
- * If set, limits how many levels of subdirectories will be traversed.
134
- */
135
- depth?: number;
136
-
137
- /**
138
- * By default, add event fires when a file first appears on disk.
139
- * Setting this will wait for the write to finish before firing.
140
- */
141
- awaitWriteFinish?: boolean | {
142
- stabilityThreshold?: number;
143
- pollInterval?: number;
144
- };
145
-
146
- /**
147
- * If set to true, will use fs.watchFile() (polling) instead of fs.watch().
148
- */
149
- usePolling?: boolean;
150
-
151
- /**
152
- * Whether to use fsevents watching on macOS (if available).
153
- */
154
- useFsEvents?: boolean;
155
-
156
- /**
157
- * The base path to watch.
158
- */
159
- cwd?: string;
160
-
161
- /**
162
- * Whether to disable globbing.
163
- */
164
- disableGlobbing?: boolean;
165
-
166
- /**
167
- * Automatically filter out artifacts that occur when using editors.
168
- */
169
- atomic?: boolean | number;
170
- }
171
-
172
- /**
173
- * FSWatcher class - Compatible with chokidar
174
- */
175
- export class FSWatcher extends EventEmitter {
176
- private _watcher: any;
177
- private _closed: boolean = false;
178
- private _watched: Set<string> = new Set();
179
-
180
- constructor(options?: WatchOptions) {
181
- super();
182
- this.options = options || {};
183
- }
184
-
185
- public options: WatchOptions;
186
-
187
- /**
188
- * Add paths to be watched
189
- */
190
- add(paths: string | string[]): FSWatcher {
191
- if (this._closed) {
192
- throw new Error('Watcher has been closed');
193
- }
194
-
195
- const pathArray = Array.isArray(paths) ? paths : [paths];
196
-
197
- if (runtime === 'node') {
198
- if (this._watcher) {
199
- this._watcher.add(pathArray);
200
- }
201
- } else {
202
- pathArray.forEach(path => this._watched.add(path));
203
- }
204
-
205
- return this;
206
- }
207
-
208
- /**
209
- * Stop watching paths
210
- */
211
- unwatch(paths: string | string[]): FSWatcher {
212
- if (this._closed) {
213
- return this;
214
- }
215
-
216
- const pathArray = Array.isArray(paths) ? paths : [paths];
217
-
218
- if (runtime === 'node') {
219
- if (this._watcher) {
220
- this._watcher.unwatch(pathArray);
221
- }
222
- } else {
223
- pathArray.forEach(path => this._watched.delete(path));
224
- }
225
-
226
- return this;
227
- }
228
-
229
- /**
230
- * Close the watcher
231
- */
232
- async close(): Promise<void> {
233
- if (this._closed) {
234
- return;
235
- }
236
-
237
- this._closed = true;
238
-
239
- if (runtime === 'node') {
240
- if (this._watcher) {
241
- await this._watcher.close();
242
- }
243
- }
244
-
245
- this.removeAllListeners();
246
- }
247
-
248
- /**
249
- * Get watched paths
250
- */
251
- getWatched(): { [directory: string]: string[] } {
252
- if (runtime === 'node' && this._watcher) {
253
- return this._watcher.getWatched();
254
- }
255
-
256
- const result: { [directory: string]: string[] } = {};
257
- this._watched.forEach(path => {
258
- const dir = path.substring(0, path.lastIndexOf('/')) || '.';
259
- const file = path.substring(path.lastIndexOf('/') + 1);
260
- if (!result[dir]) {
261
- result[dir] = [];
262
- }
263
- result[dir].push(file);
264
- });
265
-
266
- return result;
267
- }
268
-
269
- /**
270
- * Internal method to set native watcher
271
- * @internal
272
- */
273
- _setWatcher(watcher: any): void {
274
- this._watcher = watcher;
275
- }
276
- }
277
-
278
- /**
279
- * Extract base directory from glob pattern
280
- * e.g., 'src/**\/*.ts' -> 'src', '**\/*.ts' -> '.'
281
- */
282
- function getBaseDirectory(pattern: string): string {
283
- const normalizedPattern = normalizePath(pattern);
284
-
285
- // Remove glob patterns to get the base directory
286
- const parts = normalizedPattern.split(/[\\\/]/);
287
- let baseDir = '';
288
- let sawGlob = false;
289
-
290
- for (const part of parts) {
291
- if (part.includes('*') || part.includes('?')) {
292
- sawGlob = true;
293
- break;
294
- }
295
- baseDir = baseDir ? `${baseDir}/${part}` : part;
296
- }
297
-
298
- if (sawGlob) {
299
- return baseDir || '.';
300
- }
301
-
302
- if (normalizedPattern && existsSync(normalizedPattern)) {
303
- try {
304
- return statSync(normalizedPattern).isDirectory()
305
- ? normalizedPattern
306
- : normalizePath(dirname(normalizedPattern)) || '.';
307
- } catch {
308
- return normalizePath(dirname(normalizedPattern)) || '.';
309
- }
310
- }
311
-
312
- const lastSegment = parts[parts.length - 1] || '';
313
- if (lastSegment.includes('.') && !lastSegment.startsWith('.')) {
314
- return normalizePath(dirname(normalizedPattern)) || '.';
315
- }
316
-
317
- return normalizedPattern || '.';
318
- }
319
-
320
- /**
321
- * Check if a path matches a glob pattern
322
- */
323
- function matchesPattern(filePath: string, pattern: string): boolean {
324
- // Simple glob matching - convert pattern to regex
325
- const regexPattern = normalizePath(pattern)
326
- .replace(/[.+^${}()|[\]\\]/g, '\\$&')
327
- .replace(/\*\*/g, '.*')
328
- .replace(/\*/g, '[^/]*')
329
- .replace(/\?/g, '.');
330
-
331
- const regex = new RegExp(`^${regexPattern}$`);
332
- const normalizedPath = normalizePath(filePath);
333
-
334
- return regex.test(normalizedPath);
335
- }
336
-
337
- /**
338
- * Watch files and directories
339
- */
340
- export function watch(
341
- paths: string | string[],
342
- options?: WatchOptions
343
- ): FSWatcher {
344
- const watcher = new FSWatcher(options);
345
- const pathArray = Array.isArray(paths) ? paths : [paths];
346
-
347
- // Extract patterns and their base directories
348
- const watchMap = new Map<string, string[]>();
349
-
350
- pathArray.forEach(path => {
351
- const baseDir = getBaseDirectory(path);
352
- if (!watchMap.has(baseDir)) {
353
- watchMap.set(baseDir, []);
354
- }
355
- watchMap.get(baseDir)!.push(path);
356
- });
357
-
358
- if (runtime === 'node') {
359
- // Node.js - use native fs.watch
360
- const fs = require('fs');
361
- watchMap.forEach((patterns, baseDir) => setupFsWatch(watcher, baseDir, patterns, fs));
362
- } else if (runtime === 'bun') {
363
- // Bun - use native fs.watch
364
- const fs = require('fs');
365
- watchMap.forEach((patterns, baseDir) => setupFsWatch(watcher, baseDir, patterns, fs));
366
- } else if (runtime === 'deno') {
367
- // Deno - use Deno.watchFs
368
- // Extract just the base directories for Deno
369
- const baseDirs = Array.from(watchMap.keys());
370
- const allPatterns = Array.from(watchMap.values()).flat();
371
-
372
- (async () => {
373
- try {
374
- // @ts-ignore
375
- const denoWatcher = Deno.watchFs(baseDirs);
376
-
377
- for await (const event of denoWatcher) {
378
- if (watcher['_closed']) break;
379
-
380
- for (const path of event.paths) {
381
- const normalizedPath = normalizePath(path);
382
-
383
- // Check if the file matches any of the patterns
384
- if (!matchesAnyPattern(normalizedPath, allPatterns)) continue;
385
-
386
- switch (event.kind) {
387
- case 'create':
388
- emitEvent(watcher, 'add', path);
389
- break;
390
- case 'modify':
391
- emitEvent(watcher, 'change', path);
392
- break;
393
- case 'remove':
394
- emitEvent(watcher, 'unlink', path);
395
- break;
396
- }
397
- }
398
- }
399
- } catch (error) {
400
- if (!watcher['_closed']) {
401
- watcher.emit('error', error as Error);
402
- }
403
- }
404
- })();
405
-
406
- pathArray.forEach(path => watcher.add(path));
407
- queueMicrotask(() => watcher.emit('ready'));
408
- }
409
-
410
- return watcher;
411
- }
412
-
413
- /**
414
- * Get current runtime
415
- */
416
- export function getRuntime(): 'node' | 'bun' | 'deno' {
417
- return runtime;
418
- }
419
-
420
- /**
421
- * Default export
422
- */
423
- export default {
424
- watch,
425
- FSWatcher,
426
- getRuntime,
427
- };