@solidrt/flux-types 0.0.46 → 0.0.47
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 +33 -32
- package/gui/rendertree.d.ts +7 -1
- package/package.json +1 -1
- package/standards/base64.d.ts +3 -2
- package/standards/fetch.d.ts +6 -2
- package/standards/time.d.ts +19 -1
package/gui/gpu.d.ts
CHANGED
|
@@ -676,12 +676,14 @@ declare module "flux:gpu" {
|
|
|
676
676
|
* shared value (specific beats general), and they are target state: entry
|
|
677
677
|
* add/remove/rebuild cannot lose them. A draw target legitimately mixes
|
|
678
678
|
* material classes, so coverage may be partial: a name only some entries'
|
|
679
|
-
* programs declare is applied where declared and skipped elsewhere
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
684
|
-
*
|
|
679
|
+
* programs declare is applied where declared and skipped elsewhere - down
|
|
680
|
+
* to zero coverage: a name no current entry declares is stored and skips
|
|
681
|
+
* everywhere until a declaring entry arrives, so shared state does not
|
|
682
|
+
* depend on write order (a seed before entries and a write after are the
|
|
683
|
+
* same state). Validation is arity where declared: a name must match the
|
|
684
|
+
* declared component count in every entry program that declares it; an
|
|
685
|
+
* entry added later whose program lacks an already-set name is never a
|
|
686
|
+
* retroactive error, the value just skips it.
|
|
685
687
|
*/
|
|
686
688
|
export function setTargetParams(target: TextureId, params: ShaderParams): void
|
|
687
689
|
/**
|
|
@@ -702,12 +704,12 @@ declare module "flux:gpu" {
|
|
|
702
704
|
* reads - an environment map, a shadow map, a LUT - bound once per
|
|
703
705
|
* target, with the shared-params rules throughout: an entry's own binding
|
|
704
706
|
* for the same name wins; a name only some entries' programs declare
|
|
705
|
-
* binds where declared and is skipped elsewhere
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
* the applicable shared ones) must fit the device's texture units.
|
|
707
|
+
* binds where declared and is skipped elsewhere, down to zero coverage
|
|
708
|
+
* (an undeclared name is stored, joins the sampler graph, and binds when
|
|
709
|
+
* a declaring entry arrives); shared bindings are target state that entry
|
|
710
|
+
* add/remove/rebuild cannot lose. Each name must be a sampler2D
|
|
711
|
+
* everywhere it is declared, and each entry's effective inputs (its own
|
|
712
|
+
* plus the applicable shared ones) must fit the device's texture units.
|
|
711
713
|
*/
|
|
712
714
|
export function setTargetTextures(target: TextureId, textures: Record<string, TextureId>): void
|
|
713
715
|
/**
|
|
@@ -773,7 +775,8 @@ declare module "flux:gpu" {
|
|
|
773
775
|
*/
|
|
774
776
|
export function copyTexture(src: TextureId, dst: TextureId): void
|
|
775
777
|
/**
|
|
776
|
-
* Capture a render-tree node's subtree
|
|
778
|
+
* Capture a render-tree node's subtree as RGBA8 pixels (tightly packed,
|
|
779
|
+
* top-to-bottom rows - the {@link readTexture} result shape), resolving once
|
|
777
780
|
* it has been rendered on the next paint pass. The node must be attached to
|
|
778
781
|
* the live tree (an unmounted node is never painted, so its capture rejects)
|
|
779
782
|
* and paint a non-zero box. A laid-out node captures its layout box. A `d-*`
|
|
@@ -781,34 +784,32 @@ declare module "flux:gpu" {
|
|
|
781
784
|
* painted box instead: its own `w`/`h` when set, else the nearest laid-out
|
|
782
785
|
* ancestor's box (the same box the render tree reports for it), with its
|
|
783
786
|
* `x`/`y` paint offset mapped to the texture origin.
|
|
784
|
-
* Rendered at the current display scale, so `width`/`height` are
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
* (`<texture src>`, a shader sampler input, {@link readTexture}).
|
|
787
|
+
* Rendered at the current display scale, so `width`/`height` are actual
|
|
788
|
+
* pixel dimensions (ceil(logicalSize * displayScale)), not logical points.
|
|
789
|
+
* No texture is created and there is nothing to free; to display or sample
|
|
790
|
+
* the result, upload it with {@link createTexture}.
|
|
789
791
|
*
|
|
790
792
|
* Intended for one-shot bakes and inspection: turning something the engine
|
|
791
793
|
* can draw but the app cannot compute - shaped text, an SVG, a themed view -
|
|
792
|
-
* into pixels
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
* same shape.
|
|
794
|
+
* into pixels the app processes on the CPU. Baking a glyph atlas by laying
|
|
795
|
+
* out cells, capturing them and keeping the coverage channel is the worked
|
|
796
|
+
* example. Tests and freeze-frames are the same shape.
|
|
796
797
|
*
|
|
797
798
|
* Not a rendering primitive. Every call rasterizes the subtree into a fresh
|
|
798
|
-
* offscreen MSAA target
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
799
|
+
* offscreen MSAA target and reads the pixels back to the CPU: a GPU -> CPU
|
|
800
|
+
* readback stall plus a paint pass of latency, per call, with nothing
|
|
801
|
+
* incremental about it. Batch what you capture (many nodes captured together
|
|
802
|
+
* are serviced by one paint pass), and do not drive it per frame or reach
|
|
803
|
+
* for it to feed live content into a shader - an effect over what is beneath
|
|
804
|
+
* it, a backdrop filter. Content that must stay current has to come from a
|
|
805
|
+
* source that updates in place: another pipeline's render target, a camera
|
|
806
|
+
* texture, a mutable texture.
|
|
806
807
|
*/
|
|
807
|
-
export function captureSnapshot(nodeId: number): Promise<{
|
|
808
|
+
export function captureSnapshot(nodeId: number): Promise<{ width: number; height: number; data: Uint8Array }>
|
|
808
809
|
/**
|
|
809
810
|
* Read back a registered texture's current pixels as RGBA8 (tightly packed,
|
|
810
811
|
* top-to-bottom rows), for any texture id whatever created it (createTexture,
|
|
811
|
-
* createShaderTexture,
|
|
812
|
+
* createShaderTexture, a render target). Synchronous. Throws if the id is
|
|
812
813
|
* unknown.
|
|
813
814
|
*/
|
|
814
815
|
export function readTexture(id: TextureId): { width: number; height: number; data: Uint8Array }
|
package/gui/rendertree.d.ts
CHANGED
|
@@ -28,7 +28,13 @@ declare module "flux:rendertree" {
|
|
|
28
28
|
export function detachNode(parentId: number, nodeId: number): void
|
|
29
29
|
/** Free `nodeId` and its whole subtree. Call after {@link detachNode}. */
|
|
30
30
|
export function destroyNode(nodeId: number): void
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Write a single property on a node; `value` is marshalled per property.
|
|
33
|
+
* Throws an `Error` for an unknown property name (message starts with
|
|
34
|
+
* "Unknown property") or a value that does not decode; it never aborts the
|
|
35
|
+
* runtime. Core's renderer warns-and-continues on the name-level rejections
|
|
36
|
+
* and rethrows value errors.
|
|
37
|
+
*/
|
|
32
38
|
export function setProperty(nodeId: number, name: string, value: unknown): void
|
|
33
39
|
/**
|
|
34
40
|
* Declare which pointer deliveries the node's handlers want, as a bitmask
|
package/package.json
CHANGED
package/standards/base64.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
declare function btoa(data: string): string
|
|
11
11
|
/**
|
|
12
12
|
* Base64-decode to a binary string: each decoded byte becomes one char code
|
|
13
|
-
* (read the bytes back with `charCodeAt`).
|
|
14
|
-
* ignored
|
|
13
|
+
* (read the bytes back with `charCodeAt`). Forgiving per WHATWG: ASCII
|
|
14
|
+
* whitespace is ignored and missing `=` padding is tolerated; anything else
|
|
15
|
+
* that is not valid base64 throws.
|
|
15
16
|
*/
|
|
16
17
|
declare function atob(data: string): string
|
package/standards/fetch.d.ts
CHANGED
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
// Grouped in one file because the four share BodyInit/HeadersInit and reference
|
|
5
5
|
// each other.
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Header initializer: a plain name -> value object, or another Headers.
|
|
9
|
+
* Values must be strings: a non-string value throws (the web stringifies it).
|
|
10
|
+
*/
|
|
8
11
|
type HeadersInit = Record<string, string> | Headers
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* A message body: a string, raw bytes, or an async-iterable of string/byte
|
|
12
|
-
* chunks (e.g. an `async function*`), which is sent as a stream.
|
|
15
|
+
* chunks (e.g. an `async function*`), which is sent as a stream. Any other
|
|
16
|
+
* value throws (the web stringifies it).
|
|
13
17
|
*/
|
|
14
18
|
type BodyInit = string | Uint8Array | AsyncIterable<string | Uint8Array>
|
|
15
19
|
|
package/standards/time.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
// Timers, microtask scheduling, and the monotonic clock. flux's timers differ
|
|
2
2
|
// from the browser in two ways: the delay is required, and no extra callback
|
|
3
3
|
// arguments are forwarded.
|
|
4
|
+
//
|
|
5
|
+
// In a GUI runtime the whole time surface here is FRAME-STEPPED: timers and
|
|
6
|
+
// performance.now() march on the same paced timeline as onFrame and
|
|
7
|
+
// requestAnimationFrame, quantized to frames. So timer resolution is one
|
|
8
|
+
// frame (~16 ms at 60 Hz; a setTimeout of 0 runs on the next frame), an
|
|
9
|
+
// interval fires at most once per frame, and pausing the runtime clock (the
|
|
10
|
+
// dev tools' set_time_scale 0) freezes all of it together deterministically.
|
|
11
|
+
// Date.now() is the wall-clock escape hatch: it always reports real calendar
|
|
12
|
+
// time. Headless flux (scripts, servers) keeps ordinary wall-clock timers.
|
|
4
13
|
|
|
5
14
|
/**
|
|
6
15
|
* Run `callback` after at least `ms` milliseconds. Returns a timer id for
|
|
@@ -25,7 +34,16 @@ declare function queueMicrotask(callback: () => void): void
|
|
|
25
34
|
declare let performance: {
|
|
26
35
|
/**
|
|
27
36
|
* Milliseconds since a monotonic origin (high-resolution, not wall-clock). Use
|
|
28
|
-
* for measuring durations, not for calendar time.
|
|
37
|
+
* for measuring durations, not for calendar time. In a GUI runtime this is
|
|
38
|
+
* the paced frame timeline (same clock as the onFrame/requestAnimationFrame
|
|
39
|
+
* timestamps, frozen while the runtime clock is paused); for real elapsed
|
|
40
|
+
* wall time use Date.now().
|
|
29
41
|
*/
|
|
30
42
|
now(): number
|
|
43
|
+
/**
|
|
44
|
+
* Wall-clock time (ms since the Unix epoch) when the runtime started. Unlike
|
|
45
|
+
* the browser, timeOrigin + now() is not the current wall-clock time: now()
|
|
46
|
+
* runs on the paced runtime timeline, which can be frozen or scaled.
|
|
47
|
+
*/
|
|
48
|
+
readonly timeOrigin: number
|
|
31
49
|
}
|