@solidrt/flux-types 0.0.52 → 0.0.54

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 CHANGED
@@ -740,6 +740,22 @@ declare module "flux:gpu" {
740
740
  * alone.
741
741
  * Returns a texture id (display, resize, destroy like any target; entries
742
742
  * die with it).
743
+ *
744
+ * `into` makes a SUB-TARGET: a draw target that renders into the `width`
745
+ * x `height` rectangle at `x`/`y` (top-left origin, the texture leaf's
746
+ * `srcX`/`srcY` space; default 0) of draw target `into`'s storage instead
747
+ * of owning any. It is a draw target to every verb - entries, shared
748
+ * params and bindings, order, `setTargetSize` - with dirty state of its
749
+ * own, and the parent renders ALL its tiles in ONE pass: a changed tile
750
+ * redraws over its own rectangle (the rest keeps its pixels), a changed
751
+ * parent redraws everything. That is what makes N views or N shadow maps
752
+ * cost one pass instead of N. The returned id is not a texture: sample,
753
+ * display (`<d-texture src={parent} srcX srcY srcW srcH>`), read back and
754
+ * copy the PARENT; `depthTexture(parent)` is the tile's depth too. Depth,
755
+ * `samples`, `render` and `loadOp` are the parent's (passing them
756
+ * throws), `clearColor` is the tile's own. A rectangle partly outside the
757
+ * parent is clipped; {@link setTargetRect} moves it. Tiles do not nest.
758
+ * Destroying the parent destroys its tiles.
743
759
  */
744
760
  export function createDrawTarget(
745
761
  width: number,
@@ -752,6 +768,9 @@ declare module "flux:gpu" {
752
768
  render?: "auto" | "manual"
753
769
  loadOp?: "clear" | "load"
754
770
  samples?: 1 | 2 | 4 | 8
771
+ into?: TextureId
772
+ x?: number
773
+ y?: number
755
774
  } & SamplerOptions &
756
775
  LabelOption,
757
776
  ): TextureId
@@ -890,6 +909,14 @@ declare module "flux:gpu" {
890
909
  * which carries seed pixels instead.)
891
910
  */
892
911
  export function setTargetSize(id: TextureId, width: number, height: number): void
912
+ /**
913
+ * Move and resize a sub-target's rectangle in its parent (top-left
914
+ * origin; every key required). The parent re-renders in full at the next
915
+ * flush. Throws for anything but a sub-target (see `into` on
916
+ * {@link createDrawTarget}); `setTargetSize` on a tile is this with the
917
+ * origin kept.
918
+ */
919
+ export function setTargetRect(id: TextureId, rect: { x: number; y: number; width: number; height: number }): void
893
920
  /**
894
921
  * Rebind one draw entry's sampler2D inputs by uniform name:
895
922
  * {@link setTargetTextures} addressed to a single entry, same merge,
@@ -87,7 +87,11 @@ declare module "flux:rendertree" {
87
87
  export function setRoot(id: number): void
88
88
  /** Create a node of `kind` (the primitive element name) with the given id. Throws an `Error` for a name that is not an element. */
89
89
  export function createNode(id: number, kind: string): void
90
- /** Insert `nodeId` under `parentId`, before `anchorId` if given (else appended). */
90
+ /**
91
+ * Insert `nodeId` under `parentId`, before `anchorId` if given (else appended).
92
+ * Throws an `Error` when a laid-out node would land under a detached (d-*)
93
+ * parent: a detached subtree is entirely detached. The tree is left untouched.
94
+ */
91
95
  export function insertNode(parentId: number, nodeId: number, anchorId?: number): void
92
96
  /**
93
97
  * Unlink `nodeId` from `parentId` but keep its subtree alive, so it can be
@@ -1,24 +1,47 @@
1
1
  declare module "flux:image" {
2
- /** Decoded pixels: tightly-packed RGBA8 plus the pixel dimensions. */
2
+ /**
3
+ * Decoded pixels: tightly-packed RGBA8 plus the pixel dimensions. Alpha is
4
+ * premultiplied unless the call that produced them said otherwise.
5
+ */
3
6
  export type DecodedImage = {
4
7
  data: Uint8Array
5
8
  width: number
6
9
  height: number
7
10
  }
8
11
 
12
+ /**
13
+ * Which alpha convention a pixel buffer follows. Image files store
14
+ * `"straight"` alpha; every texture and target on the GPU is
15
+ * `"premultiplied"` (color already multiplied by alpha), and so is what
16
+ * `readTexture` / `captureSnapshot` hand back.
17
+ */
18
+ export type AlphaMode = "premultiplied" | "straight"
19
+
9
20
  /**
10
21
  * Decodes encoded image bytes (png, jpeg, webp, gif, bmp, ico) into raw
11
22
  * RGBA8 pixels plus the decoded dimensions. Synchronous, pure CPU. Throws
12
23
  * when the bytes are not a decodable image.
24
+ *
25
+ * `alpha` selects what comes out: `"premultiplied"` (default) is ready for
26
+ * `createTexture` as-is; `"straight"` is the file's pixels verbatim, for CPU
27
+ * processing that wants color under transparent pixels preserved. Opaque
28
+ * pixels are identical either way.
13
29
  */
14
- export function decodeImage(bytes: Uint8Array): DecodedImage
30
+ export function decodeImage(bytes: Uint8Array, options?: { alpha?: AlphaMode }): DecodedImage
15
31
 
16
32
  /**
17
33
  * Encodes raw RGBA8 pixels into an image file, the reverse of `decodeImage`
18
- * (`encodeImage(decodeImage(bytes))` round-trips). `format` defaults to
19
- * `"png"` (lossless, keeps alpha); `"jpeg"` drops the alpha channel and
20
- * takes `quality` in 0..1 (default 0.9, ignored for png). Throws when
21
- * `data.length` does not match `width * height * 4`.
34
+ * (`encodeImage(decodeImage(bytes))` round-trips: exactly for opaque and
35
+ * fully transparent pixels, within rounding for translucent ones). `format`
36
+ * defaults to `"png"` (lossless, keeps alpha); `"jpeg"` drops the alpha
37
+ * channel and takes `quality` in 0..1 (default 0.9, ignored for png).
38
+ * `alpha` names what `img.data` holds: `"premultiplied"` (default, a decode
39
+ * or a readback) is converted to the straight alpha PNG stores;
40
+ * `"straight"` is written verbatim. Throws when `data.length` does not
41
+ * match `width * height * 4`.
22
42
  */
23
- export function encodeImage(img: DecodedImage, options?: { format?: "png" | "jpeg"; quality?: number }): Uint8Array
43
+ export function encodeImage(
44
+ img: DecodedImage,
45
+ options?: { format?: "png" | "jpeg"; quality?: number; alpha?: AlphaMode },
46
+ ): Uint8Array
24
47
  }
package/modules/net.d.ts CHANGED
@@ -22,6 +22,10 @@ declare module "flux:net" {
22
22
  /**
23
23
  * Outcome of a {@link probe}. `closed` (a refusal) still means the host is up —
24
24
  * something answered; only `filtered` (a timeout/unreachable) is no evidence.
25
+ *
26
+ * Windows reports a refusal only after ~2 s of SYN retries, so a `timeoutMs`
27
+ * under that reads a refused port as `filtered` there; `open` is instant
28
+ * everywhere.
25
29
  */
26
30
  type Liveness = "open" | "closed" | "filtered"
27
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidrt/flux-types",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "license": "MIT",
5
5
  "funding": "https://github.com/sponsors/wellawaretech",
6
6
  "author": "Antoine van Wel",