embedded-react 0.12.0 → 0.14.0

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 (38) hide show
  1. package/README.md +222 -6
  2. package/aot/compile.mjs +3316 -364
  3. package/aot/style-map.mjs +30 -6
  4. package/assets/bake-font.mjs +104 -12
  5. package/assets/bake-svg.mjs +11 -1
  6. package/assets/build-builtin-font.mjs +6 -12
  7. package/assets/emit-c.mjs +10 -2
  8. package/assets/emit-container.mjs +4 -2
  9. package/assets/font-config.mjs +49 -0
  10. package/assets/font-sizes.mjs +652 -0
  11. package/assets/glyph-coverage.mjs +281 -0
  12. package/assets/index.mjs +29 -5
  13. package/build.mjs +11 -21
  14. package/cli.mjs +41 -3
  15. package/compile-bin.mjs +71 -0
  16. package/hotreload/pack-app.mjs +8 -21
  17. package/hotreload/pack-split.mjs +12 -27
  18. package/pack-container.mjs +10 -47
  19. package/package.json +2 -1
  20. package/sim/embedded-react.wasm +0 -0
  21. package/sim/index.html +32 -3
  22. package/sim-server.mjs +33 -27
  23. package/src/embedded-react/Animated.js +23 -9
  24. package/src/embedded-react/Button.js +98 -0
  25. package/src/embedded-react/FlatList.js +88 -0
  26. package/src/embedded-react/ImageBackground.js +67 -0
  27. package/src/embedded-react/PanResponder.js +326 -0
  28. package/src/embedded-react/SectionList.js +148 -0
  29. package/src/embedded-react/TouchableOpacity.js +152 -0
  30. package/src/embedded-react/components.js +4 -3
  31. package/src/embedded-react/index.d.ts +867 -60
  32. package/src/embedded-react/index.js +7 -2
  33. package/src/embedded-react/list-child.js +54 -0
  34. package/src/embedded-react/svg-ops.js +309 -77
  35. package/src/embedded-react/warn-props.js +80 -0
  36. package/src/host-config.js +103 -3
  37. package/src/props.js +40 -0
  38. package/src/renderer.js +31 -0
@@ -14,20 +14,116 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- // Public type declarations for the `embedded-react` package — the React Native analog. These cover the
18
- // common surface (View / Text / Pressable / Image / StyleSheet / Animated / hooks); the SVG primitives are
19
- // typed loosely for now. The runtime is JavaScript and ignores types entirely — these only power editors
20
- // and `tsc`. React hooks (useState, useEffect, …) still come from 'react', as in React Native.
17
+ // Public type declarations for the `embedded-react` package — the React Native analog. The runtime is
18
+ // JavaScript and ignores types entirely; these only power editors and `tsc`. React hooks (useState,
19
+ // useEffect, …) still come from 'react', as in React Native.
20
+ //
21
+ // What is declared here is what the RUNTIME honors. The sources of truth are the bridge's prop and event
22
+ // tables (`k_prop_names` / `event_type_from_name` in bridges/quickjs/native_ui_bridge.c), the top-level
23
+ // prop list (`PASSTHROUGH` in src/props.js), and the SVG compiler (src/embedded-react/svg-ops.js). A prop
24
+ // the engine ignores is deliberately absent, so a name that typechecks is a name that reaches the engine.
25
+ // `npm test` runs a parity test over those tables to keep it that way.
26
+ //
27
+ // Flow B (the AOT compiler) lowers a documented SUBSET of this surface and fails the build on anything it
28
+ // cannot compile, so these types describe Flow A and the AOT reports the difference.
21
29
 
22
- import type {ReactNode} from 'react';
30
+ import type {ReactNode, Ref} from 'react';
31
+
32
+ /** A node handle: what a `ref` on a host component receives, and what the imperative API takes. */
33
+ export type NodeHandle = number;
23
34
 
24
35
  // --- Styling ---------------------------------------------------------------
36
+
37
+ /**
38
+ * A box dimension. Percentage strings are resolved for `width` and `height` only — every other box
39
+ * property (margins, padding, min/max, borders, insets) takes pixels and ignores a string.
40
+ */
41
+ export type DimensionValue = number | `${number}%`;
42
+
43
+ /** Drop-shadow displacement in px (RN's `shadowOffset`). */
44
+ export interface ShadowOffset {
45
+ width: number;
46
+ height: number;
47
+ }
48
+
49
+ /** Fractional pivot `[x, y]` in 0–1 that `transform` rotates and scales about. Defaults to the centre. */
50
+ export type TransformOrigin = [number, number];
51
+
52
+ /**
53
+ * One transform entry. Every axis except `perspective` can be driven by an `AnimatedValue`; `scale` binds
54
+ * both axes at once. Rotations are CSS angle strings ('45deg', '0.5rad').
55
+ */
56
+ export type TransformStyle =
57
+ | {scale: number | AnimatedValue}
58
+ | {scaleX: number | AnimatedValue}
59
+ | {scaleY: number | AnimatedValue}
60
+ | {translateX: number | AnimatedValue}
61
+ | {translateY: number | AnimatedValue}
62
+ | {rotate: string | AnimatedValue}
63
+ | {rotateX: string | AnimatedValue}
64
+ | {rotateY: string | AnimatedValue}
65
+ | {rotateZ: string | AnimatedValue}
66
+ | {perspective: number};
67
+
68
+ /**
69
+ * Value type of an untyped style entry. Styles stay open (a not-yet-declared key is not an error), and the
70
+ * union covers the object- and array-valued entries — `shadowOffset`, `transformOrigin`, `transform` — so
71
+ * they are legal both under their own declarations and through the index signature.
72
+ */
73
+ export type StyleValue =
74
+ | string
75
+ | number
76
+ | AnimatedValue
77
+ | TransformStyle[]
78
+ | ShadowOffset
79
+ | TransformOrigin
80
+ | undefined;
81
+
25
82
  /** A single style object. Properties mirror the React Native subset the engine supports. */
26
83
  export interface ViewStyle {
27
- [key: string]: string | number | undefined | TransformStyle[];
84
+ [key: string]: StyleValue;
85
+
86
+ // Box size.
87
+ width?: DimensionValue;
88
+ height?: DimensionValue;
89
+ minWidth?: number;
90
+ minHeight?: number;
91
+ maxWidth?: number;
92
+ maxHeight?: number;
93
+ aspectRatio?: number;
94
+
95
+ // Insets (with `position: 'absolute'`). A percentage measures against the containing block:
96
+ // left/right against its width, top/bottom against its height.
97
+ top?: DimensionValue;
98
+ left?: DimensionValue;
99
+ right?: DimensionValue;
100
+ bottom?: DimensionValue;
101
+
102
+ // Margin.
103
+ margin?: number;
104
+ marginTop?: number;
105
+ marginRight?: number;
106
+ marginBottom?: number;
107
+ marginLeft?: number;
108
+ marginHorizontal?: number;
109
+ marginVertical?: number;
110
+
111
+ // Padding.
112
+ padding?: number;
113
+ paddingTop?: number;
114
+ paddingRight?: number;
115
+ paddingBottom?: number;
116
+ paddingLeft?: number;
117
+ paddingHorizontal?: number;
118
+ paddingVertical?: number;
119
+
120
+ // Flex.
28
121
  flex?: number;
122
+ flexGrow?: number;
123
+ flexShrink?: number;
124
+ flexBasis?: number;
29
125
  flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
30
- alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch';
126
+ flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
31
127
  justifyContent?:
32
128
  | 'flex-start'
33
129
  | 'flex-end'
@@ -35,111 +131,643 @@ export interface ViewStyle {
35
131
  | 'space-between'
36
132
  | 'space-around'
37
133
  | 'space-evenly';
38
- width?: number | string;
39
- height?: number | string;
40
- maxWidth?: number | string;
41
- maxHeight?: number | string;
42
- margin?: number;
43
- marginTop?: number;
44
- marginBottom?: number;
45
- marginLeft?: number;
46
- marginRight?: number;
47
- padding?: number;
48
- paddingVertical?: number;
49
- paddingHorizontal?: number;
134
+ alignItems?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch';
135
+ alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch';
136
+ alignContent?:
137
+ | 'flex-start'
138
+ | 'flex-end'
139
+ | 'center'
140
+ | 'stretch'
141
+ | 'space-between'
142
+ | 'space-around';
50
143
  gap?: number;
51
- backgroundColor?: string;
144
+ rowGap?: number;
145
+ columnGap?: number;
146
+
147
+ // Placement and visibility.
148
+ position?: 'relative' | 'absolute';
149
+ display?: 'flex' | 'none';
150
+ overflow?: 'visible' | 'hidden' | 'scroll';
151
+ zIndex?: number;
152
+ /**
153
+ * Hit-testing behaviour for this node and its subtree. 'none' ignores touches entirely, 'box-none' lets
154
+ * children be touched but not the node itself, 'box-only' the reverse. RN also allows this as a
155
+ * top-level prop; here it is a style entry, which is what the engine reads.
156
+ */
157
+ pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only';
158
+
159
+ // Paint.
160
+ backgroundColor?: string | AnimatedValue;
161
+ opacity?: number | AnimatedValue;
162
+
163
+ // Border.
52
164
  borderRadius?: number;
165
+ borderTopLeftRadius?: number;
166
+ borderTopRightRadius?: number;
167
+ borderBottomLeftRadius?: number;
168
+ borderBottomRightRadius?: number;
53
169
  borderWidth?: number;
170
+ borderTopWidth?: number;
171
+ borderRightWidth?: number;
172
+ borderBottomWidth?: number;
173
+ borderLeftWidth?: number;
54
174
  borderColor?: string;
55
- opacity?: number;
175
+ borderTopColor?: string;
176
+ borderRightColor?: string;
177
+ borderBottomColor?: string;
178
+ borderLeftColor?: string;
179
+ borderStyle?: 'solid' | 'dashed' | 'dotted';
180
+
181
+ // Transform.
56
182
  transform?: TransformStyle[];
57
- display?: 'flex' | 'none';
183
+ transformOrigin?: TransformOrigin;
184
+
185
+ // Shadow. Rendered only in a build with shadows enabled (ERUI_SHADOWS) and `shadowOpacity` above 0.
186
+ shadowColor?: string;
187
+ shadowOffset?: ShadowOffset;
188
+ shadowOpacity?: number;
189
+ shadowRadius?: number;
190
+ elevation?: number;
58
191
  }
59
192
 
60
193
  export interface TextStyle extends ViewStyle {
61
- color?: string;
194
+ color?: string | AnimatedValue;
62
195
  fontSize?: number;
63
196
  fontFamily?: string;
197
+ /** Anything from 600 up (or 'bold') selects the bold face; the engine carries no other weights. */
64
198
  fontWeight?: string | number;
199
+ /** 'italic' is a synthetic slant (horizontal shear), not a separate face. */
200
+ fontStyle?: 'normal' | 'italic';
65
201
  textAlign?: 'auto' | 'left' | 'right' | 'center';
202
+ textDecorationLine?: 'none' | 'underline' | 'line-through';
203
+ lineHeight?: number;
204
+ letterSpacing?: number;
66
205
  }
67
206
 
68
- export type TransformStyle =
69
- | {scale: number | AnimatedValue}
70
- | {scaleX: number | AnimatedValue}
71
- | {scaleY: number | AnimatedValue}
72
- | {translateX: number | AnimatedValue}
73
- | {translateY: number | AnimatedValue}
74
- | {rotate: string | AnimatedValue};
207
+ /** <Modal> styling: a View plus the scrim color painted behind the modal. */
208
+ export interface ModalStyle extends ViewStyle {
209
+ backdropColor?: string;
210
+ }
211
+
212
+ /** <TextInput> styling: text styling plus the caret color. */
213
+ export interface TextInputStyle extends TextStyle {
214
+ cursorColor?: string;
215
+ }
75
216
 
76
217
  export type StyleProp<T> = T | false | null | undefined | StyleProp<T>[];
77
218
 
219
+ // --- Events ----------------------------------------------------------------
220
+
221
+ /** The laid-out box reported by `onLayout`, in parent coordinates. */
222
+ export interface LayoutRectangle {
223
+ x: number;
224
+ y: number;
225
+ width: number;
226
+ height: number;
227
+ }
228
+
229
+ /**
230
+ * The object an event handler receives. `type` is the engine's own name for the event that fired, so a
231
+ * handler shared between events can switch on it. Coordinates are screen px; `dx`/`dy` are the distance
232
+ * traveled since the touch went down.
233
+ */
234
+ /**
235
+ * The touch payload every gesture callback receives: the point, the displacement from touch-down, and
236
+ * the speed the finger was traveling at when it was last measured. Raw `onTouch*` events carry the same
237
+ * fields as the responder events do, so a flick is `onTouchEnd={e => e.vx > 0.4 && next()}` — no
238
+ * PanResponder and no clock needed.
239
+ */
240
+ export interface TouchPoint {
241
+ x: number;
242
+ y: number;
243
+ dx: number;
244
+ dy: number;
245
+ /** Velocity in px/ms, measured over the most recent move (0 before the first one). */
246
+ vx: number;
247
+ vy: number;
248
+ }
249
+
250
+ export interface NativeEvent<T extends string = string> extends TouchPoint {
251
+ type: T;
252
+ }
253
+
254
+ /** The `type` string on each of the engine's responder lifecycle events. */
255
+ export type ResponderEvent = NativeEvent<
256
+ | 'responderGrant'
257
+ | 'responderReject'
258
+ | 'responderMove'
259
+ | 'responderRelease'
260
+ | 'responderTerminate'
261
+ >;
262
+
263
+ /**
264
+ * What a responder NEGOTIATION query is handed. Deliberately a bare `TouchPoint`: a query is not one
265
+ * of the named events — the engine asks it mid-hit-test — so the object carries NO `type` field. Reading
266
+ * `event.type` in a should-set predicate would be `undefined` at runtime, and the types say so.
267
+ */
268
+ export type ResponderQueryEvent = TouchPoint;
269
+
270
+ /** Any touch or press event — the type to give a handler shared across several of them. */
271
+ export type GestureResponderEvent = NativeEvent<
272
+ | 'press'
273
+ | 'longPress'
274
+ | 'pressIn'
275
+ | 'pressOut'
276
+ | 'touchStart'
277
+ | 'touchMove'
278
+ | 'touchEnd'
279
+ | 'touchCancel'
280
+ >;
281
+
282
+ /** Any <TextInput> focus / blur / submit event. */
283
+ export type TextInputEvent = NativeEvent<'focus' | 'blur' | 'submitEditing'>;
284
+
285
+ export interface ScrollEvent extends NativeEvent<'scroll'> {
286
+ scrollX: number;
287
+ scrollY: number;
288
+ }
289
+
290
+ export interface LayoutChangeEvent extends NativeEvent<'layout'> {
291
+ layout: LayoutRectangle;
292
+ }
293
+
294
+ /**
295
+ * The gesture responder system, RN-shaped — accepted on every host component. The `*ShouldSet*` props
296
+ * are negotiation QUERIES: on every touch-down (start) and touch-move (move) the engine walks the hit
297
+ * chain — capture phase root→leaf first, then bubble leaf→root — and the first node whose predicate
298
+ * returns true claims the gesture. The `onResponder*` events then fire on the owner alone. A granted
299
+ * responder blocks a ScrollView ancestor's auto-scroll and takes the gesture back from one that has
300
+ * already started scrolling. Most apps want `PanResponder` (below) instead of wiring these directly.
301
+ */
302
+ export interface GestureResponderHandlers {
303
+ onStartShouldSetResponder?: (event: ResponderQueryEvent) => boolean;
304
+ onStartShouldSetResponderCapture?: (event: ResponderQueryEvent) => boolean;
305
+ onMoveShouldSetResponder?: (event: ResponderQueryEvent) => boolean;
306
+ onMoveShouldSetResponderCapture?: (event: ResponderQueryEvent) => boolean;
307
+ /** The gesture was won: this node now owns the touch stream. */
308
+ onResponderGrant?: (event: ResponderEvent) => void;
309
+ /** A claim was refused — the current owner declined to yield. Re-asked on later moves. */
310
+ onResponderReject?: (event: ResponderEvent) => void;
311
+ /** A move while owning the gesture; `dx`/`dy` accumulate from touch-down. */
312
+ onResponderMove?: (event: ResponderEvent) => void;
313
+ /** The touch lifted while this node owned the gesture. */
314
+ onResponderRelease?: (event: ResponderEvent) => void;
315
+ /** The gesture was taken away (a canceled touch, or this node yielded to a challenger). */
316
+ onResponderTerminate?: (event: ResponderEvent) => void;
317
+ /** A challenger wants the gesture: return true to yield (the default), false to keep it. */
318
+ onResponderTerminationRequest?: (event: ResponderQueryEvent) => boolean;
319
+ }
320
+
321
+ /**
322
+ * Touch and layout handlers, accepted on every host component. Raw touches bubble from the node that was
323
+ * hit up through its ancestors, so a handler on a container sees its children's touches too — and they
324
+ * keep bubbling whatever the responder system decides; the responder props above are how a node OWNS a
325
+ * gesture. `onTouchCancel` fires when the sequence is abandoned rather than finished — the host reporting
326
+ * a canceled touch, or a fresh touch-down on a finger whose previous sequence never ended — and is the
327
+ * hook for undoing whatever `onTouchStart` began.
328
+ */
329
+ export interface TouchEventProps extends GestureResponderHandlers {
330
+ onTouchStart?: (event: NativeEvent<'touchStart'>) => void;
331
+ onTouchMove?: (event: NativeEvent<'touchMove'>) => void;
332
+ onTouchEnd?: (event: NativeEvent<'touchEnd'>) => void;
333
+ onTouchCancel?: (event: NativeEvent<'touchCancel'>) => void;
334
+ onLayout?: (event: LayoutChangeEvent) => void;
335
+ }
336
+
337
+ /**
338
+ * The press family. A press looks for the nearest ancestor carrying one of these, so wrapping a subtree in
339
+ * a single <Pressable> is enough — no handler per child.
340
+ */
341
+ export interface PressEventProps {
342
+ onPress?: (event: NativeEvent<'press'>) => void;
343
+ onLongPress?: (event: NativeEvent<'longPress'>) => void;
344
+ onPressIn?: (event: NativeEvent<'pressIn'>) => void;
345
+ onPressOut?: (event: NativeEvent<'pressOut'>) => void;
346
+ delayLongPress?: number;
347
+ }
348
+
78
349
  // --- Components ------------------------------------------------------------
79
- export interface ViewProps {
350
+
351
+ export interface ViewProps extends TouchEventProps {
80
352
  style?: StyleProp<ViewStyle>;
81
353
  children?: ReactNode;
354
+ /** Prunes the subtree from layout, raster and hit-testing without unmounting it (style `display` wins). */
82
355
  visible?: boolean;
356
+ ref?: Ref<NodeHandle>;
83
357
  }
84
358
 
85
- export interface TextProps {
359
+ export interface TextProps extends TouchEventProps {
86
360
  style?: StyleProp<TextStyle>;
87
361
  children?: ReactNode;
362
+ /** Truncate past this many lines. 0 (the default) does not truncate. */
88
363
  numberOfLines?: number;
364
+ ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
365
+ visible?: boolean;
366
+ ref?: Ref<NodeHandle>;
89
367
  }
90
368
 
91
- export interface PressableProps {
369
+ /**
370
+ * An image source: the name an asset import resolves to (the bundler's image plugin turns
371
+ * `import logo from './logo.png'` into the file's basename), or an RN-style `{uri}`. RN's numeric
372
+ * `require()` id is not accepted — it carries no engine-side asset name, so it never resolves.
373
+ */
374
+ export type ImageSource = string | {uri: string};
375
+
376
+ export interface ImageProps extends TouchEventProps {
377
+ source: ImageSource;
378
+ style?: StyleProp<ViewStyle>;
379
+ /** How the bitmap fills its box. Defaults to 'cover'. */
380
+ resizeMode?: 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
381
+ /** Recolors the image, keeping its alpha — for monochrome icons. */
382
+ tintColor?: string;
383
+ /** The engine asset name, when set directly instead of through `source`. */
384
+ imageName?: string;
385
+ visible?: boolean;
386
+ ref?: Ref<NodeHandle>;
387
+ }
388
+
389
+ export interface PressableProps extends TouchEventProps, PressEventProps {
92
390
  style?: StyleProp<ViewStyle>;
93
391
  children?: ReactNode;
94
- onPress?: () => void;
95
392
  disabled?: boolean;
96
393
  visible?: boolean;
394
+ ref?: Ref<NodeHandle>;
395
+ }
396
+
397
+ /**
398
+ * A `<Pressable>` that dims while it is held — every Pressable prop works here unchanged. The fade runs
399
+ * on the native driver, so it costs no re-render; note that a dimmed node composites its whole subtree
400
+ * off-screen, so dim the box that reads as the button rather than the surrounding screen.
401
+ *
402
+ * The press feedback owns `opacity`: an animated one in `style` is ignored here and rejected by the AOT.
403
+ * To animate opacity yourself, use `<Pressable>`. Animating any other property, `transform` included, is
404
+ * fine.
405
+ */
406
+ export interface TouchableOpacityProps extends PressableProps {
407
+ /** Opacity to dim to while held, 0–1. Defaults to RN's 0.2. */
408
+ activeOpacity?: number;
97
409
  }
98
410
 
99
- export type ImageSource = number | string | {uri: string};
411
+ /**
412
+ * A scrolling container. It scrolls whichever axis overflows, so lay the content out with
413
+ * `flexDirection: 'row'` for a horizontal scroller.
414
+ */
415
+ export interface ScrollViewProps extends ViewProps {
416
+ onScroll?: (event: ScrollEvent) => void;
417
+ }
100
418
 
101
- export interface ImageProps {
102
- source: ImageSource;
419
+ /**
420
+ * `<FlatList>` is a thin `<ScrollView>` alias, **not** a virtualized list — every row mounts as a real
421
+ * engine node and stays mounted. These four props are the only ones either flow honors (the AOT
422
+ * rejects the rest at compile time); for headers, footers, separators, `horizontal` or
423
+ * `onEndReached`, use a `<ScrollView>` with `.map` directly.
424
+ */
425
+ export interface FlatListProps<T = unknown> {
426
+ data?: readonly T[];
427
+ renderItem?: (info: {item: T; index: number}) => ReactNode;
428
+ keyExtractor?: (item: T, index: number) => string | number;
103
429
  style?: StyleProp<ViewStyle>;
104
430
  }
105
431
 
106
- export interface ScrollViewProps extends ViewProps {
107
- horizontal?: boolean;
432
+ /**
433
+ * `<SectionList>` is a thin `<ScrollView>` alias like `<FlatList>` — no virtualization, no sticky
434
+ * headers, and every header, row and footer mounts as a real engine node and stays mounted. Header,
435
+ * rows and footer are flat siblings, exactly as in RN. Flow A / simulator only for now: the AOT has no
436
+ * `<SectionList>` lowering yet.
437
+ */
438
+ export interface SectionListProps<ItemT = unknown, SectionT = DefaultSectionT> {
439
+ sections?: ReadonlyArray<SectionListData<ItemT, SectionT>>;
440
+ renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => ReactNode;
441
+ renderSectionHeader?: (info: {
442
+ section: SectionListData<ItemT, SectionT>;
443
+ }) => ReactNode;
444
+ renderSectionFooter?: (info: {
445
+ section: SectionListData<ItemT, SectionT>;
446
+ }) => ReactNode;
447
+ keyExtractor?: (item: ItemT, index: number) => string | number;
448
+ style?: StyleProp<ViewStyle>;
108
449
  }
109
450
 
110
- export interface TextInputProps {
111
- style?: StyleProp<TextStyle>;
451
+ /** Whatever else a section carries alongside its `data` — RN's convention is a `title`. */
452
+ export type DefaultSectionT = {[key: string]: any};
453
+
454
+ /** One section: your own fields, plus the row data and the optional per-section overrides. */
455
+ export type SectionListData<ItemT, SectionT = DefaultSectionT> = SectionT & {
456
+ data: readonly ItemT[];
457
+ /** Namespaces this section's row keys. Defaults to the section's index. */
458
+ key?: string | number;
459
+ /** Overrides the list-wide `renderItem` for this section only. */
460
+ renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => ReactNode;
461
+ /** Overrides the list-wide `keyExtractor` for this section only. */
462
+ keyExtractor?: (item: ItemT, index: number) => string | number;
463
+ };
464
+
465
+ /** What `renderItem` is called with. RN's `separators` is absent — there are no separators here. */
466
+ export interface SectionListRenderItemInfo<ItemT, SectionT = DefaultSectionT> {
467
+ item: ItemT;
468
+ /** The row's index WITHIN its section. */
469
+ index: number;
470
+ section: SectionListData<ItemT, SectionT>;
471
+ }
472
+
473
+ /**
474
+ * RN's pre-styled button: a `<Pressable>` around a single centred `<Text>`. It takes no `style` — that
475
+ * is upstream's design, and the escape hatch is the same one RN gives you: build the `<Pressable>` +
476
+ * `<Text>` yourself. Accessibility, TV-focus and `testID` props are accepted and ignored (no OS to
477
+ * report them to); anything else warns once.
478
+ */
479
+ export interface ButtonProps {
480
+ title?: string;
481
+ onPress?: (event: NativeEvent<'press'>) => void;
482
+ /** Fill colour, replacing the default blue. */
483
+ color?: string;
484
+ /** Greys the button out and detaches `onPress`. */
485
+ disabled?: boolean;
486
+ }
487
+
488
+ /**
489
+ * A `<View>` with an `<Image>` stretched behind its children — what you reach for because `<Image>`
490
+ * takes no children. `style` lays out the container; every other prop goes to the image, as upstream.
491
+ */
492
+ export interface ImageBackgroundProps extends Omit<
493
+ ImageProps,
494
+ 'style' | 'ref'
495
+ > {
496
+ /** Container style — the box the picture fills (its content box, so padding insets the picture). */
497
+ style?: StyleProp<ViewStyle>;
498
+ /** Merged over the fill: `borderRadius`, `opacity`, `tintColor`. */
499
+ imageStyle?: StyleProp<ViewStyle>;
500
+ /** Ref to the `<Image>` node; the outer `ref` points at the `<View>`. */
501
+ imageRef?: Ref<NodeHandle>;
502
+ children?: ReactNode;
503
+ ref?: Ref<NodeHandle>;
504
+ }
505
+
506
+ export interface TextInputProps extends TouchEventProps {
507
+ style?: StyleProp<TextInputStyle>;
112
508
  value?: string;
113
509
  placeholder?: string;
510
+ placeholderTextColor?: string;
511
+ editable?: boolean;
512
+ secureTextEntry?: boolean;
513
+ visible?: boolean;
114
514
  onChangeText?: (text: string) => void;
515
+ onSubmitEditing?: (event: NativeEvent<'submitEditing'>) => void;
516
+ onFocus?: (event: NativeEvent<'focus'>) => void;
517
+ onBlur?: (event: NativeEvent<'blur'>) => void;
518
+ ref?: Ref<NodeHandle>;
115
519
  }
116
520
 
117
- export interface SwitchProps {
521
+ export interface SwitchProps extends TouchEventProps {
522
+ style?: StyleProp<ViewStyle>;
118
523
  value?: boolean;
119
524
  onValueChange?: (value: boolean) => void;
525
+ trackColor?: {false?: string; true?: string};
526
+ thumbColor?: string;
527
+ visible?: boolean;
528
+ ref?: Ref<NodeHandle>;
529
+ }
530
+
531
+ export interface ActivityIndicatorProps extends TouchEventProps {
532
+ /** The spinner tint comes from the style's `color`, as in RN. */
533
+ style?: StyleProp<TextStyle>;
534
+ /** Whether the spinner is turning. Defaults to true. */
535
+ animating?: boolean;
536
+ visible?: boolean;
537
+ ref?: Ref<NodeHandle>;
538
+ }
539
+
540
+ export interface ModalProps extends TouchEventProps {
541
+ style?: StyleProp<ModalStyle>;
542
+ children?: ReactNode;
543
+ visible?: boolean;
544
+ backdropColor?: string;
545
+ ref?: Ref<NodeHandle>;
546
+ }
547
+
548
+ export interface DialGradient {
549
+ /** 'conic' sweeps the stops along the angle; 'radial' across the thickness. */
550
+ type: 'conic' | 'radial';
551
+ stops: Array<{color: string; offset?: number}>;
552
+ }
553
+
554
+ /**
555
+ * Native arc widget: a dial / gauge / progress ring rasterized analytically by the engine. Angles are
556
+ * degrees clockwise from 3 o'clock; the default is a 270° sweep starting at 135° (the LVGL arc).
557
+ */
558
+ export interface DialProps extends TouchEventProps {
559
+ style?: StyleProp<ViewStyle>;
560
+ /** Current value in [min, max]. Animatable with Animated.Value (native driver). */
561
+ value?: number | AnimatedValue;
562
+ min?: number;
563
+ max?: number;
564
+ startAngle?: number;
565
+ sweepAngle?: number;
566
+ /** Drag quantisation step (default 1). */
567
+ step?: number;
568
+ /** Track + indicator thickness in px (default: 1/10 of the smaller side). */
569
+ thickness?: number;
570
+ /** Optional wider backing band behind the track, centred on it. */
571
+ bandThickness?: number;
572
+ bandColor?: string;
573
+ trackColor?: string;
574
+ indicatorColor?: string;
575
+ /** Indicator paint ramp; overrides indicatorColor. */
576
+ indicatorGradient?: DialGradient;
577
+ cap?: 'butt' | 'round';
578
+ /** Split the arc into N segments separated by gapAngle degrees (default 2). */
579
+ segments?: number;
580
+ gapAngle?: number;
581
+ /** 'child': the engine positions the first child on the value point (multi-knob dials, custom knobs). */
582
+ knob?: 'none' | 'circle' | 'image' | 'child';
583
+ knobSize?: number;
584
+ knobColor?: string;
585
+ knobBorderColor?: string;
586
+ knobBorderWidth?: number;
587
+ knobImage?: ImageSource;
588
+ /** Built-in drag-to-set: the knob follows the finger natively; onChange gets the quantized value. */
589
+ adjustable?: boolean;
590
+ /**
591
+ * Dual-setpoint mode: the indicator spans [valueStart, value] and gets a knob at each end. A drag
592
+ * latches the end it started nearest, and the ends clamp against each other instead of crossing.
593
+ */
594
+ range?: boolean;
595
+ /** RANGE mode: the band's low end. Animatable like `value`. */
596
+ valueStart?: number | AnimatedValue;
597
+ /**
598
+ * RANGE mode: the minimum separation the two ends keep, in value units. 0 (default) lets them meet.
599
+ * Above 0, a drag that would close the gap pushes the far end along instead of stopping dead, and
600
+ * stops only once that end reaches the range bound.
601
+ */
602
+ minSpan?: number;
603
+ /** Called with the new value; in `range` mode the band's low end is the second argument. */
604
+ onChange?: (value: number, valueStart: number) => void;
605
+ visible?: boolean;
606
+ children?: ReactNode;
607
+ ref?: Ref<NodeHandle>;
120
608
  }
121
609
 
122
610
  export const View: (props: ViewProps) => JSX.Element;
123
611
  export const Text: (props: TextProps) => JSX.Element;
124
612
  export const Image: (props: ImageProps) => JSX.Element;
125
613
  export const Pressable: (props: PressableProps) => JSX.Element;
126
- export const TouchableOpacity: (props: PressableProps) => JSX.Element;
614
+ export const TouchableOpacity: (props: TouchableOpacityProps) => JSX.Element;
127
615
  export const ScrollView: (props: ScrollViewProps) => JSX.Element;
128
- export const FlatList: (props: Record<string, unknown>) => JSX.Element;
616
+ export function FlatList<T>(props: FlatListProps<T>): JSX.Element;
617
+ export function SectionList<ItemT, SectionT = DefaultSectionT>(
618
+ props: SectionListProps<ItemT, SectionT>,
619
+ ): JSX.Element;
620
+ export const Button: (props: ButtonProps) => JSX.Element;
621
+ export const ImageBackground: (props: ImageBackgroundProps) => JSX.Element;
129
622
  export const TextInput: (props: TextInputProps) => JSX.Element;
130
623
  export const Switch: (props: SwitchProps) => JSX.Element;
131
- export const ActivityIndicator: (props: ViewProps) => JSX.Element;
132
- export const Modal: (props: ViewProps) => JSX.Element;
133
-
134
- // SVG primitives (see the repo for their full prop sets).
135
- export const Svg: (props: Record<string, unknown>) => JSX.Element;
136
- export const Path: (props: Record<string, unknown>) => JSX.Element;
137
- export const Circle: (props: Record<string, unknown>) => JSX.Element;
138
- export const Ellipse: (props: Record<string, unknown>) => JSX.Element;
139
- export const Rect: (props: Record<string, unknown>) => JSX.Element;
140
- export const Line: (props: Record<string, unknown>) => JSX.Element;
141
- export const G: (props: Record<string, unknown>) => JSX.Element;
142
- export const Arc: (props: Record<string, unknown>) => JSX.Element;
624
+ export const ActivityIndicator: (props: ActivityIndicatorProps) => JSX.Element;
625
+ export const Modal: (props: ModalProps) => JSX.Element;
626
+ export const Dial: (props: DialProps) => JSX.Element;
627
+
628
+ // --- SVG -------------------------------------------------------------------
629
+ // <Svg> is the only host node (an engine vector node). The shape tags are descriptive children that the
630
+ // renderer flattens into that node's op-tape — like raw text inside <Text>, they are never mounted on
631
+ // their own, so they take no style, no events and no ref. Use them only inside an <Svg>.
632
+ // Arrays and fragments around them are unwrapped, so a mapped list of shapes works. A component is never
633
+ // rendered — flattening the subtree means it is not mounted, so `<Needle/>` draws nothing whatever it
634
+ // returns; inline its shapes, or call it as a plain function ({needle()}) to put them in children.
635
+
636
+ /** An SVG geometry attribute: a number, or a numeric string as in the SVG markup ('12', '1.5'). */
637
+ export type SvgNumber = number | string;
638
+
639
+ /** Gradient kind: 1 linear (axis (ax,ay)→(bx,by)), 2 radial (centre (ax,ay), radius r), 3 conic. */
640
+ export type VectorGradientType = 1 | 2 | 3;
641
+
642
+ /**
643
+ * A gradient ramp for a shape's fill or stroke. Up to 8 stops are carried to the engine; a longer list is
644
+ * resampled down to 8 rather than truncated, so the ramp keeps its shape.
645
+ */
646
+ export interface VectorGradient {
647
+ type: VectorGradientType;
648
+ stops: Array<{color: string | number; offset: number}>;
649
+ ax?: number;
650
+ ay?: number;
651
+ bx?: number;
652
+ by?: number;
653
+ r?: number;
654
+ }
655
+
656
+ /**
657
+ * Paint attributes, shared by every shape. A <G> resolves these for its children, which override
658
+ * individually. Colours accept #rgb / #rgba / #rrggbb / #rrggbbaa, rgb() / rgba(), and a small named set
659
+ * (none, transparent, black, white, red, green, blue, gray). An unfilled shape defaults to BLACK — set
660
+ * `fill="none"` on anything meant to be stroke-only.
661
+ */
662
+ export interface SvgPaintProps {
663
+ fill?: string;
664
+ stroke?: string;
665
+ strokeWidth?: SvgNumber;
666
+ strokeLinecap?: 'butt' | 'round' | 'square';
667
+ strokeLinejoin?: 'miter' | 'round' | 'bevel';
668
+ strokeMiterlimit?: SvgNumber;
669
+ fillRule?: 'nonzero' | 'evenodd';
670
+ /** Fills with a gradient instead of the solid `fill`. */
671
+ fillGrad?: VectorGradient;
672
+ /** Strokes with a gradient instead of the solid `stroke`. */
673
+ strokeGrad?: VectorGradient;
674
+ }
675
+
676
+ /** A `.svg` import: the build bakes it to a vector op-tape, or to a raster asset when it uses features the
677
+ * vector baker cannot represent (text, masks, filters). Pass it straight to `<Svg source>`. */
678
+ export type SvgSource =
679
+ | {
680
+ kind: 'vector';
681
+ ops: number[];
682
+ paints: number[];
683
+ gradients?: unknown[];
684
+ width: number;
685
+ height: number;
686
+ }
687
+ | {kind: 'raster'; name: string; width: number; height: number};
688
+
689
+ export interface SvgProps extends SvgPaintProps, TouchEventProps {
690
+ children?: ReactNode;
691
+ /** An imported `.svg`. Its tape is scaled to the render box and any shape children are ignored. */
692
+ source?: SvgSource;
693
+ /** Render-box size. Taken as direct props (the react-native-svg convention); a style width/height wins. */
694
+ width?: SvgNumber;
695
+ height?: SvgNumber;
696
+ /** 'minX minY width height'. Coordinates are baked into the tape against width/height. */
697
+ viewBox?: string;
698
+ style?: StyleProp<ViewStyle>;
699
+ visible?: boolean;
700
+ ref?: Ref<NodeHandle>;
701
+ }
702
+
703
+ /** Groups shapes under one paint and an optional translate/scale, composed with any enclosing <G>. */
704
+ export interface GProps extends SvgPaintProps {
705
+ children?: ReactNode;
706
+ x?: SvgNumber;
707
+ y?: SvgNumber;
708
+ translateX?: SvgNumber;
709
+ translateY?: SvgNumber;
710
+ scale?: SvgNumber;
711
+ }
712
+
713
+ export interface PathProps extends SvgPaintProps {
714
+ /** Path data. M/L/H/V/C/S/Q/T/A/Z, absolute and relative. Parsing a `d` string costs more than the
715
+ * primitive shapes — prefer <Circle>/<Rect>/<Arc> for anything rebuilt per frame. */
716
+ d?: string;
717
+ }
718
+
719
+ export interface CircleProps extends SvgPaintProps {
720
+ cx?: SvgNumber;
721
+ cy?: SvgNumber;
722
+ r?: SvgNumber;
723
+ }
724
+
725
+ export interface EllipseProps extends SvgPaintProps {
726
+ cx?: SvgNumber;
727
+ cy?: SvgNumber;
728
+ rx?: SvgNumber;
729
+ ry?: SvgNumber;
730
+ }
731
+
732
+ export interface RectProps extends SvgPaintProps {
733
+ x?: SvgNumber;
734
+ y?: SvgNumber;
735
+ width?: SvgNumber;
736
+ height?: SvgNumber;
737
+ /** Corner radii. Omitting one (or giving it a negative value, which SVG treats as `auto`) falls back to
738
+ * the other; each is clamped to half its own side. */
739
+ rx?: SvgNumber;
740
+ ry?: SvgNumber;
741
+ }
742
+
743
+ export interface LineProps extends SvgPaintProps {
744
+ x1?: SvgNumber;
745
+ y1?: SvgNumber;
746
+ x2?: SvgNumber;
747
+ y2?: SvgNumber;
748
+ }
749
+
750
+ /**
751
+ * Circular-arc convenience primitive (not a standard SVG element). Angles are DEGREES clockwise from
752
+ * 12 o'clock. It emits a native arc op — no `d` parsing or bezier conversion — so it is cheap enough to
753
+ * rebuild every drag frame.
754
+ */
755
+ export interface ArcProps extends SvgPaintProps {
756
+ cx?: SvgNumber;
757
+ cy?: SvgNumber;
758
+ r?: SvgNumber;
759
+ startAngle?: SvgNumber;
760
+ endAngle?: SvgNumber;
761
+ }
762
+
763
+ export const Svg: (props: SvgProps) => JSX.Element;
764
+ export const Path: (props: PathProps) => JSX.Element;
765
+ export const Circle: (props: CircleProps) => JSX.Element;
766
+ export const Ellipse: (props: EllipseProps) => JSX.Element;
767
+ export const Rect: (props: RectProps) => JSX.Element;
768
+ export const Line: (props: LineProps) => JSX.Element;
769
+ export const G: (props: GProps) => JSX.Element;
770
+ export const Arc: (props: ArcProps) => JSX.Element;
143
771
 
144
772
  // --- StyleSheet ------------------------------------------------------------
145
773
  export const StyleSheet: {
@@ -193,7 +821,10 @@ export const Animated: {
193
821
  spring(value: AnimatedValue, config: AnimationConfig): Animation;
194
822
  decay(value: AnimatedValue, config: Record<string, unknown>): Animation;
195
823
  sequence(animations: Animation[]): Animation;
196
- parallel(animations: Animation[], config?: {stopTogether?: boolean}): Animation;
824
+ parallel(
825
+ animations: Animation[],
826
+ config?: {stopTogether?: boolean},
827
+ ): Animation;
197
828
  stagger(delay: number, animations: Animation[]): Animation;
198
829
  loop(animation: Animation, config?: {iterations?: number}): Animation;
199
830
  delay(ms: number): Animation;
@@ -210,6 +841,182 @@ export function usePersistentState<S>(
210
841
  export function useHostValue(initial: number): number;
211
842
  export const Easing: Record<string, (t: number) => number>;
212
843
  export const LayoutAnimation: Record<string, unknown>;
213
- export function updateVector(...args: unknown[]): void;
214
- export function updateText(...args: unknown[]): void;
215
- export function setKeyboardConfig(...args: unknown[]): void;
844
+
845
+ // --- PanResponder ----------------------------------------------------------
846
+
847
+ /**
848
+ * The running state of a drag, handed to every PanResponder callback. It is ONE mutable object reused
849
+ * for the responder's lifetime — read what you need during the callback; don't stash it expecting a
850
+ * snapshot.
851
+ */
852
+ export interface PanResponderGestureState {
853
+ /** Identifies this responder; stable for its lifetime. */
854
+ stateID: number;
855
+ /** Latest touchpoint. */
856
+ moveX: number;
857
+ moveY: number;
858
+ /** Where the gesture was granted — the anchor `dx`/`dy` are measured from. */
859
+ x0: number;
860
+ y0: number;
861
+ /** Travel since the grant, in pixels. */
862
+ dx: number;
863
+ dy: number;
864
+ /** Velocity in pixels per millisecond. */
865
+ vx: number;
866
+ vy: number;
867
+ /** Fingers currently on the panel. */
868
+ numberActiveTouches: number;
869
+ }
870
+
871
+ export type PanResponderCallback = (
872
+ event: ResponderEvent,
873
+ gestureState: PanResponderGestureState,
874
+ ) => void;
875
+
876
+ /**
877
+ * Returning `true` claims the gesture — or, for a termination request, KEEPS it. The event is a bare
878
+ * touchpoint: a negotiation query carries no `type`.
879
+ */
880
+ export type PanResponderPredicate = (
881
+ event: ResponderQueryEvent,
882
+ gestureState: PanResponderGestureState,
883
+ ) => boolean;
884
+
885
+ /**
886
+ * RN's PanResponder config, riding the engine's native responder system (the low-level
887
+ * GestureResponderHandlers above). Returning `true` from a should-set predicate claims the gesture
888
+ * through real negotiation — capture asks root→leaf before bubble asks leaf→root — so a granted pan
889
+ * OWNS the touch stream: a ScrollView ancestor will not auto-scroll under it, and a move-should-set
890
+ * claim takes the gesture back from a scroller that already started. With no should-set supplied the
891
+ * responder never grants, exactly as in RN.
892
+ *
893
+ * Only `onShouldBlockNativeResponder` (Android-specific) is absent; passing it — or a typo — warns.
894
+ *
895
+ * Flow B compiles this config too: the AOT lowers `useRef(PanResponder.create({…})).current` and the
896
+ * `{...pan.panHandlers}` spread onto the same engine responder system, so the gesture needs no JS on the
897
+ * device. `onPanResponderStart`/`End` are the exception — they fold EXTRA fingers into one gesture, which
898
+ * is Flow A only, and the AOT fails the build by name rather than dropping them.
899
+ */
900
+ export interface PanResponderConfig {
901
+ onStartShouldSetPanResponder?: PanResponderPredicate;
902
+ onStartShouldSetPanResponderCapture?: PanResponderPredicate;
903
+ onMoveShouldSetPanResponder?: PanResponderPredicate;
904
+ onMoveShouldSetPanResponderCapture?: PanResponderPredicate;
905
+ onPanResponderGrant?: PanResponderCallback;
906
+ onPanResponderMove?: PanResponderCallback;
907
+ onPanResponderRelease?: PanResponderCallback;
908
+ /** The gesture was taken away: a canceled touch, or this responder yielded to a challenger. */
909
+ onPanResponderTerminate?: PanResponderCallback;
910
+ /** A challenger wants the gesture: return true to yield (the default), false to keep it. */
911
+ onPanResponderTerminationRequest?: PanResponderPredicate;
912
+ /** This responder's claim lost a negotiation. Re-asked claims are re-rejected on later moves. */
913
+ onPanResponderReject?: PanResponderCallback;
914
+ /** A later finger joined the gesture in flight. Flow A only (the AOT rejects it by name). */
915
+ onPanResponderStart?: PanResponderCallback;
916
+ /**
917
+ * A finger lifted, but the gesture continues on the ones still down. Driven by the raw touch stream
918
+ * rather than a responder event, so this one receives the `touchEnd` payload. Flow A only (the AOT
919
+ * rejects it by name).
920
+ */
921
+ onPanResponderEnd?: (
922
+ event: NativeEvent<'touchEnd'>,
923
+ gestureState: PanResponderGestureState,
924
+ ) => void;
925
+ }
926
+
927
+ export interface PanResponderInstance {
928
+ /** Spread onto any component: `<View {...pan.panHandlers} />`. */
929
+ panHandlers: TouchEventProps;
930
+ }
931
+
932
+ /**
933
+ * Recognizes drags, swipes, and flings via the native gesture responder system. Create it ONCE per
934
+ * component and keep it in a ref — the handlers close over one gesture state, so re-creating it per
935
+ * render loses the drag.
936
+ */
937
+ export const PanResponder: {
938
+ create(config?: PanResponderConfig): PanResponderInstance;
939
+ };
940
+
941
+ // --- Imperative escape hatch -----------------------------------------------
942
+ // For continuous gestures, where a React render per pointer move is too slow. Grab a node handle from a
943
+ // ref, push updates here, and commit back to React state when the gesture ends.
944
+
945
+ /**
946
+ * One primitive for `updateVector`: exactly one geometry key plus its paint. Note the SHORT paint spellings
947
+ * (`cap`, `join`, `miter`) — this is the allocation-free path, not the JSX attribute set.
948
+ */
949
+ export interface VectorShape {
950
+ /** [cx, cy, r, startDeg, endDeg] — degrees clockwise from 12 o'clock. */
951
+ arc?: [number, number, number, number, number];
952
+ /** [cx, cy, r] */
953
+ circle?: [number, number, number];
954
+ /** [x1, y1, x2, y2] */
955
+ line?: [number, number, number, number];
956
+ /** [x, y, w, h], or [x, y, w, h, rx, ry] for rounded corners. */
957
+ rect?:
958
+ | [number, number, number, number]
959
+ | [number, number, number, number, number, number];
960
+ /** Path data. Slower than the primitives above (regex + bezier conversion). */
961
+ path?: string;
962
+ fill?: string;
963
+ stroke?: string;
964
+ strokeWidth?: number;
965
+ miter?: number;
966
+ cap?: 'butt' | 'round' | 'square';
967
+ join?: 'miter' | 'round' | 'bevel';
968
+ fillRule?: 'nonzero' | 'evenodd';
969
+ fillGrad?: VectorGradient;
970
+ strokeGrad?: VectorGradient;
971
+ }
972
+
973
+ /**
974
+ * Sets an <Svg> node's geometry from primitive shape descriptors, skipping React and the `d` parser.
975
+ * `dirtyRect` is an optional node-local [x, y, w, h] bounding the change; give it and only that region is
976
+ * repainted, which is a large win for a small update on a big vector node.
977
+ */
978
+ export function updateVector(
979
+ handle: NodeHandle | null | undefined,
980
+ shapes: VectorShape[],
981
+ dirtyRect?: [number, number, number, number],
982
+ ): void;
983
+
984
+ /** Sets a <Text> node's content without disturbing its style. A later React render reverts cleanly. */
985
+ export function updateText(
986
+ handle: NodeHandle | null | undefined,
987
+ text: string | number,
988
+ ): void;
989
+
990
+ /** One key in a `setKeyboardConfig` layer. `char` types it; `layer` switches layer; `backspace`/`done` act. */
991
+ export interface KeyboardKey {
992
+ char?: string;
993
+ label?: string;
994
+ /** Index of the layer this key switches to. */
995
+ layer?: number;
996
+ backspace?: boolean;
997
+ done?: boolean;
998
+ /** Grid columns the key spans (default 1) — a wider space bar or shift. */
999
+ span?: number;
1000
+ /** Lit while its own layer is showing. */
1001
+ highlight?: boolean;
1002
+ }
1003
+
1004
+ /** A keyboard layout: layers of rows of keys. Omit `layers` to keep the built-in QWERTY. */
1005
+ export interface KeyboardConfig {
1006
+ panelColor?: string;
1007
+ keyColor?: string;
1008
+ keyActiveColor?: string;
1009
+ labelColor?: string;
1010
+ fontSize?: number;
1011
+ rowHeight?: number;
1012
+ keyGap?: number;
1013
+ keyRadius?: number;
1014
+ gridCols?: number;
1015
+ layers?: KeyboardKey[][][];
1016
+ }
1017
+
1018
+ /**
1019
+ * Customizes the on-screen software keyboard. Only effective when the engine was built with the keyboard
1020
+ * enabled (ERUI_ONSCREEN_KEYBOARD=1); a no-op otherwise. Pass nothing to restore the built-in default.
1021
+ */
1022
+ export function setKeyboardConfig(config?: KeyboardConfig | null): void;