@solidrt/flux-types 0.0.50 → 0.0.52
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/README.md +3 -3
- package/gui/audio.d.ts +116 -12
- package/gui/camera.d.ts +4 -3
- package/gui/gpu.d.ts +185 -28
- package/gui/rendertree.d.ts +90 -7
- package/gui/spatial.d.ts +188 -0
- package/index.d.ts +5 -1
- package/modules/fs.d.ts +33 -0
- package/modules/http.d.ts +3 -3
- package/modules/isolate.d.ts +50 -10
- package/modules/net.d.ts +2 -0
- package/modules/process.d.ts +36 -0
- package/modules/sqlite.d.ts +27 -5
- package/modules/subprocess.d.ts +9 -0
- package/modules/tty.d.ts +69 -0
- package/package.json +2 -1
- package/standards/abort.d.ts +36 -0
- package/standards/crypto.d.ts +18 -0
- package/standards/fetch.d.ts +8 -1
- package/standards/time.d.ts +21 -16
package/modules/subprocess.d.ts
CHANGED
|
@@ -14,6 +14,15 @@ declare module "flux:subprocess" {
|
|
|
14
14
|
* as UTF-8 strings.
|
|
15
15
|
*/
|
|
16
16
|
encoding?: "buffer" | "utf8"
|
|
17
|
+
/**
|
|
18
|
+
* `spawn()` only: the child outlives this engine and this process. It is
|
|
19
|
+
* never killed on drop or reload, has no stdin/stdout/stderr pipes (all
|
|
20
|
+
* null: `stdout`/`stderr` iterate to nothing, `write` fails) and runs in
|
|
21
|
+
* its own process group, so a Ctrl+C to the parent does not reach it.
|
|
22
|
+
* `pid`, `kill()` and `status()` still work. Cannot combine with `stdin`.
|
|
23
|
+
* What a dev tool uses to launch another runtime instance.
|
|
24
|
+
*/
|
|
25
|
+
detached?: boolean
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
/** The buffered result of a child run to completion via {@link Command.output}. */
|
package/modules/tty.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare module "flux:tty" {
|
|
2
|
+
/**
|
|
3
|
+
* Whether stdin is a terminal this process can use. False for a pipe, a
|
|
4
|
+
* file, or no stdin at all (a GUI launch), the cases where nobody is there
|
|
5
|
+
* to prompt; on unix also false for a job backgrounded from an interactive
|
|
6
|
+
* shell (`cmd &`), which still has the terminal as stdin but would be
|
|
7
|
+
* stopped by job control the moment it touched it.
|
|
8
|
+
*/
|
|
9
|
+
export let isTTY: boolean
|
|
10
|
+
/** One key press in raw mode (see {@link setRawMode}). */
|
|
11
|
+
export interface Key {
|
|
12
|
+
/**
|
|
13
|
+
* Node's keypress names: "return", "backspace", "tab", "escape",
|
|
14
|
+
* "delete", "insert", "up", "down", "left", "right", "home", "end",
|
|
15
|
+
* "pageup", "pagedown", "space", "f1".."f12", or the lowercase letter
|
|
16
|
+
* or symbol typed.
|
|
17
|
+
*/
|
|
18
|
+
name: string
|
|
19
|
+
/** The character typed, with its case, for a printable key; else undefined. */
|
|
20
|
+
char: string | undefined
|
|
21
|
+
ctrl: boolean
|
|
22
|
+
/** Alt (Option) held. */
|
|
23
|
+
meta: boolean
|
|
24
|
+
shift: boolean
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Listen for input on stdin. `"line"` delivers one line per call as the
|
|
28
|
+
* terminal's own line discipline hands it over (cooked mode: the terminal
|
|
29
|
+
* does the editing), with the newline stripped; `"key"` delivers one key
|
|
30
|
+
* press per call while raw mode is on (and nothing arrives as a line
|
|
31
|
+
* then); `"close"` fires once when stdin reaches end of file (Ctrl-D in
|
|
32
|
+
* cooked mode, or the pipe closing). A listener holds the process alive
|
|
33
|
+
* until it unsubscribes; after `"close"` nothing can come, so every tty
|
|
34
|
+
* listener is dropped then, and a later `on` registers nothing. stdin is
|
|
35
|
+
* read once per process: a second engine in the same process (an isolate)
|
|
36
|
+
* gets no input.
|
|
37
|
+
*
|
|
38
|
+
* @param event `"line"`, `"key"` or `"close"`.
|
|
39
|
+
* @param callback Receives the line text or the {@link Key}; nothing for
|
|
40
|
+
* `"close"`.
|
|
41
|
+
* @returns An unsubscribe function.
|
|
42
|
+
*/
|
|
43
|
+
export function on(event: "line", callback: (line: string) => void): () => void
|
|
44
|
+
export function on(event: "key", callback: (key: Key) => void): () => void
|
|
45
|
+
export function on(event: "close", callback: () => void): () => void
|
|
46
|
+
/**
|
|
47
|
+
* Like {@link on}, but the listener fires at most once and then unsubscribes.
|
|
48
|
+
*/
|
|
49
|
+
export function once(event: "line", callback: (line: string) => void): () => void
|
|
50
|
+
export function once(event: "key", callback: (key: Key) => void): () => void
|
|
51
|
+
export function once(event: "close", callback: () => void): () => void
|
|
52
|
+
/**
|
|
53
|
+
* Switch the terminal's raw mode: no echo, no line editing, no signal keys
|
|
54
|
+
* (Ctrl-C arrives as a key), and stdin delivers `"key"` events instead of
|
|
55
|
+
* `"line"`s. The change applies from the next read: a line the terminal
|
|
56
|
+
* is already collecting is delivered as a line. Turn it off before
|
|
57
|
+
* exiting; the runtime also restores the terminal on exit and on a panic,
|
|
58
|
+
* but not on a kill. Throws when stdin is not a terminal.
|
|
59
|
+
*
|
|
60
|
+
* While raw, `console.log` output still breaks lines correctly (the
|
|
61
|
+
* runtime writes "\r\n"); your own {@link write} calls must use "\r\n".
|
|
62
|
+
*/
|
|
63
|
+
export function setRawMode(on: boolean): void
|
|
64
|
+
/**
|
|
65
|
+
* Write `text` to stdout as is and flush: no newline appended, unlike
|
|
66
|
+
* `console.log`. What a prompt needs.
|
|
67
|
+
*/
|
|
68
|
+
export function write(text: string): void
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The web-standard abort primitives. A deliberate subset: an `onabort`
|
|
2
|
+
// handler property only (no addEventListener), a plain-object event (not an
|
|
3
|
+
// Event instance), and no `AbortSignal.timeout`/`any`. Without `DOMException`
|
|
4
|
+
// the default abort reason is an `Error` whose `name` is "AbortError".
|
|
5
|
+
|
|
6
|
+
/** The event passed to {@link AbortSignal.onabort}. */
|
|
7
|
+
interface AbortEvent {
|
|
8
|
+
type: "abort"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface AbortSignal {
|
|
12
|
+
/** True once the signal has been aborted. */
|
|
13
|
+
readonly aborted: boolean
|
|
14
|
+
/** The abort reason; `undefined` until aborted. */
|
|
15
|
+
readonly reason: any
|
|
16
|
+
/** Called once when the signal aborts. */
|
|
17
|
+
onabort: ((event: AbortEvent) => void) | null
|
|
18
|
+
/** Throws `reason` if the signal is aborted; no-op otherwise. */
|
|
19
|
+
throwIfAborted(): void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare let AbortSignal: {
|
|
23
|
+
prototype: AbortSignal
|
|
24
|
+
/** An already-aborted signal. */
|
|
25
|
+
abort(reason?: any): AbortSignal
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class AbortController {
|
|
29
|
+
/** The controller's signal; the same object on every read. */
|
|
30
|
+
readonly signal: AbortSignal
|
|
31
|
+
/**
|
|
32
|
+
* Abort the signal with `reason` (default: an `Error` named "AbortError")
|
|
33
|
+
* and fire its `onabort`. Aborting an already-aborted signal is a no-op.
|
|
34
|
+
*/
|
|
35
|
+
abort(reason?: any): void
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// crypto. The Web Crypto surface flux provides: `subtle.digest` only. No key
|
|
2
|
+
// material, no encryption, no random: an app hashes bytes (content
|
|
3
|
+
// addressing, integrity checks) and the rest of the standard waits for a need.
|
|
4
|
+
|
|
5
|
+
interface SubtleCrypto {
|
|
6
|
+
/**
|
|
7
|
+
* Hash `data` (a Uint8Array or ArrayBuffer) with `algorithm`, one of
|
|
8
|
+
* "SHA-256", "SHA-384", "SHA-512" (as a string or `{ name }`). Resolves to
|
|
9
|
+
* the digest as an ArrayBuffer. Other algorithms (SHA-1 included) reject.
|
|
10
|
+
*/
|
|
11
|
+
digest(algorithm: string | { name: string }, data: Uint8Array | ArrayBuffer): Promise<ArrayBuffer>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Crypto {
|
|
15
|
+
readonly subtle: SubtleCrypto
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare var crypto: Crypto
|
package/standards/fetch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The Fetch API cluster (Headers, Request, Response, fetch). A deliberate subset
|
|
2
2
|
// of the WHATWG Fetch standard: flux provides exactly these members and no more
|
|
3
|
-
// (no Blob, FormData, ReadableStream, clone(),
|
|
3
|
+
// (no Blob, FormData, ReadableStream, clone(), ...).
|
|
4
4
|
// Grouped in one file because the four share BodyInit/HeadersInit and reference
|
|
5
5
|
// each other.
|
|
6
6
|
|
|
@@ -70,6 +70,13 @@ interface RequestInit {
|
|
|
70
70
|
* throttled.
|
|
71
71
|
*/
|
|
72
72
|
cache?: "force-cache" | "reload" | "default" | "no-store" | "no-cache"
|
|
73
|
+
/**
|
|
74
|
+
* Abort signal for `fetch`: aborting rejects the fetch promise with the
|
|
75
|
+
* signal's `reason` and drops the request mid-flight; a fetch on an
|
|
76
|
+
* already-aborted signal rejects without sending anything. Ignored by the
|
|
77
|
+
* `Request` constructor.
|
|
78
|
+
*/
|
|
79
|
+
signal?: AbortSignal
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
/**
|
package/standards/time.d.ts
CHANGED
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
// from the browser in two ways: the delay is required, and no extra callback
|
|
3
3
|
// arguments are forwarded.
|
|
4
4
|
//
|
|
5
|
-
// In a GUI runtime the
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
5
|
+
// In a GUI runtime the timers are FRAME-QUANTIZED but WALL-ACCURATE: a
|
|
6
|
+
// deadline is measured against the real clock from the moment of
|
|
7
|
+
// registration, and firing happens on frame boundaries. So a timer fires at
|
|
8
|
+
// the first frame at or after its deadline - at least `ms` after
|
|
9
|
+
// registration, at most one frame late (~16 ms at 60 Hz; a setTimeout of 0
|
|
10
|
+
// runs on the next frame) - and deadlines do not drift when frames run
|
|
11
|
+
// slow. An interval fires at most once per frame (missed periods collapse
|
|
12
|
+
// instead of storming). Pausing the runtime clock (the dev tools'
|
|
13
|
+
// set_time_scale 0) freezes timers and frame callbacks together; a timer
|
|
14
|
+
// that came due while the app was suspended (backgrounded) fires on the
|
|
15
|
+
// resume frame. performance.now() is real elapsed time, for measuring
|
|
16
|
+
// work; the onFrame / requestAnimationFrame timestamp is a separate paced
|
|
17
|
+
// animation timeline. Date.now() is calendar time. Headless flux (scripts,
|
|
18
|
+
// servers) keeps ordinary wall-clock timers.
|
|
13
19
|
|
|
14
20
|
/**
|
|
15
21
|
* Run `callback` after at least `ms` milliseconds. Returns a timer id for
|
|
@@ -33,17 +39,16 @@ declare function queueMicrotask(callback: () => void): void
|
|
|
33
39
|
|
|
34
40
|
declare let performance: {
|
|
35
41
|
/**
|
|
36
|
-
* Milliseconds since
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
42
|
+
* Milliseconds elapsed since the runtime started (high-resolution,
|
|
43
|
+
* monotonic, sub-millisecond). Real time: it keeps advancing across
|
|
44
|
+
* synchronous work and while the runtime clock is paused, so it is the
|
|
45
|
+
* clock for measuring durations. For frame time use the onFrame /
|
|
46
|
+
* requestAnimationFrame timestamp; for calendar time use Date.now().
|
|
41
47
|
*/
|
|
42
48
|
now(): number
|
|
43
49
|
/**
|
|
44
|
-
* Wall-clock time (ms since the Unix epoch) when the runtime started
|
|
45
|
-
*
|
|
46
|
-
* runs on the paced runtime timeline, which can be frozen or scaled.
|
|
50
|
+
* Wall-clock time (ms since the Unix epoch) when the runtime started, so
|
|
51
|
+
* timeOrigin + now() tracks Date.now().
|
|
47
52
|
*/
|
|
48
53
|
readonly timeOrigin: number
|
|
49
54
|
}
|