@moddable/typings 8.1.1 → 8.2.1

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.
@@ -102,8 +102,14 @@ declare module "commodetto/Poco" {
102
102
 
103
103
  const Poco: PocoConstructor
104
104
 
105
+ export interface Screen extends PixelsOut {
106
+ command?(id: number, data?: ByteBuffer): void;
107
+ frameRate?: number;
108
+ syncFrames?: number;
109
+ }
110
+
105
111
  global {
106
- const screen: PixelsOut
112
+ const screen: Screen
107
113
  }
108
114
 
109
115
  export default Poco
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Runtime.
5
+ *
6
+ * The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Lesser 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 Runtime 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 Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public License
17
+ * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "embedded:update" {
22
+ import type { Flash } from "embedded:storage/flash";
23
+
24
+ export interface UpdateOpenOptions {
25
+ partition: Flash;
26
+ mode?: "a" | "w";
27
+ byteLength?: number;
28
+ }
29
+
30
+ export interface Updater {
31
+ close(): void;
32
+ complete(): void;
33
+ write(bytes: ByteBuffer): void;
34
+ write(bytes: ByteBuffer, byteOffset: number): void;
35
+ format: "buffer";
36
+ }
37
+
38
+ const Update: {
39
+ open(options: UpdateOpenOptions): Updater;
40
+ };
41
+
42
+ export default Update;
43
+ }
@@ -46,6 +46,8 @@ declare module "embedded:io/digital" {
46
46
  constructor(options: {
47
47
  pin: PinSpecifier;
48
48
  mode: Mode;
49
+ activeLow?: boolean;
50
+ initialValue?: 0 | 1;
49
51
  format?: "number";
50
52
  target?: any;
51
53
  } & ({
@@ -41,6 +41,10 @@ declare module "embedded:io/digitalbank" {
41
41
  pins: number;
42
42
  mode: Mode;
43
43
  bank?: number | string;
44
+ activeLow?: boolean;
45
+ initialValue?: number;
46
+ rises?: number;
47
+ falls?: number;
44
48
  onReadable?: (this: DigitalBank, trigger: number) => void;
45
49
  format?: "number";
46
50
  target?: any;
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Runtime.
5
+ *
6
+ * The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Lesser 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 Runtime 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 Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public License
17
+ * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "embedded:network/dnssd" {
22
+ import type UDP from "embedded:io/socket/udp";
23
+
24
+ export interface DNSSDSocketOptions {
25
+ io: typeof UDP;
26
+ address?: string;
27
+ multicast?: string;
28
+ timeToLive?: number;
29
+ }
30
+
31
+ export interface DNSSDOptions {
32
+ socket: DNSSDSocketOptions;
33
+ }
34
+
35
+ export interface ClaimOptions {
36
+ host: string;
37
+ onReady?(): void;
38
+ onError?(): void;
39
+ }
40
+
41
+ export interface ClaimHandle {
42
+ close(): void;
43
+ }
44
+
45
+ export interface ServiceObject {
46
+ name: string;
47
+ host: string;
48
+ address: string;
49
+ port: number;
50
+ txt?: Map<string, string | undefined>;
51
+ }
52
+
53
+ export interface DiscoverOptions {
54
+ serviceType: string;
55
+ onFound?(service: ServiceObject): void;
56
+ onUpdate?(service: ServiceObject): void;
57
+ onLost?(service: ServiceObject): void;
58
+ }
59
+
60
+ export interface DiscoverHandle {
61
+ close(): void;
62
+ }
63
+
64
+ export interface AdvertiseOptions {
65
+ serviceType: string;
66
+ host: string;
67
+ name?: string;
68
+ port: number;
69
+ txt?: Map<string, string | ByteBuffer>;
70
+ }
71
+
72
+ export interface AdvertiseHandle {
73
+ close(): void;
74
+ updateTXT(txt: Map<string, string | ByteBuffer>): void;
75
+ }
76
+
77
+ export default class DNSSD {
78
+ constructor(options: DNSSDOptions);
79
+ close(): void;
80
+ claim(options: ClaimOptions): ClaimHandle;
81
+ discover(options: DiscoverOptions): DiscoverHandle;
82
+ advertise(options: AdvertiseOptions): AdvertiseHandle;
83
+ }
84
+ }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Runtime.
5
+ *
6
+ * The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Lesser 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 Runtime 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 Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public License
17
+ * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "embedded:network/http/server" {
22
+ import type Listener from "embedded:io/socket/listener";
23
+ import type TCP from "embedded:io/socket/tcp";
24
+
25
+ export interface HTTPRequest {
26
+ method: string;
27
+ path: string;
28
+ headers: Map<string, string>;
29
+ }
30
+
31
+ export interface HTTPResponse {
32
+ status: number;
33
+ headers: Map<string, string | number>;
34
+ }
35
+
36
+ export interface HTTPConnectionHandlers {
37
+ onRequest?(this: HTTPConnection, request: HTTPRequest): void;
38
+ onReadable?(this: HTTPConnection, count: number): void;
39
+ onResponse?(this: HTTPConnection, response: HTTPResponse): void;
40
+ onWritable?(this: HTTPConnection, count: number): void;
41
+ onDone?(this: HTTPConnection): void;
42
+ onError?(this: HTTPConnection): void;
43
+ }
44
+
45
+ export interface HTTPConnection {
46
+ close(): void;
47
+ detach(): TCP;
48
+ accept(options: HTTPConnectionHandlers): void;
49
+ respond(options: HTTPResponse): void;
50
+ read(count?: number): ArrayBuffer | undefined;
51
+ write(bytes?: ByteBuffer): number;
52
+ route: HTTPConnectionHandlers;
53
+ format: "buffer";
54
+ }
55
+
56
+ export interface HTTPServerOptions {
57
+ io: typeof Listener;
58
+ port?: number;
59
+ onConnect(this: HTTPServer, connection: HTTPConnection): void;
60
+ }
61
+
62
+ export default class HTTPServer {
63
+ constructor(options: HTTPServerOptions);
64
+ close(): void;
65
+ readonly port: number;
66
+ }
67
+ }
@@ -54,6 +54,8 @@ declare module "embedded:network/interface/wifi" {
54
54
  readonly connection: number;
55
55
  readonly address: string | undefined;
56
56
  readonly MAC: string | undefined;
57
+ readonly SSID: string | undefined;
58
+ readonly RSSI: number | undefined;
57
59
  }
58
60
 
59
61
  export default WiFi;
package/mc/ffi.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Runtime.
5
+ *
6
+ * The Moddable SDK Runtime is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Lesser 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 Runtime 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 Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public License
17
+ * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // Fallback typing for mc/ffi. When a project's manifest declares ffi.functions,
22
+ // mcconfig generates a project-specific mc.ffi.d.ts with the exact signatures
23
+ // of the bound native functions; that generated typing takes precedence via
24
+ // the per-build tsconfig paths map.
25
+
26
+ declare module "mc/ffi" {
27
+ interface FFI {
28
+ [name: string]: (...args: any[]) => any;
29
+ }
30
+ const FFI: { new(): FFI };
31
+ export default FFI;
32
+ }
package/mcpack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2025 Moddable Tech, Inc
2
+ * Copyright (c) 2020-2026 Moddable Tech, Inc
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -18,6 +18,16 @@
18
18
  *
19
19
  */
20
20
 
21
+ /// <reference path="./web/fetch.d.ts" />
22
+ /// <reference path="./web/headers.d.ts" />
23
+ /// <reference path="./web/structuredClone.d.ts" />
24
+ /// <reference path="./web/url.d.ts" />
25
+ /// <reference path="./web/worker.d.ts" />
26
+ /// <reference path="./web/websocket.d.ts" />
27
+ /// <reference path="./web/webstorage.d.ts" />
28
+ /// <reference path="./text/decoder.d.ts" />
29
+ /// <reference path="./text/encoder.d.ts" />
30
+
21
31
  import type Timer from "timer";
22
32
 
23
33
  interface Console {
@@ -32,14 +42,35 @@ declare global {
32
42
  const setImmediate: (handler: Function) => Timer;
33
43
  const setInterval: (handler: Function, timeout?: number) => Timer;
34
44
  const setTimeout: (handler: Function, timeout?: number) => Timer;
45
+
46
+ const localStorage: import("webstorage").default;
47
+
48
+ const WebSocket: typeof import("web/websocket").default;
49
+ type WebSocket = import("web/websocket").default;
50
+
51
+ const Headers: typeof import("headers").default;
52
+ type Headers = import("headers").default;
53
+
54
+ const fetch: typeof import("fetch").fetch;
55
+
56
+ const structuredClone: typeof import("structuredClone").default;
57
+
58
+ const TextDecoder: typeof import("text/decoder").default;
59
+ type TextDecoder = import("text/decoder").default;
60
+
61
+ const TextEncoder: typeof import("text/encoder").default;
62
+ type TextEncoder = import("text/encoder").default;
63
+
64
+ const URL: typeof import("url").URL;
65
+ type URL = import("url").URL;
66
+
67
+ const URLSearchParams: typeof import("url").URLSearchParams;
68
+ type URLSearchParams = import("url").URLSearchParams;
69
+
70
+ const Worker: typeof import("worker").default;
71
+ type Worker = import("worker").default;
72
+
73
+ const SharedWorker: typeof import("worker").SharedWorker;
74
+ type SharedWorker = import("worker").SharedWorker;
35
75
  }
36
76
 
37
- // import fetch from "fetch";
38
- // import Headers from "headers";
39
- // import structuredClone from "structuredClone";
40
- // import TextDecoder from "text/decoder";
41
- // import TextEncoder from "text/encoder";
42
- // import URL from "url";
43
- // import { URLSearchParams } from "url";
44
- // import Worker from "worker";
45
- // import { SharedWorker } from "worker";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "8.1.1",
3
+ "version": "8.2.1",
4
4
  "main": "",
5
5
  "types": [
6
6
  "xs.d.ts",
package/piu/MC-types.d.ts CHANGED
@@ -145,6 +145,7 @@ export interface ContentDictionary
145
145
  name?: string;
146
146
  anchor?: string;
147
147
  Behavior?: BehaviorConstructor;
148
+ behavior?: Behavior;
148
149
  skin?: Skin | SkinDictionary;
149
150
  Skin?: SkinConstructor;
150
151
  style?: Style | StyleDictionary;
@@ -424,6 +425,7 @@ export interface Application extends Container {
424
425
  displayListLength: number;
425
426
  commandListLength: number;
426
427
  touchCount: number;
428
+ purge(): void;
427
429
  }
428
430
  export interface ApplicationDictionary extends ContainerDictionary {
429
431
  displayListLength?: number;
package/piu/MC.d.ts CHANGED
@@ -18,8 +18,10 @@
18
18
  *
19
19
  */
20
20
 
21
+ /// <reference path="../easing.d.ts" />
22
+
21
23
  declare module "piu/MC" {
22
- import {} from "commodetto/Poco"; // for global screen
24
+ import { } from "commodetto/Poco"; // for global screen
23
25
  import type * as MC from "piu/MC-types";
24
26
 
25
27
  global {
@@ -0,0 +1,33 @@
1
+ {
2
+ "_comment": "Base tsconfig for projects using @moddable/typings. Project tsconfig.json should `extends` this and add its own outDir, include, sourceMap, etc.",
3
+ "compilerOptions": {
4
+ "lib": ["es2025"],
5
+ "module": "preserve",
6
+ "moduleResolution": "bundler",
7
+ "target": "ES2025",
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "embedded:io/*": ["./embedded_io/*"],
11
+ "embedded:io/socket/*": ["./embedded_io/socket/*"],
12
+ "embedded:io/audio/*": ["./embedded_io/audio/*"],
13
+ "embedded:io/bluetoothle/*": ["./embedded_io/ble/*"],
14
+ "embedded:network/*": ["./embedded_network/*"],
15
+ "embedded:network/http/*": ["./embedded_network/http/*"],
16
+ "embedded:network/interface/*": ["./embedded_network/interface/*"],
17
+ "embedded:network/mqtt/*": ["./embedded_network/mqtt/*"],
18
+ "embedded:network/websocket/*": ["./embedded_network/websocket/*"],
19
+ "embedded:network/dns/resolver/*": ["./embedded_network/dns/resolver/*"],
20
+ "embedded:network/ntp/*": ["./embedded_network/ntp/*"],
21
+ "embedded:storage/*": ["./embedded/storage/*"],
22
+ "embedded:provider/*": ["./embedded_provider/*"],
23
+ "embedded:*": ["./embedded/*"],
24
+ "mc/*": ["./mc/*"],
25
+ "mod/*": ["./mod/*"],
26
+ "pins/*": ["./pins/*"],
27
+ "piu/*": ["./piu/*"],
28
+ "commodetto/*": ["./commodetto/*"],
29
+ "text/*": ["./text/*"],
30
+ "*": ["./*"]
31
+ }
32
+ }
33
+ }
@@ -55,6 +55,16 @@ declare module "web/websocket" {
55
55
  constructor(url: string, protocol?: string);
56
56
  constructor(options: WebSocketOptions);
57
57
 
58
+ static readonly CONNECTING: 0;
59
+ static readonly OPEN: 1;
60
+ static readonly CLOSING: 2;
61
+ static readonly CLOSED: 3;
62
+
63
+ readonly CONNECTING: 0;
64
+ readonly OPEN: 1;
65
+ readonly CLOSING: 2;
66
+ readonly CLOSED: 3;
67
+
58
68
  binaryType: "arraybuffer";
59
69
  readonly bufferedAmount: number;
60
70
  readonly extensions: string;