@moddable/typings 9.5.0 → 10.0.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 (164) hide show
  1. package/DS18X20.d.ts +40 -0
  2. package/{embedded_io/system.d.ts → ResourceIterator.d.ts} +4 -9
  3. package/ble/bleclient.d.ts +1 -0
  4. package/ble/bleserver.d.ts +1 -0
  5. package/ble/btutils.d.ts +3 -0
  6. package/ble/connection.d.ts +1 -0
  7. package/ble/gap.d.ts +2 -0
  8. package/ble/gatt.d.ts +4 -0
  9. package/ble/hidclient.d.ts +5 -0
  10. package/ble/sm.d.ts +3 -0
  11. package/captiveportal.d.ts +5 -5
  12. package/commodetto/Poco.d.ts +10 -2
  13. package/commodetto/ReadGIF.d.ts +1 -1
  14. package/commodetto/outline.d.ts +4 -1
  15. package/commodetto/parseRLE.d.ts +1 -1
  16. package/commodetto/readJPEG.d.ts +1 -1
  17. package/config/analog.d.ts +31 -0
  18. package/config/digital.d.ts +32 -0
  19. package/config/dns.d.ts +33 -0
  20. package/config/dnssd.d.ts +31 -0
  21. package/config/files.d.ts +27 -0
  22. package/config/flash.d.ts +27 -0
  23. package/config/httpclient.d.ts +34 -0
  24. package/config/httpsclient.d.ts +34 -0
  25. package/config/httpserver.d.ts +33 -0
  26. package/config/i2c.d.ts +33 -0
  27. package/config/mqtt.d.ts +27 -0
  28. package/config/mqttclient.d.ts +31 -0
  29. package/config/mqttsclient.d.ts +32 -0
  30. package/config/ntp.d.ts +34 -0
  31. package/config/pulsecount.d.ts +30 -0
  32. package/config/pwm.d.ts +30 -0
  33. package/config/serial.d.ts +31 -0
  34. package/config/socket.d.ts +34 -0
  35. package/config/spi.d.ts +31 -0
  36. package/config/storage.d.ts +27 -0
  37. package/config/system.d.ts +27 -0
  38. package/config/tls.d.ts +30 -0
  39. package/config/update.d.ts +27 -0
  40. package/config/wsclient.d.ts +31 -0
  41. package/config/wssclient.d.ts +32 -0
  42. package/crc.d.ts +1 -1
  43. package/dns/server.d.ts +1 -0
  44. package/embedded/RTC/zephyr-builtin.d.ts +48 -0
  45. package/embedded/RTC.d.ts +18 -7
  46. package/embedded/display.d.ts +8 -3
  47. package/embedded/storage/files.d.ts +10 -7
  48. package/embedded/storage/flash.d.ts +2 -2
  49. package/embedded/storage/key-value.d.ts +27 -6
  50. package/embedded/system.d.ts +49 -0
  51. package/embedded_io/_common.d.ts +42 -3
  52. package/embedded_io/analog.d.ts +7 -7
  53. package/embedded_io/audio/in.d.ts +3 -2
  54. package/embedded_io/audio/out.d.ts +12 -4
  55. package/embedded_io/ble/central.d.ts +5 -4
  56. package/embedded_io/ble/peripheral.d.ts +6 -5
  57. package/embedded_io/crypt/digest.d.ts +2 -2
  58. package/embedded_io/digital.d.ts +4 -3
  59. package/embedded_io/digitalbank.d.ts +9 -5
  60. package/embedded_io/i2c.d.ts +9 -6
  61. package/embedded_io/image/in/camera.d.ts +82 -0
  62. package/embedded_io/pulsecount.d.ts +7 -5
  63. package/embedded_io/pwm.d.ts +11 -5
  64. package/embedded_io/serial.d.ts +33 -16
  65. package/embedded_io/socket/listener.d.ts +3 -2
  66. package/embedded_io/socket/tcp/tls.d.ts +41 -12
  67. package/embedded_io/socket/tcp.d.ts +26 -12
  68. package/embedded_io/socket/udp.d.ts +17 -12
  69. package/embedded_io/spi.d.ts +8 -6
  70. package/embedded_network/dns/resolver/udp.d.ts +13 -6
  71. package/embedded_network/dns/server/udp.d.ts +39 -0
  72. package/embedded_network/dnssd.d.ts +9 -7
  73. package/embedded_network/http/client.d.ts +21 -7
  74. package/embedded_network/http/server/route/serversentevents.d.ts +48 -0
  75. package/embedded_network/http/server/route/static.d.ts +41 -0
  76. package/embedded_network/http/server/route/webdav.d.ts +42 -0
  77. package/embedded_network/http/server/route/ws/handshake.d.ts +28 -0
  78. package/embedded_network/http/server.d.ts +27 -6
  79. package/embedded_network/interface/ethernet.d.ts +3 -3
  80. package/embedded_network/interface/wifi/accesspoint.d.ts +2 -2
  81. package/embedded_network/interface/wifi.d.ts +21 -12
  82. package/embedded_network/mdns.d.ts +2 -2
  83. package/embedded_network/mqtt/client.d.ts +55 -16
  84. package/embedded_network/ntp/client.d.ts +16 -8
  85. package/embedded_network/websocket/client.d.ts +47 -28
  86. package/embedded_provider/builtin.d.ts +40 -34
  87. package/file.d.ts +4 -0
  88. package/flash.d.ts +1 -0
  89. package/global.d.ts +0 -3
  90. package/host/default.d.ts +31 -0
  91. package/host/esp32/moddable_six.d.ts +50 -0
  92. package/host/esp32/moddable_two.d.ts +55 -0
  93. package/host/generic.d.ts +47 -0
  94. package/host/index.d.ts +24 -0
  95. package/host/lin.d.ts +30 -0
  96. package/host/mac.d.ts +30 -0
  97. package/host/pebble.d.ts +70 -0
  98. package/host/win.d.ts +30 -0
  99. package/http.d.ts +2 -0
  100. package/mcpack.d.ts +20 -0
  101. package/mdns.d.ts +1 -0
  102. package/modules.d.ts +1 -1
  103. package/mqtt/js.d.ts +22 -4
  104. package/neopixel.d.ts +2 -2
  105. package/onewire.d.ts +31 -0
  106. package/package.json +14 -4
  107. package/pebble/accelerometer.d.ts +5 -5
  108. package/pebble/battery.d.ts +3 -3
  109. package/pebble/button.d.ts +2 -2
  110. package/pebble/compass.d.ts +3 -3
  111. package/pebble/dictation.d.ts +2 -2
  112. package/pebble/global.d.ts +37 -3
  113. package/pebble/health.d.ts +2 -2
  114. package/pebble/location.d.ts +2 -2
  115. package/pebble/message.d.ts +5 -5
  116. package/pebble/piu.d.ts +2 -57
  117. package/pebble/poco.d.ts +2 -2
  118. package/pebble/texture.d.ts +33 -0
  119. package/pebble/touch.d.ts +47 -0
  120. package/ping.d.ts +1 -0
  121. package/pins/analog.d.ts +1 -0
  122. package/pins/audioin.d.ts +1 -0
  123. package/pins/digital.d.ts +1 -0
  124. package/pins/i2c.d.ts +1 -0
  125. package/pins/pwm.d.ts +1 -0
  126. package/pins/rmt.d.ts +1 -0
  127. package/pins/servo.d.ts +1 -0
  128. package/pins/smbus.d.ts +1 -0
  129. package/piu/MC-types.d.ts +231 -97
  130. package/piu/MC.d.ts +2 -1
  131. package/piu/QRCode.d.ts +5 -0
  132. package/piu/RoundRect.d.ts +53 -0
  133. package/piu/SVGImage.d.ts +62 -0
  134. package/piu/Timeline.d.ts +17 -21
  135. package/pococolorcell.d.ts +25 -0
  136. package/pocoqrcode.d.ts +25 -0
  137. package/pocostatic.d.ts +25 -0
  138. package/preference.d.ts +1 -0
  139. package/securesocket.d.ts +1 -0
  140. package/sntp.d.ts +1 -0
  141. package/socket.d.ts +6 -0
  142. package/ssl/session.d.ts +60 -0
  143. package/time.d.ts +1 -1
  144. package/tsconfig.es2024.json +0 -1
  145. package/tsconfig.es2025.json +1 -1
  146. package/web/bluetooth.d.ts +112 -0
  147. package/web/decompressionstream.d.ts +1 -1
  148. package/web/eventsource.d.ts +12 -7
  149. package/web/fetch-streams.d.ts +57 -0
  150. package/web/fetch.d.ts +1 -1
  151. package/web/serial.d.ts +58 -0
  152. package/web/websocket.d.ts +18 -13
  153. package/web/webstorage.d.ts +3 -0
  154. package/web/worker.d.ts +2 -0
  155. package/websocket.d.ts +2 -0
  156. package/wifi.d.ts +1 -0
  157. package/xs.d.ts +52 -5
  158. package/data/location/nmea.d.ts +0 -103
  159. package/data/location/ubx.d.ts +0 -78
  160. package/display.d.ts +0 -68
  161. package/embedded/sensor/Barometer-Humidity-Temperature/BME280.d.ts +0 -102
  162. package/embedded/sensor/Location/GPS.d.ts +0 -96
  163. package/embedded/sensor/Location/IP.d.ts +0 -67
  164. package/pebble/device.d.ts +0 -51
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the bus types (I2CBus, ...) are declared by the typing of embedded:provider/builtin
22
+ /// <reference path="../../embedded_provider/builtin.d.ts" />
23
+ // the manifest of this target includes the manifests of these configurations
24
+ /// <reference path="../../config/digital.d.ts" />
25
+ /// <reference path="../../config/i2c.d.ts" />
26
+ /// <reference path="../../config/pwm.d.ts" />
27
+
28
+ declare module "embedded:provider/builtin" {
29
+ import type { PinSpecifier } from "embedded:io/_common";
30
+
31
+ interface Device {
32
+ pin: DevicePin;
33
+ network: DeviceNetwork;
34
+ }
35
+ interface DevicePin {
36
+ button: PinSpecifier;
37
+ buttonA: PinSpecifier;
38
+ LED: PinSpecifier;
39
+ backlight: PinSpecifier;
40
+ }
41
+ interface DeviceI2C {
42
+ default: I2CBus;
43
+ }
44
+ interface DeviceSerial {
45
+ default: SerialBus;
46
+ }
47
+ interface DeviceSPI {
48
+ default: SPIBus;
49
+ }
50
+ }
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the bus types (I2CBus, ...) are declared by the typing of embedded:provider/builtin
22
+ /// <reference path="../../embedded_provider/builtin.d.ts" />
23
+ // the manifest of this target includes the manifests of these configurations
24
+ /// <reference path="../../config/digital.d.ts" />
25
+ /// <reference path="../../config/i2c.d.ts" />
26
+ /// <reference path="../../config/pwm.d.ts" />
27
+
28
+ declare module "embedded:provider/builtin" {
29
+ import type { PinSpecifier } from "embedded:io/_common";
30
+
31
+ interface Device {
32
+ pin: DevicePin;
33
+ network: DeviceNetwork;
34
+ }
35
+ interface DevicePin {
36
+ button: PinSpecifier;
37
+ buttonA: PinSpecifier;
38
+ led: PinSpecifier;
39
+ backlight: PinSpecifier;
40
+ displayDC: PinSpecifier;
41
+ displaySelect: PinSpecifier;
42
+ }
43
+ interface DeviceAnalog {
44
+ default: AnalogBus;
45
+ }
46
+ interface DeviceI2C {
47
+ default: I2CBus;
48
+ }
49
+ interface DeviceSerial {
50
+ default: SerialBus;
51
+ }
52
+ interface DeviceSPI {
53
+ default: SPIBus;
54
+ }
55
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // a host provider of no particular target: pins by any name, a default bus of each kind in the build, and a network.
22
+ // The bus types (I2CBus, ...) are declared by the typing of embedded:provider/builtin
23
+ /// <reference path="../embedded_provider/builtin.d.ts" />
24
+
25
+ declare module "embedded:provider/builtin" {
26
+ import type { PinSpecifier } from "embedded:io/_common";
27
+
28
+ interface Device {
29
+ pin: DevicePin;
30
+ network: DeviceNetwork;
31
+ }
32
+ interface DevicePin {
33
+ [name: string]: PinSpecifier;
34
+ }
35
+ interface DeviceAnalog {
36
+ default: AnalogBus;
37
+ }
38
+ interface DeviceI2C {
39
+ default: I2CBus;
40
+ }
41
+ interface DeviceSerial {
42
+ default: SerialBus;
43
+ }
44
+ interface DeviceSPI {
45
+ default: SPIBus;
46
+ }
47
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the host provider typing selected by tsc --customConditions <platform> (e.g. esp32/moddable_two) through the
22
+ // imports field of package.json; without a condition, default.d.ts. Referenced by mcpack.d.ts for tsc-only projects.
23
+ // Not at the top level of typings, where a file is the typing of the module of its name (and "host" is a module of the simulator)
24
+ import "#host";
package/host/lin.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the host provider of lin builds, including the simulator and its skins, is empty: no pins, no buses. The IO classes
22
+ // in the build are typed by their configurations, as everywhere else. This file exists so that the generic host is not assumed.
23
+ // The network is the computer's.
24
+ /// <reference path="../embedded_provider/builtin.d.ts" />
25
+
26
+ declare module "embedded:provider/builtin" {
27
+ interface Device {
28
+ network: DeviceNetwork;
29
+ }
30
+ }
package/host/mac.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the host provider of mac builds, including the simulator and its skins, is empty: no pins, no buses. The IO classes
22
+ // in the build are typed by their configurations, as everywhere else. This file exists so that the generic host is not assumed.
23
+ // The network is the computer's.
24
+ /// <reference path="../embedded_provider/builtin.d.ts" />
25
+
26
+ declare module "embedded:provider/builtin" {
27
+ interface Device {
28
+ network: DeviceNetwork;
29
+ }
30
+ }
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the host provider of Pebble, build/devices/pebble/host/main.js. Its network clients are Pebble's
22
+ // own implementations of the ECMA-419 classes. They connect through the phone, so they take no socket
23
+ // or resolver: the HTTP client takes the protocol and the WebSocket client whether it is secure.
24
+ /// <reference path="../embedded_provider/builtin.d.ts" />
25
+
26
+ declare module "embedded:provider/builtin" {
27
+ import type HTTPClient from "embedded:network/http/client";
28
+ import type { ClientOptions } from "embedded:network/http/client";
29
+ import type WebSocketClient from "embedded:network/websocket/client";
30
+ import type { Directory } from "embedded:storage/files";
31
+ import type keyValue from "embedded:storage/key-value";
32
+ import type Touch from "embedded:sensor/Touch/pebble";
33
+
34
+ interface PebbleHTTPClient {
35
+ new (options: Omit<ClientOptions, "socket" | "dns"> & { protocol?: "http" | "https" }): HTTPClient;
36
+ readonly prototype: HTTPClient;
37
+ }
38
+ interface Device {
39
+ network: DeviceNetwork;
40
+ info: DeviceInfo;
41
+ files: Directory;
42
+ keyValue: typeof keyValue;
43
+ sensor: DeviceSensor;
44
+ }
45
+ interface DeviceSensor {
46
+ Touch: typeof Touch;
47
+ }
48
+ interface DeviceNetwork {
49
+ http: {
50
+ io: PebbleHTTPClient;
51
+ protocol: "http";
52
+ };
53
+ https: {
54
+ io: PebbleHTTPClient;
55
+ protocol: "https";
56
+ };
57
+ ws: {
58
+ io: typeof WebSocketClient;
59
+ secure: false;
60
+ };
61
+ wss: {
62
+ io: typeof WebSocketClient;
63
+ secure: true;
64
+ };
65
+ }
66
+ interface DeviceInfo {
67
+ language: string;
68
+ serialNumber: string;
69
+ }
70
+ }
package/host/win.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the host provider of win builds, including the simulator and its skins, is empty: no pins, no buses. The IO classes
22
+ // in the build are typed by their configurations, as everywhere else. This file exists so that the generic host is not assumed.
23
+ // The network is the computer's.
24
+ /// <reference path="../embedded_provider/builtin.d.ts" />
25
+
26
+ declare module "embedded:provider/builtin" {
27
+ interface Device {
28
+ network: DeviceNetwork;
29
+ }
30
+ }
package/http.d.ts CHANGED
@@ -53,6 +53,7 @@ declare module "http" {
53
53
  // TODO: better
54
54
  export type HTTPRequestCallback = (message: RequestStatus, val1?: any, val2?: any) => void | number | boolean | string | ArrayBuffer;
55
55
 
56
+ /** @deprecated Use fetch, or the ECMA-419 embedded:network/http/client and embedded:network/http/server */
56
57
  export class Request {
57
58
  constructor(options: HTTPRequestOptions);
58
59
  close(): void;
@@ -99,6 +100,7 @@ declare module "http" {
99
100
  export type HTTPServerCallback = (this: Request, message: ServerMessages, val1?: any, val2?: any) => void | number | boolean | string |
100
101
  ArrayBuffer | { status?: number, reason?: string, headers?: string[], body: true | string | ArrayBuffer };
101
102
 
103
+ /** @deprecated Use fetch, or the ECMA-419 embedded:network/http/client and embedded:network/http/server */
102
104
  export class Server {
103
105
  constructor(
104
106
  options?: HTTPServerOptions
package/mcpack.d.ts CHANGED
@@ -18,12 +18,16 @@
18
18
  *
19
19
  */
20
20
 
21
+ /// <reference path="./host/index.d.ts" />
21
22
  /// <reference path="./web/abortsignal.d.ts" />
23
+ /// <reference path="./web/bluetooth.d.ts" />
24
+ /// <reference path="./web/serial.d.ts" />
22
25
  /// <reference path="./web/console.d.ts" />
23
26
  /// <reference path="./web/decompressionstream.d.ts" />
24
27
  /// <reference path="./web/domexception.d.ts" />
25
28
  /// <reference path="./web/eventsource.d.ts" />
26
29
  /// <reference path="./web/fetch.d.ts" />
30
+ /// <reference path="./web/fetch-streams.d.ts" />
27
31
  /// <reference path="./web/headers.d.ts" />
28
32
  /// <reference path="./web/streams.d.ts" />
29
33
  /// <reference path="./web/structuredClone.d.ts" />
@@ -37,10 +41,26 @@
37
41
  /// <reference path="./web/worker.d.ts" />
38
42
  /// <reference path="./text/decoder.d.ts" />
39
43
  /// <reference path="./text/encoder.d.ts" />
44
+ // the manifests of the web modules above and of the ECMA-419 HTTP and WebSocket clients ("mcpack": true)
45
+ // include the manifests of these configurations. The module typings do not reference them, because a host
46
+ // that implements the modules itself (Pebble) builds none of these configurations.
47
+ /// <reference path="./config/httpclient.d.ts" />
48
+ /// <reference path="./config/httpsclient.d.ts" />
49
+ /// <reference path="./config/wsclient.d.ts" />
50
+ /// <reference path="./config/wssclient.d.ts" />
40
51
 
41
52
  export {};
42
53
 
43
54
  declare global {
55
+ interface Navigator {
56
+ readonly bluetooth: typeof import("web-bluetooth").bluetooth;
57
+ readonly serial: typeof import("web/serial").serial;
58
+ }
59
+ const navigator: Navigator;
60
+
61
+ const BluetoothUUID: typeof import("web-bluetooth").BluetoothUUID;
62
+ type BluetoothUUID = import("web-bluetooth").BluetoothUUID;
63
+
44
64
  const EventSource: typeof import("web/eventsource").default;
45
65
  type EventSource = import("web/eventsource").default;
46
66
 
package/mdns.d.ts CHANGED
@@ -25,6 +25,7 @@ declare module "mdns" {
25
25
  port: number,
26
26
  txt: Record<string, string>
27
27
  };
28
+ /** @deprecated Use the ECMA-419 DNS-SD client, embedded:network/dnssd */
28
29
  class MDNS {
29
30
  constructor(
30
31
  options: {
package/modules.d.ts CHANGED
@@ -21,7 +21,7 @@
21
21
  declare module "modules" {
22
22
  export default class Modules {
23
23
  static has(name: string): boolean;
24
- static importNow(name: string, namespace?: boolean): unknown;
24
+ static importNow<T = unknown>(name: string, namespace?: boolean): T;
25
25
  static get host(): string[];
26
26
  static get archive(): string[];
27
27
  }
package/mqtt/js.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // the manifest that supplies this module includes the manifests of these configurations
2
+ /// <reference path="../config/mqttsclient.d.ts" />
3
+ /// <reference path="../config/dns.d.ts" />
4
+
1
5
  // Adapted from https://github.com/mqttjs/MQTT.js
2
6
  //
3
7
  // The MIT License (MIT)
@@ -31,7 +35,7 @@ export interface IClientOptions /*extends ISecureClientOptions*/ {
31
35
  // protocol?: "wss" | "ws" | "mqtt" | "mqtts" | "tcp" | "ssl" | "wx" | "wxs"
32
36
 
33
37
  // wsOptions?: ClientOptions | ClientRequestArgs
34
- keepalive?: number // 10 seconds, set to 0 to disable
38
+ keepalive?: number // 60 seconds, set to 0 to disable
35
39
  clientId?: string // 'mqttxs_' + Math.random().toString(16).substr(2, 8)
36
40
  // protocolId?: string // 'MQTT'
37
41
  // protocolVersion?: number //4
@@ -166,7 +170,7 @@ export class Client /*extends events.EventEmitter*/ {
166
170
  // public options: IClientOptions
167
171
  // public queueQoSZero: boolean
168
172
 
169
- constructor(url: string, options: IClientOptions)
173
+ constructor(url: string, options?: IClientOptions)
170
174
 
171
175
  public on(event: "connect", cb: OnConnectCallback): this
172
176
  public on(event: "message", cb: OnMessageCallback): this
@@ -178,6 +182,18 @@ export class Client /*extends events.EventEmitter*/ {
178
182
  //public on(event: "end" | "reconnect" | "offline" | "outgoingEmpty", cb: () => void): this
179
183
  public on(event: string, cb: Function): this
180
184
 
185
+ // on and off return the client for chaining, as in MQTT.js. addEventListener and removeEventListener return nothing.
186
+ public addEventListener(event: "connect", cb: OnConnectCallback): void
187
+ public addEventListener(event: "message", cb: OnMessageCallback): void
188
+ //public addEventListener(event: "packetsend" | "packetreceive", cb: OnPacketCallback): void
189
+ //public addEventListener(event: "disconnect", cb: OnDisconnectCallback): void
190
+ public addEventListener(event: "error", cb: OnErrorCallback): void
191
+ public addEventListener(event: "close", cb: OnCloseCallback): void
192
+ public addEventListener(event: "end" | "reconnect" | "offline", cb: () => void): void
193
+ public addEventListener(event: string, cb: Function): void
194
+ public off(event: string, cb: Function): this
195
+ public removeEventListener(event: string, cb: Function): void
196
+
181
197
  // public once(event: "connect", cb: OnConnectCallback): this
182
198
  // public once(event: "message", cb: OnMessageCallback): this
183
199
  // public once(event: "packetsend" | "packetreceive", cb: OnPacketCallback): this
@@ -212,11 +228,11 @@ export class Client /*extends events.EventEmitter*/ {
212
228
  */
213
229
  public publish(
214
230
  topic: string,
215
- message: string | ArrayBuffer,
231
+ message: string | ArrayBuffer | ArrayBufferView,
216
232
  opts: IClientPublishOptions,
217
233
  callback?: PacketCallback
218
234
  ): this
219
- public publish(topic: string, message: string | ArrayBuffer, callback?: PacketCallback): this
235
+ public publish(topic: string, message: string | ArrayBuffer | ArrayBufferView, callback?: PacketCallback): this
220
236
 
221
237
  /**
222
238
  * subscribe - subscribe to <topic>
@@ -334,4 +350,6 @@ export class Client /*extends events.EventEmitter*/ {
334
350
  public getLastMessageId(): number
335
351
  }
336
352
 
353
+ export function connect(url: string, options?: IClientOptions): Client
354
+
337
355
  }
package/neopixel.d.ts CHANGED
@@ -29,8 +29,8 @@ declare module "neopixel" {
29
29
  close(): void;
30
30
  update(): void;
31
31
 
32
- makeRGB(r: number, g: number, b: number): number;
33
- makeHSB(h: number, s: number, b: number): number;
32
+ makeRGB(r: number, g: number, b: number, w?: number): number;
33
+ makeHSB(h: number, s: number, b: number, w?: number): number;
34
34
  setPixel(index: number, color: number): void;
35
35
  fill(color: number, index?: number, count?: number): void;
36
36
  getPixel(index: number): number;
package/onewire.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright (c) 2023 Moddable Tech, Inc.
3
+ * Copyright (c) 2023 Throsten von Eicken
4
+ *
5
+ * This file is part of the Moddable SDK.
6
+ *
7
+ * This work is licensed under the
8
+ * Creative Commons Attribution 4.0 International License.
9
+ * To view a copy of this license, visit
10
+ * <http://creativecommons.org/licenses/by/4.0>.
11
+ * or send a letter to Creative Commons, PO Box 1866,
12
+ * Mountain View, CA 94042, USA.
13
+ *
14
+ */
15
+
16
+ declare module "onewire" {
17
+ export default class OneWire {
18
+ constructor(dictionary : Record<string,any>);
19
+ close() : void;
20
+ // the bus identifies devices by their 8 byte ROM code, in an ArrayBuffer
21
+ read() : number;
22
+ read(count : number) : ArrayBuffer;
23
+ write(data : number) : void;
24
+ select(device : ArrayBuffer) : void;
25
+ search() : ArrayBuffer[];
26
+ isPresent(id : ArrayBuffer) : boolean;
27
+ reset() : boolean;
28
+ static crc(buffer : ArrayBuffer, length? : number) : number;
29
+ static hex(buffer : ArrayBuffer | Uint8Array) : string;
30
+ }
31
+ }
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "9.5.0",
3
+ "version": "10.0.0",
4
4
  "main": "",
5
5
  "types": "xs",
6
6
  "typesVersions": {
7
- ">=6.0.0-0": { "tsconfig.base.json": ["./tsconfig.es2025.json"] },
8
- ">=5.4.0-0": { "tsconfig.base.json": ["./tsconfig.es2024.json"] }
7
+ ">=6.0.0-0": {
8
+ "tsconfig.base.json": [
9
+ "./tsconfig.es2025.json"
10
+ ]
11
+ }
9
12
  },
10
13
  "author": "Moddable",
11
14
  "license": "ISC",
12
- "description": ""
15
+ "description": "",
16
+ "imports": {
17
+ "#host": {
18
+ "esp32/moddable_six": "./host/esp32/moddable_six.d.ts",
19
+ "esp32/moddable_two": "./host/esp32/moddable_two.d.ts",
20
+ "default": "./host/default.d.ts"
21
+ }
22
+ }
13
23
  }
@@ -21,9 +21,9 @@
21
21
  type TapDirection = "+x" | "-x" | "+y" | "-y" | "+z" | "-z";
22
22
 
23
23
  interface AccelerometerOptions {
24
- onSample?: () => void;
25
- onTap?: (direction: TapDirection) => void;
26
- onDoubleTap?: (direction: TapDirection) => void;
24
+ onSample?: (this: Accelerometer) => void;
25
+ onTap?: (this: Accelerometer, direction: TapDirection) => void;
26
+ onDoubleTap?: (this: Accelerometer, direction: TapDirection) => void;
27
27
  }
28
28
 
29
29
  interface AccelerometerConfigureOptions {
@@ -36,12 +36,12 @@ interface AccelerometerSample {
36
36
  z: number;
37
37
  }
38
38
 
39
- declare class Accelerometer {
39
+ declare class Accelerometer implements Disposable {
40
40
  constructor(options: AccelerometerOptions);
41
41
  close(): void;
42
42
  configure(options: AccelerometerConfigureOptions): void;
43
43
  sample(): AccelerometerSample;
44
+ [Symbol.dispose](): void;
44
45
  }
45
- interface Accelerometer extends Disposable {}
46
46
 
47
47
  export default Accelerometer;
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  interface BatteryOptions {
22
- onSample?: () => void;
22
+ onSample?: (this: Battery) => void;
23
23
  }
24
24
 
25
25
  interface BatterySample {
@@ -28,12 +28,12 @@ interface BatterySample {
28
28
  plugged: boolean;
29
29
  }
30
30
 
31
- declare class Battery {
31
+ declare class Battery implements Disposable {
32
32
  constructor(options: BatteryOptions);
33
33
  close(): void;
34
34
  configure(options: {}): void;
35
35
  sample(): BatterySample;
36
+ [Symbol.dispose](): void;
36
37
  }
37
- interface Battery extends Disposable {}
38
38
 
39
39
  export default Battery;
@@ -58,10 +58,10 @@ interface PebbleButtonMultipleOptions extends PebbleButtonRecognizers {
58
58
 
59
59
  type PebbleButtonOptions = PebbleButtonSingleOptions | PebbleButtonMultipleOptions;
60
60
 
61
- declare class PebbleButton {
61
+ declare class PebbleButton implements Disposable {
62
62
  constructor(options: PebbleButtonOptions);
63
63
  close(): void;
64
+ [Symbol.dispose](): void;
64
65
  }
65
- interface PebbleButton extends Disposable {}
66
66
 
67
67
  export default PebbleButton;
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  interface CompassOptions {
22
- onSample?: () => void;
22
+ onSample?: (this: Compass) => void;
23
23
  }
24
24
 
25
25
  interface CompassConfigureOptions {
@@ -30,12 +30,12 @@ interface CompassSample {
30
30
  heading: number;
31
31
  }
32
32
 
33
- declare class Compass {
33
+ declare class Compass implements Disposable {
34
34
  constructor(options: CompassOptions);
35
35
  close(): void;
36
36
  configure(options: CompassConfigureOptions): void;
37
37
  sample(): CompassSample;
38
+ [Symbol.dispose](): void;
38
39
  }
39
- interface Compass extends Disposable {}
40
40
 
41
41
  export default Compass;
@@ -29,7 +29,7 @@ interface DictationConfigureOptions {
29
29
  errorDialogs?: boolean;
30
30
  }
31
31
 
32
- declare class Dictation {
32
+ declare class Dictation implements Disposable {
33
33
  constructor(options: DictationOptions);
34
34
  close(): void;
35
35
  configure(options: DictationConfigureOptions): void;
@@ -37,7 +37,7 @@ declare class Dictation {
37
37
  stop(): void;
38
38
  read(): string | undefined;
39
39
  readonly format: "string";
40
+ [Symbol.dispose](): void;
40
41
  }
41
- interface Dictation extends Disposable {}
42
42
 
43
43
  export default Dictation;