@moddable/typings 9.0.0 → 9.0.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.
@@ -0,0 +1,65 @@
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/interface/wifi/accesspoint" {
22
+ export type WiFiAccessPointChangedProperty = "connection";
23
+
24
+ export type WiFiAccessPointAuthentication = "none" | "wpa_psk" | "wpa2_psk" | "wpa_wpa2_psk" | "wpa3_psk" | "wpa2_wpa3_psk";
25
+
26
+ export interface WiFiAccessPointStation extends Disposable {
27
+ close(): void;
28
+
29
+ readonly MAC: string;
30
+ readonly address: string | undefined;
31
+ }
32
+
33
+ export interface WiFiAccessPointConstructorOptions {
34
+ SSID: string;
35
+ password?: string;
36
+ authentication?: WiFiAccessPointAuthentication;
37
+ channel?: number;
38
+ hidden?: boolean;
39
+ max?: number;
40
+ interval?: number;
41
+ onChanged?(this: WiFiAccessPoint, property: WiFiAccessPointChangedProperty): void;
42
+ onConnect?(this: WiFiAccessPoint, station: WiFiAccessPointStation): void;
43
+ onDisconnect?(this: WiFiAccessPoint, station: WiFiAccessPointStation): void;
44
+ }
45
+
46
+ export interface WiFiAccessPointConfigureOptions {
47
+ portal?: string;
48
+ }
49
+
50
+ class WiFiAccessPoint {
51
+ constructor(options: WiFiAccessPointConstructorOptions);
52
+
53
+ close(): void;
54
+ configure(options: WiFiAccessPointConfigureOptions): void;
55
+
56
+ readonly connection: number;
57
+ readonly address: string | undefined;
58
+ readonly MAC: string | undefined;
59
+ readonly SSID: string | undefined;
60
+ readonly channel: number | undefined;
61
+ }
62
+ interface WiFiAccessPoint extends Disposable {}
63
+
64
+ export default WiFiAccessPoint;
65
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "main": "",
5
5
  "types": "xs",
6
6
  "typesVersions": {
@@ -30,8 +30,8 @@ interface LocationSample {
30
30
  }
31
31
 
32
32
  interface LocationOptions {
33
- onSample?: () => void;
34
- onError?: (error: Error) => void;
33
+ onSample?: (this: Location) => void;
34
+ onError?: (this: Location, error: Error) => void;
35
35
  }
36
36
 
37
37
  interface LocationConfiguration {
package/xs.d.ts ADDED
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Copyright (c) 2020-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 Trace {
22
+ (...log: (string | number | boolean)[]):void;
23
+ left(log: string | ArrayBufferLike, conversation?: string):void;
24
+ center(log: string | ArrayBufferLike, conversation?: string):void;
25
+ right(log: string | ArrayBufferLike, conversation?: string):void;
26
+ }
27
+ declare const trace:Trace;
28
+
29
+ declare class HostBuffer {
30
+ readonly byteLength: number
31
+ private brand: boolean;
32
+ }
33
+
34
+ interface ArrayBufferTypes {
35
+ HostBuffer: HostBuffer;
36
+ }
37
+
38
+ interface ByteBufferTypes extends ArrayBufferTypes {
39
+ Uint8Array: Uint8Array,
40
+ Uint8ClampedArray: Uint8ClampedArray,
41
+ Int8Array: Int8Array,
42
+ DataView: DataView
43
+ }
44
+
45
+ type ByteBuffer = ByteBufferTypes[keyof ByteBufferTypes];
46
+
47
+ interface ObjectConstructor {
48
+ freeze<T>(obj: T, freeze?: boolean | number): Readonly<T>;
49
+ }
50
+
51
+ interface JSON {
52
+ parse(text: string, reviver?: string[]): any;
53
+ }
54
+
55
+ interface StringConstructor {
56
+ fromArrayBuffer(buffer: ArrayBufferLike): string;
57
+ }
58
+
59
+ interface ArrayBufferConstructor {
60
+ fromString(string: string): ArrayBuffer;
61
+ fromBigInt(value: bigint): ArrayBuffer;
62
+ }
63
+
64
+ interface ArrayBuffer {
65
+ concat(...buffers: ArrayBufferLike[]): ArrayBuffer;
66
+ }
67
+
68
+ interface Uint8Array {
69
+ toHex(): string;
70
+ toBase64(): string
71
+ }
72
+
73
+ interface FromBase64Options {
74
+ alphabet?: "base64url" | "base64";
75
+ lastChunkHandling?: "stop-before-partial" | "strict" | "loose";
76
+ omitPadding?: boolean;
77
+ }
78
+
79
+ interface Uint8ArrayConstructor {
80
+ fromBase64(base64: string, options?: FromBase64Options): Uint8Array;
81
+ fromHex(string: string): Uint8Array;
82
+ }
83
+
84
+ interface BigIntConstructor {
85
+ bitLength(value: bigint): number
86
+ fromArrayBuffer(buffer: ArrayBufferLike): bigint
87
+ }
88
+
89
+ // integer math proposal
90
+ interface Math {
91
+ idiv(a: number, b: number): number
92
+ imod(a: number, b: number): number
93
+ imuldiv(a: number, b: number, c: number): number
94
+ irandom(a: number, b: number): number
95
+ irem(a: number, b: number): number
96
+ mod(a: number, b: number): number
97
+ }
98
+
99
+ // xs host objects, host functions
100
+ declare function Native(name: string): new (...args: any[]) => any;
101
+ declare function native(name: string): (...args: any[]) => any;
102
+
103
+ // Compartment?
@@ -1,102 +0,0 @@
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 "embedded:sensor/Barometer-Humidity-Temperature/BME280" {
22
- interface BME280IO {
23
- write(buffer: ArrayBuffer | ArrayBufferView, stop?: boolean): void;
24
- read(buffer: ArrayBuffer | ArrayBufferView): void;
25
- close(): void;
26
- }
27
-
28
- interface BME280SensorOptions {
29
- io: new (options: object) => BME280IO;
30
- address?: number;
31
- hz?: number;
32
- data?: number | string;
33
- clock?: number | string;
34
- [key: string]: unknown;
35
- }
36
-
37
- interface BME280Options {
38
- sensor: BME280SensorOptions;
39
- target?: unknown;
40
- }
41
-
42
- interface BME280Configuration {
43
- mode?: number;
44
- temperatureSampling?: number;
45
- pressureSampling?: number;
46
- humiditySampling?: number;
47
- filter?: number;
48
- standbyDuration?: number;
49
- }
50
-
51
- interface BME280Sample {
52
- thermometer: { temperature: number };
53
- hygrometer: { humidity?: number };
54
- barometer: { pressure: number };
55
- }
56
-
57
- interface BME280ConfigConstants {
58
- readonly Sampling: {
59
- readonly SKIPPED: 0x00;
60
- readonly X1: 0x01;
61
- readonly X2: 0x02;
62
- readonly X4: 0x03;
63
- readonly X8: 0x04;
64
- readonly X16: 0x05;
65
- };
66
- readonly Filter: {
67
- readonly OFF: 0x00;
68
- readonly X2: 0x01;
69
- readonly X4: 0x02;
70
- readonly X8: 0x03;
71
- readonly X16: 0x04;
72
- };
73
- readonly Mode: {
74
- readonly SLEEP: 0x00;
75
- readonly FORCED: 0x01;
76
- readonly NORMAL: 0x03;
77
- };
78
- readonly Standby: {
79
- readonly MS_0_5: 0x00;
80
- readonly MS_62_5: 0x01;
81
- readonly MS_125: 0x02;
82
- readonly MS_250: 0x03;
83
- readonly MS_500: 0x04;
84
- readonly MS_1000: 0x05;
85
- readonly MS_10: 0x06;
86
- readonly MS_20: 0x07;
87
- };
88
- }
89
-
90
- class BME280 {
91
- constructor(options: BME280Options);
92
- configure(options: BME280Configuration): void;
93
- sample(): BME280Sample;
94
- close(): void;
95
- target?: unknown;
96
- }
97
- interface BME280 extends Disposable {}
98
-
99
- const Config: BME280ConfigConstants;
100
-
101
- export { BME280 as default, BME280, Config };
102
- }
@@ -1,39 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Moddable Tech, Inc.
3
- */
4
-
5
- import type {
6
- LocationConfiguration,
7
- LocationOptions,
8
- LocationSample,
9
- LocationSensor
10
- } from "./location";
11
-
12
- export interface FixedOptions extends LocationOptions {
13
- latitude: number;
14
- longitude: number;
15
- altitude?: number;
16
- accuracy?: number;
17
- }
18
-
19
- export interface FixedConfiguration extends LocationConfiguration {
20
- latitude?: number;
21
- longitude?: number;
22
- altitude?: number;
23
- accuracy?: number;
24
- }
25
-
26
- declare class Fixed implements LocationSensor {
27
- constructor(options: FixedOptions);
28
- configure(options: FixedConfiguration): void;
29
- sample(): LocationSample | undefined;
30
- close(): void;
31
- readonly identification: {
32
- model: string;
33
- classification: string;
34
- description: string;
35
- };
36
- }
37
- interface Fixed extends Disposable {}
38
-
39
- export default Fixed;
@@ -1,44 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Moddable Tech, Inc.
3
- */
4
-
5
- import type {
6
- LocationConfiguration,
7
- LocationOptions,
8
- LocationSample,
9
- LocationSensor
10
- } from "./location";
11
-
12
- export interface IPOptions extends LocationOptions {
13
- endpoint?: string;
14
- host?: string;
15
- path?: string;
16
- port?: number;
17
- headers?: Map<string, string> | Record<string, string>;
18
- http?: object;
19
- parse?: (json: unknown) => LocationSample | undefined;
20
- defaultAccuracy?: number;
21
- interval?: number;
22
- }
23
-
24
- export interface IPConfiguration extends LocationConfiguration {
25
- endpoint?: string;
26
- host?: string;
27
- path?: string;
28
- interval?: number;
29
- }
30
-
31
- declare class IP implements LocationSensor {
32
- constructor(options: IPOptions);
33
- configure(options: IPConfiguration): void;
34
- sample(): LocationSample | undefined;
35
- close(): void;
36
- readonly identification: {
37
- model: string;
38
- classification: string;
39
- description: string;
40
- };
41
- }
42
- interface IP extends Disposable {}
43
-
44
- export default IP;
@@ -1,56 +0,0 @@
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
- /** ECMA-419 Location sample (W3C Geolocation-shaped). */
22
- export interface LocationSample {
23
- latitude: number;
24
- longitude: number;
25
- altitude?: number;
26
- accuracy?: number;
27
- altitudeAccuracy?: number;
28
- heading?: number;
29
- speed?: number;
30
- timestamp?: number;
31
- }
32
-
33
- export interface LocationIdentification {
34
- model: string;
35
- classification: string;
36
- description: string;
37
- }
38
-
39
- export interface LocationConfiguration {
40
- enableHighAccuracy?: boolean;
41
- timeout?: number;
42
- maximumAge?: number;
43
- }
44
-
45
- export interface LocationOptions {
46
- onSample?: () => void;
47
- onError?: (error: Error) => void;
48
- target?: unknown;
49
- }
50
-
51
- export interface LocationSensor {
52
- configure(options: LocationConfiguration): void;
53
- sample(): LocationSample | undefined;
54
- close(): void;
55
- readonly identification: LocationIdentification;
56
- }
@@ -1,64 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Moddable Tech, Inc.
3
- */
4
-
5
- export interface RFIDSample {
6
- present: boolean;
7
- uid?: Uint8Array;
8
- uidHex?: string;
9
- sak?: number;
10
- type?: string;
11
- }
12
-
13
- export interface MFRC522SPIOptions {
14
- sensor: {
15
- io: new (options: object) => object;
16
- clock?: number;
17
- in?: number;
18
- out?: number;
19
- port?: number;
20
- hz?: number;
21
- mode?: number;
22
- [key: string]: unknown;
23
- };
24
- select: {
25
- io: new (options: object) => { write(v: number): void; close(): void };
26
- pin: number;
27
- mode?: number;
28
- [key: string]: unknown;
29
- };
30
- reset?: {
31
- io: new (options: object) => { write(v: number): void; close(): void };
32
- pin: number;
33
- mode?: number;
34
- [key: string]: unknown;
35
- };
36
- onSample?: () => void;
37
- onError?: (error: Error) => void;
38
- target?: unknown;
39
- interval?: number;
40
- }
41
-
42
- export interface MFRC522SPIConfiguration {
43
- interval?: number;
44
- antenna?: boolean;
45
- }
46
-
47
- declare class MFRC522SPI {
48
- constructor(options: MFRC522SPIOptions);
49
- configure(options: MFRC522SPIConfiguration): void;
50
- sample(): RFIDSample | undefined;
51
- close(): void;
52
- readonly identification: {
53
- model: string;
54
- classification: string;
55
- description: string;
56
- };
57
- readonly version: number;
58
- authenticate(): never;
59
- readBlock(): never;
60
- writeBlock(): never;
61
- }
62
- interface MFRC522SPI extends Disposable {}
63
-
64
- export default MFRC522SPI;
@@ -1,50 +0,0 @@
1
- /*
2
- * Copyright (c) 2026 Moddable Tech, Inc.
3
- */
4
-
5
- export interface RFIDSample {
6
- present: boolean;
7
- uid?: Uint8Array;
8
- uidHex?: string;
9
- sak?: number;
10
- type?: string;
11
- }
12
-
13
- export interface MFRC522Options {
14
- sensor: {
15
- io: new (options: object) => object;
16
- data?: number;
17
- clock?: number;
18
- address?: number;
19
- hz?: number;
20
- [key: string]: unknown;
21
- };
22
- onSample?: () => void;
23
- onError?: (error: Error) => void;
24
- target?: unknown;
25
- interval?: number;
26
- }
27
-
28
- export interface MFRC522Configuration {
29
- interval?: number;
30
- antenna?: boolean;
31
- }
32
-
33
- declare class MFRC522 {
34
- constructor(options: MFRC522Options);
35
- configure(options: MFRC522Configuration): void;
36
- sample(): RFIDSample | undefined;
37
- close(): void;
38
- readonly identification: {
39
- model: string;
40
- classification: string;
41
- description: string;
42
- };
43
- readonly version: number;
44
- authenticate(): never;
45
- readBlock(): never;
46
- writeBlock(): never;
47
- }
48
- interface MFRC522 extends Disposable {}
49
-
50
- export default MFRC522;