@moddable/typings 7.1.0 → 7.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.
package/ChatAudioIO.d.ts CHANGED
@@ -20,9 +20,10 @@
20
20
 
21
21
  declare module "ChatAudioIO" {
22
22
  type ChatAudioIOOptions = {
23
- specifier: "googleGeminiLive" | "openAIRealtime" | "humeAIEVI" | "elevenLabsAgent";
23
+ specifier: "googleGeminiLive" | "openAIRealtime" | "humeAIEVI" | "elevenLabsAgent" | "deepgramAgent";
24
24
  voiceName?: string;
25
25
  instructions?: string;
26
+ apiKey?: string;
26
27
 
27
28
  onStateChanged?: (this: ChatAudioIO, state: number) => void;
28
29
  onInputTranscript?: (this: ChatAudioIO, text: string, more: boolean) => void;
@@ -45,6 +45,10 @@ declare module "commodetto/Bitmap" {
45
45
  static readonly RGB444 = 13
46
46
  static readonly JPEG = 14
47
47
  static readonly PNG = 15
48
+ static readonly MonochromeAligned = 21
49
+ static readonly MonochromePebble = 22
50
+ static readonly MonochromeARGB2222 = 23
51
+ static readonly MonochromeGray4 = 24
48
52
 
49
53
  static readonly RLE = 0x80
50
54
  }
@@ -66,8 +66,8 @@ declare module "embedded:storage/files" {
66
66
  status(path: string, options?: DirectoryStatusOptions): Status;
67
67
 
68
68
  createDirectory(path: string): boolean;
69
- createLink(path: string, target: string): void;
70
- readLink(path: string): string;
69
+ createLink?(path: string, target: string): void;
70
+ readLink?(path: string): string;
71
71
 
72
72
  scan(path?: string): IterableIterator<string>;
73
73
  [Symbol.iterator](): IterableIterator<string>;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2024-2025 Moddable Tech, Inc.
2
+ * Copyright (c) 2024-2026 Moddable Tech, Inc.
3
3
  *
4
4
  * This file is part of the Moddable SDK Runtime.
5
5
  *
@@ -20,6 +20,7 @@
20
20
 
21
21
  declare module "embedded:storage/key-value" {
22
22
  export interface StorageOpenOptions {
23
+ format?: StorageFormat;
23
24
  path: string;
24
25
  mode?: "r" | "r+";
25
26
  }
@@ -20,10 +20,10 @@
20
20
 
21
21
  declare module "embedded:network/http/client" {
22
22
  export interface ClientOptions {
23
- socket: any
24
- port?:number
23
+ socket?: any
24
+ port?: number
25
25
  host: string
26
- dns: any
26
+ dns?: any
27
27
  onError?: (err:any)=>void
28
28
  }
29
29
 
@@ -31,7 +31,8 @@ declare module "embedded:network/http/client" {
31
31
  method?: string
32
32
  path?: string
33
33
  headers?: Map<string, string|string[]>
34
- onHeaders?: (this: HTTPRequest, status:number, headers: Map<String, string>) => void
34
+ headersMask?: Array<string>
35
+ onHeaders?: (this: HTTPRequest, status:number, headers: Map<string, string>, statusText: string) => void
35
36
  onReadable?: (this: HTTPRequest, count: number) => void
36
37
  onWritable?: (this: HTTPRequest, count: number) => void
37
38
  onDone?: (this: HTTPRequest, error: Error|null) => void // note: error is empty Error object
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Copyright (c) 2025 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
+ // websocketclient.d.ts
22
+
23
+ declare module "embedded:network/websocket/client" {
24
+ interface WebSocketClientOptions {
25
+ onReadable?: (this: WebSocketClient, count: number, options: { more: boolean; binary: boolean }) => void;
26
+ onWritable?: (this: WebSocketClient, count: number) => void;
27
+ onControl?: (this: WebSocketClient, opcode: number, data: ArrayBuffer) => void;
28
+ onClose?: (this: WebSocketClient) => void;
29
+ onError?: (this: WebSocketClient) => void;
30
+ format?: "buffer" | "number";
31
+ target?: any;
32
+ attach?: {
33
+ constructor: new (options: any) => any;
34
+ };
35
+ host?: string;
36
+ path?: string;
37
+ port?: number;
38
+ protocol?: string;
39
+ headers?: Map<string, string>;
40
+ dns?: {
41
+ io: new (options: any) => any;
42
+ };
43
+ socket?: {
44
+ io: new (options: any) => any;
45
+ };
46
+ }
47
+
48
+ interface WebSocketWriteOptions {
49
+ opcode?: number;
50
+ binary?: boolean;
51
+ more?: boolean;
52
+ }
53
+
54
+ class WebSocketClient {
55
+ constructor(options: WebSocketClientOptions);
56
+
57
+ close(): void;
58
+ write(data: ByteBuffer, options?: WebSocketWriteOptions): number;
59
+ read(): number | ArrayBuffer;
60
+ read(count: number): ArrayBuffer;
61
+ read(buffer: ByteBuffer): number;
62
+
63
+ format: "buffer" | "number";
64
+ target?: any;
65
+
66
+ static readonly text: 1;
67
+ static readonly binary: 2;
68
+ static readonly close: 8;
69
+ static readonly ping: 9;
70
+ static readonly pong: 10;
71
+ }
72
+
73
+ export default WebSocketClient;
74
+ }
package/global.d.ts CHANGED
@@ -1,9 +1,12 @@
1
- import System_ from "embedded:io/system"
2
- import Device from "embedded:provider/builtin"
1
+ declare module "global" {
3
2
 
4
- export {}
5
- declare global {
6
- // NOTE: `System` is non-standard and temporary to support the IO examples. Breaking changes are possible.
7
- var System: typeof System_;
8
- var device: typeof Device;
3
+ import System_ from "embedded:io/system"
4
+ import Device from "embedded:provider/builtin"
5
+
6
+ export {}
7
+ global {
8
+ // NOTE: `System` is non-standard and temporary to support the IO examples. Breaking changes are possible.
9
+ var System: typeof System_;
10
+ var device: typeof Device;
11
+ }
9
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "7.1.0",
3
+ "version": "7.2.1",
4
4
  "main": "",
5
5
  "types": [
6
6
  "xs.d.ts",
@@ -0,0 +1,46 @@
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
+ type TapDirection = "+x" | "-x" | "+y" | "-y" | "+z" | "-z";
22
+
23
+ interface AccelerometerOptions {
24
+ onSample?: () => void;
25
+ onTap?: (direction: TapDirection) => void;
26
+ onDoubleTap?: (direction: TapDirection) => void;
27
+ }
28
+
29
+ interface AccelerometerConfigureOptions {
30
+ hz?: 10 | 25 | 50 | 100;
31
+ }
32
+
33
+ interface AccelerometerSample {
34
+ x: number;
35
+ y: number;
36
+ z: number;
37
+ }
38
+
39
+ declare class Accelerometer {
40
+ constructor(options: AccelerometerOptions);
41
+ close(): void;
42
+ configure(options: AccelerometerConfigureOptions): void;
43
+ sample(): AccelerometerSample;
44
+ }
45
+
46
+ export default Accelerometer;
@@ -0,0 +1,38 @@
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
+ interface BatteryOptions {
22
+ onSample?: () => void;
23
+ }
24
+
25
+ interface BatterySample {
26
+ percent: number;
27
+ charging: boolean;
28
+ plugged: boolean;
29
+ }
30
+
31
+ declare class Battery {
32
+ constructor(options: BatteryOptions);
33
+ close(): void;
34
+ configure(options: {}): void;
35
+ sample(): BatterySample;
36
+ }
37
+
38
+ export default Battery;
@@ -0,0 +1,40 @@
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
+ type ButtonType = "back" | "up" | "down" | "select";
22
+
23
+ interface PebbleButtonSingleOptions {
24
+ type: ButtonType;
25
+ onPush: (pushed: 0 | 1, type: ButtonType) => void;
26
+ }
27
+
28
+ interface PebbleButtonMultipleOptions {
29
+ types: ButtonType[];
30
+ onPush: (pushed: 0 | 1, type: ButtonType) => void;
31
+ }
32
+
33
+ type PebbleButtonOptions = PebbleButtonSingleOptions | PebbleButtonMultipleOptions;
34
+
35
+ declare class PebbleButton {
36
+ constructor(options: PebbleButtonOptions);
37
+ close(): void;
38
+ }
39
+
40
+ export default PebbleButton;
@@ -0,0 +1,40 @@
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
+ interface CompassOptions {
22
+ onSample?: () => void;
23
+ }
24
+
25
+ interface CompassConfigureOptions {
26
+ filter?: number;
27
+ }
28
+
29
+ interface CompassSample {
30
+ heading: number;
31
+ }
32
+
33
+ declare class Compass {
34
+ constructor(options: CompassOptions);
35
+ close(): void;
36
+ configure(options: CompassConfigureOptions): void;
37
+ sample(): CompassSample;
38
+ }
39
+
40
+ export default Compass;
@@ -0,0 +1,51 @@
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
+ declare module "embedded:provider/builtin" {
22
+
23
+ const device: {
24
+ readonly network: {
25
+ http: {
26
+ io: typeof import("embedded:network/http/client").default;
27
+ protocol: "http";
28
+ };
29
+ https: {
30
+ io: typeof import("embedded:network/http/client").default;
31
+ protocol: "https";
32
+ };
33
+ ws: {
34
+ io: typeof import("embedded:network/websocket/client").default;
35
+ secure: false;
36
+ };
37
+ wss: {
38
+ io: typeof import("embedded:network/websocket/client").default;
39
+ secure: true;
40
+ };
41
+ };
42
+ readonly info: {
43
+ readonly language: string,
44
+ readonly serialNumber: string,
45
+ }
46
+ readonly files: import("embedded:storage/files").Directory;
47
+ readonly keyValue: typeof import("embedded:storage/key-value").default;
48
+ }
49
+
50
+ export default device;
51
+ }
@@ -0,0 +1,129 @@
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
+ /*
22
+ console
23
+ */
24
+
25
+ interface Console {
26
+ log(...args: any[]): void;
27
+ }
28
+
29
+ declare const console:Console;
30
+
31
+ /*
32
+ watch global
33
+ */
34
+
35
+ interface TimeChangeEvent {
36
+ date: Date;
37
+ }
38
+
39
+ interface ConnectionState {
40
+ app: boolean;
41
+ pebblekit: boolean;
42
+ }
43
+
44
+ type TimeEventType = "secondchange" | "minutechange" | "hourchange" | "daychange";
45
+
46
+ type PebbleEventType = TimeEventType | "connected" | "resize";
47
+
48
+ type TimeChangeCallback = (event: TimeChangeEvent) => void;
49
+
50
+ type ConnectedCallback = () => void;
51
+
52
+ type ResizeCallback = (progress: number) => void;
53
+
54
+ interface watch {
55
+ addEventListener(event: TimeEventType, callback: TimeChangeCallback): void;
56
+ addEventListener(event: "connected", callback: ConnectedCallback): void;
57
+ addEventListener(event: "resize", callback: ResizeCallback): void;
58
+ removeEventListener(event: TimeEventType, callback: TimeChangeCallback): void;
59
+ removeEventListener(event: "connected", callback: ConnectedCallback): void;
60
+ removeEventListener(event: "resize", callback: ResizeCallback): void;
61
+ readonly connected: ConnectionState;
62
+ }
63
+
64
+ declare const watch: watch;
65
+
66
+ /*
67
+ Resource
68
+ */
69
+
70
+ declare const Resource: typeof import('Resource').default;
71
+
72
+ /*
73
+ setTimeout and friends
74
+ */
75
+
76
+ declare function setInterval(callback: () => void, delay: number): number;
77
+ declare function clearInterval(id: number): void;
78
+ declare function setTimeout(callback: () => void, delay: number): number;
79
+ declare function clearTimeout(id: number): void;
80
+
81
+ /*
82
+ Web
83
+ */
84
+
85
+ declare const URL: typeof import('url').URL;
86
+ declare const URLSearchParams: typeof import('url').URLSearchParams;
87
+ declare const Headers: typeof import('headers').default;
88
+ declare const localStorage: import('webstorage').default;
89
+ declare const WebSocket: typeof import('web/websocket').default;
90
+ declare const fetch: typeof import('fetch').fetch;
91
+
92
+ /*
93
+ Piu
94
+ */
95
+
96
+ type Application = import("piu/MC-types").Application;
97
+ type Behavior = import("piu/MC-types").Behavior;
98
+ type Column = import("piu/MC-types").Column;
99
+ type Container = import("piu/MC-types").Container;
100
+ type Content = import("piu/MC-types").Content;
101
+ type ContentDictionary = import("piu/MC-types").ContentDictionary;
102
+ type Label = import("piu/MC-types").Label;
103
+ type Link = import("piu/MC-types").Link;
104
+ type Locals = import("piu/MC-types").Locals;
105
+ type Port = import("piu/MC-types").Port;
106
+ type Row = import("piu/MC-types").Row;
107
+ type Skin = import("piu/MC-types").Skin;
108
+ type Style = import("piu/MC-types").Style;
109
+ type Text = import("piu/MC-types").Text;
110
+ type Texture = import("piu/MC-types").Texture;
111
+ type Transition = import("piu/MC-types").Transition;
112
+
113
+ declare const Inverter: InverterConstructor;
114
+ declare const RonndRect: RoundRectConstructor;
115
+ declare const ScreenBuffer: ScreenBufferConstructor;
116
+ declare const SVGImage: SVGImageConsructor;
117
+
118
+ /*
119
+ ECMA-419
120
+ */
121
+
122
+ // device is defined in typings/pebble/device.d.ts
123
+
124
+ declare module "embedded:storage/files" {
125
+ interface DirectoryOpenFileOptions {
126
+ size?: number;
127
+ }
128
+ }
129
+
@@ -0,0 +1,50 @@
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
+ interface LocationSample {
22
+ latitude: number;
23
+ longitude: number;
24
+ altitude?: number;
25
+ accuracy?: number;
26
+ altitudeAccuracy?: number;
27
+ heading?: number;
28
+ speed?: number;
29
+ timestamp?: number;
30
+ }
31
+
32
+ interface LocationOptions {
33
+ onSample?: () => void;
34
+ onError?: (error: Error) => void;
35
+ }
36
+
37
+ interface LocationConfiguration {
38
+ enableHighAccuracy?: boolean;
39
+ timeout?: number;
40
+ maximumAge?: number;
41
+ }
42
+
43
+ declare class Location {
44
+ constructor(options: LocationOptions);
45
+ close(): void;
46
+ configure(options: LocationConfiguration): void;
47
+ sample(): LocationSample | undefined;
48
+ }
49
+
50
+ export default Location;
@@ -0,0 +1,46 @@
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
+ interface MessageOptions {
22
+ onReadable?: () => void;
23
+ onWritable?: (count: number) => void;
24
+ onSuspend?: () => void;
25
+ format?: "map";
26
+ input?: number;
27
+ output?: number;
28
+ keys?: Map<string, number> | Array<string>;
29
+ }
30
+
31
+ type MessageKey = string | number;
32
+ type MessageReadValue = number | string | ArrayBuffer;
33
+ type MessageWriteValue = number | string | ByteBuffer | boolean;
34
+
35
+ declare class Message {
36
+ constructor(options: MessageOptions);
37
+ close(): void;
38
+ read(): Map<MessageKey, MessageReadValue>;
39
+ write(map: Map<MessageKey, MessageWriteValue>): void;
40
+ get format(): "map";
41
+ set format(value: "map");
42
+ get input(): number;
43
+ get output(): number;
44
+ }
45
+
46
+ export default Message;