@moddable/typings 8.3.0 → 9.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.
- package/embedded/sensor/Barometer-Humidity-Temperature/BME280.d.ts +102 -0
- package/embedded/sensor/Location/fixed.d.ts +39 -0
- package/embedded/sensor/Location/ip.d.ts +44 -0
- package/embedded/sensor/Location/location.d.ts +56 -0
- package/embedded/sensor/RFID/mfrc522-spi.d.ts +64 -0
- package/embedded/sensor/RFID/mfrc522.d.ts +50 -0
- package/embedded/storage/key-value.d.ts +2 -2
- package/embedded_io/socket/tcp/tls.d.ts +46 -9
- package/embedded_io/socket/tcp.d.ts +6 -8
- package/embedded_network/interface/wifi.d.ts +1 -0
- package/mcpack.d.ts +71 -14
- package/package.json +7 -6
- package/piu/ImageBuffer.d.ts +43 -0
- package/piu/MC-types.d.ts +4 -4
- package/web/abortsignal.d.ts +37 -0
- package/web/console.d.ts +50 -0
- package/web/decompressionstream.d.ts +34 -0
- package/web/domexception.d.ts +29 -0
- package/web/eventsource.d.ts +1 -1
- package/web/streams.d.ts +216 -0
- package/web/textdecoderstream.d.ts +37 -0
- package/web/textencoderstream.d.ts +29 -0
- package/web/timers.d.ts +33 -0
- package/web/websocket.d.ts +7 -3
- package/web/websocketstream.d.ts +53 -0
- package/xs.d.ts +0 -103
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
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;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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;
|
|
@@ -0,0 +1,50 @@
|
|
|
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;
|
|
@@ -33,8 +33,8 @@ declare module "embedded:storage/key-value" {
|
|
|
33
33
|
|
|
34
34
|
delete(key: string): void;
|
|
35
35
|
|
|
36
|
-
read(key: string): ArrayBuffer | string | number | bigint;
|
|
37
|
-
read(key: string, buffer: ByteBuffer): number;
|
|
36
|
+
read(key: string): ArrayBuffer | string | number | bigint | undefined;
|
|
37
|
+
read(key: string, buffer: ByteBuffer): number | undefined;
|
|
38
38
|
write(key: string, value: ByteBuffer | string | number | bigint): void;
|
|
39
39
|
|
|
40
40
|
[Symbol.iterator](): IterableIterator<string>;
|
|
@@ -1,17 +1,54 @@
|
|
|
1
1
|
declare module "embedded:io/socket/tcp/tls" {
|
|
2
|
-
import { Options as TCPOptions } from "embedded:io/socket/tcp"
|
|
3
|
-
|
|
2
|
+
import TCP, { Options as TCPOptions } from "embedded:io/socket/tcp"
|
|
3
|
+
|
|
4
|
+
export type TLSVersion = "TLSv1.1" | "TLSv1.2" | "TLSv1.3"
|
|
5
|
+
|
|
6
|
+
export type TLSOptions = {
|
|
7
|
+
/** Server Name Indication (SNI) and the name certificates are validated against. */
|
|
4
8
|
host: string
|
|
5
|
-
|
|
9
|
+
minimumVersion?: TLSVersion
|
|
10
|
+
maximumVersion?: TLSVersion
|
|
11
|
+
/** Application-Layer Protocol Negotiation (ALPN). */
|
|
12
|
+
applicationLayerProtocol?: string | ByteBuffer | Array<string | ByteBuffer>
|
|
13
|
+
maximumFragmentLength?: number
|
|
14
|
+
ca?: ByteBuffer | ByteBuffer[]
|
|
15
|
+
clientKey?: ByteBuffer | ByteBuffer[]
|
|
16
|
+
clientCertificate?: ByteBuffer | ByteBuffer[]
|
|
17
|
+
|
|
18
|
+
// Moddable SDK extensions
|
|
19
|
+
/** Trace TLS protocol activity. Defaults to `false`. */
|
|
20
|
+
trace?: boolean
|
|
21
|
+
/** Verify the server's certificate chain. Defaults to `true`. Never disable in production. */
|
|
22
|
+
verify?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Extends the TCP socket's options object. Listed explicitly so the callbacks
|
|
26
|
+
can be typed with `this` as the TLS socket rather than the TCP socket. */
|
|
27
|
+
export type Options = {
|
|
28
|
+
address: string
|
|
29
|
+
port: number
|
|
30
|
+
noDelay?: boolean
|
|
31
|
+
format?: "number" | "buffer"
|
|
32
|
+
target?: any
|
|
33
|
+
onReadable?: (this: TLSSocket, bytes: number) => void
|
|
34
|
+
onWritable?: (this: TLSSocket, bytes: number) => void
|
|
35
|
+
onError?: (this: TLSSocket) => void
|
|
36
|
+
|
|
37
|
+
tls: TLSOptions
|
|
38
|
+
/** The TCP socket this TLS socket runs over. A Moddable SDK extension. */
|
|
39
|
+
TCP: { io: new (options: TCPOptions) => TCP } & Partial<TCPOptions>
|
|
6
40
|
}
|
|
7
|
-
|
|
41
|
+
|
|
42
|
+
class TLSSocket {
|
|
8
43
|
constructor(options: Options)
|
|
9
44
|
close(): void
|
|
10
|
-
read(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
45
|
+
read(): number | ArrayBuffer
|
|
46
|
+
read(byteLength: number): ArrayBuffer
|
|
47
|
+
read(buffer: ByteBuffer): number
|
|
48
|
+
write(buffer: ByteBuffer, options?: { more?: boolean, byteLength?: number }): number
|
|
49
|
+
get format(): "number" | "buffer"
|
|
50
|
+
set format(value: "number" | "buffer")
|
|
14
51
|
}
|
|
15
52
|
interface TLSSocket extends Disposable {}
|
|
53
|
+
export default TLSSocket;
|
|
16
54
|
}
|
|
17
|
-
|
|
@@ -19,16 +19,13 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/socket/tcp" {
|
|
22
|
-
export type Options = ((
|
|
22
|
+
export type Options = (({
|
|
23
23
|
address: string;
|
|
24
|
-
} | {
|
|
25
|
-
host: string;
|
|
26
|
-
}) & {
|
|
27
24
|
port: number;
|
|
28
25
|
}) | {
|
|
29
26
|
from: TCP;
|
|
30
27
|
}) & {
|
|
31
|
-
|
|
28
|
+
noDelay?: boolean;
|
|
32
29
|
onReadable?: (this: TCP, bytes: number) => void;
|
|
33
30
|
onWritable?: (this: TCP, bytes: number) => void;
|
|
34
31
|
onError?: (this: TCP) => void;
|
|
@@ -40,9 +37,10 @@ declare module "embedded:io/socket/tcp" {
|
|
|
40
37
|
constructor(options: Options)
|
|
41
38
|
readonly remoteAddress: string | undefined;
|
|
42
39
|
readonly remotePort: number | undefined;
|
|
43
|
-
read(
|
|
44
|
-
read(
|
|
45
|
-
|
|
40
|
+
read(): number | ArrayBuffer;
|
|
41
|
+
read(byteLength: number): ArrayBuffer;
|
|
42
|
+
read(buffer: ByteBuffer): number;
|
|
43
|
+
write(value: number | ByteBuffer): number;
|
|
46
44
|
close(): void;
|
|
47
45
|
get format(): "number" | "buffer"
|
|
48
46
|
set format(value: "number" | "buffer")
|
package/mcpack.d.ts
CHANGED
|
@@ -18,32 +18,29 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/// <reference path="./web/abortsignal.d.ts" />
|
|
22
|
+
/// <reference path="./web/console.d.ts" />
|
|
23
|
+
/// <reference path="./web/decompressionstream.d.ts" />
|
|
24
|
+
/// <reference path="./web/domexception.d.ts" />
|
|
21
25
|
/// <reference path="./web/eventsource.d.ts" />
|
|
22
26
|
/// <reference path="./web/fetch.d.ts" />
|
|
23
27
|
/// <reference path="./web/headers.d.ts" />
|
|
28
|
+
/// <reference path="./web/streams.d.ts" />
|
|
24
29
|
/// <reference path="./web/structuredClone.d.ts" />
|
|
30
|
+
/// <reference path="./web/textdecoderstream.d.ts" />
|
|
31
|
+
/// <reference path="./web/textencoderstream.d.ts" />
|
|
32
|
+
/// <reference path="./web/timers.d.ts" />
|
|
25
33
|
/// <reference path="./web/url.d.ts" />
|
|
26
|
-
/// <reference path="./web/worker.d.ts" />
|
|
27
34
|
/// <reference path="./web/websocket.d.ts" />
|
|
35
|
+
/// <reference path="./web/websocketstream.d.ts" />
|
|
28
36
|
/// <reference path="./web/webstorage.d.ts" />
|
|
37
|
+
/// <reference path="./web/worker.d.ts" />
|
|
29
38
|
/// <reference path="./text/decoder.d.ts" />
|
|
30
39
|
/// <reference path="./text/encoder.d.ts" />
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
interface Console {
|
|
35
|
-
log(...log: (string | number | boolean)[]):void;
|
|
36
|
-
}
|
|
41
|
+
export {};
|
|
37
42
|
|
|
38
43
|
declare global {
|
|
39
|
-
const console: Console;
|
|
40
|
-
const clearImmediate: (timer: Timer) => void;
|
|
41
|
-
const clearInterval: (timer: Timer) => void;
|
|
42
|
-
const clearTimeout: (timer: Timer) => void;
|
|
43
|
-
const setImmediate: (handler: Function) => Timer;
|
|
44
|
-
const setInterval: (handler: Function, timeout?: number) => Timer;
|
|
45
|
-
const setTimeout: (handler: Function, timeout?: number) => Timer;
|
|
46
|
-
|
|
47
44
|
const EventSource: typeof import("web/eventsource").default;
|
|
48
45
|
type EventSource = import("web/eventsource").default;
|
|
49
46
|
|
|
@@ -76,5 +73,65 @@ declare global {
|
|
|
76
73
|
|
|
77
74
|
const SharedWorker: typeof import("worker").SharedWorker;
|
|
78
75
|
type SharedWorker = import("worker").SharedWorker;
|
|
76
|
+
|
|
77
|
+
const AbortController: typeof import("web/abortsignal").AbortController;
|
|
78
|
+
type AbortController = import("web/abortsignal").AbortController;
|
|
79
|
+
|
|
80
|
+
const AbortSignal: typeof import("web/abortsignal").AbortSignal;
|
|
81
|
+
type AbortSignal = import("web/abortsignal").AbortSignal;
|
|
82
|
+
|
|
83
|
+
const DOMException: typeof import("web/domexception").DOMException;
|
|
84
|
+
type DOMException = import("web/domexception").DOMException;
|
|
85
|
+
|
|
86
|
+
const ReadableStream: typeof import("web/streams").ReadableStream;
|
|
87
|
+
type ReadableStream<R = any> = import("web/streams").ReadableStream<R>;
|
|
88
|
+
|
|
89
|
+
const ReadableStreamDefaultReader: typeof import("web/streams").ReadableStreamDefaultReader;
|
|
90
|
+
type ReadableStreamDefaultReader<R = any> = import("web/streams").ReadableStreamDefaultReader<R>;
|
|
91
|
+
|
|
92
|
+
const ReadableStreamBYOBReader: typeof import("web/streams").ReadableStreamBYOBReader;
|
|
93
|
+
type ReadableStreamBYOBReader = import("web/streams").ReadableStreamBYOBReader;
|
|
94
|
+
|
|
95
|
+
const ReadableStreamDefaultController: typeof import("web/streams").ReadableStreamDefaultController;
|
|
96
|
+
type ReadableStreamDefaultController<R = any> = import("web/streams").ReadableStreamDefaultController<R>;
|
|
97
|
+
|
|
98
|
+
const ReadableByteStreamController: typeof import("web/streams").ReadableByteStreamController;
|
|
99
|
+
type ReadableByteStreamController = import("web/streams").ReadableByteStreamController;
|
|
100
|
+
|
|
101
|
+
const ReadableStreamBYOBRequest: typeof import("web/streams").ReadableStreamBYOBRequest;
|
|
102
|
+
type ReadableStreamBYOBRequest = import("web/streams").ReadableStreamBYOBRequest;
|
|
103
|
+
|
|
104
|
+
const WritableStream: typeof import("web/streams").WritableStream;
|
|
105
|
+
type WritableStream<W = any> = import("web/streams").WritableStream<W>;
|
|
106
|
+
|
|
107
|
+
const WritableStreamDefaultWriter: typeof import("web/streams").WritableStreamDefaultWriter;
|
|
108
|
+
type WritableStreamDefaultWriter<W = any> = import("web/streams").WritableStreamDefaultWriter<W>;
|
|
109
|
+
|
|
110
|
+
const WritableStreamDefaultController: typeof import("web/streams").WritableStreamDefaultController;
|
|
111
|
+
type WritableStreamDefaultController = import("web/streams").WritableStreamDefaultController;
|
|
112
|
+
|
|
113
|
+
const TransformStream: typeof import("web/streams").TransformStream;
|
|
114
|
+
type TransformStream<I = any, O = any> = import("web/streams").TransformStream<I, O>;
|
|
115
|
+
|
|
116
|
+
const TransformStreamDefaultController: typeof import("web/streams").TransformStreamDefaultController;
|
|
117
|
+
type TransformStreamDefaultController<O = any> = import("web/streams").TransformStreamDefaultController<O>;
|
|
118
|
+
|
|
119
|
+
const ByteLengthQueuingStrategy: typeof import("web/streams").ByteLengthQueuingStrategy;
|
|
120
|
+
type ByteLengthQueuingStrategy = import("web/streams").ByteLengthQueuingStrategy;
|
|
121
|
+
|
|
122
|
+
const CountQueuingStrategy: typeof import("web/streams").CountQueuingStrategy;
|
|
123
|
+
type CountQueuingStrategy = import("web/streams").CountQueuingStrategy;
|
|
124
|
+
|
|
125
|
+
const DecompressionStream: typeof import("web/decompressionstream").default;
|
|
126
|
+
type DecompressionStream = import("web/decompressionstream").default;
|
|
127
|
+
|
|
128
|
+
const TextDecoderStream: typeof import("web/textdecoderstream").default;
|
|
129
|
+
type TextDecoderStream = import("web/textdecoderstream").default;
|
|
130
|
+
|
|
131
|
+
const TextEncoderStream: typeof import("web/textencoderstream").default;
|
|
132
|
+
type TextEncoderStream = import("web/textencoderstream").default;
|
|
133
|
+
|
|
134
|
+
const WebSocketStream: typeof import("web/websocketstream").default;
|
|
135
|
+
type WebSocketStream = import("web/websocketstream").default;
|
|
79
136
|
}
|
|
80
137
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moddable/typings",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"main": "",
|
|
5
|
-
"types":
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
"types": "xs",
|
|
6
|
+
"typesVersions": {
|
|
7
|
+
">=6.0.0-0": { "tsconfig.base.json": ["./tsconfig.es2025.json"] },
|
|
8
|
+
">=5.4.0-0": { "tsconfig.base.json": ["./tsconfig.es2024.json"] }
|
|
9
|
+
},
|
|
10
|
+
"author": "Moddable",
|
|
10
11
|
"license": "ISC",
|
|
11
12
|
"description": ""
|
|
12
13
|
}
|
|
@@ -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
|
+
|
|
22
|
+
declare module "piu/ImageBuffer" {
|
|
23
|
+
import { Content, ContentDictionary } from "piu/MC";
|
|
24
|
+
|
|
25
|
+
interface ImageBuffer extends Content {
|
|
26
|
+
buffer: ByteBuffer;
|
|
27
|
+
}
|
|
28
|
+
interface ImageBufferDictionary extends ContentDictionary {
|
|
29
|
+
imageType?: number;
|
|
30
|
+
imageWidth: number;
|
|
31
|
+
imageHeight: number;
|
|
32
|
+
}
|
|
33
|
+
interface ImageBufferConstructor {
|
|
34
|
+
new(behaviorData?: any, dictionary?: ImageBufferDictionary): ImageBuffer;
|
|
35
|
+
(behaviorData?: any, dictionary?: ImageBufferDictionary): ImageBuffer;
|
|
36
|
+
|
|
37
|
+
template<T>(this: T, fn: (arg: any) => ImageBufferDictionary): T;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
global {
|
|
41
|
+
const ImageBuffer: ImageBufferConstructor
|
|
42
|
+
}
|
|
43
|
+
}
|
package/piu/MC-types.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export interface Behavior<T extends Content = Content> {
|
|
|
77
77
|
onTimeChanged?(content: T): void;
|
|
78
78
|
onTouchBegan?(content: T, id: number, x: number, y: number, ticks: number): void;
|
|
79
79
|
onTouchCancelled?(content: T, id: number): void;
|
|
80
|
-
|
|
80
|
+
onTouchEnded?(content: T, id: number, x: number, y: number, ticks: number): void;
|
|
81
81
|
onTouchMoved?(content: T, id: number, x: number, y: number, ticks: number): void;
|
|
82
82
|
// TODO: complete callbacks
|
|
83
83
|
}
|
|
@@ -259,9 +259,9 @@ export interface Container extends Content {
|
|
|
259
259
|
add(content: Content): void;
|
|
260
260
|
content(at: number | string): Content | undefined;
|
|
261
261
|
empty(start?: number, stop?: number): void;
|
|
262
|
-
firstThat(id: string, ...extras: any[]):
|
|
262
|
+
firstThat(id: string, ...extras: any[]): Content | undefined;
|
|
263
263
|
insert(content: Content, before: Content): void;
|
|
264
|
-
lastThat(id: string, ...extras: any[]):
|
|
264
|
+
lastThat(id: string, ...extras: any[]): Content | undefined;
|
|
265
265
|
remove(content: Content): void;
|
|
266
266
|
replace(content: Content, by: Content): void;
|
|
267
267
|
run(transition: Transition, ...extras: any[]): void;
|
|
@@ -454,7 +454,7 @@ export interface LayoutConstructor extends ContainerConstructor {
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
export interface Image extends Content {
|
|
457
|
-
readonly frameCount:
|
|
457
|
+
readonly frameCount: number;
|
|
458
458
|
frameIndex: number;
|
|
459
459
|
}
|
|
460
460
|
export interface ImageDictionary extends ContentDictionary {
|