@solidrt/flux-types 0.0.34 → 0.0.36
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/gui/gpu.d.ts +34 -1
- package/gui/rendertree.d.ts +10 -2
- package/modules/http.d.ts +7 -7
- package/modules/net.d.ts +40 -7
- package/modules/p2p.d.ts +3 -3
- package/modules/sqlite.d.ts +1 -1
- package/modules/subprocess.d.ts +2 -2
- package/package.json +1 -1
package/gui/gpu.d.ts
CHANGED
|
@@ -20,7 +20,23 @@ declare module "flux:gpu" {
|
|
|
20
20
|
* (default 0) selects which frame to upload.
|
|
21
21
|
*/
|
|
22
22
|
export function uploadTexture(id: number, data: Uint8Array, offset?: number): void
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Replace a texture's storage with a new size at the same id (an id-stable
|
|
25
|
+
* resize): `<texture src>` references and shader sampler bindings keep
|
|
26
|
+
* working, and shaders sampling the texture re-render. `data` seeds the new
|
|
27
|
+
* contents and, like {@link createMutableTexture}, must hold at least one
|
|
28
|
+
* width*height*4 frame. Shader/pipeline target ids are rejected - resize
|
|
29
|
+
* those with {@link setShaderSize}.
|
|
30
|
+
*/
|
|
31
|
+
export function resizeTexture(id: number, data: Uint8Array, width: number, height: number): void
|
|
32
|
+
/**
|
|
33
|
+
* Destroy a texture (immutable, mutable, or shader). Frame-safe: the id is
|
|
34
|
+
* reclaimed by the runtime once the render tree no longer references it, so
|
|
35
|
+
* destroying the old id in the same update that repoints `<texture src>` at
|
|
36
|
+
* its replacement never paints a blank frame, whatever order the two land
|
|
37
|
+
* in. A destroyed id that stays mounted keeps drawing (and stays allocated)
|
|
38
|
+
* until it is unmounted or repointed.
|
|
39
|
+
*/
|
|
24
40
|
export function destroyTexture(id: number): void
|
|
25
41
|
/**
|
|
26
42
|
* Compile a GLSL ES fragment shader into an offscreen texture of the given
|
|
@@ -36,6 +52,23 @@ declare module "flux:gpu" {
|
|
|
36
52
|
): number
|
|
37
53
|
/** Update a shader texture's float uniforms by name and re-render it. */
|
|
38
54
|
export function setShaderParams(id: number, params: Record<string, number>): void
|
|
55
|
+
/**
|
|
56
|
+
* Rebind a shader texture's sampler2D inputs by uniform name and re-render
|
|
57
|
+
* it with its last-applied params - the sampler analog of
|
|
58
|
+
* {@link setShaderParams}. Bindings not named keep their current source, so
|
|
59
|
+
* a single input can be retargeted (post-process source swap, ping-pong
|
|
60
|
+
* between two data textures) without recompiling the shader. Throws if the
|
|
61
|
+
* shader or a source texture id is unknown, or a sampler would source the
|
|
62
|
+
* shader's own target.
|
|
63
|
+
*/
|
|
64
|
+
export function setShaderTextures(id: number, textures: Record<string, number>): void
|
|
65
|
+
/**
|
|
66
|
+
* Resize a shader or pipeline target texture in place and re-render it: the
|
|
67
|
+
* id, compiled program, last-applied params, and sampler bindings all carry
|
|
68
|
+
* over; only the output size changes. The setDrawCount analog for output
|
|
69
|
+
* size.
|
|
70
|
+
*/
|
|
71
|
+
export function setShaderSize(id: number, width: number, height: number): void
|
|
39
72
|
|
|
40
73
|
export type Topology = "points" | "lines" | "line-strip" | "triangles" | "triangle-strip"
|
|
41
74
|
/**
|
package/gui/rendertree.d.ts
CHANGED
|
@@ -46,8 +46,16 @@ declare module "flux:rendertree" {
|
|
|
46
46
|
*/
|
|
47
47
|
export function measureText(text: string, options?: MeasureTextOptions): { width: number, height: number }
|
|
48
48
|
/**
|
|
49
|
-
* The node's
|
|
50
|
-
*
|
|
49
|
+
* The node's bounding box from the most recent layout, relative to its
|
|
50
|
+
* nearest positioning context (an ancestor with an explicit
|
|
51
|
+
* `position="relative"`, falling back to the window), or `null` if it has no
|
|
52
|
+
* layout or has not been laid out yet. Transforms anywhere in the chain
|
|
53
|
+
* compose fully; the box is the axis-aligned bounds of the transformed quad.
|
|
51
54
|
*/
|
|
52
55
|
export function getBoundingBox(id: number): { x: number, y: number, width: number, height: number } | null
|
|
56
|
+
/**
|
|
57
|
+
* Like getBoundingBox, but always window-relative (getBoundingClientRect
|
|
58
|
+
* semantics), for comparing against pointer event coordinates.
|
|
59
|
+
*/
|
|
60
|
+
export function getBoundingBoxViewport(id: number): { x: number, y: number, width: number, height: number } | null
|
|
53
61
|
}
|
package/modules/http.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ declare module "flux:http" {
|
|
|
99
99
|
* The peer's IP address (or, for a connection accepted over the `p2p`
|
|
100
100
|
* option, the peer's endpoint id), or undefined when unknown.
|
|
101
101
|
*/
|
|
102
|
-
readonly
|
|
102
|
+
readonly remoteAddr: string | undefined
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
@@ -151,8 +151,8 @@ declare module "flux:http" {
|
|
|
151
151
|
type Server = {
|
|
152
152
|
/** The bound port. */
|
|
153
153
|
readonly port: number
|
|
154
|
-
/** The bound
|
|
155
|
-
readonly
|
|
154
|
+
/** The bound host/interface. */
|
|
155
|
+
readonly host: string
|
|
156
156
|
/** The server's base URL, e.g. `"http://0.0.0.0:3000/"`. */
|
|
157
157
|
readonly url: string
|
|
158
158
|
/**
|
|
@@ -179,7 +179,7 @@ declare module "flux:http" {
|
|
|
179
179
|
* Stop accepting new connections and gracefully shut down open ones. Safe to
|
|
180
180
|
* call more than once.
|
|
181
181
|
*/
|
|
182
|
-
|
|
182
|
+
close(): void
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/** Options for accepting `flux:p2p` connections alongside the TCP listener. */
|
|
@@ -194,7 +194,7 @@ declare module "flux:http" {
|
|
|
194
194
|
/** Port to listen on. */
|
|
195
195
|
port: number
|
|
196
196
|
/** Hostname/interface to bind. Defaults to "0.0.0.0" (all interfaces). */
|
|
197
|
-
|
|
197
|
+
host?: string
|
|
198
198
|
/**
|
|
199
199
|
* Route table keyed by path pattern. Patterns may contain `:name` segments,
|
|
200
200
|
* exposed on `req.params`. Each value is a handler function, a static
|
|
@@ -219,7 +219,7 @@ declare module "flux:http" {
|
|
|
219
219
|
/**
|
|
220
220
|
* Accept connections on a `flux:p2p` Endpoint alongside the TCP listener:
|
|
221
221
|
* each incoming connection whose ALPN matches `protocol` has the HTTP/WS
|
|
222
|
-
* protocol spoken over its first bidirectional stream. `server.
|
|
222
|
+
* protocol spoken over its first bidirectional stream. `server.close()`
|
|
223
223
|
* stops accepting; the endpoint itself stays open for its owner.
|
|
224
224
|
*/
|
|
225
225
|
p2p?: P2pOptions
|
|
@@ -228,7 +228,7 @@ declare module "flux:http" {
|
|
|
228
228
|
/**
|
|
229
229
|
* Start an HTTP server. Loosely models Bun's `Bun.serve`.
|
|
230
230
|
*
|
|
231
|
-
* @param options Port,
|
|
231
|
+
* @param options Port, host, routes, fetch fallback, error handler, and
|
|
232
232
|
* websocket callbacks.
|
|
233
233
|
* @returns The running {@link Server}.
|
|
234
234
|
*/
|
package/modules/net.d.ts
CHANGED
|
@@ -67,32 +67,46 @@ declare module "flux:net" {
|
|
|
67
67
|
*/
|
|
68
68
|
export class Conn implements AsyncIterable<Uint8Array> {
|
|
69
69
|
/** The remote peer's address, e.g. "192.168.2.37:445". */
|
|
70
|
-
readonly
|
|
70
|
+
readonly remoteAddr: string
|
|
71
71
|
/** Write all of `data`. Resolves once it is handed to the OS. */
|
|
72
72
|
write(data: string | Uint8Array): Promise<void>
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Half-close: flush and end the write side, so the peer sees end-of-stream
|
|
75
|
+
* while this side keeps reading until the peer closes. The way to signal
|
|
76
|
+
* "request done" to protocols that answer after EOF. After it, {@link write}
|
|
77
|
+
* throws. Idempotent, and a no-op once the connection is closed.
|
|
78
|
+
*/
|
|
79
|
+
closeWrite(): Promise<void>
|
|
80
|
+
/**
|
|
81
|
+
* Close the connection now: a pending read ends, the peer sees end-of-stream
|
|
82
|
+
* at once. Bytes already handed to the OS still flush.
|
|
83
|
+
*/
|
|
74
84
|
close(): void
|
|
75
85
|
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
/**
|
|
79
89
|
* A bound TCP listener: an async-iterable of incoming connections, so
|
|
80
|
-
* `for await (let conn of listener)` accepts them.
|
|
90
|
+
* `for await (let conn of listener)` accepts them. `close()` to stop.
|
|
81
91
|
*/
|
|
82
92
|
export class Listener implements AsyncIterable<Conn> {
|
|
83
|
-
/** The bound local address (with the OS-assigned port when 0 was requested). */
|
|
93
|
+
/** The bound local address (with the OS-assigned port when 0 was requested). Empty once closed. */
|
|
84
94
|
readonly localAddr: string
|
|
95
|
+
/** Close the listener: release the port and end the iteration. */
|
|
96
|
+
close(): void
|
|
85
97
|
[Symbol.asyncIterator](): AsyncIterator<Conn>
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
/** A bound UDP socket with the broadcast/multicast controls a peer beacon needs. */
|
|
89
101
|
export class Udp {
|
|
90
|
-
/** The bound local address (with the OS-assigned port when 0 was requested). */
|
|
102
|
+
/** The bound local address (with the OS-assigned port when 0 was requested). Empty once closed. */
|
|
91
103
|
readonly localAddr: string
|
|
92
104
|
/** Send a datagram to `host:port` — a unicast peer, a broadcast address, or a multicast group. */
|
|
93
105
|
send(data: string | Uint8Array, host: string, port: number): Promise<void>
|
|
94
|
-
/** Receive the next datagram. */
|
|
95
|
-
recv(): Promise<Datagram>
|
|
106
|
+
/** Receive the next datagram, or `null` once the socket is closed. */
|
|
107
|
+
recv(): Promise<Datagram | null>
|
|
108
|
+
/** Close the socket: release it (and its bound port) and resolve a pending {@link recv} with `null`. */
|
|
109
|
+
close(): void
|
|
96
110
|
/** Allow sending to the broadcast address (SO_BROADCAST). */
|
|
97
111
|
setBroadcast(on: boolean): void
|
|
98
112
|
/** TTL for outgoing multicast (1 keeps it on the local link). */
|
|
@@ -108,6 +122,17 @@ declare module "flux:net" {
|
|
|
108
122
|
leaveMulticast(group: string, iface?: string): void
|
|
109
123
|
}
|
|
110
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Outcome of an {@link icmpEcho}. Infallible like {@link probe}: `timeout`
|
|
127
|
+
* covers every "no evidence" case (no reply, unreachable, resolve failure);
|
|
128
|
+
* `unsupported` means this platform/configuration has no unprivileged ICMP
|
|
129
|
+
* socket, so "host silent" and "cannot ask" stay distinguishable.
|
|
130
|
+
*/
|
|
131
|
+
type IcmpEchoResult =
|
|
132
|
+
| { status: "reply"; rttMs: number; payload: Uint8Array }
|
|
133
|
+
| { status: "timeout" }
|
|
134
|
+
| { status: "unsupported" }
|
|
135
|
+
|
|
111
136
|
/**
|
|
112
137
|
* Probe `host:port` with a TCP connect and report what it says about the host.
|
|
113
138
|
* Infallible — every outcome maps to a {@link Liveness}, so a sweep never has to
|
|
@@ -131,6 +156,14 @@ declare module "flux:net" {
|
|
|
131
156
|
/** Bind a {@link Udp} socket. */
|
|
132
157
|
export function udp(opts?: UdpOptions): Promise<Udp>
|
|
133
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Ping `host` once: send an ICMP echo request carrying `payload` (default
|
|
161
|
+
* empty) and wait for the matching reply. IPv4 only.
|
|
162
|
+
*
|
|
163
|
+
* @param opts timeoutMs (default 1000).
|
|
164
|
+
*/
|
|
165
|
+
export function icmpEcho(host: string, payload?: string | Uint8Array, opts?: ConnectOptions): Promise<IcmpEchoResult>
|
|
166
|
+
|
|
134
167
|
/**
|
|
135
168
|
* Enumerate local network interfaces and their addresses — the no-subprocess
|
|
136
169
|
* way to find the subnet to scan (replaces parsing `ip addr`). Synchronous.
|
package/modules/p2p.d.ts
CHANGED
|
@@ -55,9 +55,9 @@ declare module "flux:p2p" {
|
|
|
55
55
|
readonly remoteId: string
|
|
56
56
|
/** Queue bytes on the send half. */
|
|
57
57
|
write(data: string | Uint8Array): void
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
/** Tear the stream down:
|
|
58
|
+
/** Half-close: end the send half (QUIC FIN) after queued writes flush. The recv half stays open. */
|
|
59
|
+
closeWrite(): void
|
|
60
|
+
/** Tear the stream down: end the send half and stop reading. */
|
|
61
61
|
close(): void
|
|
62
62
|
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>
|
|
63
63
|
}
|
package/modules/sqlite.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ declare module "flux:sqlite" {
|
|
|
34
34
|
* @param path Database file path.
|
|
35
35
|
* @param mode Open mode; defaults to "ro".
|
|
36
36
|
*/
|
|
37
|
-
static
|
|
37
|
+
static open(path: string, mode?: OpenMode): Promise<Database>
|
|
38
38
|
/** Create a reusable prepared statement (synchronous; compiles on first run). */
|
|
39
39
|
query(sql: string): Statement
|
|
40
40
|
/** One-shot write; uses plain prepare (no caching). */
|
package/modules/subprocess.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ declare module "flux:subprocess" {
|
|
|
50
50
|
stderr: AsyncIterable<Uint8Array>
|
|
51
51
|
/** Queue bytes to the child's stdin. Writes serialize and respect backpressure. */
|
|
52
52
|
write(data: string | Uint8Array): Promise<void>
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/** Half-close: close the child's stdin (after queued writes drain) so it sees EOF. */
|
|
54
|
+
closeWrite(): Promise<void>
|
|
55
55
|
/** Request termination (portable; SIGKILL / TerminateProcess). */
|
|
56
56
|
kill(): void
|
|
57
57
|
/** Resolves with the exit status when the child exits. */
|