@solidrt/flux-types 0.0.53 → 0.0.55

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
@@ -129,8 +129,19 @@ declare module "flux:gpu" {
129
129
  * shader sampling minifies through the chain; the `<texture>` display
130
130
  * draw samples the full-size level. Regeneration is one GPU pass per
131
131
  * upload or render, so a per-frame texture pays it per frame.
132
+ *
133
+ * `anisotropy` (default 1 = off) is the anisotropic filtering level, Three's
134
+ * `texture.anisotropy`: the most taps a shader sample may take along the
135
+ * axis a surface is foreshortened on, so a tiled ground plane seen at a
136
+ * grazing angle stays sharp to the horizon instead of smearing into the
137
+ * mip level its long axis picks. Any number >= 1; rounded down to a power
138
+ * of two, capped at 16 and then at the device's `limits.maxAnisotropy`
139
+ * (1 on a device without the extension - the texture then samples as
140
+ * today, no error). Only meaningful with `mipmap: true` (it filters
141
+ * through the chain), ignored by the `<texture>` display draw like the
142
+ * chain itself. Below 1 or non-finite throws.
132
143
  */
133
- export type SamplerOptions = { filter?: FilterMode; wrap?: WrapMode; mipmap?: boolean }
144
+ export type SamplerOptions = { filter?: FilterMode; wrap?: WrapMode; mipmap?: boolean; anisotropy?: number }
134
145
  /**
135
146
  * One `textures` binding value: a texture id, sampled with the texture's
136
147
  * own declared state, or `{ id, filter?, wrap? }` to sample that id with a
@@ -186,6 +197,14 @@ declare module "flux:gpu" {
186
197
  maxTextureUnits: number
187
198
  /** Vertex attributes one pipeline may declare (>= 16). */
188
199
  maxVertexAttribs: number
200
+ /**
201
+ * Highest `anisotropy` level the device samples at (a power of two, 1
202
+ * when the device has no anisotropic filtering). A report, not a
203
+ * ceiling: a higher requested level is clamped to it silently, so
204
+ * `anisotropy: limits.maxAnisotropy` is the "as sharp as this device
205
+ * goes" spelling.
206
+ */
207
+ maxAnisotropy: number
189
208
  }
190
209
  /**
191
210
  * Create an immutable texture from a pixel buffer (exactly
@@ -277,7 +296,14 @@ declare module "flux:gpu" {
277
296
  * 300 es`, `precision highp float;`, `uniform vec2 iResolution;`, plus
278
297
  * `out vec4 fragColor;` for a fragment stage (the same text
279
298
  * {@link createPipelineTexture} injects). Do not combine `header` with your
280
- * own `#version` line. Returns a shader (stage) id in its own id space;
299
+ * own `#version` line. The header declares those names rather than only
300
+ * filling them, so a source compiled with `header: true` must not declare
301
+ * them again: `uniform vec3 iResolution;` carried over from a ported shader
302
+ * is the usual mistake and fails as a redefinition (under the header
303
+ * iResolution is vec2; only a complete source may declare it vec3 and get
304
+ * `(w, h, 1.0)`). Everything else - samplers, app-driven uniforms,
305
+ * varyings (no `vUV` here) - is the source's own declaration.
306
+ * Returns a shader (stage) id in its own id space;
281
307
  * compile errors throw here, synchronously, at a call site the app chose.
282
308
  * Free with {@link destroyShader}.
283
309
  *
@@ -15,7 +15,7 @@ declare module "flux:rendertree" {
15
15
  lineHeight?: number
16
16
  /** measureText only. */
17
17
  maxLines?: number
18
- /** prepareText only: also report each unit's {@link TextUnit.carets}. */
18
+ /** prepareText only: also report each unit's {@link TextUnit.carets} (kerned per-glyph positions). */
19
19
  carets?: boolean
20
20
  /**
21
21
  * prepareText only: styled ranges over the text, in JS string offsets,
@@ -65,7 +65,11 @@ declare module "flux:rendertree" {
65
65
  * With `carets`: the caret positions inside the unit, one per grapheme
66
66
  * cluster boundary from its start (`offset` = start, x 0) to the end of
67
67
  * its shaped text (before any break characters), in order. `offset` is
68
- * into the prepared text, `x` from the unit's pen position.
68
+ * into the prepared text, `x` from the unit's pen position. These are
69
+ * the per-glyph x positions of the shaping that is drawn, kerning
70
+ * included: for placing or animating single glyphs, use them rather
71
+ * than measuring characters one at a time with measureText, which sees
72
+ * no neighbors and drifts on every kerning pair.
69
73
  */
70
74
  carets?: { offset: number, x: number }[]
71
75
  }
@@ -165,8 +169,11 @@ declare module "flux:rendertree" {
165
169
  export function measureText(text: string, options?: MeasureTextOptions): { width: number, height: number }
166
170
  /**
167
171
  * Segment `text` into wrap units and shape each in the given font (through
168
- * the shared word cache), for laying lines out in app code; see
169
- * layoutNextLine in @solidrt/core. Single style; `maxLines` is ignored.
172
+ * the shared word cache, so a text already drawn or prepared costs no
173
+ * shaping), for app-side line breaking - text into a shape, around an
174
+ * obstacle, across columns, fitted by size, per glyph; see layoutNextLine
175
+ * in @solidrt/core. `runs` restyle ranges, `carets` adds glyph positions;
176
+ * `maxLines` is ignored.
170
177
  */
171
178
  export function prepareText(text: string, options?: MeasureTextOptions): PreparedText
172
179
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidrt/flux-types",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "license": "MIT",
5
5
  "funding": "https://github.com/sponsors/wellawaretech",
6
6
  "author": "Antoine van Wel",