@geastack/core 0.1.39 → 0.1.41

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/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export type * from './audio-worklet'
6
6
  export declare function flushAudioWorkletOutput(): void
7
7
  export type * from './typed-arrays'
8
8
  import type { AudioContextOptions, AudioWorklet, MediaStreamAudioSourceNode } from './audio-worklet'
9
+ export type * from './audio-worklet'
9
10
 
10
11
  // Opt-in native 64-bit integer. Structurally a `number` (assign/read without
11
12
  // casts), but where a binding, parameter, field, or return is annotated `int`,
@@ -18,6 +19,19 @@ import type { AudioContextOptions, AudioWorklet, MediaStreamAudioSourceNode } fr
18
19
  declare const __gea_int_brand: unique symbol
19
20
  declare global {
20
21
  type int = number & { readonly [__gea_int_brand]?: never }
22
+ type i64 = number & { readonly [__gea_int_brand]?: never }
23
+ type int64 = number & { readonly [__gea_int_brand]?: never }
24
+ }
25
+
26
+ // Opt-in native 32-bit integer: `int` at the width of a 32-bit core, held in an
27
+ // `int32_t`. On an ESP32-S3 a 64-bit `int` sum is two instructions and its
28
+ // quotient a library call; an `i32` one is a single instruction. Arithmetic
29
+ // wraps at 32 bits, `/` landing in an `i32` truncates, and a Number stored into
30
+ // one converts by ToInt32 (truncate, wrap, NaN -> 0). Under Node it is a number.
31
+ declare const __gea_i32_brand: unique symbol
32
+ declare global {
33
+ type i32 = number & { readonly [__gea_i32_brand]?: never }
34
+ type int32 = number & { readonly [__gea_i32_brand]?: never }
21
35
  }
22
36
 
23
37
  // Opt-in single-precision float. Structurally a `number` (assign/read without
@@ -82,6 +96,10 @@ export interface GeaIntrinsicElements {
82
96
  img: ImageProps
83
97
  input: NativeInputElementProps
84
98
  textarea: NativeTextAreaElementProps
99
+ select: NativeSelectProps
100
+ option: NativeOptionProps
101
+ stepper: NativeStepperProps
102
+ progress: NativeProgressProps
85
103
  'virtual-list': NativeVirtualListProps
86
104
  }
87
105
 
@@ -116,7 +134,11 @@ declare global {
116
134
  }
117
135
  const console: Console
118
136
 
119
- function requestAnimationFrame(callback: (timestampMs: number) => void): number
137
+ // Retains the callback and runs it next frame, so it cannot be inert -- but it
138
+ // writes no property on anything, which is all the argument stamp asks.
139
+ // Native frames supply whole milliseconds; the request handle stays numeric.
140
+ /** @gea-host-no-property-writes */
141
+ function requestAnimationFrame(callback: (timestampMs: int) => void): number
120
142
 
121
143
  // Native one-shot / repeating timers (gea::host::setTimeout/setInterval,
122
144
  // engine/../host/include/host/timers.h), NOT Node's `NodeJS.Timeout` (there is
@@ -172,8 +194,20 @@ declare global {
172
194
  // fillText anchors the top of the line box, which carries ascender and
173
195
  // descender the glyphs do not fill, so subtracting half the font size sags.
174
196
  measureTextInkCenter(text: string): number
175
- drawImageCircle(image: GeaEmbeddedImage, dx: number, dy: number, width: number, height: number): void
176
- drawImageRotated90CW(image: GeaEmbeddedImage, dx: number, dy: number, width: number, height: number): void
197
+ drawImageCircle(
198
+ image: GeaEmbeddedImage,
199
+ dx: number,
200
+ dy: number,
201
+ width: number,
202
+ height: number,
203
+ ): void
204
+ drawImageRotated90CW(
205
+ image: GeaEmbeddedImage,
206
+ dx: number,
207
+ dy: number,
208
+ width: number,
209
+ height: number,
210
+ ): void
177
211
  drawImageTiledX(image: GeaEmbeddedImage, dx: number, dy: number, width: number): void
178
212
  }
179
213
 
@@ -197,7 +231,8 @@ export type StyleLength =
197
231
  | `max(${string})`
198
232
  | `clamp(${string})`
199
233
  export type StyleBox = StyleLength | string
200
- export type StylePreferredSize = StyleLength | 'auto' | 'min-content' | 'max-content' | 'fit-content'
234
+ export type StylePreferredSize =
235
+ StyleLength | 'auto' | 'min-content' | 'max-content' | 'fit-content'
201
236
  export type StyleOverflow = 'visible' | 'hidden' | 'clip' | 'scroll' | 'auto' | 'overlay'
202
237
  export type ClassMap = Record<string, string | number | boolean | null | undefined>
203
238
  export type ClassValue = string | ClassMap
@@ -312,7 +347,10 @@ export interface Event {
312
347
  }
313
348
 
314
349
  export interface EventTarget {
315
- addEventListener<K extends keyof GeaEventMap>(type: K, listener: (event: GeaEventMap[K]) => void): void
350
+ addEventListener<K extends keyof GeaEventMap>(
351
+ type: K,
352
+ listener: (event: GeaEventMap[K]) => void,
353
+ ): void
316
354
  addEventListener(type: string, listener: (event: Event) => void): void
317
355
  }
318
356
 
@@ -414,7 +452,9 @@ export interface PressEvent extends PointerEvent {
414
452
  readonly currentTarget: PressEventTarget
415
453
  }
416
454
 
417
- export type PressEventArgument = number & PressEvent
455
+ // Native listeners receive the engine event. Numeric press metadata is exposed
456
+ // through pressId/pressValue; the event itself is not an arithmetic value.
457
+ export type PressEventArgument = PressEvent
418
458
  export type PressHandler = (event: PressEventArgument) => void
419
459
 
420
460
  export interface TouchPoint {
@@ -461,9 +501,8 @@ export interface RotaryEvent extends Event {
461
501
  * `keydown` is the engine's hardware-button/shortcut event and carries a
462
502
  * `KeyEvent`; `input` carries an `InputEvent`. Both are dispatched off-tree by
463
503
  * the runtime (`dispatch_key_input`, and `virtual_keyboard.cpp`'s synthetic
464
- * pair). `keyup` and `pointercancel` are deliberately ABSENT: `eventTypeIndex`
465
- * returns -1 for both, so `addEventListener` drops them and the handler would
466
- * never run. Declaring them would promise a callback the engine does not make.
504
+ * pair). Hardware button releases dispatch `keyup` with the same KeyEvent.
505
+ * `pointercancel` remains unsupported by the native event dispatcher.
467
506
  */
468
507
  export interface GeaEventMap {
469
508
  click: PressEvent
@@ -475,6 +514,7 @@ export interface GeaEventMap {
475
514
  pointerup: PointerEvent
476
515
  input: InputEvent
477
516
  keydown: KeyEvent
517
+ keyup: KeyEvent
478
518
  rotary: RotaryEvent
479
519
  scroll: Event
480
520
  }
@@ -501,9 +541,12 @@ export interface NativeTouchEventAttributes {
501
541
  }
502
542
 
503
543
  export interface NativeEventAttributes extends NativeTouchEventAttributes {
544
+ /** Text services and app-owned editors may dispatch input on ordinary views. */
545
+ onInput?: (event: InputEvent) => void
504
546
  onClick?: PressHandler
505
547
  onPress?: PressHandler
506
548
  onKeyDown?: (event: KeyEvent) => void
549
+ onKeyUp?: (event: KeyEvent) => void
507
550
  onRotary?: RotaryEventHandler
508
551
  }
509
552
 
@@ -612,7 +655,10 @@ export interface AudioProps extends DataAttributes {
612
655
  autoplay?: boolean | string | number
613
656
  controls?: boolean | string | number
614
657
  loop?: boolean | string | number
615
- ref?: HTMLAudioElement | (typeof globalThis extends { HTMLAudioElement: { prototype: infer E } } ? E : never) | null
658
+ ref?:
659
+ | HTMLAudioElement
660
+ | (typeof globalThis extends { HTMLAudioElement: { prototype: infer E } } ? E : never)
661
+ | null
616
662
  autoPlay?: boolean
617
663
  children?: any
618
664
  }
@@ -626,7 +672,10 @@ export interface VideoProps extends DataAttributes {
626
672
  playsinline?: boolean
627
673
  autoPlay?: boolean
628
674
  playsInline?: boolean
629
- ref?: HTMLVideoElement | (typeof globalThis extends { HTMLVideoElement: { prototype: infer E } } ? E : never) | null
675
+ ref?:
676
+ | HTMLVideoElement
677
+ | (typeof globalThis extends { HTMLVideoElement: { prototype: infer E } } ? E : never)
678
+ | null
630
679
  }
631
680
 
632
681
  export type ImageSource = string | ArrayBuffer | Uint8Array | GeaEmbeddedImage
@@ -688,7 +737,10 @@ export interface LoadImageOptions {
688
737
  // native `GeaEmbeddedImage` handle directly rather than a Promise — `await` still
689
738
  // works and keeps the value (and any `GeaEmbeddedImage[]` cache) a concrete
690
739
  // struct instead of a boxed gea_cpp_value.
691
- export declare function loadImage(src: string | ArrayBuffer | Uint8Array, options?: LoadImageOptions): GeaEmbeddedImage
740
+ export declare function loadImage(
741
+ src: string | ArrayBuffer | Uint8Array,
742
+ options?: LoadImageOptions,
743
+ ): GeaEmbeddedImage
692
744
  export declare function loadImageWithOpaque(src: Uint8Array, opaque: boolean): GeaEmbeddedImage
693
745
 
694
746
  // Load + decode an image directly from a persistent-cache file (e.g. a microSD
@@ -713,6 +765,9 @@ export declare function writeCacheFile(path: string, bytes: Uint8Array): boolean
713
765
  // pushed to /sdcard). Empty Uint8Array when the file is absent / no storage.
714
766
  export declare function readCacheFile(path: string): Uint8Array
715
767
 
768
+ /** Delete a persistent-cache file. */
769
+ export declare function removeCacheFile(path: string): boolean
770
+
716
771
  // Read a .pmtiles archive flashed into the spare ota_1 partition over USB
717
772
  // (esptool). Empty Uint8Array when none present (or off-device).
718
773
  export declare function readMapArchive(): Uint8Array
@@ -798,7 +853,7 @@ export class Component<RootElement extends GeaElement = GeaElement, Props = void
798
853
  // reactive overhead. Extend this only when the component manages its own state.
799
854
  export class ReactiveComponent<
800
855
  RootElement extends GeaElement = GeaElement,
801
- Props = void
856
+ Props = void,
802
857
  > extends Component<RootElement, Props> {}
803
858
 
804
859
  export interface BluetoothKeyboard {
@@ -969,9 +1024,28 @@ export interface CanvasRenderingContext2D {
969
1024
  fillCircle(x: number, y: number, radius: number, fill?: string | number): void
970
1025
  strokeCircle(x: number, y: number, radius: number): void
971
1026
  fillCircleRgb565(x: number, y: number, radius: number, color: number): void
972
- fillTriangleRgb565(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, color: number): void
973
- fillCirclesRgb565(xs: ArrayLike<number>, ys: ArrayLike<number>, radius: number, colors: ArrayLike<number>, count?: number): void
974
- fillCirclesRgb565Uniform(xs: ArrayLike<number>, ys: ArrayLike<number>, radius: number, color: number): void
1027
+ fillTriangleRgb565(
1028
+ x0: number,
1029
+ y0: number,
1030
+ x1: number,
1031
+ y1: number,
1032
+ x2: number,
1033
+ y2: number,
1034
+ color: number,
1035
+ ): void
1036
+ fillCirclesRgb565(
1037
+ xs: ArrayLike<number>,
1038
+ ys: ArrayLike<number>,
1039
+ radius: number,
1040
+ colors: ArrayLike<number>,
1041
+ count?: number,
1042
+ ): void
1043
+ fillCirclesRgb565Uniform(
1044
+ xs: ArrayLike<number>,
1045
+ ys: ArrayLike<number>,
1046
+ radius: number,
1047
+ color: number,
1048
+ ): void
975
1049
  /**
976
1050
  * Batched opaque triangles as ONE recorded present command. `order[0..count)`
977
1051
  * indexes the coordinate/colour arrays in paint (depth) order; colours are
@@ -1012,8 +1086,20 @@ export interface CanvasRenderingContext2D {
1012
1086
  // with no alpha plane: the blit skips the pixels outside the shape rather
1013
1087
  // than blending them. A square opaque tile would otherwise paint its
1014
1088
  // corners over whatever it overlaps.
1015
- drawImageCircle(image: GeaEmbeddedImage, dx: number, dy: number, width: number, height: number): void
1016
- drawImageRotated90CW(image: GeaEmbeddedImage, dx: number, dy: number, width: number, height: number): void
1089
+ drawImageCircle(
1090
+ image: GeaEmbeddedImage,
1091
+ dx: number,
1092
+ dy: number,
1093
+ width: number,
1094
+ height: number,
1095
+ ): void
1096
+ drawImageRotated90CW(
1097
+ image: GeaEmbeddedImage,
1098
+ dx: number,
1099
+ dy: number,
1100
+ width: number,
1101
+ height: number,
1102
+ ): void
1017
1103
  drawImageTiledX(image: GeaEmbeddedImage, dx: number, dy: number, width: number): void
1018
1104
  /**
1019
1105
  * An RGB565 pixel buffer the app writes directly:
@@ -1077,7 +1163,8 @@ export interface DisplayEpaperRefreshConfig {
1077
1163
  fullOnCover?: boolean
1078
1164
  }
1079
1165
 
1080
- export type DisplayOrientation = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'
1166
+ export type DisplayOrientation =
1167
+ 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'
1081
1168
 
1082
1169
  export type DisplayOrientationSupport = DisplayOrientation | 'portrait' | 'landscape' | 'all'
1083
1170
 
@@ -1104,7 +1191,9 @@ export interface DisplayController {
1104
1191
  getOrientation(): DisplayOrientation
1105
1192
  setOrientation(orientation: DisplayOrientation): void
1106
1193
  getSupportedOrientations(): DisplayOrientationSupport[]
1107
- setSupportedOrientations(orientations: DisplayOrientationSupport | DisplayOrientationSupport[]): void
1194
+ setSupportedOrientations(
1195
+ orientations: DisplayOrientationSupport | DisplayOrientationSupport[],
1196
+ ): void
1108
1197
  getAutoRotate(): boolean
1109
1198
  setAutoRotate(enabled: boolean): void
1110
1199
  /**
@@ -1254,6 +1343,9 @@ export interface LedController {
1254
1343
  export declare const Led: LedController
1255
1344
 
1256
1345
  export interface ClockController {
1346
+ /** Set wall time and persist to the board RTC when present. */
1347
+ setEpochMs(timestamp: number): boolean
1348
+
1257
1349
  // Milliseconds since the Unix epoch from the platform real-time clock
1258
1350
  // (gettimeofday). Reflects a host-set time (GEADEV SETTIME / the companion
1259
1351
  // app on launch). Unlike Date.now() — which reads a monotonic clock on
@@ -1293,12 +1385,21 @@ declare global {
1293
1385
  }
1294
1386
 
1295
1387
  export interface BatteryController {
1388
+ /** External power is present. */
1389
+ charging(): boolean
1390
+
1296
1391
  // Battery charge percentage (0-100) read from the platform PMU.
1297
1392
  level(): number
1298
1393
  }
1299
1394
 
1300
1395
  export declare const Battery: BatteryController
1301
1396
 
1397
+ export interface HapticsController {
1398
+ vibrate(durationMs: number, strength?: number): boolean
1399
+ }
1400
+
1401
+ export declare const Haptics: HapticsController
1402
+
1302
1403
  export interface NotifyController {
1303
1404
  // Transient host->app notification channel (e.g. pushed from the companion
1304
1405
  // via GEADEV NOTIFY). text() is the latest message; seq() increments on each
@@ -1337,9 +1438,17 @@ export interface AudioBuffer {
1337
1438
  readonly length: number
1338
1439
  readonly duration: number
1339
1440
  readonly numberOfChannels: number
1340
- copyFromChannel(destination: Float32Array<ArrayBuffer>, channelNumber: number, bufferOffset?: number): void
1341
- copyToChannel(source: Float32Array<ArrayBuffer>, channelNumber: number, bufferOffset?: number): void
1342
- getChannelData(channel: number): Float32Array<ArrayBuffer>
1441
+ copyFromChannel(
1442
+ destination: Float32Array<ArrayBufferLike>,
1443
+ channelNumber: number,
1444
+ bufferOffset?: number,
1445
+ ): void
1446
+ copyToChannel(
1447
+ source: Float32Array<ArrayBufferLike>,
1448
+ channelNumber: number,
1449
+ bufferOffset?: number,
1450
+ ): void
1451
+ getChannelData(channel: number): Float32Array<ArrayBufferLike>
1343
1452
  }
1344
1453
 
1345
1454
  export interface AudioBufferSourceNode {
@@ -1368,6 +1477,7 @@ export interface AudioContext {
1368
1477
  readonly currentTime: number
1369
1478
  readonly destination: AudioDestinationNode
1370
1479
  createOscillator(): OscillatorNode
1480
+ createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer
1371
1481
  createBufferSource(): AudioBufferSourceNode
1372
1482
  decodeAudioData(audioData: ArrayBuffer | Uint8Array | GeaAudioBlob): Promise<AudioBuffer>
1373
1483
  createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode
@@ -1496,6 +1606,8 @@ export interface CameraController {
1496
1606
  /** Capture a still frame. `capturePhoto` is the preferred alias of `capture`. */
1497
1607
  capture(options?: CameraCaptureOptions): Promise<CameraPhoto>
1498
1608
  capturePhoto(options?: CameraCaptureOptions): Promise<CameraPhoto>
1609
+ /** Take the newest encoded JPEG data URL without waiting; empty when no fresh frame is ready. */
1610
+ captureFrame(): string
1499
1611
  /** Record a video clip (esp32-p4: Motion-JPEG; iOS movie: later). */
1500
1612
  startRecording(options: CameraRecordOptions): Promise<void>
1501
1613
  stopRecording(): Promise<CameraClip>
@@ -1555,12 +1667,12 @@ export interface GeolocationController {
1555
1667
  getCurrentPosition(
1556
1668
  success: (position: GeolocationPosition) => void,
1557
1669
  error?: (error: GeolocationPositionError) => void,
1558
- options?: PositionOptions
1670
+ options?: PositionOptions,
1559
1671
  ): void
1560
1672
  watchPosition(
1561
1673
  success: (position: GeolocationPosition) => void,
1562
1674
  error?: (error: GeolocationPositionError) => void,
1563
- options?: PositionOptions
1675
+ options?: PositionOptions,
1564
1676
  ): number
1565
1677
  clearWatch(id: number): void
1566
1678
  }
@@ -1569,6 +1681,12 @@ export declare const Geolocation: GeolocationController
1569
1681
  export declare const geolocation: GeolocationController
1570
1682
 
1571
1683
  export interface WiFiController {
1684
+ accessPointMac(): string
1685
+ startCaptivePortal(): boolean
1686
+ stopCaptivePortal(): void
1687
+ startAccessPoint(ssid: string, password?: string): boolean
1688
+ stopAccessPoint(): void
1689
+
1572
1690
  enabled(): boolean
1573
1691
  setEnabled(enabled: boolean): void
1574
1692
  connected(): boolean
@@ -1599,7 +1717,8 @@ export interface ButtonProps {
1599
1717
  children?: any
1600
1718
  }
1601
1719
 
1602
- export interface NativeButtonProps extends NativeEventAttributes {
1720
+ export interface NativeButtonProps extends DataAttributes, NativeEventAttributes {
1721
+ id?: string
1603
1722
  disabled?: boolean
1604
1723
  key?: string | number
1605
1724
  class?: ClassValue
@@ -1631,12 +1750,9 @@ export interface NativeVirtualListProps extends NativeEventAttributes {
1631
1750
  export interface InputElementProps {
1632
1751
  class?: ClassValue
1633
1752
  style?: Style
1634
- // The three shapes the renderer actually materializes: `range` becomes an
1635
- // NSSlider and `checkbox` an NSSwitch, everything else an NSTextField
1636
- // (`apple/targets/macos/main/macos_renderer.mm`, `makeViewForType`). The union
1637
- // had drifted to the text-field spellings alone, so an app writing the switch
1638
- // the renderer has always drawn did not typecheck.
1639
- type?: 'text' | 'password' | 'button' | 'range' | 'checkbox'
1753
+ // macOS uses NSSlider for range, NSButton for radio, and NSSwitch for checkbox.
1754
+ // Add data-control="checkbox" for an AppKit checkbox button.
1755
+ type?: 'text' | 'password' | 'button' | 'range' | 'checkbox' | 'radio'
1640
1756
  // Optional, because the renderer treats it as one: every reader guards with
1641
1757
  // `if (value && value[0])`, and `applySwitchProps` never reads it at all --
1642
1758
  // a switch's state is `checked`. Requiring it made `<input type="checkbox">`
@@ -1649,7 +1765,11 @@ export interface InputElementProps {
1649
1765
  // switch's state and is written back on toggle.
1650
1766
  min?: number | string
1651
1767
  max?: number | string
1768
+ step?: number | string
1652
1769
  checked?: boolean | string
1770
+ disabled?: boolean
1771
+ readOnly?: boolean
1772
+ name?: string
1653
1773
  placeholder?: string
1654
1774
  autoFocus?: boolean | number
1655
1775
  pressId?: number
@@ -1659,13 +1779,16 @@ export interface InputElementProps {
1659
1779
  onFocus?: () => void
1660
1780
  onBlur?: () => void
1661
1781
  onKeyDown?: (event: KeyEvent) => void
1782
+ onKeyUp?: (event: KeyEvent) => void
1662
1783
  input?: (value: string) => void
1663
1784
  focus?: () => void
1664
1785
  blur?: () => void
1665
1786
  keydown?: (keyCode: number) => void
1787
+ keyup?: (keyCode: number) => void
1666
1788
  }
1667
1789
 
1668
- export interface NativeInputElementProps extends InputElementProps {
1790
+ export interface NativeInputElementProps extends InputElementProps, DataAttributes {
1791
+ id?: string
1669
1792
  ref?: GeaElement | null
1670
1793
  }
1671
1794
 
@@ -1679,10 +1802,40 @@ export interface TextAreaElementProps {
1679
1802
  onBlur?: () => void
1680
1803
  }
1681
1804
 
1682
- export interface NativeTextAreaElementProps extends TextAreaElementProps {
1805
+ export interface NativeTextAreaElementProps extends TextAreaElementProps, DataAttributes {
1806
+ id?: string
1807
+ disabled?: boolean
1808
+ readOnly?: boolean
1683
1809
  ref?: GeaElement | null
1684
1810
  }
1685
1811
 
1812
+ export interface NativeSelectProps extends NativeViewProps {
1813
+ value?: string
1814
+ disabled?: boolean
1815
+ onInput?: (event: InputEvent) => void
1816
+ }
1817
+
1818
+ export interface NativeOptionProps extends TextProps {
1819
+ value?: string
1820
+ selected?: boolean
1821
+ disabled?: boolean
1822
+ }
1823
+
1824
+ export interface NativeStepperProps extends NativeViewProps {
1825
+ value?: string
1826
+ min?: number | string
1827
+ max?: number | string
1828
+ step?: number | string
1829
+ disabled?: boolean
1830
+ onInput?: (event: InputEvent) => void
1831
+ }
1832
+
1833
+ export interface NativeProgressProps extends NativeViewProps {
1834
+ value?: number | string
1835
+ max?: number | string
1836
+ indeterminate?: boolean
1837
+ }
1838
+
1686
1839
  export declare function mount(component: new () => Component): void
1687
1840
 
1688
1841
  /**
@@ -1745,7 +1898,7 @@ export declare function fetchUploadFileAsync(
1745
1898
  contentType: string,
1746
1899
  prefix: string,
1747
1900
  filePath: string,
1748
- suffix: string
1901
+ suffix: string,
1749
1902
  ): number
1750
1903
 
1751
1904
  /**
@@ -1774,7 +1927,7 @@ declare global {
1774
1927
  contentType: string,
1775
1928
  prefix: string,
1776
1929
  filePath: string,
1777
- suffix: string
1930
+ suffix: string,
1778
1931
  ): number
1779
1932
  function fetchDownloadFileAsync(url: string, auth: string, destPath: string): number
1780
1933
  function fetchUploadProgress(id: number): number
@@ -1818,13 +1971,18 @@ export interface WebSocketInstance {
1818
1971
  }
1819
1972
 
1820
1973
  export interface WebSocketConstructor {
1821
- new (url: string, protocols?: string | string[]): WebSocketInstance
1974
+ new (url: string, protocols?: string | string[], options?: WebSocketOptions): WebSocketInstance
1822
1975
  readonly CONNECTING: 0
1823
1976
  readonly OPEN: 1
1824
1977
  readonly CLOSING: 2
1825
1978
  readonly CLOSED: 3
1826
1979
  }
1827
1980
 
1981
+ /** Native connection headers. Browser WebSockets do not support this option. */
1982
+ export interface WebSocketOptions {
1983
+ headers: { name: string; value: string }[]
1984
+ }
1985
+
1828
1986
  declare global {
1829
1987
  const WebSocket: WebSocketConstructor
1830
1988
  }
@@ -1840,7 +1998,16 @@ declare global {
1840
1998
  * off disk — a reply that sets `file` streams that path on the server worker
1841
1999
  * without ever loading the bytes into JS.
1842
2000
  */
2001
+ export interface HttpHeader {
2002
+ name: string
2003
+ value: string
2004
+ }
2005
+
1843
2006
  export interface IncomingMessage {
2007
+ readonly headers: HttpHeader[]
2008
+ /** Raw request body, limited to 2 MiB by the native server. */
2009
+ readonly body: Uint8Array
2010
+
1844
2011
  /** "GET", "POST", ... */
1845
2012
  readonly method: string
1846
2013
  /** Full request target including the query string (e.g. "/n/3.wav?x=1"). */
@@ -1852,6 +2019,7 @@ export interface IncomingMessage {
1852
2019
  }
1853
2020
 
1854
2021
  export interface HttpReply {
2022
+ headers?: HttpHeader[]
1855
2023
  /** HTTP status code. Defaults to 200. */
1856
2024
  status?: number
1857
2025
  /** Response Content-Type. Defaults to "text/plain". */
@@ -1909,7 +2077,13 @@ export interface MediaStreamConstructor {
1909
2077
  }
1910
2078
 
1911
2079
  export interface MediaStreamConstraints {
1912
- audio?: boolean | { sampleRate?: number; channelCount?: number; echoCancellation?: boolean }
2080
+ audio?:
2081
+ | boolean
2082
+ | {
2083
+ sampleRate?: number
2084
+ channelCount?: number
2085
+ echoCancellation?: boolean
2086
+ }
1913
2087
  video?: false
1914
2088
  }
1915
2089
 
@@ -2105,7 +2279,9 @@ export interface RTCDataChannelInit {
2105
2279
  negotiated?: boolean
2106
2280
  id?: number
2107
2281
  }
2108
- export interface RTCDataChannelMessageEvent { readonly data: string | ArrayBuffer }
2282
+ export interface RTCDataChannelMessageEvent {
2283
+ readonly data: string | ArrayBuffer
2284
+ }
2109
2285
  export interface RTCDataChannel {
2110
2286
  readonly label: string
2111
2287
  readonly protocol: string
@@ -2128,8 +2304,12 @@ export interface RTCRtpSender {
2128
2304
  readonly track: MediaStreamTrack | null
2129
2305
  replaceTrack(track: MediaStreamTrack | null): Promise<void>
2130
2306
  }
2131
- export interface RTCRtpReceiver { readonly track: MediaStreamTrack | null }
2132
- export interface RTCRtpTransceiverInit { direction?: 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive' }
2307
+ export interface RTCRtpReceiver {
2308
+ readonly track: MediaStreamTrack | null
2309
+ }
2310
+ export interface RTCRtpTransceiverInit {
2311
+ direction?: 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive'
2312
+ }
2133
2313
  export interface RTCRtpTransceiver {
2134
2314
  readonly sender: RTCRtpSender
2135
2315
  readonly receiver: RTCRtpReceiver
@@ -2141,8 +2321,10 @@ export interface RTCRtpTransceiver {
2141
2321
  }
2142
2322
 
2143
2323
  export interface RTCPeerConnectionInstance {
2144
- readonly connectionState: 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed'
2145
- readonly iceConnectionState: 'new' | 'checking' | 'connected' | 'completed' | 'failed' | 'disconnected' | 'closed'
2324
+ readonly connectionState:
2325
+ 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed'
2326
+ readonly iceConnectionState:
2327
+ 'new' | 'checking' | 'connected' | 'completed' | 'failed' | 'disconnected' | 'closed'
2146
2328
 
2147
2329
  onicecandidate: ((event: RTCPeerConnectionIceEvent) => void) | null
2148
2330
  ontrack: ((event: RTCTrackEvent) => void) | null
@@ -2157,7 +2339,10 @@ export interface RTCPeerConnectionInstance {
2157
2339
  ondatachannel: ((event: { channel: RTCDataChannel }) => void) | null
2158
2340
  addTrack(track: MediaStreamTrack, stream?: MediaStream): RTCRtpSender
2159
2341
  removeTrack(sender: RTCRtpSender): void
2160
- addTransceiver(trackOrKind: MediaStreamTrack | 'audio', init?: RTCRtpTransceiverInit): RTCRtpTransceiver
2342
+ addTransceiver(
2343
+ trackOrKind: MediaStreamTrack | 'audio',
2344
+ init?: RTCRtpTransceiverInit,
2345
+ ): RTCRtpTransceiver
2161
2346
  getTransceivers(): RTCRtpTransceiver[]
2162
2347
  getSenders(): RTCRtpSender[]
2163
2348
  getReceivers(): RTCRtpReceiver[]
@@ -2179,7 +2364,6 @@ declare global {
2179
2364
  function Image(props: ImageProps): GeaJsxElement
2180
2365
  }
2181
2366
 
2182
-
2183
2367
  /** Streaming mono signed PCM16, little endian, carried as base64 text. */
2184
2368
  export interface PcmAudioStream {
2185
2369
  setInput(stream: MediaStream): void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/core",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "GeaStack app API, reactivity headers, runtime sources, and type declarations.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -65,8 +65,8 @@
65
65
  "@babel/types": "^7.23.0",
66
66
  "@geajs/core": "1.5.1",
67
67
  "@geajs/vite-plugin": "1.5.0",
68
- "@geastack/compiler": "^1.0.25",
69
- "@geastack/geatsc-plugin-gea": "^0.1.21",
68
+ "@geastack/compiler": "^1.0.29",
69
+ "@geastack/geatsc-plugin-gea": "^0.1.22",
70
70
  "opentype.js": "^2.0.0",
71
71
  "vite": "^8.0.0"
72
72
  }
@@ -13,14 +13,10 @@ export function flushAudioWorkletOutput(): void {
13
13
  __geaFlushAudioWorkletOutput()
14
14
  }
15
15
 
16
- declare function __geaRegisterAudioWorkletProcessor(
16
+ declare function __geaRegisterAudioWorkletProcessor<T extends AudioWorkletProcessor>(
17
17
  name: string,
18
- create: () => AudioWorkletProcessor,
19
- process: (
20
- processor: AudioWorkletProcessor,
21
- inputs: Float32Array[][],
22
- outputs: Float32Array[][]
23
- ) => boolean
18
+ create: () => T,
19
+ process: (processor: T, inputs: Float32Array[][], outputs: Float32Array[][]) => boolean,
24
20
  ): void
25
21
 
26
22
  export abstract class AudioWorkletProcessor {
@@ -33,19 +29,19 @@ export abstract class AudioWorkletProcessor {
33
29
  abstract process(
34
30
  inputs: Float32Array[][],
35
31
  outputs: Float32Array[][],
36
- parameters: Record<string, Float32Array>
32
+ parameters: Record<string, Float32Array>,
37
33
  ): boolean
38
34
  }
39
35
 
40
36
  // The native module builder validates the concrete registration constructor.
41
37
  // AudioParam descriptors are explicitly unsupported, before code generation.
42
- export function registerProcessor(
38
+ export function registerProcessor<T extends AudioWorkletProcessor>(
43
39
  name: string,
44
- constructor: new () => AudioWorkletProcessor
40
+ constructor: new () => T,
45
41
  ): void {
46
42
  __geaRegisterAudioWorkletProcessor(
47
43
  name,
48
44
  () => new constructor(),
49
- (processor, inputs, outputs) => processor.process(inputs, outputs, {})
45
+ (processor, inputs, outputs) => processor.process(inputs, outputs, {}),
50
46
  )
51
47
  }