@solidrt/flux-types 0.0.49 → 0.0.50
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 +19 -3
- package/gui/rendertree.d.ts +36 -1
- package/modules/wasm.d.ts +7 -1
- package/package.json +1 -1
package/gui/gpu.d.ts
CHANGED
|
@@ -397,9 +397,25 @@ declare module "flux:gpu" {
|
|
|
397
397
|
* depth-tested additive pass usually pairs with `depthWrite: false`; with
|
|
398
398
|
* writes on, unsorted geometry depth-rejects its own later fragments and
|
|
399
399
|
* accumulation becomes draw-order-dependent. That pairing is the app's to
|
|
400
|
-
* state - neither option implies the other.
|
|
401
|
-
|
|
402
|
-
|
|
400
|
+
* state - neither option implies the other. "multiply" scales
|
|
401
|
+
* (glBlendFunc(DST_COLOR, ZERO)): each fragment multiplies what is already
|
|
402
|
+
* in the target, all four channels, so it darkens where "add" brightens -
|
|
403
|
+
* a projected shadow, a dust pass. Order-independent like "add", same
|
|
404
|
+
* `depthWrite: false` pairing. On the premultiplied target a uniform factor
|
|
405
|
+
* across rgb and alpha fades the existing pixels; alpha 1 with rgb below 1
|
|
406
|
+
* darkens color only - so a strength-weighted shadow is
|
|
407
|
+
* `vec4(mix(vec3(1.0), shadowColor, strength), 1.0)`, not alpha =
|
|
408
|
+
* strength (that fades instead). "alpha" composites OVER
|
|
409
|
+
* (glBlendFunc(ONE, ONE_MINUS_SRC_ALPHA)): classic translucency, with the
|
|
410
|
+
* fragment written premultiplied like every target pixel -
|
|
411
|
+
* `vec4(color * a, a)`, never straight rgb with a loose alpha. It is the
|
|
412
|
+
* one order-DEPENDENT mode: the result follows draw-list order, so
|
|
413
|
+
* translucent geometry must land back-to-front - by draw-list ordering
|
|
414
|
+
* (`before`, `setDrawOrder`) or a sorting layer above - and normally after
|
|
415
|
+
* the opaque draws with `depthWrite: false`, so it depth-tests against them
|
|
416
|
+
* without occluding what it only tints. Nothing sorts for you here.
|
|
417
|
+
*/
|
|
418
|
+
export type BlendMode = "none" | "add" | "multiply" | "alpha"
|
|
403
419
|
/**
|
|
404
420
|
* Face culling for a pipeline's draws. "none" (default) rasters both faces
|
|
405
421
|
* - the two-sided fallback open surfaces need. "back" discards faces wound
|
package/gui/rendertree.d.ts
CHANGED
|
@@ -5,15 +5,44 @@
|
|
|
5
5
|
// module; requestFrame here only schedules a future frame.
|
|
6
6
|
|
|
7
7
|
declare module "flux:rendertree" {
|
|
8
|
-
/** Font options for {@link measureText}. */
|
|
8
|
+
/** Font options for {@link measureText} and {@link prepareText}. */
|
|
9
9
|
export interface MeasureTextOptions {
|
|
10
10
|
fontFamily?: "sans" | "serif" | "mono" | (string & {})
|
|
11
11
|
fontSize?: number
|
|
12
12
|
fontStyle?: "normal" | "italic"
|
|
13
13
|
fontWeight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
|
|
14
|
+
lineHeight?: number
|
|
15
|
+
/** measureText only. */
|
|
14
16
|
maxLines?: number
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
/**
|
|
20
|
+
* One wrap unit (a word plus its trailing whitespace, or an empty unit at
|
|
21
|
+
* a blank line) of a {@link prepareText} result: everything the engine
|
|
22
|
+
* knows about it, for app-side line breaking.
|
|
23
|
+
*/
|
|
24
|
+
export interface TextUnit {
|
|
25
|
+
/** The unit's text without its break characters. */
|
|
26
|
+
text: string
|
|
27
|
+
/** Offsets into the prepared text (JS string indexing), break characters included: the ranges tile the text. */
|
|
28
|
+
start: number
|
|
29
|
+
end: number
|
|
30
|
+
/** Horizontal extent including trailing whitespace: what the next unit's pen position advances by. */
|
|
31
|
+
advance: number
|
|
32
|
+
/** Ink extent without trailing whitespace: what the unit needs at the end of a line. */
|
|
33
|
+
width: number
|
|
34
|
+
ascent: number
|
|
35
|
+
descent: number
|
|
36
|
+
/** The unit ends at a hard line break (newline). */
|
|
37
|
+
hardBreak: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The wrap units of a text in one font, shaped once. Plain data; layout is arithmetic over `units`. */
|
|
41
|
+
export interface PreparedText {
|
|
42
|
+
text: string
|
|
43
|
+
units: TextUnit[]
|
|
44
|
+
}
|
|
45
|
+
|
|
17
46
|
/** Create the window root node with the given id. */
|
|
18
47
|
export function createRoot(id: number): void
|
|
19
48
|
/** Create a node of `kind` (the primitive element name) with the given id. */
|
|
@@ -73,6 +102,12 @@ declare module "flux:rendertree" {
|
|
|
73
102
|
* adding it to the tree.
|
|
74
103
|
*/
|
|
75
104
|
export function measureText(text: string, options?: MeasureTextOptions): { width: number, height: number }
|
|
105
|
+
/**
|
|
106
|
+
* Segment `text` into wrap units and shape each in the given font (through
|
|
107
|
+
* the shared word cache), for laying lines out in app code; see
|
|
108
|
+
* layoutNextLine in @solidrt/core. Single style; `maxLines` is ignored.
|
|
109
|
+
*/
|
|
110
|
+
export function prepareText(text: string, options?: MeasureTextOptions): PreparedText
|
|
76
111
|
/**
|
|
77
112
|
* The node's bounding box from the most recent layout, relative to its
|
|
78
113
|
* nearest positioning context (an ancestor with an explicit
|
package/modules/wasm.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// There is no `WebAssembly` global in flux; this module is the entire wasm
|
|
2
|
-
// surface.
|
|
2
|
+
// surface. Modules run in a pure interpreter (wasmi, no JIT), so this is a
|
|
3
|
+
// portability tool - one compiled module runs on every flux target with no
|
|
4
|
+
// native binaries or dlopen - not a speed tool. Tight typed compute runs
|
|
5
|
+
// somewhat faster than the same loop in JavaScript (a small constant
|
|
6
|
+
// factor, nowhere near browser wasm speed), and every host call costs
|
|
7
|
+
// extra marshalling, so call-heavy code can end up slower.
|
|
8
|
+
// Imports must be scalar-signature functions only (no imported
|
|
3
9
|
// memory, globals or tables), which constrains the toolchain on the other
|
|
4
10
|
// side: default emscripten output imports its memory and is rejected, while
|
|
5
11
|
// `emcc -sSTANDALONE_WASM=1 --no-entry` produces a module that fits.
|