@moddable/typings 8.2.1 → 8.2.2

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2025 Moddable Tech, Inc.
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
3
  *
4
4
  * This file is part of the Moddable SDK Runtime.
5
5
  *
@@ -21,17 +21,31 @@
21
21
  declare module "embedded:network/interface/ethernet" {
22
22
  import type {PortSpecifier} from "embedded:io/_common";
23
23
 
24
+ export type EthernetChangedProperty = "connection" | "address";
25
+
24
26
  export interface EthernetConstructorOptions {
25
27
  port?: PortSpecifier;
26
- onChanged?: () => void;
28
+ onChanged?: (property: EthernetChangedProperty) => void;
29
+ }
30
+
31
+ export interface EthernetStaticAddress {
32
+ address: string;
33
+ mask: string;
34
+ gateway: string;
35
+ }
36
+
37
+ export interface EthernetConfigureOptions {
38
+ hostname?: string;
39
+ static?: EthernetStaticAddress | false;
27
40
  }
28
41
 
29
42
  class Ethernet {
30
43
  constructor(options: EthernetConstructorOptions);
31
44
 
32
45
  close(): void;
33
- connect(options: {}): void;
46
+ connect(): void;
34
47
  disconnect(): void;
48
+ configure(options: EthernetConfigureOptions): void;
35
49
 
36
50
  readonly connection: number;
37
51
  readonly address: string | undefined;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2025 Moddable Tech, Inc.
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
3
  *
4
4
  * This file is part of the Moddable SDK Runtime.
5
5
  *
@@ -21,9 +21,11 @@
21
21
  declare module "embedded:network/interface/wifi" {
22
22
  import type {PortSpecifier} from "embedded:io/_common";
23
23
 
24
+ export type WiFiChangedProperty = "connection" | "address";
25
+
24
26
  export interface WiFiConstructorOptions {
25
27
  port?: PortSpecifier;
26
- onChanged?: () => void;
28
+ onChanged?: (property: WiFiChangedProperty) => void;
27
29
  }
28
30
 
29
31
  export interface WiFiScanResult {
@@ -43,6 +45,17 @@ declare module "embedded:network/interface/wifi" {
43
45
  password?: string;
44
46
  }
45
47
 
48
+ export interface WiFiStaticAddress {
49
+ address: string;
50
+ mask: string;
51
+ gateway: string;
52
+ }
53
+
54
+ export interface WiFiConfigureOptions {
55
+ hostname?: string;
56
+ static?: WiFiStaticAddress | false;
57
+ }
58
+
46
59
  class WiFi {
47
60
  constructor(options: WiFiConstructorOptions);
48
61
 
@@ -50,6 +63,7 @@ declare module "embedded:network/interface/wifi" {
50
63
  scan(options: WiFiScanOptions): void;
51
64
  connect(options: WiFiConnectOptions): void;
52
65
  disconnect(): void;
66
+ configure(options: WiFiConfigureOptions): void;
53
67
 
54
68
  readonly connection: number;
55
69
  readonly address: string | undefined;
package/inflate.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2025 Moddable Tech, Inc.
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -24,7 +24,7 @@ declare module "inflate" {
24
24
  constructor(options?: {windowBits?: number});
25
25
  close(): void;
26
26
 
27
- push(buffer: ByteBuffer, end?: boolean): number;
27
+ push(buffer: ByteBuffer, flush?: boolean, output?: ByteBuffer): void;
28
28
 
29
29
  onData: (data: ArrayBuffer) => void;
30
30
  onEnd: (status: number) => void;
package/mcpack.d.ts CHANGED
@@ -18,6 +18,7 @@
18
18
  *
19
19
  */
20
20
 
21
+ /// <reference path="./web/eventsource.d.ts" />
21
22
  /// <reference path="./web/fetch.d.ts" />
22
23
  /// <reference path="./web/headers.d.ts" />
23
24
  /// <reference path="./web/structuredClone.d.ts" />
@@ -43,6 +44,9 @@ declare global {
43
44
  const setInterval: (handler: Function, timeout?: number) => Timer;
44
45
  const setTimeout: (handler: Function, timeout?: number) => Timer;
45
46
 
47
+ const EventSource: typeof import("web/eventsource").default;
48
+ type EventSource = import("web/eventsource").default;
49
+
46
50
  const localStorage: import("webstorage").default;
47
51
 
48
52
  const WebSocket: typeof import("web/websocket").default;
package/modules.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2022 Chris Midgley
2
+ * Copyright (c) 2022-2026 Chris Midgley
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -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): unknown;
24
+ static importNow(name: string, namespace?: boolean): unknown;
25
25
  static get host(): string[];
26
26
  static get archive(): string[];
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "8.2.1",
3
+ "version": "8.2.2",
4
4
  "main": "",
5
5
  "types": [
6
6
  "xs.d.ts",
@@ -18,7 +18,7 @@
18
18
  *
19
19
  */
20
20
 
21
- type ButtonType = "back" | "up" | "down" | "select";
21
+ export type ButtonType = "back" | "up" | "down" | "select";
22
22
 
23
23
  interface PebbleButtonSingleOptions {
24
24
  type: ButtonType;
@@ -85,6 +85,7 @@ interface watch {
85
85
  removeEventListener(event: "didFocus", callback: FocusCallback): void;
86
86
  removeEventListener(event: "wakeup", callback: WakeupCallback): void;
87
87
  light(enable?: boolean): void;
88
+ exit(reason?: number): void;
88
89
  readonly connected: ConnectionState;
89
90
  readonly hour12: boolean;
90
91
  readonly model: number;
package/pebble/poco.d.ts CHANGED
@@ -47,10 +47,19 @@ declare module "commodetto/Poco" {
47
47
  constructor(id: number | string);
48
48
  }
49
49
 
50
+ class PebbleDrawCommand {
51
+ readonly type: number;
52
+ strokeWidth: number;
53
+ stroke: number;
54
+ fill: number;
55
+ hidden: boolean;
56
+ }
57
+
50
58
  class PebbleDrawCommandList {
51
59
  scale(x: number, y: number): this;
52
60
  scale(scale: number): this;
53
61
  rotate(angle: number, cx: number, cy: number): this;
62
+ process(callback: (this: PebbleDrawCommandList, command: PebbleDrawCommand) => void): this;
54
63
  }
55
64
 
56
65
  class PebbleDrawCommandImage extends PebbleDrawCommandList {
package/piu/MC-types.d.ts CHANGED
@@ -34,7 +34,7 @@ export type Size = {
34
34
  height?: number;
35
35
  };
36
36
  export type Bounds = Position & Size;
37
- export type Color = string;
37
+ export type Color = string | number;
38
38
  export type ContentState = {
39
39
  state?: number;
40
40
  variant?: number;
@@ -529,19 +529,19 @@ export interface Locals {
529
529
  }
530
530
 
531
531
  export interface blendColors {
532
- (a: number, c1: number, c2: number): Color
532
+ (a: number, c1: number, c2: number): Extract<Color, number>
533
533
  }
534
534
  export interface hsl {
535
- (h: number, s: number, l: number): Color
535
+ (h: number, s: number, l: number): Extract<Color, number>
536
536
  }
537
537
  export interface hsla {
538
- (h: number, s: number, l: number, a: number): Color
538
+ (h: number, s: number, l: number, a: number): Extract<Color, number>
539
539
  }
540
540
  export interface rgb {
541
- (r: number, g: number, b: number): Color
541
+ (r: number, g: number, b: number): Extract<Color, number>
542
542
  }
543
543
  export interface rgba {
544
- (r: number, g: number, b: number, a: number): Color
544
+ (r: number, g: number, b: number, a: number): Extract<Color, number>
545
545
  }
546
546
 
547
547
 
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "_comment": "Base tsconfig for projects using @moddable/typings. Project tsconfig.json should `extends` this and add its own outDir, include, sourceMap, etc.",
3
3
  "compilerOptions": {
4
- "lib": ["es2025"],
4
+ "lib": ["es2024"],
5
5
  "module": "preserve",
6
6
  "moduleResolution": "bundler",
7
- "target": "ES2025",
7
+ "target": "ES2024",
8
8
  "baseUrl": ".",
9
9
  "paths": {
10
10
  "embedded:io/*": ["./embedded_io/*"],
@@ -0,0 +1,8 @@
1
+ {
2
+ "_comment": "ES2025 overrides on top of the ES2024 base. Used when TypeScript >= 6 (see typesVersions in package.json).",
3
+ "extends": "./tsconfig.es2024.json",
4
+ "compilerOptions": {
5
+ "lib": ["es2025"],
6
+ "target": "ES2025"
7
+ }
8
+ }
@@ -0,0 +1,76 @@
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
+ declare module "web/eventsource" {
22
+ import Headers from "headers"
23
+
24
+ interface EventSourceInit {
25
+ method?: string;
26
+ headers?: Headers | Record<string, string>;
27
+ body?: string | ArrayBuffer;
28
+ }
29
+
30
+ interface EventSourceEvent {
31
+ type: string;
32
+ }
33
+
34
+ interface EventSourceMessageEvent extends EventSourceEvent {
35
+ data: string;
36
+ origin: string;
37
+ lastEventID: string;
38
+ }
39
+
40
+ interface EventSourceErrorEvent extends EventSourceEvent {
41
+ status?: number;
42
+ statusText?: string;
43
+ }
44
+
45
+ type EventSourceEventListener = (event: any) => void;
46
+
47
+ class EventSource {
48
+ constructor(url: string, options?: EventSourceInit);
49
+
50
+ static readonly CONNECTING: 0;
51
+ static readonly OPEN: 1;
52
+ static readonly CLOSED: 2;
53
+
54
+ readonly CONNECTING: 0;
55
+ readonly OPEN: 1;
56
+ readonly CLOSED: 2;
57
+
58
+ readonly readyState: number;
59
+ readonly url: string;
60
+
61
+ onerror?(event: EventSourceErrorEvent): void;
62
+ onopen?(event: EventSourceEvent): void;
63
+ onmessage?(event: EventSourceMessageEvent): void;
64
+
65
+ addEventListener(type: "open", listener: (event: EventSourceEvent) => void): void;
66
+ addEventListener(type: "error", listener: (event: EventSourceErrorEvent) => void): void;
67
+ addEventListener(type: "message", listener: (event: EventSourceMessageEvent) => void): void;
68
+ addEventListener(type: string, listener: (event: EventSourceMessageEvent) => void): void;
69
+
70
+ removeEventListener(type: string, listener: EventSourceEventListener): void;
71
+
72
+ close(): void;
73
+ }
74
+
75
+ export default EventSource;
76
+ }