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.
- 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/package.json +6 -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/native-estimation.ts
DELETED
|
@@ -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
|
-
}
|