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-types.ts
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import { type NativeStyleResolveOptions } from './style';
|
|
2
|
-
|
|
3
|
-
export type NativePlatform = 'generic' | 'android' | 'ios';
|
|
4
|
-
|
|
5
|
-
export type NativePropScalar = string | number | boolean | null;
|
|
6
|
-
export interface NativePropObject {
|
|
7
|
-
[key: string]: NativePropValue;
|
|
8
|
-
}
|
|
9
|
-
export type NativePropValue = NativePropScalar | NativePropObject | NativePropValue[];
|
|
10
|
-
|
|
11
|
-
export interface NativeTextNode {
|
|
12
|
-
kind: 'text';
|
|
13
|
-
value: string;
|
|
14
|
-
stateId?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface NativeElementNode {
|
|
18
|
-
kind: 'element';
|
|
19
|
-
component: string;
|
|
20
|
-
sourceTag: string;
|
|
21
|
-
props: Record<string, NativePropValue>;
|
|
22
|
-
events: string[];
|
|
23
|
-
children: NativeNode[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type NativeNode = NativeTextNode | NativeElementNode;
|
|
27
|
-
|
|
28
|
-
export interface NativeTree {
|
|
29
|
-
platform: NativePlatform;
|
|
30
|
-
roots: NativeNode[];
|
|
31
|
-
stateDescriptors?: NativeStateDescriptor[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface NativeTransformOptions {
|
|
35
|
-
platform?: NativePlatform;
|
|
36
|
-
tagMap?: Record<string, string>;
|
|
37
|
-
wrapTextNodes?: boolean;
|
|
38
|
-
preserveUnknownTags?: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface AndroidComposeOptions {
|
|
42
|
-
packageName?: string;
|
|
43
|
-
functionName?: string;
|
|
44
|
-
includePackage?: boolean;
|
|
45
|
-
includeImports?: boolean;
|
|
46
|
-
includePreview?: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface SwiftUIOptions {
|
|
50
|
-
structName?: string;
|
|
51
|
-
includeImports?: boolean;
|
|
52
|
-
includePreview?: boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type NativeHelperFlag = 'imagePlaceholder' | 'unsupportedPlaceholder' | 'uriHandler' | 'openUrlHandler' | 'downloadHandler' | 'bridge' | 'webViewSurface' | 'mediaSurface' | 'interactivePressState' | 'backgroundImage';
|
|
56
|
-
export type NativeResolvedStyleMap = WeakMap<NativeElementNode, Record<string, NativePropValue>>;
|
|
57
|
-
export interface NativeStyleContextEntry {
|
|
58
|
-
scope: NativeStyleScope;
|
|
59
|
-
ancestors: NativeStyleScope[];
|
|
60
|
-
inheritedTextStyles: Record<string, NativePropValue>;
|
|
61
|
-
}
|
|
62
|
-
export type NativeStyleContextMap = WeakMap<NativeElementNode, NativeStyleContextEntry>;
|
|
63
|
-
|
|
64
|
-
export interface NativeStyleScope {
|
|
65
|
-
tagName: string;
|
|
66
|
-
classNames: string[];
|
|
67
|
-
attributes: Record<string, string>;
|
|
68
|
-
pseudoStates: string[];
|
|
69
|
-
previousSiblings?: NativeStyleScope[];
|
|
70
|
-
nextSiblings?: NativeStyleScope[];
|
|
71
|
-
children?: NativeStyleScope[];
|
|
72
|
-
childIndex?: number;
|
|
73
|
-
siblingCount?: number;
|
|
74
|
-
sameTypeIndex?: number;
|
|
75
|
-
sameTypeCount?: number;
|
|
76
|
-
containerNames?: string[];
|
|
77
|
-
containerWidth?: number;
|
|
78
|
-
isContainer?: boolean;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface NativeRenderHints {
|
|
82
|
-
fillWidth?: boolean;
|
|
83
|
-
fillHeight?: boolean;
|
|
84
|
-
availableWidth?: number;
|
|
85
|
-
availableHeight?: number;
|
|
86
|
-
negotiatedMaxWidth?: number;
|
|
87
|
-
negotiatedMaxHeight?: number;
|
|
88
|
-
parentFlexLayout?: 'Row' | 'Column';
|
|
89
|
-
parentRowBaselineAlignment?: 'first' | 'last';
|
|
90
|
-
absoluteOverlay?: boolean;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface NativeChunkedRow {
|
|
94
|
-
items: NativeNode[];
|
|
95
|
-
weights?: Array<number | undefined>;
|
|
96
|
-
columnSizes?: Array<NativeGridColumnTrackSizeSpec | undefined>;
|
|
97
|
-
minHeight?: number;
|
|
98
|
-
height?: number;
|
|
99
|
-
maxHeight?: number;
|
|
100
|
-
trackWeight?: number;
|
|
101
|
-
stretchEligible?: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface NativeGridTrackSizeSpec {
|
|
105
|
-
minHeight?: number;
|
|
106
|
-
height?: number;
|
|
107
|
-
maxHeight?: number;
|
|
108
|
-
trackWeight?: number;
|
|
109
|
-
stretchEligible?: boolean;
|
|
110
|
-
intrinsicHeight?: boolean;
|
|
111
|
-
intrinsicMinHeight?: boolean;
|
|
112
|
-
intrinsicMaxHeight?: boolean;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface NativeGridColumnTrackSizeSpec {
|
|
116
|
-
minWidth?: number;
|
|
117
|
-
width?: number;
|
|
118
|
-
maxWidth?: number;
|
|
119
|
-
trackWeight?: number;
|
|
120
|
-
intrinsicWidth?: boolean;
|
|
121
|
-
intrinsicMinWidth?: boolean;
|
|
122
|
-
intrinsicMaxWidth?: boolean;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export type NativeVideoPosterFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
126
|
-
export type NativeVideoPosterPosition = 'center' | 'top' | 'bottom' | 'leading' | 'trailing' | 'top-leading' | 'top-trailing' | 'bottom-leading' | 'bottom-trailing';
|
|
127
|
-
export type NativeBackgroundRepeat = 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
128
|
-
export type NativeContentStackAlignment = 'start' | 'center' | 'end' | 'stretch' | 'space-between' | 'space-around' | 'space-evenly';
|
|
129
|
-
export type NativeGridItemAlignment = 'start' | 'center' | 'end' | 'stretch';
|
|
130
|
-
|
|
131
|
-
export interface NativeBackgroundLayerMetadata {
|
|
132
|
-
source?: string;
|
|
133
|
-
gradient?: NativeGradientValue;
|
|
134
|
-
color?: NativeColorValue;
|
|
135
|
-
repeat?: NativeBackgroundRepeat;
|
|
136
|
-
size?: string;
|
|
137
|
-
position?: string;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface NativeBackgroundImageSpec {
|
|
141
|
-
kind: 'image';
|
|
142
|
-
source: string;
|
|
143
|
-
fit: NativeVideoPosterFit;
|
|
144
|
-
position: NativeVideoPosterPosition;
|
|
145
|
-
repeat: NativeBackgroundRepeat;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export type NativeBackgroundLayerSpec =
|
|
149
|
-
| NativeBackgroundImageSpec
|
|
150
|
-
| { kind: 'gradient'; gradient: NativeGradientValue }
|
|
151
|
-
| { kind: 'color'; color: NativeColorValue };
|
|
152
|
-
|
|
153
|
-
export interface NativeGridTemplateAreaPlacement {
|
|
154
|
-
rowPlacement: { start?: number; span: number };
|
|
155
|
-
columnPlacement: { start?: number; span: number };
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface NativeGridTrackDefinition {
|
|
159
|
-
tracks: string[];
|
|
160
|
-
lineNames: Map<string, number[]>;
|
|
161
|
-
lineCount: number;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface NativeChunkedLayout {
|
|
165
|
-
kind: 'grid' | 'wrap';
|
|
166
|
-
rows: NativeChunkedRow[];
|
|
167
|
-
rowGap?: number;
|
|
168
|
-
columnGap?: number;
|
|
169
|
-
contentAlignment?: NativeContentStackAlignment;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface NativeAutoMarginFlags {
|
|
173
|
-
top: boolean;
|
|
174
|
-
right: boolean;
|
|
175
|
-
bottom: boolean;
|
|
176
|
-
left: boolean;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export interface StateLike<T = unknown> {
|
|
180
|
-
value: T;
|
|
181
|
-
subscribe: (listener: (value: T) => void) => () => void;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export type NativeStateValueType = 'string' | 'number' | 'boolean' | 'string-array';
|
|
185
|
-
|
|
186
|
-
export interface NativeStateDescriptor {
|
|
187
|
-
id: string;
|
|
188
|
-
type: NativeStateValueType;
|
|
189
|
-
initialValue: string | number | boolean | string[];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export interface NativeBindingReference extends NativePropObject {
|
|
193
|
-
id: string;
|
|
194
|
-
kind: 'value' | 'checked';
|
|
195
|
-
valueType: NativeStateValueType;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export interface NativePickerOption {
|
|
199
|
-
label: string;
|
|
200
|
-
value: string;
|
|
201
|
-
selected?: boolean;
|
|
202
|
-
disabled?: boolean;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface NativeControlEventExpressionOptions {
|
|
206
|
-
valueExpression?: string;
|
|
207
|
-
valuesExpression?: string;
|
|
208
|
-
checkedExpression?: string;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export interface NativeTransformContext {
|
|
212
|
-
nextStateIndex: number;
|
|
213
|
-
stateIds: WeakMap<object, string>;
|
|
214
|
-
stateDescriptors: Map<string, NativeStateDescriptor>;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export interface AndroidComposeContext {
|
|
218
|
-
textFieldIndex: number;
|
|
219
|
-
sliderIndex: number;
|
|
220
|
-
toggleIndex: number;
|
|
221
|
-
pickerIndex: number;
|
|
222
|
-
interactionIndex: number;
|
|
223
|
-
stateDeclarations: string[];
|
|
224
|
-
declaredStateIds: Set<string>;
|
|
225
|
-
helperFlags: Set<NativeHelperFlag>;
|
|
226
|
-
resolvedStyles: NativeResolvedStyleMap;
|
|
227
|
-
styleContexts: NativeStyleContextMap;
|
|
228
|
-
styleResolveOptions: NativeStyleResolveOptions;
|
|
229
|
-
stateDescriptors: Map<string, NativeStateDescriptor>;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface SwiftUIContext {
|
|
233
|
-
textFieldIndex: number;
|
|
234
|
-
sliderIndex: number;
|
|
235
|
-
toggleIndex: number;
|
|
236
|
-
pickerIndex: number;
|
|
237
|
-
interactionIndex: number;
|
|
238
|
-
stateDeclarations: string[];
|
|
239
|
-
declaredStateIds: Set<string>;
|
|
240
|
-
helperFlags: Set<NativeHelperFlag>;
|
|
241
|
-
resolvedStyles: NativeResolvedStyleMap;
|
|
242
|
-
styleContexts: NativeStyleContextMap;
|
|
243
|
-
styleResolveOptions: NativeStyleResolveOptions;
|
|
244
|
-
stateDescriptors: Map<string, NativeStateDescriptor>;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface NativeColorValue {
|
|
248
|
-
red: number;
|
|
249
|
-
green: number;
|
|
250
|
-
blue: number;
|
|
251
|
-
alpha: number;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export type NativeGradientDirection =
|
|
255
|
-
| 'topToBottom'
|
|
256
|
-
| 'bottomToTop'
|
|
257
|
-
| 'leadingToTrailing'
|
|
258
|
-
| 'trailingToLeading'
|
|
259
|
-
| 'topLeadingToBottomTrailing'
|
|
260
|
-
| 'bottomTrailingToTopLeading';
|
|
261
|
-
|
|
262
|
-
export interface NativeGradientValue {
|
|
263
|
-
colors: NativeColorValue[];
|
|
264
|
-
direction: NativeGradientDirection;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export type NativeVectorPathCommand =
|
|
268
|
-
| { kind: 'moveTo' | 'lineTo'; x: number; y: number }
|
|
269
|
-
| { kind: 'cubicTo'; control1X: number; control1Y: number; control2X: number; control2Y: number; x: number; y: number }
|
|
270
|
-
| { kind: 'close' };
|
|
271
|
-
|
|
272
|
-
export interface NativeIntrinsicSizeSpec {
|
|
273
|
-
intrinsicWidth: number;
|
|
274
|
-
intrinsicHeight: number;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export interface NativeCanvasPoint {
|
|
278
|
-
x: number;
|
|
279
|
-
y: number;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export type NativeCanvasDrawOperation =
|
|
283
|
-
| {
|
|
284
|
-
kind: 'rect';
|
|
285
|
-
x?: number;
|
|
286
|
-
y?: number;
|
|
287
|
-
width: number;
|
|
288
|
-
height: number;
|
|
289
|
-
rx?: number;
|
|
290
|
-
ry?: number;
|
|
291
|
-
fill?: string;
|
|
292
|
-
fillStyle?: string;
|
|
293
|
-
stroke?: string;
|
|
294
|
-
strokeStyle?: string;
|
|
295
|
-
strokeWidth?: number;
|
|
296
|
-
lineWidth?: number;
|
|
297
|
-
}
|
|
298
|
-
| {
|
|
299
|
-
kind: 'circle';
|
|
300
|
-
cx: number;
|
|
301
|
-
cy: number;
|
|
302
|
-
r: number;
|
|
303
|
-
fill?: string;
|
|
304
|
-
fillStyle?: string;
|
|
305
|
-
stroke?: string;
|
|
306
|
-
strokeStyle?: string;
|
|
307
|
-
strokeWidth?: number;
|
|
308
|
-
lineWidth?: number;
|
|
309
|
-
}
|
|
310
|
-
| {
|
|
311
|
-
kind: 'ellipse';
|
|
312
|
-
cx: number;
|
|
313
|
-
cy: number;
|
|
314
|
-
rx: number;
|
|
315
|
-
ry: number;
|
|
316
|
-
fill?: string;
|
|
317
|
-
fillStyle?: string;
|
|
318
|
-
stroke?: string;
|
|
319
|
-
strokeStyle?: string;
|
|
320
|
-
strokeWidth?: number;
|
|
321
|
-
lineWidth?: number;
|
|
322
|
-
}
|
|
323
|
-
| {
|
|
324
|
-
kind: 'line';
|
|
325
|
-
x1: number;
|
|
326
|
-
y1: number;
|
|
327
|
-
x2: number;
|
|
328
|
-
y2: number;
|
|
329
|
-
stroke?: string;
|
|
330
|
-
strokeStyle?: string;
|
|
331
|
-
strokeWidth?: number;
|
|
332
|
-
lineWidth?: number;
|
|
333
|
-
}
|
|
334
|
-
| {
|
|
335
|
-
kind: 'polyline' | 'polygon';
|
|
336
|
-
points: string | NativeCanvasPoint[];
|
|
337
|
-
fill?: string;
|
|
338
|
-
fillStyle?: string;
|
|
339
|
-
stroke?: string;
|
|
340
|
-
strokeStyle?: string;
|
|
341
|
-
strokeWidth?: number;
|
|
342
|
-
lineWidth?: number;
|
|
343
|
-
}
|
|
344
|
-
| {
|
|
345
|
-
kind: 'path';
|
|
346
|
-
d: string;
|
|
347
|
-
fill?: string;
|
|
348
|
-
fillStyle?: string;
|
|
349
|
-
stroke?: string;
|
|
350
|
-
strokeStyle?: string;
|
|
351
|
-
strokeWidth?: number;
|
|
352
|
-
lineWidth?: number;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
export type NativeVectorShape =
|
|
356
|
-
| {
|
|
357
|
-
kind: 'circle';
|
|
358
|
-
cx: number;
|
|
359
|
-
cy: number;
|
|
360
|
-
r: number;
|
|
361
|
-
fill?: NativeColorValue;
|
|
362
|
-
stroke?: NativeColorValue;
|
|
363
|
-
strokeWidth?: number;
|
|
364
|
-
}
|
|
365
|
-
| {
|
|
366
|
-
kind: 'rect';
|
|
367
|
-
x: number;
|
|
368
|
-
y: number;
|
|
369
|
-
width: number;
|
|
370
|
-
height: number;
|
|
371
|
-
rx?: number;
|
|
372
|
-
ry?: number;
|
|
373
|
-
fill?: NativeColorValue;
|
|
374
|
-
stroke?: NativeColorValue;
|
|
375
|
-
strokeWidth?: number;
|
|
376
|
-
}
|
|
377
|
-
| {
|
|
378
|
-
kind: 'ellipse';
|
|
379
|
-
cx: number;
|
|
380
|
-
cy: number;
|
|
381
|
-
rx: number;
|
|
382
|
-
ry: number;
|
|
383
|
-
fill?: NativeColorValue;
|
|
384
|
-
stroke?: NativeColorValue;
|
|
385
|
-
strokeWidth?: number;
|
|
386
|
-
}
|
|
387
|
-
| {
|
|
388
|
-
kind: 'path';
|
|
389
|
-
commands: NativeVectorPathCommand[];
|
|
390
|
-
fill?: NativeColorValue;
|
|
391
|
-
stroke?: NativeColorValue;
|
|
392
|
-
strokeWidth?: number;
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
export interface NativeVectorViewport {
|
|
396
|
-
minX: number;
|
|
397
|
-
minY: number;
|
|
398
|
-
width: number;
|
|
399
|
-
height: number;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
export interface NativeVectorSpec extends NativeIntrinsicSizeSpec {
|
|
403
|
-
viewport: NativeVectorViewport;
|
|
404
|
-
shapes: NativeVectorShape[];
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
export interface NativeCanvasSpec extends NativeIntrinsicSizeSpec {
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export interface NativeFlexStyleValues {
|
|
411
|
-
grow?: number;
|
|
412
|
-
shrink?: number;
|
|
413
|
-
basis?: NativePropValue;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export interface NativeShadowValue {
|
|
417
|
-
offsetX: number;
|
|
418
|
-
offsetY: number;
|
|
419
|
-
blur: number;
|
|
420
|
-
color: NativeColorValue;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export type NativeBorderStyleKeyword = 'solid' | 'dashed' | 'dotted' | 'none' | 'unsupported';
|
|
424
|
-
|
|
425
|
-
export interface NativeBorderSideValue {
|
|
426
|
-
width: string;
|
|
427
|
-
color: NativeColorValue;
|
|
428
|
-
style?: NativeBorderStyleKeyword;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
export interface NativeBorderValue {
|
|
432
|
-
width?: string;
|
|
433
|
-
color?: NativeColorValue;
|
|
434
|
-
style?: NativeBorderStyleKeyword;
|
|
435
|
-
top?: NativeBorderSideValue;
|
|
436
|
-
right?: NativeBorderSideValue;
|
|
437
|
-
bottom?: NativeBorderSideValue;
|
|
438
|
-
left?: NativeBorderSideValue;
|
|
439
|
-
}
|
package/src/native-typography.ts
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { type NativeStyleResolveOptions } from './style';
|
|
2
|
-
import type { NativePropValue } from './native-types';
|
|
3
|
-
import { formatFloat, getNativeStyleResolveOptions, parseCssUnitValue, toScaledUnitNumber } from './native-units';
|
|
4
|
-
import { parseCssColor, toComposeColorLiteral } from './native-color';
|
|
5
|
-
import { quoteKotlinString } from './native-strings';
|
|
6
|
-
import { applyComposeTextTransformExpression } from './native-state';
|
|
7
|
-
|
|
8
|
-
export function resolveComposeFontFamily(value: NativePropValue | undefined): string | undefined {
|
|
9
|
-
if (typeof value !== 'string') {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const normalized = value.toLowerCase();
|
|
14
|
-
if (normalized.includes('sans-serif') || normalized.includes('sans') || normalized.includes('avenir') || normalized.includes('trebuchet') || normalized.includes('arial')) {
|
|
15
|
-
return 'FontFamily.SansSerif';
|
|
16
|
-
}
|
|
17
|
-
if (normalized.includes('serif') || normalized.includes('georgia') || normalized.includes('times new roman')) {
|
|
18
|
-
return 'FontFamily.Serif';
|
|
19
|
-
}
|
|
20
|
-
if (normalized.includes('monospace') || normalized.includes('courier') || normalized.includes('mono')) {
|
|
21
|
-
return 'FontFamily.Monospace';
|
|
22
|
-
}
|
|
23
|
-
if (normalized.includes('cursive')) {
|
|
24
|
-
return 'FontFamily.Cursive';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function resolveSwiftFontDesign(value: NativePropValue | undefined): string | undefined {
|
|
31
|
-
if (typeof value !== 'string') {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const normalized = value.toLowerCase();
|
|
36
|
-
if (normalized.includes('sans-serif') || normalized.includes('sans') || normalized.includes('avenir') || normalized.includes('trebuchet') || normalized.includes('arial')) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
if (normalized.includes('serif') || normalized.includes('georgia') || normalized.includes('times new roman')) {
|
|
40
|
-
return '.serif';
|
|
41
|
-
}
|
|
42
|
-
if (normalized.includes('monospace') || normalized.includes('courier') || normalized.includes('mono')) {
|
|
43
|
-
return '.monospaced';
|
|
44
|
-
}
|
|
45
|
-
if (normalized.includes('rounded')) {
|
|
46
|
-
return '.rounded';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function resolveComposeLineHeight(
|
|
53
|
-
value: NativePropValue | undefined,
|
|
54
|
-
fontSize: NativePropValue | undefined,
|
|
55
|
-
styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
|
|
56
|
-
): string | undefined {
|
|
57
|
-
const parsed = parseCssUnitValue(value);
|
|
58
|
-
const baseFontSize = toScaledUnitNumber(fontSize, styleResolveOptions) ?? 16;
|
|
59
|
-
const lineHeight = parsed?.unit === '' && parsed.value > 0 && parsed.value <= 4
|
|
60
|
-
? baseFontSize * parsed.value
|
|
61
|
-
: toScaledUnitNumber(value, styleResolveOptions);
|
|
62
|
-
|
|
63
|
-
return lineHeight !== undefined ? `${formatFloat(lineHeight)}.sp` : undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function resolveSwiftLineSpacing(
|
|
67
|
-
value: NativePropValue | undefined,
|
|
68
|
-
fontSize: NativePropValue | undefined,
|
|
69
|
-
styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
|
|
70
|
-
): string | undefined {
|
|
71
|
-
const parsed = parseCssUnitValue(value);
|
|
72
|
-
const baseFontSize = toScaledUnitNumber(fontSize, styleResolveOptions) ?? 17;
|
|
73
|
-
const lineHeight = parsed?.unit === '' && parsed.value > 0 && parsed.value <= 4
|
|
74
|
-
? baseFontSize * parsed.value
|
|
75
|
-
: toScaledUnitNumber(value, styleResolveOptions);
|
|
76
|
-
if (lineHeight === undefined) {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const spacing = lineHeight - baseFontSize;
|
|
81
|
-
return spacing > 0 ? formatFloat(spacing) : undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function resolveTextTransform(value: NativePropValue | undefined): 'uppercase' | 'lowercase' | 'capitalize' | undefined {
|
|
85
|
-
if (typeof value !== 'string') return undefined;
|
|
86
|
-
const normalized = value.trim().toLowerCase();
|
|
87
|
-
if (normalized === 'uppercase' || normalized === 'lowercase' || normalized === 'capitalize') {
|
|
88
|
-
return normalized;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function resolveComposeTextDecoration(value: NativePropValue | undefined): string | undefined {
|
|
95
|
-
if (typeof value !== 'string') {
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const normalized = value.trim().toLowerCase();
|
|
100
|
-
if (normalized.includes('underline') && normalized.includes('line-through')) {
|
|
101
|
-
return 'TextDecoration.combine(listOf(TextDecoration.Underline, TextDecoration.LineThrough))';
|
|
102
|
-
}
|
|
103
|
-
if (normalized.includes('underline')) {
|
|
104
|
-
return 'TextDecoration.Underline';
|
|
105
|
-
}
|
|
106
|
-
if (normalized.includes('line-through')) {
|
|
107
|
-
return 'TextDecoration.LineThrough';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function resolveSwiftTextDecoration(value: NativePropValue | undefined): { underline: boolean; strikethrough: boolean } | undefined {
|
|
114
|
-
if (typeof value !== 'string') {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const normalized = value.trim().toLowerCase();
|
|
119
|
-
const underline = normalized.includes('underline');
|
|
120
|
-
const strikethrough = normalized.includes('line-through');
|
|
121
|
-
return underline || strikethrough ? { underline, strikethrough } : undefined;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function applyTextTransform(text: string, transform: 'uppercase' | 'lowercase' | 'capitalize' | undefined): string {
|
|
125
|
-
if (!transform) return text;
|
|
126
|
-
if (transform === 'uppercase') return text.toUpperCase();
|
|
127
|
-
if (transform === 'lowercase') return text.toLowerCase();
|
|
128
|
-
return text.replace(/\b\p{L}/gu, (char) => char.toUpperCase());
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function resolveComposeFontWeight(value: NativePropValue | undefined): string | undefined {
|
|
132
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
133
|
-
return `FontWeight.W${Math.min(900, Math.max(100, Math.round(value / 100) * 100))}`;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (typeof value === 'string') {
|
|
137
|
-
const trimmed = value.trim().toLowerCase();
|
|
138
|
-
if (/^\d+$/.test(trimmed)) {
|
|
139
|
-
return `FontWeight.W${Math.min(900, Math.max(100, Math.round(Number(trimmed) / 100) * 100))}`;
|
|
140
|
-
}
|
|
141
|
-
if (trimmed === 'bold') return 'FontWeight.Bold';
|
|
142
|
-
if (trimmed === 'semibold') return 'FontWeight.SemiBold';
|
|
143
|
-
if (trimmed === 'medium') return 'FontWeight.Medium';
|
|
144
|
-
if (trimmed === 'normal') return 'FontWeight.Normal';
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function resolveSwiftFontWeight(value: NativePropValue | undefined): string | undefined {
|
|
151
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
152
|
-
if (value >= 700) return '.bold';
|
|
153
|
-
if (value >= 600) return '.semibold';
|
|
154
|
-
if (value >= 500) return '.medium';
|
|
155
|
-
return '.regular';
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (typeof value === 'string') {
|
|
159
|
-
const trimmed = value.trim().toLowerCase();
|
|
160
|
-
if (/^\d+$/.test(trimmed)) {
|
|
161
|
-
return resolveSwiftFontWeight(Number(trimmed));
|
|
162
|
-
}
|
|
163
|
-
if (trimmed === 'bold') return '.bold';
|
|
164
|
-
if (trimmed === 'semibold') return '.semibold';
|
|
165
|
-
if (trimmed === 'medium') return '.medium';
|
|
166
|
-
if (trimmed === 'normal') return '.regular';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function resolveComposeTextAlign(value: NativePropValue | undefined): string | undefined {
|
|
173
|
-
if (typeof value !== 'string') return undefined;
|
|
174
|
-
switch (value.trim().toLowerCase()) {
|
|
175
|
-
case 'center':
|
|
176
|
-
return 'TextAlign.Center';
|
|
177
|
-
case 'right':
|
|
178
|
-
case 'end':
|
|
179
|
-
return 'TextAlign.End';
|
|
180
|
-
case 'left':
|
|
181
|
-
case 'start':
|
|
182
|
-
return 'TextAlign.Start';
|
|
183
|
-
default:
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function resolveSwiftTextAlign(value: NativePropValue | undefined): string | undefined {
|
|
189
|
-
if (typeof value !== 'string') return undefined;
|
|
190
|
-
switch (value.trim().toLowerCase()) {
|
|
191
|
-
case 'center':
|
|
192
|
-
return '.center';
|
|
193
|
-
case 'right':
|
|
194
|
-
case 'end':
|
|
195
|
-
return '.trailing';
|
|
196
|
-
case 'left':
|
|
197
|
-
case 'start':
|
|
198
|
-
return '.leading';
|
|
199
|
-
default:
|
|
200
|
-
return undefined;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function buildComposeTextStyleArgsFromStyle(
|
|
205
|
-
style: Record<string, NativePropValue> | undefined,
|
|
206
|
-
styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
|
|
207
|
-
): string[] {
|
|
208
|
-
if (!style) {
|
|
209
|
-
return [];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const args: string[] = [];
|
|
213
|
-
const color = parseCssColor(style.color);
|
|
214
|
-
const fontSize = toScaledUnitNumber(style.fontSize, styleResolveOptions);
|
|
215
|
-
const fontWeight = resolveComposeFontWeight(style.fontWeight);
|
|
216
|
-
const fontFamily = resolveComposeFontFamily(style.fontFamily);
|
|
217
|
-
const letterSpacing = toScaledUnitNumber(style.letterSpacing, styleResolveOptions);
|
|
218
|
-
const lineHeight = resolveComposeLineHeight(style.lineHeight, style.fontSize, styleResolveOptions);
|
|
219
|
-
const textAlign = resolveComposeTextAlign(style.textAlign);
|
|
220
|
-
const textDecoration = resolveComposeTextDecoration(style.textDecoration);
|
|
221
|
-
|
|
222
|
-
if (color) args.push(`color = ${toComposeColorLiteral(color)}`);
|
|
223
|
-
if (fontSize !== undefined) args.push(`fontSize = ${formatFloat(fontSize)}.sp`);
|
|
224
|
-
if (fontWeight) args.push(`fontWeight = ${fontWeight}`);
|
|
225
|
-
if (fontFamily) args.push(`fontFamily = ${fontFamily}`);
|
|
226
|
-
if (letterSpacing !== undefined) args.push(`letterSpacing = ${formatFloat(letterSpacing)}.sp`);
|
|
227
|
-
if (lineHeight) args.push(`lineHeight = ${lineHeight}`);
|
|
228
|
-
if (textAlign) args.push(`textAlign = ${textAlign}`);
|
|
229
|
-
if (textDecoration) args.push(`textDecoration = ${textDecoration}`);
|
|
230
|
-
|
|
231
|
-
return args;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export function buildComposeLabelTextFromStyle(
|
|
235
|
-
label: string,
|
|
236
|
-
style: Record<string, NativePropValue> | undefined,
|
|
237
|
-
expression?: string,
|
|
238
|
-
styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
|
|
239
|
-
): string {
|
|
240
|
-
const transform = resolveTextTransform(style?.textTransform);
|
|
241
|
-
const textValue = expression
|
|
242
|
-
? applyComposeTextTransformExpression(expression, transform)
|
|
243
|
-
: quoteKotlinString(applyTextTransform(label, transform));
|
|
244
|
-
const args = [`text = ${textValue}`, ...buildComposeTextStyleArgsFromStyle(style, styleResolveOptions)];
|
|
245
|
-
return `Text(${args.join(', ')})`;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export function buildComposeTextStyleLiteralFromStyle(
|
|
249
|
-
style: Record<string, NativePropValue> | undefined,
|
|
250
|
-
styleResolveOptions: NativeStyleResolveOptions = getNativeStyleResolveOptions('generic'),
|
|
251
|
-
): string | undefined {
|
|
252
|
-
const args = buildComposeTextStyleArgsFromStyle(style, styleResolveOptions);
|
|
253
|
-
return args.length > 0 ? `androidx.compose.ui.text.TextStyle(${args.join(', ')})` : undefined;
|
|
254
|
-
}
|