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
@@ -1,194 +0,0 @@
1
- import { type NativeStyleResolveOptions } from './style';
2
- import type { NativeNode, NativePropValue } from './native-types';
3
- import { isFillValue, parseBoxShadowList, resolveBackdropBlurRadius, resolveStyleCurrentColor } from './native-color';
4
- import { parseCssUnitValue, resolveAxisUnitNumber, toDpLiteral, toScaledUnitNumber, getNativeStyleResolveOptions } from './native-units';
5
- import { flattenTextContent } from './native-strings';
6
- import { estimateHorizontalPadding, estimateVerticalPadding } from './native-spacing';
7
- import { resolveNativeBackgroundLayersFromStyle } from './native-background';
8
- import { resolveNativeBorder } from './native-border';
9
-
10
- const INLINE_DISPLAY_VALUES = new Set(['inline', 'inline-block', 'inline-flex', 'inline-grid']);
11
- const DEFAULT_BLOCK_FILL_SOURCE_TAGS = new Set([
12
- 'html',
13
- 'body',
14
- 'main',
15
- 'header',
16
- 'footer',
17
- 'nav',
18
- 'section',
19
- 'article',
20
- 'aside',
21
- 'div',
22
- 'form',
23
- 'fieldset',
24
- 'figure',
25
- 'details',
26
- 'dialog',
27
- 'menu',
28
- 'ul',
29
- 'ol',
30
- 'li',
31
- 'table',
32
- 'tbody',
33
- 'thead',
34
- 'tfoot',
35
- 'tr',
36
- ]);
37
- const FILL_WIDTH_EXCLUDED_COMPONENTS = new Set(['Text', 'Button', 'Link', 'Toggle', 'TextInput', 'Image', 'Media', 'WebView', 'Canvas', 'Vector', 'Math']);
38
-
39
- export function shouldFillChunkedCellChild(node: NativeNode): boolean {
40
- if (node.kind !== 'element') {
41
- return false;
42
- }
43
-
44
- return !FILL_WIDTH_EXCLUDED_COMPONENTS.has(node.component);
45
- }
46
-
47
- function hasNativeContainerSpacing(
48
- style: Record<string, NativePropValue>,
49
- styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
50
- ): boolean {
51
- return [
52
- style.padding,
53
- style.paddingHorizontal,
54
- style.paddingVertical,
55
- style.paddingTop,
56
- style.paddingRight,
57
- style.paddingBottom,
58
- style.paddingLeft,
59
- style.paddingStart,
60
- style.paddingEnd,
61
- style.gap,
62
- style.rowGap,
63
- style.columnGap,
64
- ].some((value) => toScaledUnitNumber(value, styleResolveOptions) !== undefined);
65
- }
66
-
67
- function hasNativeContainerDecoration(
68
- style: Record<string, NativePropValue>,
69
- styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
70
- ): boolean {
71
- return resolveNativeBackgroundLayersFromStyle(style, styleResolveOptions).length > 0
72
- || resolveBackdropBlurRadius(style, styleResolveOptions) !== undefined
73
- || resolveNativeBorder(style, (value) => toDpLiteral(value, styleResolveOptions)) !== undefined
74
- || parseBoxShadowList(style.boxShadow, resolveStyleCurrentColor(style)).length > 0;
75
- }
76
-
77
- export function shouldDefaultFillWidthHint(
78
- node: NativeNode,
79
- style: Record<string, NativePropValue> | undefined,
80
- styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
81
- ): boolean {
82
- if (node.kind !== 'element' || !shouldFillChunkedCellChild(node)) {
83
- return false;
84
- }
85
-
86
- const display = typeof style?.display === 'string'
87
- ? style.display.trim().toLowerCase()
88
- : undefined;
89
-
90
- if (display && INLINE_DISPLAY_VALUES.has(display)) {
91
- return false;
92
- }
93
-
94
- if (display === 'flex' || display === 'grid' || typeof style?.flexDirection === 'string') {
95
- return true;
96
- }
97
-
98
- if (style && (hasNativeContainerSpacing(style, styleResolveOptions) || hasNativeContainerDecoration(style, styleResolveOptions))) {
99
- return true;
100
- }
101
-
102
- return DEFAULT_BLOCK_FILL_SOURCE_TAGS.has(node.sourceTag);
103
- }
104
-
105
- export function estimateNodePreferredWidth(
106
- node: NativeNode,
107
- style: Record<string, NativePropValue> | undefined,
108
- styleResolveOptions: NativeStyleResolveOptions,
109
- ): number {
110
- if (node.kind === 'text') {
111
- return Math.max(48, node.value.trim().length * 8);
112
- }
113
-
114
- if (style?.width && isFillValue(style.width)) {
115
- return styleResolveOptions.viewportWidth ?? 390;
116
- }
117
-
118
- const explicitWidth = resolveAxisUnitNumber(style?.width ?? style?.minWidth, 'horizontal', undefined, styleResolveOptions);
119
- if (explicitWidth !== undefined && explicitWidth > 0) {
120
- return explicitWidth;
121
- }
122
-
123
- const fontSize = toScaledUnitNumber(style?.fontSize, styleResolveOptions) ?? 16;
124
- const text = flattenTextContent(node.children)
125
- || (typeof node.props.placeholder === 'string' ? node.props.placeholder : '');
126
- let baseWidth = text
127
- ? Math.max(56, text.length * fontSize * (node.component === 'Button' || node.component === 'Link' ? 0.58 : 0.52))
128
- : 0;
129
-
130
- switch (node.component) {
131
- case 'Button':
132
- case 'Link':
133
- baseWidth = Math.max(baseWidth, 120);
134
- break;
135
- case 'TextInput':
136
- baseWidth = Math.max(baseWidth, 220);
137
- break;
138
- case 'Toggle':
139
- baseWidth = Math.max(baseWidth, 56);
140
- break;
141
- default:
142
- baseWidth = Math.max(baseWidth, 160);
143
- break;
144
- }
145
-
146
- return baseWidth + estimateHorizontalPadding(style, styleResolveOptions);
147
- }
148
-
149
- export function estimateNodePreferredHeight(
150
- node: NativeNode,
151
- style: Record<string, NativePropValue> | undefined,
152
- styleResolveOptions: NativeStyleResolveOptions,
153
- ): number | undefined {
154
- if (node.kind === 'text') {
155
- return undefined;
156
- }
157
-
158
- if (style?.height && isFillValue(style.height)) {
159
- return undefined;
160
- }
161
-
162
- const explicitHeight = resolveAxisUnitNumber(style?.height ?? style?.minHeight, 'vertical', undefined, styleResolveOptions);
163
- if (explicitHeight !== undefined && explicitHeight > 0) {
164
- return explicitHeight;
165
- }
166
-
167
- const fontSize = toScaledUnitNumber(style?.fontSize, styleResolveOptions) ?? 16;
168
- const lineHeightValue = parseCssUnitValue(style?.lineHeight);
169
- const lineHeight = lineHeightValue?.unit === '' && lineHeightValue.value > 0 && lineHeightValue.value <= 4
170
- ? fontSize * lineHeightValue.value
171
- : toScaledUnitNumber(style?.lineHeight, styleResolveOptions) ?? (fontSize * 1.2);
172
- const text = flattenTextContent(node.children)
173
- || (typeof node.props.placeholder === 'string' ? node.props.placeholder : '');
174
- const lineCount = text ? text.split(/\r?\n/).length : 0;
175
- let baseHeight = lineCount > 0 ? lineHeight * lineCount : 0;
176
-
177
- switch (node.component) {
178
- case 'Button':
179
- case 'Link':
180
- baseHeight = Math.max(baseHeight, 40);
181
- break;
182
- case 'TextInput':
183
- baseHeight = Math.max(baseHeight, 44);
184
- break;
185
- case 'Toggle':
186
- baseHeight = Math.max(baseHeight, 32);
187
- break;
188
- default:
189
- baseHeight = Math.max(baseHeight, 24);
190
- break;
191
- }
192
-
193
- return baseHeight + estimateVerticalPadding(style, styleResolveOptions);
194
- }