@kineviz/gl 0.6.0 → 0.7.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,1274 @@
2
2
 
3
3
  All notable changes to `@kineviz/gl` are documented here.
4
4
 
5
+ ## Unreleased
6
+
7
+ Nothing yet.
8
+
9
+ ## 0.7.0 — 2026-11-25
10
+
11
+ The first release of `@kineviz/gl` on the public npm registry, under
12
+ Apache-2.0. Everything below is relative to 0.6.1, which was only ever
13
+ distributed inside the Kineviz workspace — so although this release contains
14
+ breaking changes, no npm consumer can be broken by them. Read the breaking
15
+ sections anyway if you are upgrading an in-house host from a workspace build.
16
+
17
+ The minor bump rather than a patch is because of those breaking changes: the
18
+ `three` peer range moves to `~0.184.0`, and the GPU layout controllers move to
19
+ the `@kineviz/gl/layout-gpu` subpath.
20
+
21
+ three.js moves from r121 (2020) to r184. Goal: get the existing WebGL path onto
22
+ a version that has WebGPU at all, without changing how anything looks or
23
+ behaves. This is the prerequisite step of the WebGPU renderer migration — no
24
+ WebGPU rendering code lands here, and the engine still has exactly one render
25
+ path.
26
+
27
+ ### Added — license and attribution files
28
+
29
+ - **`LICENSE` (Apache-2.0) and `NOTICE` now ship in the package**, and
30
+ `package.json` declares `"license": "Apache-2.0"` instead of the placeholder
31
+ commercial-license pointer, which is removed. `NOTICE` lists every
32
+ third-party package the bundles carry with the license identifier read from
33
+ that package's own `package.json`. Source maps remain excluded from the
34
+ tarball (`!dist/**/*.map` in `files`), so no original TypeScript ships.
35
+
36
+ ### Added — the remaining facade namespaces are exported, so they get API reference pages
37
+
38
+ - **`RendererApi`, `TypesApi`, `AlgorithmApi`, `HoverApi`, `OverlaysApi`,
39
+ `PlaybackApi`, `IoApi`, `QueryApi`, `SchemaApi` and `UiApi` are now exported
40
+ from the package entry** (`AlgorithmApi`, `HoverApi` and `SchemaApi` also from
41
+ the `api/` barrel). They were always reachable as `api.renderer`, `api.types`
42
+ and so on; what was missing was the exported class. The docs generator builds
43
+ the published reference by looking each facade property's class up in typedoc's
44
+ output, and typedoc only sees what the entry exports — so those ten namespaces,
45
+ a third of the API, had **no reference page at all**, which is how
46
+ `api.renderer.setNodeSizeScale` and `setMaxScreenFraction` could ship with
47
+ nowhere to document them. No behaviour change; nothing was renamed.
48
+ - `DebugApi` stays unexported on purpose: `api.debug` is a diagnostics surface,
49
+ not part of the documented API.
50
+ - Covered by `src/api/__tests__/namespaceExports.test.ts` (3 tests: the facade
51
+ still exposes its namespaces, every documented namespace's class is exported,
52
+ and the deliberate exception stays off the surface; dropping one export from
53
+ the entry file fails it).
54
+
55
+ ### Changed — the published reference now matches the documented surface
56
+
57
+ - **Eight interaction-wiring methods are marked `@internal` and no longer appear
58
+ in the API reference**: `CameraApi.wireLayoutRuntime`, `EmphasisApi.wireInteraction`,
59
+ `HoverApi.wireHoverHandler`, `MapApi.wireIs3D` / `wireMapDamping` /
60
+ `wireMapMaxGrowth`, `RendererApi.wireMaxScreenFraction` / `wireNodeSizeScale`.
61
+ They are called by the React shell once the engine is mounted and were never
62
+ meant for hosts; they are still present at runtime, so nothing breaks. The
63
+ reference generator additionally skips `_`-prefixed members, which is what
64
+ removed the page for `api.layout._writePositionsNoUndo`.
65
+ - `api.renderer.setNodeSizeScale`'s documentation no longer describes how the
66
+ scale is applied internally; the observable guarantee (everything derived from
67
+ node size, including the clickable area, moves together) is unchanged.
68
+ - No test covers these, because nothing in the public surface changed — the
69
+ evidence is the generated output: `docs/content/api/*/wire*.mdx` and
70
+ `docs/content/api/layout/_writePositionsNoUndo.mdx` are gone, and the site
71
+ builds with zero broken links.
72
+
73
+ ### Removed — BREAKING for hosts
74
+
75
+ - **`setLicenseKey` is gone**, along with `api/modules/LicenseApi.ts`. It stored
76
+ a string in module state and validated nothing — its own header said so — so
77
+ it gated no capability and stopped nobody. What it did do was tell host
78
+ developers they might owe a licence for code that never checked one. The
79
+ engine is heading for an open-source release; if licence enforcement ever
80
+ happens it belongs in a proprietary package that has something to enforce,
81
+ not in the renderer. Hosts calling it should delete the call: there is no
82
+ replacement and nothing to migrate to.
83
+ - Covered by `src/api/__tests__/namespaceExports.test.ts` (2 added tests: no
84
+ export from the package entry matches `/licen[cs]e/i`, and neither entry file
85
+ references a licence module; re-adding the export fails both).
86
+
87
+ ### Changed — BREAKING for hosts
88
+
89
+ - **`forceLayout`'s default backend is now `"d3"` (CPU d3-force-3d), was
90
+ `"auto"`.** `"auto"` picked WebGPU whenever `navigator.gpu` existed, so the
91
+ same graph settled into a different shape depending on the viewer's browser:
92
+ a screenshot taken on one machine did not match another, and a layout tuned on
93
+ a GPU machine came out wrong for the half of the audience without one. The two
94
+ backends do not converge to the same layout, and d3-force-3d's reads better,
95
+ so the default is now the one that is also deterministic across machines.
96
+ WebGPU remains a per-canvas opt-in for **scale**: `forceLayout={{ engine:
97
+ "webgpu" }}`, or `{ engine: "auto" }` to restore exactly the old behaviour.
98
+ Requesting `"webgpu"` where it is unavailable still falls back to `"d3"` with
99
+ a dev-mode warning, so it is safe to request unconditionally.
100
+ - Covered by `src/react/__tests__/forceLayoutEngine.test.ts` (3 added/changed
101
+ tests: an unset engine resolves to `"d3"` **on the WebGPU-capable branch too**
102
+ — that branch is the whole regression — the default warns about nothing, and
103
+ `"auto"` still resolves to `"webgpu"`. Restoring the old
104
+ `hasWebGPU ? "webgpu" : "d3"` fallthrough fails two of them.)
105
+
106
+ - **The GPU force-layout classes moved off the package root to
107
+ `@kineviz/gl/layout-gpu`.** `GPUForceLayoutController`,
108
+ `GPULayoutControllerAdapter`, `WebGPUForceLayoutController`,
109
+ `WebGPULayoutControllerAdapter`, `GPUForceLayoutEngine`, `createForceLayout`
110
+ and `isWebGPUAvailable` are no longer exported from `@kineviz/gl`; the
111
+ classes themselves are unchanged, and the migration is one import path:
112
+
113
+ ```diff
114
+ - import { WebGPUForceLayoutController } from "@kineviz/gl";
115
+ + import { WebGPUForceLayoutController } from "@kineviz/gl/layout-gpu";
116
+ ```
117
+
118
+ They were re-exported "for consumer convenience", and that convenience was
119
+ not free: a static re-export is an **eager** edge in the module graph, so
120
+ every host downloaded both GPU layout backends whether or not it ran one, and
121
+ the dynamic import below had nothing left to defer. **Using the WebGPU
122
+ backend needs none of these imports** — `forceLayout={{ engine: "webgpu" }}`
123
+ loads the controller on demand, unchanged.
124
+ - **The WebGPU force-layout backend is loaded on demand.** `GraphCanvas` now
125
+ reaches it through `await import("@kineviz/gpu-compute/webgpu")`, and
126
+ `@kineviz/gpu-compute` gained `./cpu` and `./webgpu` entries so that the
127
+ split is possible at all: it shipped as one bundled module holding all three
128
+ backends, and a dynamic import of one export from a single module cannot be
129
+ split by any bundler — there is no second module to put in the lazy chunk.
130
+ Measured on the real tsup build, the ESM entry went **428 → 385 KiB gzip**
131
+ (CJS 433 → 415; CJS has no code splitting, so it keeps the WebGPU code inline
132
+ and gains only from the re-exports leaving), with 28 KiB deferred to a chunk
133
+ fetched the first time a canvas asks for `engine: "webgpu"`. If that fetch
134
+ fails — offline, blocked, a bad deploy — the canvas falls back to `"d3"` with
135
+ a `console.warn` rather than rendering with no layout.
136
+ - Covered by `src/__tests__/gpuComputeSplit.test.ts` (10 tests: neither
137
+ `src/index.ts` nor `src/react/GraphContext.tsx` statically reaches
138
+ `@kineviz/gpu-compute` or `@kineviz/gpu-compute/webgpu`, both WebGPU call
139
+ sites still load the backend dynamically, the default engine still comes from
140
+ the `/cpu` entry, `src/layout-gpu.ts` exports all seven moved symbols, and the
141
+ `./layout-gpu` subpath is declared in `package.json` and built by tsup.
142
+ Verified by mutation: restoring the static import in `GraphContext.tsx`,
143
+ re-adding the root re-export, and swapping `D3LayoutControllerAdapter` back to
144
+ the barrel each fail it) and
145
+ `src/react/graph-context/__tests__/controllerSlot.test.ts` (5 tests for the
146
+ unmount race the async branch creates: a controller that arrives after
147
+ cleanup is destroyed and not published, one that arrives in time is handed
148
+ back to the caller exactly once, and a throwing `destroy` does not escape).
149
+
150
+
151
+ - **`three` peer dependency moves from `~0.121.0` to `~0.184.0`.** Hosts must
152
+ upgrade their own `three` to a 0.184.x before taking this release; the range
153
+ is now bounded on both sides in `@kineviz/gl` **and** in `@kineviz/gpu-compute`
154
+ (which previously declared an unbounded `>=0.121.0`, so the two packages could
155
+ drift). `@types/three` is pinned to the exact matching `0.184.0` in both
156
+ packages — it used to be `"*"`, which resolved to r184 types while the runtime
157
+ was r121, so type-checking had been validating 2020 code against 2026
158
+ declarations for the whole life of the package.
159
+ - **UMD consumers get a different bundled three.** `dist/kineviz-gl.umd.js`
160
+ bundles three (it always has). The frozen copy inside it is now r184 rather
161
+ than r121. Hosts on the ESM/CJS entry supply their own three and are
162
+ unaffected by what the UMD file contains.
163
+ - **three's automatic colour management is switched off at import time.**
164
+ three enables `ColorManagement` by default from r152; leaving it on would
165
+ silently re-interpret every colour this engine constructs as sRGB and convert
166
+ it, shifting the whole picture. `@kineviz/gl` sets
167
+ `THREE.ColorManagement.enabled = false` so rendering matches r121 exactly.
168
+ This is a **process-global** flag, so a host that wants three's colour
169
+ management for its own scenes in the same page cannot have it while
170
+ `@kineviz/gl` is loaded. Revisit is scheduled for the shader-equivalence step
171
+ of the migration.
172
+ - **Renderer classes are no longer exported.** `GPUNodeRenderer`, `GPUEdgeRenderer`,
173
+ `GPUGroupRingRenderer` and `GroupSphereRenderer` leave the public surface. Hosts that
174
+ constructed them directly use `createRenderBackend("webgl")` and its
175
+ `createNodeRenderer` / `createEdgeRenderer` / `createGroupRingRenderer` /
176
+ `createGroupSphereRenderer` factories; the returned objects keep today's method
177
+ surface (`NodeRendererBackend` etc.). No deprecated aliases. `createRenderBackend("webgpu")`
178
+ exists too, but its factories throw `WebGPUBackendNotReadyError` in this release. Covered by
179
+ `src/backends/__tests__/publicSurface.test.ts`, `createRenderBackend.test.tsx`.
180
+ - **`EventMap` gains `renderFault`.** Code that switches exhaustively over
181
+ `keyof EventMap` needs a new arm (same shape of change as `DirtyFlag.nodeLabels`).
182
+
183
+ ### Fixed — API removals in three that this engine was using
184
+
185
+ Each of these was an engine-internal use of a three API that no longer exists;
186
+ none of them change `@kineviz/gl`'s own public surface.
187
+
188
+ - **Glyph atlas texture format.** `LuminanceFormat` went away with WebGL1
189
+ support (r163); the SDF glyph atlas now uses `RedFormat`, matching what
190
+ `IconAtlasManager` already used. Shader sampling was already `.r`, so no
191
+ shader change was needed.
192
+ - **Partial buffer uploads.** `BufferAttribute.updateRange` (a single
193
+ `{offset, count}` span) became the `updateRanges` array in r159 — 36 call
194
+ sites across `GPUNodeRenderer`, `GPUEdgeRenderer` and `BatchTextRenderer`.
195
+ The existing merge-into-one-contiguous-span behaviour is preserved exactly;
196
+ the merge logic is now one shared helper (`utils/bufferUpdateRange`) instead
197
+ of five hand-copied blocks. Covered by
198
+ `src/utils/__tests__/bufferUpdateRange.test.ts` and the existing
199
+ `src/backends/gpu/__tests__/GPUNodeRenderer.sparseSelection.test.tsx`.
200
+ - **Legacy instance-count mirror writes.** `InstancedBufferGeometry.maxInstancedCount`
201
+ (the deprecated alias) was removed in r125; the 21 mirror writes that existed
202
+ only to satisfy r121's `WebGLBufferRenderer` are gone, and `instanceCount` is
203
+ now the single source of truth. Covered by six new `instanceCount` assertion
204
+ files. **Note for layer authors:** the separate, underscore-prefixed
205
+ `geometry._maxInstanceCount` is a *different* property, it still exists in
206
+ r184, and the `delete` calls around it are still required — see the revised
207
+ note in `src/react/layers/LAYER_STANDARD.md`.
208
+ - **`Material.extensions.derivatives`** was removed with WebGL1 support; `fwidth()`
209
+ is core in WebGL2's GLSL ES 3.0. Removed from four materials.
210
+ - **`THREE.Quaternion.slerp(qa, qb, target, t)`** (static) → `target.slerpQuaternions(qa, qb, t)`
211
+ in the map fly-to animation.
212
+ - **`WebGLRenderer.getClearColor()`** now requires a target `Color`; the minimap's
213
+ save/restore passes one.
214
+ - **`Matrix4.getInverse()`** removal made `utils/threeCompat.ts` pointless — the
215
+ shim and its four call sites are replaced by direct `Matrix4.invert()`.
216
+ - **`ConeBufferGeometry`** (removed in r125) → `ConeGeometry` in the arrow
217
+ geometry. This one was invisible to the type checker because it sat behind an
218
+ `as any`; only the UMD bundler warned about it.
219
+ - **`three/examples/jsm/...` subpath imports now need the `.js` extension**,
220
+ because r184 ships an `exports` map that maps the path literally.
221
+
222
+ ### Fixed — the published ESM bundle no longer imports a node builtin
223
+
224
+ A host bundling `@kineviz/gl` with webpack or Vite failed its whole build with
225
+
226
+ ```
227
+ Module not found: Error: Can't resolve 'module' in '.../render-engine/dist'
228
+ ```
229
+
230
+ `io.importGraphXR` lazily imports `@kineviz/parsers`, which the package bundles
231
+ in, and that reaches `fflate` for the `.graphxr` archive. `fflate`'s export map
232
+ puts a `node` condition first, and under esbuild's default platform that is the
233
+ condition tsup applied — so the emitted chunk opened with
234
+ `import { createRequire } from "module"` for a `worker_threads` path the parser
235
+ never calls. The build now sets `platform: "browser"`, which is what this
236
+ package is, and `fflate` resolves to its browser build instead. `unzipSync` and
237
+ `strFromU8` — the only two functions the parser uses — are identical in both.
238
+ Verified by the docs site's own webpack dev server, which went from "compiled
239
+ with 1 error" to clean, and by grepping the whole of `dist/` for node builtins:
240
+ there are now none.
241
+
242
+ ### Changed — repository tooling
243
+
244
+ - **TypeScript moves from 4.8.4 to ^5.4.0 at the workspace root.** `three@0.121.0`
245
+ shipped its own `.d.ts` files, so `@types/three` was inert for this package;
246
+ r184 ships none, which puts `@types/three@0.184.0` into the compile for the
247
+ first time — and it uses `const` type parameters, which TypeScript 4.8 cannot
248
+ parse. Nine of the sixteen workspace packages were already on 5.9.3, and 5.9.3
249
+ was already in `yarn.lock`, so this resolves no new package.
250
+
251
+ ### Known issues
252
+
253
+ - **The draw-call instrument's accuracy marker does not flip.** The performance
254
+ instrument marks its draw-call reading `approximate` on a renderer whose
255
+ `info.render` has no whole-frame `drawCalls` field, and expected r184 to add
256
+ one. It does not: `WebGLInfo.render` in r184 exposes the same five fields as
257
+ r121 (`calls / frame / lines / points / triangles`). `drawCalls` belongs to
258
+ the *common* renderer's `Info`, which only the WebGPU path uses. The marker
259
+ will stay `approximate` until the engine renders through that renderer.
260
+
261
+ ### Fixed — `createNodeShaderLayer` custom layers were silently half-broken
262
+
263
+ Both bugs were invisible to the existing unit tests, which asserted CPU-side
264
+ state (the `Float32Array` contents, the dirty flag) and never the one thing that
265
+ decides what reaches the GPU. Found while building the multimedia docs examples
266
+ (`docs/content/examples/scenario-media-*`); see
267
+ the multimedia plan §8.
268
+
269
+ - **Non-dynamic per-node attributes never reached the GPU.** A `{ name, size,
270
+ value }` attribute declared without `dynamic: true` is refilled on membership
271
+ change only — and the refill wrote the CPU array without bumping the
272
+ attribute's `version`. `mount()` leaves `drawRange` at 0 and the layer's first
273
+ `frame()` lands after the engine's first render, so the buffer three had
274
+ already uploaded was the all-zero initial one, and it stayed that way for the
275
+ life of the layer. A per-node atlas-UV attribute therefore read `(0, 0)` on
276
+ every node and the layer drew fully transparent, with no error anywhere.
277
+ Layers whose attribute only *offsets* an animation (a per-node phase) looked
278
+ correct, which is why this survived. Covered by
279
+ `src/react/layers/__tests__/NodeShaderLayer.test.ts`
280
+ ("flags a non-dynamic attribute for upload after it is refilled", plus a
281
+ version assertion in the structural-swap test).
282
+ - **`hideBuiltinNode: true` did nothing.** `GraphStore.setNodeFillSuppressed()`
283
+ marked `nodeSuppressFill` dirty but did not bump the store version, and
284
+ `GPUNodeRenderer.update()` opens with `if (!versionChanged &&
285
+ !positionNeedsUpdate && !sharedDirtyFlags) return;` — so the flag sat unconsumed
286
+ until some unrelated write happened to bump the version. The built-in dot kept
287
+ drawing under the custom layer; with an opaque custom layer it is invisible,
288
+ with a ring or a hologram it is not. Covered by
289
+ `src/core/__tests__/suppressFill.test.ts`
290
+ ("bumps the store version so GPUNodeRenderer.update() does not early-return").
291
+
292
+ ### Added — media system components (images, video, audio on nodes)
293
+
294
+ - **`MediaLayer` / `createMediaLayer`.** Put pictures and live video on nodes
295
+ without writing a shader: describe the panel (`shape`, `fit`, `aspect`,
296
+ `radius`, `border`, `tint`, `effects`) and where the pixels come from
297
+ (`image(node)` per node, `video: { url, crop }` shared), and the layer
298
+ compiles the fragment program, packs the stills into one atlas texture
299
+ (single draw call), decodes the video **once** for however many nodes show
300
+ it, and registers a hitbox the size of the panel it drew. Covered by
301
+ `src/react/layers/__tests__/MediaLayer.test.tsx` and
302
+ `src/react/layers/__tests__/mediaShader.test.ts`.
303
+ - **`AudioSpectrumLayer` / `createAudioSpectrumLayer`.** Audio as a node
304
+ decoration: point it at an `<audio>`/`<video>` element, pick
305
+ `style: "ring" | "bars" | "pulse" | "wave"`, and every targeted node carries
306
+ a live spectrum. The analyser is pumped from the layer's `frame()` — no
307
+ timers, per `docs/no-timers-policy.md`. Covered by
308
+ `src/react/layers/__tests__/AudioSpectrumLayer.test.tsx`.
309
+ - **`MediaAtlas`, `MediaVideoSource`, `AudioSpectrum` / `createAudioSpectrum`.**
310
+ The pieces the two layers are built from, exported for callers who want the
311
+ texture but not the layer. `AudioSpectrum` exposes a `bins × 1` RGBA texture
312
+ plus `level` and `beat`, reuses one `MediaElementAudioSourceNode` per element
313
+ (a second `createMediaElementSource` throws), and degrades to an inert zeroed
314
+ texture where WebAudio does not exist. Covered by the two test files above.
315
+ - **`buildMediaFragment`, `mediaNeedsTime`, `buildSpectrumFragment`,
316
+ `videoTileFor`.** The pure code generators and crop math behind the two
317
+ layers, exported so a caller can inspect or extend the generated GLSL.
318
+ Covered by `mediaShader.test.ts` and `MediaLayer.test.tsx`.
319
+
320
+ ### Added — custom panel shapes
321
+
322
+ - **`MediaLayerSpec.shape` accepts every built-in node shape, and a function.**
323
+ Was `"rect" | "circle" | "squircle"`; now also `roundRect` `diamond`
324
+ `triangle` `hexagon` `star` `ring`, drawn through the engine's own
325
+ `kv_shapes.glsl` (`kvShapeSdf`) so a hexagon photo and a hexagon node dot are
326
+ the same outline, cross-checked against `core/shapes/reference.ts` by
327
+ `scripts/glsl-conformance.mjs`. Passing a **function** `(node, index) =>
328
+ ShapeName | number` shapes each node from a one-float attribute — still one
329
+ draw call. `rect`, `circle` and `squircle` stay inline, so a plain panel pulls
330
+ no shape code in at all. Covered by
331
+ `src/react/layers/__tests__/mediaShader.shapes.test.ts` and
332
+ `MediaLayer.test.tsx`.
333
+ - **`MediaLayerSpec.customSdf`.** A GLSL signed-distance expression in `vec2 q`
334
+ (panel space, y up, height 1, negative inside) for an outline the built-ins
335
+ do not cover. The one place a caller may hand-write GLSL, and deliberately one
336
+ expression rather than a program. Covered by `mediaShader.shapes.test.ts`.
337
+ - **`buildMediaHitMask`.** Generates the panel's picking mask from the same
338
+ outline code that drew it, so the two cannot drift. `MediaLayer` now always
339
+ uses it (`hitArea: "shape"`) instead of the old quad/circle approximation: a
340
+ click in a hexagon panel's corner, or in the empty band above a 16:9 panel on
341
+ its square billboard, falls through to whatever is behind. Covered by
342
+ `mediaShader.shapes.test.ts` and `MediaLayer.test.tsx`.
343
+
344
+ ### Added — node cards (a whole record drawn as the node)
345
+
346
+ - **`NodeCardLayer` / `createNodeCardLayer` / `NodeCardLayerRenderer`.** Draws a
347
+ card per node — accent header, photo, every property as a `label: value` row,
348
+ badges, footer, a rotated stamp — by rasterising it into a shared atlas and
349
+ drawing it as a clickable panel. One texture, one draw call, hundreds of
350
+ cards; it composites in the scene (edges run behind it, it dims with
351
+ focus/context, it is pickable over its outline). Takes the same panel
352
+ vocabulary as `MediaLayer` (`shape`, `customSdf`, `aspect`, `border`, `tint`,
353
+ `effects`, `sizeFactor`, `clickable`, `hideBuiltinNode`). Covered by
354
+ `src/react/layers/__tests__/NodeCardLayer.test.tsx`.
355
+ - **`NodeCardSpec` / `NodeCardField` / `NodeCardTheme` / `resolveNodeCardTheme`.**
356
+ The interface through which business meaning enters: the engine sees a title,
357
+ rows and a photo URL, never what they mean. The host's `card(node, index)`
358
+ callback is the whole mapping. Covered by
359
+ `src/react/layers/__tests__/paintNodeCard.test.ts`.
360
+ - **`NodeCardLayerSpec.paint`.** Escape hatch: draw the cell by hand on its 2D
361
+ context. The door for anything the card spec cannot express, including
362
+ rasterising real HTML via an SVG `foreignObject` image (inline the fonts and
363
+ images — remote ones do not load inside such an SVG). Covered by
364
+ `NodeCardLayer.test.tsx`.
365
+ - **`paintNodeCard` / `fitText`.** The pure painter and its text-truncation
366
+ helper, exported so a host can draw the same card somewhere else (a legend, a
367
+ tooltip, an export). Every measurement is a fraction of the card height, so
368
+ raising `resolution` makes the same card sharper rather than different.
369
+ Covered by `paintNodeCard.test.ts`.
370
+ - **`NodeCardCache` / `loadPhoto`.** The rasteriser: one cell per node, one
371
+ decode per photo URL however many cards show it, and no repaint when a card's
372
+ spec has not changed — which is what makes bumping `revision` on every data
373
+ edit cheap. Covered by
374
+ `src/react/layers/__tests__/NodeCardCache.test.ts`.
375
+
376
+ ### Added — HTML nodes (the DOM tier of the same idea)
377
+
378
+ - **`CardPlacement` gains `"center"`.** Puts a card ON its anchor instead of
379
+ beside it, and — unlike the side placements — is deliberately NOT clamped into
380
+ the viewport, so a card that *is* the node stays on the node when half of it
381
+ is off screen. `placement: "auto"` never resolves to it. Covered by
382
+ `src/react/layers/cards/__tests__/placement.test.ts`.
383
+ - **`CardItem.hideNode` / `cards.set({ hideNode })`.** Suppresses the built-in
384
+ dot under the card, so `{ placement: "center", hideNode: true }` makes the
385
+ card the node — an HTML node, with real links, inputs, scrolling and
386
+ selectable text. `CardLayer` owns exactly the ids it suppressed and releases
387
+ only those, so two features suppressing the same node do not clear each
388
+ other. Covered by `src/react/layers/cards/__tests__/CardLayer.test.tsx` and
389
+ `src/api/modules/__tests__/CardsApi.test.ts`.
390
+ - **`CardItem.scale` / `cards.set({ scale })`.** Card width in WORLD units, so
391
+ it zooms with the graph like a node does — the same `50 / viewDepth`
392
+ pixels-per-unit factor the node shader uses, clamped to `[0.08, 12]`. `0` (the
393
+ default) keeps today's fixed pixel size. Covered by `CardLayer.test.tsx`.
394
+ - **`cards.set({ template: "dossier" })` and the `DossierCard` preset.** The DOM
395
+ counterpart of `NodeCardLayer`: every property of a node with its photo,
396
+ header band, badges, stamp and footer, as styleable DOM. `imageKey`, `omit`,
397
+ `fields`, `title`, `badges`, `stamp` and `footer` say what to show and what to
398
+ call it; nothing in the preset knows what a dossier is about. Covered by
399
+ `src/react/layers/cards/__tests__/presets.test.tsx`.
400
+
401
+ ### Changed — click-dim is off by default, and never resizes a node
402
+
403
+ - **`clickDim` on `<GraphCanvas>` and `EmphasisApi`'s click-dim now default to
404
+ `false`.** They defaulted to `true`, so every host that only wanted clicks to
405
+ SELECT also got the whole graph fading out around the clicked node's 1-hop
406
+ neighborhood. A plain click now selects and nothing else in the scene moves.
407
+ Hosts that want the old behaviour pass `clickDim` (or call
408
+ `api.emphasis.setClickDimEnabled(true)`) — the feature itself is unchanged.
409
+ The `setClickDimEnabled` JSDoc already documented `false`; the code was what
410
+ disagreed. Covered by
411
+ `src/api/modules/__tests__/EmphasisApi.clickDim.test.ts`.
412
+ - **Click-dim passes `focusScale: 1`, so the kept set no longer grows.** It
413
+ inherited `FocusContextEffect`'s `1.3` default, which made every click pop
414
+ the clicked node and its neighbors 30% larger — the graph appeared to jump
415
+ under the cursor. The dim is now opacity only. `focusContext()` called
416
+ directly keeps the `1.3` default for callers who want the pop. Covered by
417
+ `EmphasisApi.clickDim.test.ts`.
418
+
419
+ ### Fixed — geometry that comes close to the camera no longer takes the frame
420
+
421
+ Animations in this engine move the SCENE, so a flight goes *through* the graph
422
+ rather than past it, and every pass brings nodes and edges within a fraction of
423
+ a unit of the camera. Two separate things went wrong there, and both of them
424
+ ended the same way: one shape covering the whole frame.
425
+
426
+ - **An edge with one end behind the camera drew a sheet across the screen.**
427
+ The edge strip is built in screen space — the shader divides by `clip.w` and
428
+ adds the widening offset in clip space — so a vertex behind the camera
429
+ (`clip.w < 0`) is mirrored through the origin by that divide, and the quad
430
+ joining it to its still-visible neighbour stretches over the entire viewport
431
+ as a flat field of the edge's colour. No width setting could affect it: the
432
+ width was right, the position was wrong. `edge.vert.glsl` now trims the
433
+ segment to the camera plane before anything is derived from its endpoints —
434
+ once per edge instance, so every vertex of the strip reaches the same
435
+ decision and the strip cannot tear, and before the control point and the
436
+ polyline are built, so a curved edge is rebuilt from the trimmed end. An edge
437
+ with *both* ends behind is left alone; the hardware clips those triangles.
438
+ Measured on the AML route-replay example flown at `distance: 26`, worst frame
439
+ of a 21-point scrub, share of the canvas covered by one colour: **40.5% → 2.5%**,
440
+ and total ink **57.2% → 5.7%**. Covered by
441
+ `src/shaders/__tests__/screenCap.shader.test.ts`.
442
+ - **A node or edge that stayed in front but came very close grew without
443
+ bound.** Outside map mode apparent size goes as `size × 50 / depth`: the node
444
+ quad was clamped at 4096 px (a screen-spanning disc) and the edge strip had
445
+ no upper bound at all. `kvScreenCap` in `kv_mapGrowth.glsl` now caps on-screen
446
+ size against a share of the smaller viewport dimension, reusing map mode's
447
+ soft knee — below half the cap it is the identity, so anything that was not
448
+ already blowing up renders exactly as before. Evaluated on the shipped GLSL,
449
+ 1200×800 viewport, a styled size-6 node: at depth 2 unchanged at 150 px; at
450
+ depth 0.2 **1500 px → 373 px**; at depth 0.05 **6000 px → 393 px**. Applied in
451
+ `node.vert.glsl` (the finished quad, selection and ripple/halo expansion
452
+ included), `picking.vert.glsl` (so the hitbox cannot outgrow the quad and
453
+ swallow every click in the frame), and `edge.vert.glsl` / `arrow.vert.glsl`
454
+ (endpoint pullback and cone, so they stay on the capped bubble). The strip
455
+ width gets an eighth of a node's share, because a capped bubble is a disc of
456
+ the cap while a capped strip is a band of it running the length of the frame:
457
+ at an equal share the bubble was tamed and the band still took a third of the
458
+ canvas.
459
+
460
+ - **What the cap costs: nothing measurable.** Frame time during playback of the
461
+ same flight, with the cap toggled at runtime inside one build and ordered
462
+ A/B/A so drift shows up as the two A windows disagreeing (1360×900 viewport,
463
+ SwiftShader, one 600-sample frame-time ring per window): cap on
464
+ **1.52 ms** mean / 4.20 ms p95, cap off **1.36 ms** / 4.20 ms, cap on again
465
+ **1.14 ms** / 3.30 ms. The spread between two identical configurations is
466
+ wider than the gap between on and off, which is what two compares and a
467
+ divide per vertex ought to look like. What it buys across those same windows:
468
+ worst-frame largest single colour **3.0% → 1.4%** of the canvas and total ink
469
+ **8.4% → 2.9%**, with both cap-on windows landing on the same figure. Raw
470
+ the recorded near-camera A/B/A flight readings.
471
+ Two traps for whoever measures this next, both of which produced a false
472
+ reading first: the engine only redraws on dirty since U9, so a static scene
473
+ stops producing frames and the ring goes stale (the numbers must be taken
474
+ during an animation), and `totalObserved` is cumulative across windows, so it
475
+ is not a per-window frame count and must not be read as a frame rate. The
476
+ near-plane trim has no runtime toggle, so it is present in all three windows;
477
+ its own effect is the scrub measurement above.
478
+
479
+ ### Added — `api.renderer.setMaxScreenFraction` / `getMaxScreenFraction`
480
+
481
+ - **The near-camera size cap is a knob.** `setMaxScreenFraction(0.5)` is the
482
+ default and means one node's diameter never covers more than half the smaller
483
+ viewport dimension; `Infinity` switches the cap off and restores the pre-cap
484
+ behaviour exactly (the shader sentinel is `-1.0`, the convention
485
+ `mapMaxGrowth` already uses). Values `<= 0` warn and fall back. The value
486
+ fans out to the node renderer, the edge + arrow materials and the node
487
+ picking material, and `wireMaxScreenFraction` replays the current value on
488
+ wire so the uniforms agree with the api on the first frame. Badge and tag are
489
+ deliberately not capped — their pixel offsets scale with depth but not with
490
+ node size, so there is no fraction they could apply that would match, and at
491
+ the range the cap engages a badge's offset has already left the screen.
492
+ Covered by `src/api/__tests__/RendererApi.maxScreenFraction.test.ts`,
493
+ `src/backends/gpu/__tests__/screenCapUniform.test.tsx` and
494
+ `src/shaders/__tests__/screenCap.shader.test.ts`.
495
+
496
+ ### Added — `api.renderer.setNodeSizeScale` / `getNodeSizeScale`
497
+
498
+ - **The global node size multiplier is a knob.** Reported as "节点现在很小" of
499
+ the cinematics examples. Outside map mode a node's apparent size is
500
+ `size × scale × 50 / depth` (`node.vert.glsl`), so **depth 50 is the reference**
501
+ where a node draws at exactly its configured size in CSS px. The shots fly at
502
+ a `distance` of 280–420 — 5.6× to 8.4× that reference — so a 15 px node
503
+ arrives 2–3 px wide and a route that reads in the overview reads as dust in
504
+ flight. `setNodeSizeScale(distance / 50)` buys it back; `1` is the default.
505
+ Values `<= 0` or non-finite warn and fall back to `1`, and `Infinity` is
506
+ rejected here rather than passed through (it is the "no cap" sentinel on
507
+ `setMaxScreenFraction`, but NaN-sized geometry on this one).
508
+
509
+ Measured on the AML example at a fixed camera pose, by horizontal runs of
510
+ non-background pixels at full canvas resolution (a node blob makes a run about
511
+ its diameter wide), with `effectiveSizes[0]` read off the store:
512
+
513
+ | scale | `effectiveSizes[0]` | node run p90 | p99 | max |
514
+ |---|---|---|---|---|
515
+ | 1 (before) | 22.5 | 7 px | 9 px | 9 px |
516
+ | 6 (`300 / 50`) | 135 | 27 px | 29 px | 33 px |
517
+ | 12 | 270 | 57 px | 59 px | 64 px |
518
+
519
+ - **It lives on `RendererApi`, not `StyleApi`, because it must not be undoable.**
520
+ `StyleApi.setDefaultNodeSize` goes through `SetDefaultNodeSizeCommand` and is
521
+ recorded in history; a flight that raised the scale on take-off and restored
522
+ it on landing would leave two entries on the undo stack per flight, and an
523
+ undo of a graph edit made before the flight would have to walk back through
524
+ them first. `RendererApi` already documents its knobs as non-undoable UI
525
+ state, and `maxScreenFraction` — the other global render parameter the
526
+ flights need — is the same shape, down to the late-bound sink.
527
+
528
+ - **One store write, five consumers.** The value is folded into
529
+ `GraphStore.effectiveSizes` (`sizes[i] × scale × NODE_CAPTION_FACTOR`); the
530
+ shader-side `nodeSizeScale` uniform stays pinned at 1.0 as before. The node
531
+ geometry aliases that array zero-copy, the picker shares the node attribute,
532
+ and the edge renderer packs from it, so the quad, the hitbox, the edge
533
+ endpoint, the arrow back-off, self-loop radii and label sizing all move
534
+ together. `setMaxScreenFraction` still applies on top, so a large scale cannot
535
+ let one node take the frame during a close pass. `wireNodeSizeScale` replays
536
+ the current value on wire (same contract as `wireMaxScreenFraction`), and
537
+ GraphContext pushes the `node={{ nodeScale }}` prop into the api *before*
538
+ wiring so one mount yields exactly one downstream push — the prop's value, not
539
+ the default on top of it.
540
+
541
+ - **`DEFAULT_NODE_SIZE_SCALE`** (new, `src/core/nodeSizeScale.ts`, not exported
542
+ from the package) is now the single source of the `1.0` that
543
+ `GraphStore._globalNodeSizeScale` and the api both start at; they used to
544
+ repeat the literal, and a drift would make `getNodeSizeScale()` misreport the
545
+ picture until the first write.
546
+
547
+ Covered by `src/api/__tests__/RendererApi.nodeSizeScale.test.ts` (the api
548
+ edge, the validation, the replay, and what the scale does to the sizes every
549
+ renderer reads) and
550
+ `src/backends/gpu/__tests__/nodeSizeScaleLockstep.test.tsx` (the quad, the
551
+ edge endpoints and the pick hitbox, each through its own mechanism). Four
552
+ mutations were applied to each file to confirm the assertions bite: removing
553
+ the validation guard (7 failures), dropping the replay (3), not calling the
554
+ sink (3), drifting the default (4), no-oping the edge setter (2), skipping the
555
+ edge repack (1), and dropping the scale from `effectiveSizes` (3).
556
+
557
+ - **What the bigger nodes cost.** Six times the diameter is up to 36 times the
558
+ fragments, so the scale is not free. Measured on `scenario-subject-expansion`
559
+ during the same walk, flipping only the scale, from the engine's own
560
+ `frame-time` channel (`__kinevizPerf`, the channel `gl-perf-bench` reads) plus
561
+ raw `requestAnimationFrame` deltas:
562
+
563
+ | scale | engine frame-time mean | p95 | rAF p50 | rAF p95 |
564
+ |---|---|---|---|---|
565
+ | 1 | 3.24 ms | 4.7 ms | 16.7 ms | 16.8 ms |
566
+ | 6 | 5.0–5.3 ms | 6.4–9.2 ms | 16.7 ms | 50–67 ms |
567
+
568
+ Read that with the caveat that the harness is headless SwiftShader — a CPU
569
+ rasteriser pays full price for fill rate, where a GPU mostly does not — so
570
+ treat it as an upper bound and as a reason the scale is a knob per example
571
+ (`FLY_DISTANCE / 50`, one constant) rather than something the engine applies
572
+ on its own. The write itself is one `O(nodes)` pass over `effectiveSizes` per
573
+ gesture, outside the render loop.
574
+
575
+ - **The four cinematics examples use it.** `scenario-cinematic-flythrough`
576
+ (420 → 8.4), `scenario-aml-route-replay` (300 → 6),
577
+ `scenario-subject-expansion` (300 → 6) and
578
+ `scenario-network-topology-sweep` (280 → 5.6) each derive the scale from the
579
+ shot's own `distance`, as `FLY_DISTANCE / 50`. A flight raises the scale and
580
+ **leaves it raised** — a shot ends where it stops, so restoring on landing
581
+ would shrink the final frame back to dust — while a frame puts it back to `1`,
582
+ because a frame pulls in only as far as its nodes need and a raised scale
583
+ there would hit the near-camera cap with one node across half the screen. The
584
+ AML example never lands (the timeline owns the camera for the rest of the
585
+ session), so it sets the scale once at cue. Verified in the browser on all
586
+ four: the store reports the expected scale, node runs in flight are p99
587
+ 13–35 px against 2–9 px before, and no console or page errors.
588
+
589
+ ### Fixed — a path flight no longer lurches between waypoints
590
+
591
+ Reported as "跳跃感很强" — the flights jumped. Two causes, both measured on a
592
+ 9-waypoint route with the uneven spacing a graph layout always produces.
593
+
594
+ - **The curve swung wide of the short hops.** `pathShot` built its Catmull-Rom
595
+ with uniform parameterisation, which overshoots when the waypoints are not
596
+ evenly spaced: a hop whose endpoints were 30 units apart had an arc length of
597
+ **70** — the camera travelled 2.3× the hop, out and back, which is exactly
598
+ what a lurch is. Worse, it inverted the speeds: that 30-unit hop given 500 ms
599
+ moved at 2.3 units/frame while a 254-unit hop given 3400 ms moved at 1.2, so
600
+ the short hops outran the long ones. The default is now `"centripetal"`
601
+ (Lee 1989), the standard cure, which keeps cusps and self-intersections out
602
+ of the path: every segment's arc length drops to **1.0×** its hop, and the
603
+ worst speed step between consecutive frames falls from **0.9 to 0.3 units**.
604
+ `PathShotOptions.curveType` is new and takes `"centripetal" | "chordal" |
605
+ "catmullrom"`, so the old uniform curve is still one option away.
606
+ - **Within a leg, the easing was applied to the curve parameter rather than to
607
+ distance.** `easeInOut` shaped how fast `u` advanced, and how much ground a
608
+ given `u` covers is up to the curve, so the intended ease-in/ease-out came
609
+ out as a speed spread of **3.67×** and **4.16×** on the two long legs of that
610
+ route. The leg now interpolates along an arc-length table and maps back to a
611
+ parameter, so the camera spends `easeInOut(q)` of the segment's LENGTH at
612
+ fraction `q` of the leg's time, and the spread is **1.92×** — the easing
613
+ itself, nothing more. The table is 600 samples built once per shot.
614
+
615
+ Covered by `src/cinematics/__tests__/shots.test.ts`. Both changes alter the
616
+ path a flight takes, so a host that pinned a screenshot of a flight will see it
617
+ move; the schedule (`duration`, `marks`, when each waypoint is reached) is
618
+ unchanged.
619
+
620
+ ### Fixed — a flight no longer rolls the graph over, so it reads as a camera move
621
+
622
+ Reported as "画布旋转感觉在跳跃,看着会头晕" — the canvas felt like it was
623
+ spinning rather than the camera moving, and watching it was nauseating. The
624
+ engine's camera genuinely never moves (`cloudScene` is what pans, zooms and
625
+ turns), but that is an implementation detail: the transform `CameraDirector`
626
+ applies is already the exact inverse of a camera orbit about the focus, so a
627
+ flight *should* be indistinguishable from one. Three defects in the orientation
628
+ were what gave it away. Measured on the AML route example with
629
+ `heading: "chase"`:
630
+
631
+ | | before | after |
632
+ | --- | --- | --- |
633
+ | worst roll off level | **161.5°** | 13.3° (the bank it asked for) |
634
+ | worst roll change in one frame | 5.76° (346°/s) | 0.57° |
635
+ | worst total turn in one frame | 5.80° | 2.54° |
636
+ | roll with `bank: 0` | 161.4° | **exactly 0** |
637
+
638
+ - **`headingQuaternion` had no up vector.** It built the orientation with
639
+ `setFromUnitVectors(dir, viewAxis)`, which is the MINIMAL rotation carrying
640
+ `dir` onto the view axis: it turns about `dir × viewAxis`, and nothing
641
+ anywhere constrained the roll. The camera ended up rolled by however the path
642
+ happened to lie in space — the graph went very nearly upside down partway
643
+ through the flight — and near `dir ≈ +Z` the function falls back to an
644
+ arbitrary perpendicular axis, so the roll did not merely drift, it snapped.
645
+ Rolling the view is the single most reliable way to make a viewer
646
+ motion-sick, which is exactly what was reported. The orientation is now built
647
+ as a camera basis (forward, up, right), levelled against `baseOrientation`'s
648
+ up rather than the world's so a shot that starts from a tilted view stays in
649
+ that frame. Yaw and pitch do as they are told; roll belongs to `bank` alone.
650
+ - **`bank` took its direction from a step function.** The lean was
651
+ `bank × magnitude × Math.sign(_b.x - _a.x)` — the sign of a world-axis
652
+ difference — so it inverted the full lean in a single frame whenever that
653
+ difference crossed zero, a `2 × bank` snap. It now rotates the bend vector
654
+ into the camera's own frame and reads the lean off its screen-x directly, so
655
+ the camera leans into whichever side of the frame the bend is on, by however
656
+ far off to that side it is, continuously through zero.
657
+ - **The curvature window was clamped instead of shrunk.** `max(0, u - 0.02)`
658
+ and `min(1, u + 0.02)` collapse one chord while the other keeps its length
659
+ near the ends of the curve, so both the size and the direction of the lean
660
+ came out of that asymmetry rather than out of the path — the worst roll of
661
+ the entire flight sat in the opening half-second. The window is now
662
+ symmetric (`h = min(0.02, u, 1 - u)`), which takes the lean smoothly to zero
663
+ at both ends: 3.42° in one frame down to 0.65°.
664
+
665
+ `heading: "lead"` improves by the same mechanism: worst turn per frame 4.88° to
666
+ 1.03°, and 0.4% of frames now exceed 60°/s against 4.3% for `chase`. What
667
+ remains on `chase` is a real camera move at a real corner — the route's last hop
668
+ doubles back on itself — and the yaw rate over the whole flight is a median of
669
+ 9°/s with a 90th percentile of 43°/s.
670
+
671
+ `headingQuaternion` is exported, so a host calling it directly gets the levelled
672
+ result. Covered by `src/cinematics/__tests__/shots.test.ts` (the
673
+ `headingQuaternion` block and `pathShot — the horizon, over a whole flight`);
674
+ each of the three fixes is independently killed by those tests.
675
+
676
+ ### Changed — a path flight glides through its waypoints instead of stopping on each one
677
+
678
+ Reported as "没有科技感" alongside the lurch above, and measured first: on the
679
+ AML route example (8 waypoints, legs 500–3400 ms), a flight was **fully
680
+ stationary for 34% of its frames** — 427 of 1243 at 60 fps, across 8 separate
681
+ stalls — and `warp` was exactly 0 for the same share. `WarpTunnelLayer` reads
682
+ `warp`, so the speed streaks switched off at every node rather than sustaining.
683
+ Both numbers came straight from the design: `dwell` held the camera exactly on
684
+ the waypoint, and `warp` published `sin(π × legProgress)`, which is 0 at both
685
+ ends of every leg by construction.
686
+
687
+ This reverses a decision that was deliberate and is recorded in its own test —
688
+ "the hold is what makes a path readable: it lands on the node, not near it". It
689
+ was a product call, and it was made: glide is now the default, and the old hold
690
+ is `glide: 0`.
691
+
692
+ - **`PathShotOptions.glide`** (`0..1`, default `1`). At `1` the camera slows to
693
+ about a fifth of the cruise on each side of the node — the incoming leg sets
694
+ how it arrives and the outgoing one how it leaves — passes exactly through
695
+ the node at the middle of its `marks` window, and accelerates away. At `0` it comes to
696
+ a dead stop and holds, as before.
697
+ - **The schedule does not move.** `duration` and `marks` are byte-identical at
698
+ either setting, and the node still sits at the centre of its window, so
699
+ anything hung off a mark — a card, a ripple, a scrub cursor, the AML
700
+ example's case-time mapping — needs no adjusting. Only where the camera is
701
+ *during* a window changes.
702
+ - **How.** The legs no longer ease one at a time; easing a leg inside its own
703
+ window is what forces the speed to zero at both of its ends. The whole
704
+ flight's "time → arc length" is fitted as one monotone cubic Hermite
705
+ (Fritsch–Carlson 1980) through the leg boundaries, so speed is continuous
706
+ everywhere by construction and the monotone limiter rules out an overshoot in
707
+ the distance axis — which would mean flying backwards.
708
+ - **`warp` now reports speed**, normalised against the fastest the flight ever
709
+ goes, with a square-root shaping because a data-paced route spreads its
710
+ per-leg cruise over 6.4× (that route: 0.096 to 0.618 units/ms) and a linear
711
+ map leaves every slow leg looking like a standstill.
712
+
713
+ Measured on the same route, `glide: 0` against the default:
714
+
715
+ | | hold | glide |
716
+ | --- | --- | --- |
717
+ | static frames | 427 / 1243 (34%), 8 stalls | 53 / 1243 (4%), 2 |
718
+ | frames with `warp == 0` | 434 (35%) | 55 (4%) |
719
+ | worst frame-to-frame speed step | 1.93 units | 0.55 units |
720
+ | lowest `warp` in flight (peak 0.5) | 0.000 | 0.080 |
721
+
722
+ Confirmed in the browser rather than only against the sampler, by hashing the
723
+ rendered canvas every frame through the example's own 22-second flight: the
724
+ picture stopped changing for **104 of 478 frames across 7 separate stalls**
725
+ with the hold, against **55 of 492 in 2** — and those 2 are the opening and
726
+ closing rest. (The share is lower than the sampler's because the warp tunnel
727
+ and the money-as-traffic parcels keep some pixels moving even while the camera
728
+ is parked, which is exactly why the stall count is the number that matters.)
729
+
730
+ The 4% that remains is the half-dwell of rest the flight deliberately opens and
731
+ closes on, which is also the only reason `warp` reaches 0 at all: between
732
+ leaving the first node and landing on the last it never drops below 0.080 of
733
+ its 0.5 peak, and at the interior waypoints it sits between 0.107 and 0.194.
734
+
735
+ One case does not improve: give every leg the same time regardless of its
736
+ length and the change of speed gets squeezed into the dwell rather than spread
737
+ over the leg, so glide buys nothing there — measured at 1.03× the old worst
738
+ speed step on a fixture whose hops are 400 and 30 units with 2000 ms each. It
739
+ is pinned at "must not cost anything" rather than claimed as a win.
740
+
741
+ Cost: 2.7 µs per sampled frame (0.02% of a 16.7 ms budget) and 0.37 ms to build
742
+ a flight, both measured on that route. Covered by
743
+ `src/cinematics/__tests__/shots.test.ts`; the three tests that asserted the
744
+ hold now sit in a `glide: 0` block, with the reversal recorded where they were.
745
+
746
+ ### Added — cinematics (camera choreography, sci-fi layers, flyable layouts)
747
+
748
+ Animation aimed at reading data in 3-D, not at decoration: the engine's camera
749
+ never moves, so all of this is layers and pure functions over the public
750
+ extension points. Nothing in engine core changed.
751
+
752
+ - **`createCinematics(api)`** returns `flyPath` / `cuePath` / `orbit` /
753
+ `warpTo` / `establish` / `frame` / `stop`, each a promise that resolves
754
+ when the move lands, plus `warp` (0..1) and `playing`. It is the only piece
755
+ that knows node ids exist: it resolves ids to points and hands the shots
756
+ nothing but geometry, so every shot stays business-free. Unknown ids are
757
+ dropped and an empty target resolves immediately instead of hanging. Covered
758
+ by `src/cinematics/__tests__/createCinematics.test.ts`.
759
+ - **`FlyPathOptions.onWaypoint(hit)`** fires when a flight arrives at a node,
760
+ with `{ index, nodeId, point, at, leaves }` — and with `null` when it is
761
+ scrubbed back before the first arrival. It is what makes a flight an analysis
762
+ tool rather than a fly-over: the card, the highlight and the ripple for a node
763
+ hang off the flight's own clock instead of a second timer that has to be kept
764
+ in step with the leg lengths by hand. Covered by
765
+ `src/cinematics/__tests__/createCinematics.test.ts`,
766
+ `src/cinematics/__tests__/CameraDirector.test.ts`.
767
+ - **`cuePath(target, opts)` → `CuedFlight`** installs a flight the host drives:
768
+ `scrub(ms)` / `scrubFraction(t)` / `release()` / `cancel()`, plus `duration`.
769
+ An analyst has one clock and it is the clock in the data, so this is the piece
770
+ that makes a timeline cursor and a camera the same gesture —
771
+ `timeline.onCursorChange(t => flight.scrubFraction(t))`. Nothing is written
772
+ until the first scrub, scrubbing is idempotent and runs backwards, and
773
+ `onWaypoint` fires on a change of which waypoint is current rather than on a
774
+ crossing, so dragging back and forth never double-reports an arrival.
775
+ Returns `null` when the target resolves to nothing. Covered by
776
+ `src/cinematics/__tests__/createCinematics.test.ts`.
777
+ - **`CameraDirector` / `createCameraDirector()`** — a `LayerRenderer` that
778
+ draws nothing and owns the view instead. It sets
779
+ `cloudScene.position = −(R·S·focus) + (0, 0, cameraZ − distance)` each frame,
780
+ which is the fixed point of the engine's own `computeFlyToTarget`, so
781
+ applying it repeatedly is idempotent and a shot can be scrubbed, re-sampled
782
+ or interrupted without drift. `captureStart()` round-trips the live view back
783
+ into a `ShotStart`. **It moves the scene and nothing else**: the camera is
784
+ the host's — map mode captures and restores it, `setViewState` writes its z —
785
+ so the director never touches it. `CameraDirectorConfig.allowLens` (default
786
+ `false`) exists only for `dollyZoomShot`, the one shot that provably cannot
787
+ be done with the scene transform. `cue` / `scrub` / `scrubFraction` /
788
+ `release` hand the clock to the host, `cued` and `duration` report that
789
+ state, and `CameraDirectorConfig.onMark` publishes arrivals. Covered by
790
+ `src/cinematics/__tests__/CameraDirector.test.ts`.
791
+ - **Shots are pure sampled functions of elapsed ms**: `pathShot` (Catmull-Rom
792
+ through the hops, with a dwell at each one, optional bank roll and
793
+ `heading: "keep" | "lead" | "chase"`), `orbitShot`, `warpShot` (recoil / run
794
+ / land, publishing `warp` for the streaks), `establishShot` and `frameShot`,
795
+ plus `dollyZoomShot` — which is **not** on the `createCinematics` surface,
796
+ because it is the one shot that needs the lens — plus `boundingSphere`,
797
+ `fitDistance`, `headingQuaternion`, `markAt` and the easings. `duration` and
798
+ `sample(ms, out)` are the whole contract, so a host can write its own shot
799
+ and hand it to `director.play()`. A shot may also publish
800
+ `marks: ShotMark[]` — the points it stops at and when — which is how
801
+ "arrived at waypoint" reaches a caller without a shot ever calling a
802
+ callback, and therefore without giving up purity.
803
+ `PathShotOptions.baseOrientation` is the view a lean is measured from, and is
804
+ required for that purity: slerping from the frame's own previous orientation
805
+ made `heading: "lead"` creep all the way round to a full chase over a few
806
+ frames, and made the same millisecond answer differently depending on how it
807
+ was reached. Covered by `src/cinematics/__tests__/shots.test.ts`.
808
+ - **`PathShotOptions.dwell` and `.travel` accept a per-leg function**, not just
809
+ a number: `travel: (i) => gapMs[i]` is asked for each segment with the index
810
+ of the waypoint it leaves, and `dwell: (i) => …` for each waypoint. This is
811
+ what lets a flight's time axis BE the data's — give each segment the gap
812
+ between the two events it joins and the camera paces itself the way the data
813
+ did, so a burst of transfers reads as a burst and an overnight wait reads as
814
+ a wait. A single number still spaces the hops evenly, which looks smoother
815
+ and says nothing. The floors are unchanged (dwell ≥ 0, travel ≥ 1) and are
816
+ applied to the function's result too, so a per-leg gap of 0 cannot produce a
817
+ zero-length segment and divide by it. Covered by
818
+ `src/cinematics/__tests__/shots.test.ts`.
819
+ - **`<ScanPlaneLayer>` / `createScanPlaneLayer`** — a lit sheet sweeps one axis
820
+ and the nodes it crosses glow (Gaussian slab, so they brighten and fade
821
+ rather than pop). The reason it is an analysis tool and not an effect: a 3-D
822
+ graph projected to a screen hides its own depth, and lighting one slab at a
823
+ time is the cheapest way to read it. `mode: "hold"` parks the sheet so a
824
+ slider can drive it, and `onSlice(nodeIds, position)` reports what is in the
825
+ slab (throttled, change-detected) for a side panel to list. The glow is a
826
+ `createNodeShaderLayer` sublayer — one draw call for any number of nodes.
827
+ Covered by `src/react/layers/__tests__/ScanPlaneLayer.test.ts`.
828
+ - **`<RadarSweepLayer>` / `createRadarSweepLayer`** — a beam sweeps out from a
829
+ node, a point, or the middle of the graph; each node flashes on contact and
830
+ decays with how long ago the beam passed, so one revolution orders a whole
831
+ neighbourhood by bearing and the range rings put a scale on distance.
832
+ `onSweep(nodeIds)` fires once per revolution in bearing order. Covered by
833
+ `src/react/layers/__tests__/RadarSweepLayer.test.ts`.
834
+ - **`<WarpTunnelLayer>` / `createWarpTunnelLayer`** — the streak overlay that
835
+ makes a long jump read as travel instead of a cut, so the viewer keeps their
836
+ bearings. It is a clip-space quad (the vertex shader writes `gl_Position`
837
+ straight from the vertex, ignoring the model and view matrices), which is why
838
+ it stays nailed to the screen while the director moves `cloudScene`
839
+ underneath. `intensity` is a callback read every frame — point it at
840
+ `cine.warp` and the streaks cannot drift out of step with the flight — and at
841
+ zero the layer goes dormant and stops asking for frames. Covered by
842
+ `src/react/layers/__tests__/WarpTunnelLayer.test.ts`.
843
+ - **`helixLayout` / `shellLayout` / `registerCinematicLayouts(api)`** — two
844
+ pure layouts registered as `"gl:helix"` and `"gl:shells"`. The helix puts an
845
+ ordered sequence on a tube along the view axis, which is compact on screen,
846
+ strictly ordered, and can be flown down the middle of; `strands: 2` is the
847
+ DNA look. Shells make radius equal hop distance from a root (Fibonacci
848
+ sphere per shell, so no pole bunching), which turns "how far is this from
849
+ that" into something read at a glance for the whole graph at once. The one
850
+ business decision — what order the nodes go in — is a caller callback.
851
+ Covered by `src/layout/__tests__/cinematic.test.ts`.
852
+
853
+ ### Added — clickable custom layers
854
+
855
+ - **`NodeShaderLayerSpec.hitArea`** (`"none" | "quad" | "circle" | "shape"`,
856
+ default `"none"`) and **`NodeShaderLayerSpec.hitMask`**. The engine's picking pass only rasterises the built-in node quad,
857
+ sized from `nodeSize * nodeSizeScale`; a custom layer drawing at
858
+ `sizeFactor: 10` was therefore clickable only on a small patch at the node
859
+ centre. With `hitArea` set, the layer registers a second mesh in the engine's
860
+ node picking scene **sharing its own geometry**, so the hitbox is exactly the
861
+ quad it drew and clicks resolve to the same `NodePickResult` a built-in node
862
+ click produces (selection, hover, context menu and drag follow with no extra
863
+ wiring). The node display geometry and the picking shaders are untouched.
864
+ `hitArea: "shape"` takes a generated `hitMask` (`{ prelude?, sdf }`, a GLSL
865
+ signed-distance expression in `vec2 q`) so the hitbox is the OUTLINE the layer
866
+ drew rather than its bounding quad; only the varyings the mask names are
867
+ forwarded into the pick program, matched on word boundaries so a helper called
868
+ `kvPanelSd` cannot drag attribute `panel` in with it. Covered by
869
+ `src/react/layers/__tests__/NodeShaderLayer.hitArea.test.ts`.
870
+ - **`LayerContext.getHitTest` and the `LayerHitTest` type.** The picking
871
+ surface a layer needs: `encodeNodeId`, `addNodeHitMesh`, `removeNodeHitMesh`.
872
+ Read it lazily — it is a thunk because the picker is created by the
873
+ renderer-init effect and a layer can mount in the same commit. Optional on
874
+ `LayerContext` and on `EngineLayerHost`, so an embedder can host layers with
875
+ no interaction at all. Covered by
876
+ `src/react/layers/__tests__/EngineLayerHost.test.ts`.
877
+ - **`Picker.addNodeHitMesh` / `removeNodeHitMesh` / `encodeNodeId`.** The engine
878
+ side of the above. Registered meshes are transform-synced with `cloudScene`
879
+ on every pick (they are not children of it) and are detached — never
880
+ disposed — when the picker is disposed. Covered by
881
+ `src/interaction/__tests__/Picker.layerHitMesh.test.tsx`.
882
+
883
+ ### Added — WebGPU render path switch (U3 dual-path-foundation)
884
+
885
+ - **`GraphRendererProps.enableWebGPURenderPath?: boolean`** (default `false`).
886
+ Setting it to `true` (or flipping the imperative switch below) already requests
887
+ a WebGPU adapter (`powerPreference: "high-performance"`) and device and holds
888
+ it, even though nothing renders on it yet in this release; `true` only means
889
+ "host allows it" — the path also needs a capable/available device and no prior
890
+ fault before anything can use it. Setting it back to `false` is a switch, not a
891
+ fallback, and never triggers `renderFault`. The underlying wiring (`initDualPath`)
892
+ is covered by `src/react/graph-context/__tests__/initDualPath.test.ts`; the
893
+ prop reaching `RendererApi` through `GraphContext`, and the foundation
894
+ surviving an ordinary renderer-rebuilding prop change (SEC-16), are covered
895
+ by `src/react/graph-context/__tests__/GraphCanvas.renderPath.test.tsx`.
896
+ - **`forceLayout`'s WebGPU engine now gets its `GPUDevice` from the same shared
897
+ device owner as the render path.** `GraphContext.tsx` passes
898
+ `device: foundation.shared.ensureDevice("layout")` to
899
+ `WebGPUForceLayoutController`, instead of the controller acquiring its own.
900
+ Consequence for hosts: a GPU device loss during layout now emits `renderFault`
901
+ (`faultKind: "device-lost"`, `causedFallback: false` when the render path was
902
+ already WebGL) and permanently disables the WebGPU render path for that engine
903
+ instance — even for hosts that never set `enableWebGPURenderPath`. Previously
904
+ that loss was silent. Covered by
905
+ `src/react/graph-context/__tests__/initDualPath.test.ts`.
906
+ - **`RendererApi.setWebGPURenderPathEnabled(enabled: boolean): void`** and
907
+ **`RendererApi.isWebGPURenderPathEnabled(): boolean`** — the imperative
908
+ equivalent of `enableWebGPURenderPath` (same switch, last writer wins).
909
+ Inert (no-op / `false`) until the engine wires the renderer post-mount.
910
+ Covered by `src/api/__tests__/RendererApi.renderPath.test.ts` (unit) and
911
+ `src/react/graph-context/__tests__/GraphCanvas.renderPath.test.tsx` (wired
912
+ through a real mount).
913
+ - **`renderFault` event.** Payload `HostFaultReport` has exactly six keys:
914
+ `reportId`, `faultKind`, `sanitizedReason`, `occurredAt`, `resultingPathId`,
915
+ `causedFallback`. `faultKind` ∈ `"device-lost" | "shader-compile-failed"` and is the
916
+ stable de-duplication key. One event per adjudicated fault; the fallback to WebGL has
917
+ already happened when the event fires, and it is permanent for the lifetime of the
918
+ engine instance. The payload never contains browser-provided text. Covered by
919
+ `src/api/__tests__/HostFaultChannel.test.ts`, `src/backends/__tests__/RenderPathSelector.test.ts`.
920
+ - **WebGPU capability probe is `navigator.gpu` presence (pending confirmation, D-26).**
921
+ three's `WebGPU.isAvailable()` helper is not used because it has a top-level `await`
922
+ that breaks the CJS/UMD builds and requests an adapter at import time.
923
+
924
+ In U3 these additions only wired the switch through to a foundation that did
925
+ not yet select anything; the section below (U4) makes the selection live.
926
+
927
+ ### Changed — the render loop is now driven by `RenderRuntime`, and the WebGPU path paints (U4 render-orchestrator)
928
+
929
+ - **`enableWebGPURenderPath` now hands painting to three's `WebGPURenderer`.**
930
+ Once the host allows the path (prop, imperative switch, or the internal debug
931
+ flag), the engine lazily loads `three/webgpu`, builds a `WebGPURenderer` on the
932
+ *shared* `GPUDevice` (the same one the WebGPU force layout uses), waits for
933
+ `init()`, and — only if three really ended up on its WebGPU backend — switches
934
+ painting to it at the next frame boundary. That renderer draws into a second
935
+ canvas stacked over the WebGL one (`pointer-events: none`, so mouse handling
936
+ stays on the WebGL canvas). **In this release the WebGPU canvas shows only the
937
+ clear colour**: no node/edge/label primitive has a WebGPU implementation yet
938
+ (they arrive with the shader and layer equivalence units). Picking, hover,
939
+ drag and the minimap keep working against the WebGL scene underneath. Setting
940
+ the switch back to `false` returns to WebGL at the next frame; the WebGPU
941
+ renderer is kept for an instant re-enable. Covered by
942
+ `src/__tests__/RenderRuntime.loop.test.ts` (path decision, visibility, perf
943
+ hand-over), `src/backends/webgpu/__tests__/WebGPUPaintTarget.test.tsx`
944
+ (renderer lifecycle) and `src/react/graph-context/__tests__/GraphCanvas.renderPath.test.tsx`
945
+ (mounted).
946
+ - **`init()` failures are silent by design.** If `three/webgpu` cannot load, the
947
+ device cannot be obtained, `WebGPURenderer.init()` rejects, or three falls back
948
+ to its WebGL2 backend, the engine stays on WebGL without emitting
949
+ `renderFault` — those are environment conditions, not runtime faults; only
950
+ `device-lost` and `shader-compile-failed` are faults. After a fault the WebGPU
951
+ renderer is disposed and never rebuilt for that engine instance. Covered by
952
+ `src/backends/webgpu/__tests__/WebGPUPaintTarget.test.tsx` (every arm: module
953
+ load rejection, device rejection, `init()` rejection, three's WebGL2-backend
954
+ fallback, and `retire()` from each of those states).
955
+ - **`GraphContextValue.renderBackend` is now a live getter** (it was a snapshot
956
+ taken at mount). Read it at use time; do not cache it. It follows the active
957
+ path only once that path's backend reports `supportsPrimitives` (WebGPU: not
958
+ yet), so it is still the WebGL factory in this release. New
959
+ **`GraphContextValue.activeRenderPathId: "webgl" | "webgpu"`** (live getter)
960
+ reports the path that actually PAINTED the last frame — `RenderRuntime`'s
961
+ frame-stable answer, the same value `__kinevizPerf.read().activePathId`
962
+ publishes, not the selector's opinion (which can flip a microtask ahead of
963
+ the frame boundary that acts on it). New
964
+ **`RenderBackend.supportsPrimitives: boolean`**. Covered by
965
+ `src/backends/__tests__/createRenderBackend.test.tsx`,
966
+ `src/react/graph-context/__tests__/initDualPath.test.ts`,
967
+ `src/react/graph-context/__tests__/GraphCanvas.renderPath.test.tsx`.
968
+ - **`__kinevizPerf.read()`**: `activePathId` reports `"webgpu"` while the WebGPU
969
+ path paints, and `drawCallAccuracy` becomes `"accurate"` there (three's common
970
+ `Info.render.drawCalls` is a whole-frame figure). The instrument is a page
971
+ global, so tearing the engine down publishes `"webgl"` again rather than
972
+ leaving a later reading pinned to the unmounted graph's path. Covered by
973
+ `src/__tests__/RenderRuntime.loop.test.ts`.
974
+ - **Internal, behaviour-preserving:** the host render loop (`useRenderLoop.ts`)
975
+ no longer duplicates the frame pipeline; `RenderRuntime` owns the RAF rhythm,
976
+ dirty-flag consumption, the two frame-callback registries (host map first,
977
+ runtime map second) and the "needsRender is cleared after the callbacks"
978
+ rule. The seven wake sources, the ability to go quiet, and the picking-debug
979
+ sustain are re-asserted against the new loop by
980
+ `src/react/graph-context/__tests__/renderLoopIdle.test.tsx`. `RenderRuntime`'s
981
+ props-mode per-frame `forceUpdateAllAttributes()` was removed — the host had
982
+ already dropped its copy (U9 / FR6.1.a) and reviving it would have restored
983
+ that cost.
984
+ - **Bundle notes.** ESM/CJS entries reference `three/webgpu` through a dynamic
985
+ `import()`, so WebGL-only hosts never download it and bundlers may split it.
986
+ The UMD file inlines it: `dist/kineviz-gl.umd.js` grows from 2,050,584 to
987
+ 2,882,978 bytes (+832,394 bytes, about +40%). CJS consumers that `require()`
988
+ the package get a dynamic `import()` of an ESM-only three subpath, which
989
+ needs Node ≥ 22.12 (or any bundler) to resolve; the WebGL path is unaffected
990
+ because the import runs only when the WebGPU render path is enabled. Each
991
+ live `WebGPURenderer` also runs three's own internal `requestAnimationFrame`
992
+ loop (`renderers/common/Animation`), independent of this engine's loop; it
993
+ stops when the renderer is disposed — which now happens BEFORE the shared
994
+ `GPUDevice` is destroyed on unmount (effect cleanups run in declaration
995
+ order, so the mount-scoped dual-path effect retires the WebGPU paint target
996
+ first). The `three/webgpu` single-import rule behind the split is enforced by
997
+ `src/backends/__tests__/hygiene.test.ts`; the byte figures above are not a
998
+ test assertion — they come from `yarn workspace @kineviz/gl build`, re-run
999
+ them there if you need to confirm.
1000
+
1001
+ ### Changed — `deleteEdges` and `deleteNodes` are in-place swap-removes (M1)
1002
+
1003
+ - `GraphStore.deleteEdges` (and `applyDelta` edge removals) no longer rebuild
1004
+ the edge arrays: each removed edge is replaced by the last edge. 100k nodes /
1005
+ 200k edges: `applyDelta` remove 1 edge 5.9 → 0.07 ms; the one-time adjacency
1006
+ build is ~40 ms on the first delete.
1007
+ - **Behaviour change:** the surviving edges are no longer kept in their original
1008
+ order, `store.data.edges` is mutated in place (as `addEdges` always did), and
1009
+ the render-state arrays keep their identity unless the count falls below a
1010
+ quarter of capacity. Code that held an edge index across a deletion must
1011
+ re-resolve it by id. Covered by `src/core/__tests__/deleteEdgesInPlace.test.ts`.
1012
+ - `GraphStore.deleteNodes` (and `applyDelta` node removals) work the same way:
1013
+ incident edges are found through an adjacency index and removed, then each node
1014
+ is replaced by the last node. 100k nodes / 200k edges: `applyDelta` remove 1
1015
+ node 513 → 0.08 ms, `deleteNodes` x1 640 → 0.03 ms. Only the nodes that change
1016
+ slot get their position re-written (by id, through `writePositions`); every
1017
+ other survivor keeps its slot and position. `structureEpoch` still bumps once
1018
+ per call, and a call that matches no id is now a no-op (previously it rebuilt
1019
+ and bumped the version). `applyDelta` reports cascaded edges in slot order.
1020
+ Covered by `src/core/__tests__/deleteNodesInPlace.test.ts`.
1021
+ - `GraphStore.batch(fn)`: groups mutations into one change-log commit (one
1022
+ notification per subscriber). `store.version` still bumps per mutation.
1023
+ Covered by `src/core/__tests__/storeChanges.test.ts`.
1024
+ - Fewer re-renders: `BadgeCloud`, `TagCloud`, `GroupCloud` and `MinimapLayer` now
1025
+ subscribe to the change domains they read instead of every store mutation, and
1026
+ the `Picker` cache signature no longer changes on hover, selection, pin or
1027
+ highlight. Behaviour is otherwise identical. Covered by
1028
+ `src/react/graph-context/__tests__/useStoreVersion.test.tsx` and
1029
+ `src/interaction/__tests__/Picker.pickCacheInvalidation.test.tsx`.
1030
+ - New (internal, not exported): `store.changes` (a `ChangeLog`) receives every
1031
+ `markDirty` write and now also ordered `remove` ops.
1032
+
1033
+ ### Changed — node GPU upload is slot-precise for add / delete (M2.1a)
1034
+
1035
+ - Adding or deleting a node no longer re-uploads every node attribute. `GPUNodeRenderer` reads its own `store.changes` cursor and uploads only the touched slots (several update ranges per attribute instead of one envelope). Geometry, material and attribute objects keep their identity. Covered by `src/backends/gpu/__tests__/GPUNodeRenderer.incremental.test.tsx`.
1036
+ - Fixed: after a node delete, the hover-dim state of the node that was moved into the hole belonged to the wrong node (the renderer's shadow arrays did not follow the swap). Same test file.
1037
+ - `UpdateStrategy.markDirty(flag, slot?)`: an optional slot lets single-entity setters (`setNodeColor`, `setNodeSize`, `setNodeIcon`) report one slot instead of the whole column. Covered by `src/core/__tests__/flagBridge.test.ts`.
1038
+ - Edge and arrow geometry (M2.1b): adding or deleting edges, or deleting a node, repacks only the touched edge slots instead of rebuilding both geometries. The per-instance arrays are now capacity-sized; a capacity change still rebuilds. Parallel-edge curvature stays identical to a full reclassification (`EdgeClassifier.applyChanges`, groups ordered by slot). Covered by `src/backends/gpu/__tests__/GPUEdgeRenderer.incremental.test.tsx` and `src/edge/__tests__/EdgeClassifier.incremental.test.ts`. Measured on this VM (jsdom, 100k nodes / 200k edges): rebuild 723 ms → delete one edge or node about 1 ms, add one edge about 4 ms.
1039
+ - `GPUEdgeRenderer.getArrowGeometry()` (diagnostic accessor).
1040
+
1041
+ ### Changed — BREAKING behaviour: imperative style is now sticky (M2.6, D4)
1042
+
1043
+ - Setting a node's colour, size, shape or icon imperatively (`setNodeColor`, `updateNodeColors`, `setNodeSize`, `updateNodeSizes`, `setNodeShape`, `setNodeIcon`, and everything built on them: `api.style.*`, the style commands, `IoApi` overrides) now *claims* that attribute of that node. `VisualMapper.apply()` — on add, on `setCategoryConfig` + `apply()`, or called explicitly — no longer overwrites a claimed attribute. Before, the next re-map silently reset it (the "first delete recolors everything else" trap). To hand an attribute back to the mapping: `store.clearNodeOverrides(ids, attrs?)` (re-maps those nodes immediately). The claim set is `store.getNodeOverrides(id)` (`NODE_OVERRIDE` bits). It lives in a new render-state column `overrides`, so it moves with its node on swap-remove.
1044
+ - Undo restores ownership as well as the value: `SetNodeColor/Size/IconCommand.undo()` and `RemoveNodesCommand.undo()` put back the previous claim set; full snapshots (`captureFullSnapshot` / `applyFullSnapshot`) now also carry `shapeIds`, `aspects` and `overrides`.
1045
+ - Behaviour you may hit: code that set a colour and relied on a later `apply()` to replace it must call `clearNodeOverrides`. A config with `defaultColor` no longer recolours nodes that were coloured by hand.
1046
+ - Covered by `src/core/__tests__/styleOverrides.test.ts` (9 tests, 3 mutations killed) and `src/style/__tests__/VisualMapper.shape.test.ts`. No `api.style.*` wrapper for `clearNodeOverrides` yet — it needs a schema, signature-contract and naming decision (§13).
1047
+ - Internal: `TypeBatches` (`src/core/batches/`) keeps per-custom-shape-type slot lists from the ChangeLog (swap-remove and reclassification in O(changes)); nothing draws from it until M5.
1048
+
1049
+ ### Added — built-in node shapes (M2.4a)
1050
+
1051
+ - `GraphStore.setNodeShape(ids, shape, aspect?)`: eight built-in outlines — `circle`, `rect`, `roundRect`, `diamond`, `triangle`, `hexagon`, `star`, `ring` — plus a width / height `aspect` (`sizes` stays a scalar: width = size, height = size / aspect). The outline drives the fill, the selection / highlight ring, icon clipping and the picking hitbox. Circle nodes render exactly as before. Covered by `src/core/__tests__/nodeShape.test.ts`, `src/core/shapes/__tests__/reference.test.ts`, `src/backends/gpu/__tests__/GPUNodeRenderer.incremental.test.tsx`; GLSL ↔ JS reference and a real-renderer picking check run in `scripts/glsl-conformance.mjs` and `scripts/shape-smoke.mjs` (SwiftShader).
1052
+ - `DirtyFlag` gains `"nodeShapes"` (a downstream exhaustive `switch` over the union stops compiling). Render state gains `shapeIds` and `aspects`.
1053
+ - Edges and arrowheads stop at the node outline along the edge direction instead of the bounding circle (M2.4b; `shapeRadiusAlong` in `core/shapes/reference.ts`, `kvShapeRadiusAlong` in GLSL). The arrowhead keeps the nominal node radius for its size. Circle graphs render byte-identical to before (SwiftShader A/B). Edge attributes `nodeSizes` (now vec4) and the arrow's `sourceSize` / `targetSize` (now vec2) carry a packed shape code (`shapeCode`, aspect quantised to 1/1024, clamped to 8); no new attribute was added.
1054
+ - `CategoryConfig` gains `defaultShape`, `defaultAspect` and `shapeMapping` (`ShapeMapping`: property value → shape, with a default); `VisualMapper` applies them like the other mappings (scoped on add, whole category on `apply()`). `setCategoryConfig` throws on an unknown shape name or a non-positive aspect. A config without shape fields leaves shapes set with `setNodeShape` alone. Covered by `src/style/__tests__/VisualMapper.shape.test.ts`. `@kineviz/graph-core` exports the new types.
1055
+ - Not yet: shapes are not saved in snapshots; WebGPU draws circles only (M2.5). Icons and images inside a non-circle shape are still clipped by the outline but laid out for a circle.
1056
+ - Internal: the node shader keeps its 13 attributes by packing `suppressFill + 2 * shapeId` into `nodeSuppressFill` and `aspect` into `nodeEffects.w` (`nodeEffects` is now a vec4). ANGLE/SwiftShader counts three's `position`/`normal`/`uv` against the 16-attribute limit, so a 14th attribute fails to link.
1057
+
1058
+ ### Added — extension registries (M0)
1059
+
1060
+ The first piece of the extension contract: per-engine registries instead of
1061
+ closed `switch` statements. Built-ins register through the same path as
1062
+ extensions; extension names must be `<pack>:<name>` and built-ins must not be.
1063
+
1064
+ - **Layouts.** `LayoutRegistry`, `defaultLayoutRegistry`, `createLayoutRegistry()`
1065
+ (from `@kineviz/gpu-compute`, re-exported here). `executeLayout` now reads the
1066
+ registry; its result for every built-in `type` is unchanged, and an unknown
1067
+ `type` still returns an empty result. Covered by `gpu-compute/tests/LayoutRegistry.test.ts`.
1068
+ - **`api.layout.register(name, fn, opts?)` / `has(name)` / `list()`**, and
1069
+ `applyByName(name, nodeIds?, options?)` runs any registered layout — recorded
1070
+ in undo history, tweened, and bracketed by `layout:start` / `layout:end`
1071
+ exactly like a built-in. Registrations are per engine. Covered by
1072
+ `src/api/__tests__/LayoutApi.registry.test.ts`.
1073
+ - **`store.registry: EngineRegistry`** with `nodes`, `edges`, `arrows` and
1074
+ `layouts`. Today only `layouts` and the edge-shape table are consumed.
1075
+ An extension edge type is accepted but is drawn as its mandatory built-in
1076
+ `fallback` until path functions exist (M3); `nodes` and `arrows` store and
1077
+ validate descriptors but nothing draws them yet (M2/M3). Covered by
1078
+ `src/registry/__tests__/EngineRegistry.test.ts`.
1079
+
1080
+ ### Changed — layout names and edge-shape ids
1081
+
1082
+ - **BREAKING (behaviour): `api.layout.applyByName` throws on an unregistered
1083
+ name.** It used to return silently, which hid typos. The error lists the
1084
+ registered names. `gl-verbs`'s `arrangeNodes` is unaffected (it constrains the
1085
+ name to the built-ins with a schema enum).
1086
+ - The edge shape name → shader id mapping (`straight` 0, `curve` 1, `radial` 2)
1087
+ lived in five inline ternaries (`GraphStore.setEdgeShape`,
1088
+ `StyleApi.setEdgeShape`, `GPUEdgeRenderer` ×3). It now lives in one table,
1089
+ `BUILTIN_EDGE_SHAPE_IDS`, read through `store.registry.resolveEdgeShapeId`.
1090
+ Same ids, same fallback to straight for an unrecognised string. The public
1091
+ `EdgeShape` type is still the closed three-name union; it widens when
1092
+ extension edges can render.
1093
+
1094
+ ### Changed — mutation path no longer does O(N+E) bookkeeping for adds and updates (M0)
1095
+
1096
+ Measured on 100k nodes / 200k edges, data layer only (`scripts/bench-mutation.ts`):
1097
+ `applyDelta` add one node 29.3 → 0.02 ms, update one node 37.9 → 0.01 ms,
1098
+ update 100 nodes 279.7 → 0.09 ms, `addEdges` one edge 37.9 → 0.04 ms.
1099
+ Removals are unchanged (still O(N+E)); they need the swap-remove work in M1.
1100
+
1101
+ - **`VisualMapper.apply(scope?)`** takes an optional `{ nodes, edges, fullCategories, fullRelationships }`.
1102
+ `addNodes`, `addEdges` and `applyDelta` now pass the items they touched, so an
1103
+ add or update re-maps only those items. **Behaviour change:** an add used to
1104
+ re-map every node of every configured category, which silently overwrote
1105
+ imperative `setNodeColor` / `setNodeSize` calls on *unrelated, existing* nodes.
1106
+ It no longer does. Categories whose mapping depends on the whole category
1107
+ (a `sizeMapping` / `widthMapping` or a sequential / diverging colour mapping
1108
+ with no explicit `domain`) and categories configured for the first time by
1109
+ that very change still re-map in full. `apply()` with no argument is unchanged.
1110
+ Covered by `src/core/__tests__/incrementalMutation.test.ts`.
1111
+ - **`GraphStore.applyDelta`** resolves updated nodes/edges through the id→index
1112
+ map instead of a linear `find`, and computes the "actually removed" lists
1113
+ without snapshotting every id. Results are identical, including cascaded edge
1114
+ order. `replaceNodeProperties` likewise. Covered by `incrementalMutation.test.ts`.
1115
+ - **`IndexManager.addEdge`** (`@kineviz/graph-core`) grows `edgeSourceIndices` /
1116
+ `edgeTargetIndices` with capacity doubling instead of reallocating on every
1117
+ call. **The arrays may now be longer than `edgeCount`**; readers must bound by
1118
+ `edgeCount` / `data.edges.length` (all in-repo readers already do), and
1119
+ `getEdgeEndpoints` now checks against `edgeCount`. Covered by
1120
+ `graph-core/tests/IndexManager.test.ts`.
1121
+ - `GraphStore.setData` no longer logs a `console.warn` with a stack trace on
1122
+ every call.
1123
+
1124
+ ### Changed — picking and minimap readback go through a dual-path backend (U5 async-readback)
1125
+
1126
+ - GPU readbacks now sit behind `PickingBackend` (`src/backends/picking/`). The
1127
+ WebGL implementation keeps the synchronous `readRenderTargetPixels` it always
1128
+ used; the WebGPU implementation reads asynchronously through three's
1129
+ `readRenderTargetPixelsAsync`, which is `copyTextureToBuffer` plus a raw
1130
+ device `mapAsync` underneath. Every result is normalised to top-left row
1131
+ order and tight rows before it leaves the backend, so callers no longer
1132
+ branch on the render path. Covered by
1133
+ `src/backends/picking/__tests__/PickingBackend.test.ts`,
1134
+ `src/backends/picking/__tests__/WebGPUPickingBackend.test.ts` and
1135
+ `src/backends/readback/__tests__/ReadbackOrientation.test.ts`.
1136
+ - **Picking's y mapping was corrected by one device pixel.** The pre-U5 WebGL
1137
+ picking code (the now-deleted `renderAndReadPixel`/`pickEdges`) computed the
1138
+ bottom-left framebuffer row as `H - round(v)`; U5's `WebGLPickingBackend`
1139
+ computes the exact geometric inverse, `H - 1 - cy`. This is a deliberate fix
1140
+ of a latent off-by-one — the old formula was out of bounds at `screenRow = 0`
1141
+ (clamped, so it never crashed) and one device pixel high everywhere else —
1142
+ not a regression. A user could perceive it as a hairline change in hit
1143
+ accuracy near node edges. Pinned by
1144
+ `src/backends/picking/__tests__/PickingBackend.test.ts`.
1145
+ - `Picker.pick()` stays **synchronous** and its result shape is unchanged, so
1146
+ `onClick`, `onDblClick` and `onContextMenu` still fire inside the DOM event
1147
+ that triggered them. A new `Picker.pickAsync()` is the asynchronous face; the
1148
+ hover pipeline uses it, and on the WebGPU path it also fills the single-entry
1149
+ cache that answers the synchronous face. Covered by
1150
+ `src/interaction/__tests__/pickAsync.test.ts`,
1151
+ `src/backends/picking/__tests__/PickCache.test.ts` and
1152
+ `src/interaction/__tests__/hoverThrottle.test.ts`.
1153
+ **Final fix wave, cache-invalidation signature:** the change signature that
1154
+ decides whether a cached synchronous answer is still valid
1155
+ (`Picker.cacheSignature()`) originally folded only the camera world matrix,
1156
+ zoom, target size, `cloudScene.position.z` and `cloudScene.scale.x`. That
1157
+ missed a pan (`cloudScene.position.x`/`.y`, e.g. `GraphControl.pan()`), a
1158
+ non-uniform rescale (`scale.y`/`.z`), a globe rotation (the full
1159
+ quaternion), and — separately — an active-path flip on the orchestrator's
1160
+ per-frame `webgl`↔`webgpu` decision (`setActivePathId()`'s own cache
1161
+ invalidation only fires once, at the moment the getter is *registered*, not
1162
+ each time its return value changes, so a real per-frame flip invalidated
1163
+ nothing). Each of the four missing terms could leave a stale synchronous
1164
+ pick answer served after the picture had already moved — on the WebGPU path
1165
+ this reads as "the click selected the wrong node." All four terms are now
1166
+ folded into `cacheSignature()`. There is also a now-fixed bug where the
1167
+ in-flight-read map's key was released *after* `cacheSignature()` was called
1168
+ to populate the cache, so a `cacheSignature()` exception permanently wedged
1169
+ that screen coordinate on the same rejected promise. Covered by
1170
+ `src/interaction/__tests__/Picker.pickCacheInvalidation.test.tsx`.
1171
+ - **`Picker.setCamera()` is live again.** The WebGL picking backend used to
1172
+ capture the camera *by value* at construction time; `setCamera()` swaps
1173
+ `Picker.camera` to a new object, but the backend kept rendering the picking
1174
+ scene with the object it was built with, so a host that calls
1175
+ `InteractionManager.setCamera()` after construction — the seam exists
1176
+ exactly for that — got picks against a stale projection with no error.
1177
+ `WebGLPickingBackendDeps.camera` is now `getCamera(): THREE.Camera`,
1178
+ resolved at each read. `@kineviz/gl`'s own `GraphContext` was never affected
1179
+ (it constructs exactly one camera for the engine's life), so this had no
1180
+ user-visible effect before this fix — it is a latent-bug fix, not a
1181
+ behaviour change any current host will notice. Covered by
1182
+ `src/backends/picking/__tests__/PickingBackend.test.ts` and
1183
+ `src/interaction/__tests__/Picker.setCameraLiveness.test.tsx`.
1184
+ - The minimap now issues a real in-flight asynchronous readback instead of
1185
+ assuming "the GPU is done next frame". `MinimapRenderer.hasPendingReadback()`
1186
+ means "a read is in flight or an image is waiting to be delivered"; a render
1187
+ is skipped while a read is outstanding. The `position-readback` perf channel's
1188
+ `site=minimap` samples now measure end-to-end asynchronous latency (submit →
1189
+ fence), not a synchronous stall, so expect the numbers to rise from about 1 ms
1190
+ to roughly 5–15 ms — the stall left the frame, it did not get slower. The
1191
+ minimap keeps rendering offscreen through a plain `THREE.WebGLRenderer` on
1192
+ **both** render paths — U5 gives it no WebGPU implementation of its own.
1193
+ **Final fix wave:** a read that resolves `undefined` (three's signal for "no
1194
+ framebuffer to read from," which is the whole jsdom test path, and can also
1195
+ happen in a real browser) used to fall back to the *previous* frame's bytes
1196
+ and publish them as if they were this frame's new content —
1197
+ `hasPendingReadback()` callers had no way to tell a genuinely fresh read
1198
+ from a re-delivered stale one. It now returns without touching
1199
+ `_readyImage`, i.e. "no new content," matching the comment that was already
1200
+ there. Covered by
1201
+ `src/react/layers/minimap/__tests__/MinimapReadback.test.tsx`.
1202
+ - **Skeleton only, replaced in U6:** with `enableWebGPURenderPath` on, the
1203
+ WebGPU canvas now draws nodes as flat instanced discs with position, diameter
1204
+ and colour, and those discs are pickable. Nothing else is on that path yet —
1205
+ no icons, labels, halos, hover dimming, selection rings, ripple/breathe
1206
+ effects, LOD, map mode, child nodes, edges or groups — and **edge picking
1207
+ returns nothing (background) while the WebGPU path is active**. The WebGL
1208
+ path is unchanged. Covered by
1209
+ `src/backends/webgpu/__tests__/WebGPUNodePrimitive.test.ts`.
1210
+ **Wiring follow-up:** the skeleton primitive shipped unbuilt in the first
1211
+ pass. `WebGPUPaintTarget.prepare()` only constructs it when its data source
1212
+ is present, and `GraphContext` was not passing one — so the WebGPU `scene`
1213
+ and `pickScene` were both empty, the canvas painted nothing but the clear
1214
+ colour, and the pick readback returned background forever. `GraphContext`
1215
+ now passes it. The dependency is a **getter** on both hops
1216
+ (`WebGPUPaintTargetDeps.getStore` / `WebGPUNodePrimitiveDeps.getStore`,
1217
+ replacing the `store` value): the paint-target effect's dependency array
1218
+ does not include the `store` prop, so a host that swaps `store` mid-mount
1219
+ would otherwise leave the primitive bound to the old one. No extra
1220
+ invalidation is needed for that swap — the primitive's existing
1221
+ colour/size array-identity check already treats a different store's arrays
1222
+ as stale and rebuilds. `getNodeSizeScale` is deliberately left at its
1223
+ default `() => 1`: the global scale is pre-multiplied into
1224
+ `GraphStore.effectiveSizes` and the WebGL node shader pins its own
1225
+ `nodeSizeScale` uniform at 1.0, so passing it here would double-apply it.
1226
+ Covered by
1227
+ `src/react/graph-context/__tests__/GraphCanvas.renderPath.test.tsx` and
1228
+ `src/backends/webgpu/__tests__/WebGPUPaintTarget.test.tsx`.
1229
+ **Two parity fixes found in browser acceptance** (neither is reachable from
1230
+ a test — jsdom has no WebGPU, so only a human at a real canvas sees them):
1231
+ the display material now sets `depthWrite = false` / `depthTest = true`,
1232
+ matching the WebGL node material. With depth writing on, the fully
1233
+ transparent corners of a nearer quad still wrote depth and occluded the
1234
+ discs behind them, which on screen read as rectangular bites taken out of
1235
+ the circles. And the primitive now copies `cloudScene`'s position,
1236
+ quaternion and scale onto both its display and its pick object every sync
1237
+ (new required dep `WebGPUNodePrimitiveDeps.getCloudTransform`, optional on
1238
+ `WebGPUPaintTargetDeps`). WebGL's node mesh is a *child* of `cloudScene` and
1239
+ inherits that transform; the skeleton primitive lives under the paint
1240
+ target's own scene root and does not — exactly the case
1241
+ `Picker.syncTransforms()` already handles for the picking meshes. Without
1242
+ it the discs ignored pan and zoom entirely, and `viewDepth` lost
1243
+ `cloudScene`'s z so every disc rendered too large. Covered by
1244
+ `src/backends/webgpu/__tests__/WebGPUNodePrimitive.test.ts`.
1245
+ - Bundle note: `three/tsl` joins `three/webgpu` behind the same dynamic import
1246
+ in `src/backends/webgpu/loadThreeWebGPU.ts`, so ESM and CJS consumers still
1247
+ defer both. Both already share `three.core.js`, so the UMD bundle grows only
1248
+ by the TSL node library. Re-measure `dist/kineviz-gl.umd.js` with
1249
+ `yarn workspace @kineviz/gl build` and record the byte figure here — this line
1250
+ is verified against build output, not by a test assertion; the single-import
1251
+ rule itself is covered by `src/backends/__tests__/hygiene.test.ts`.
1252
+
1253
+ Measured: `dist/kineviz-gl.umd.js` is 2,920,427 bytes
1254
+ (was 2,882,978 bytes before U5, +37,449 bytes).
1255
+
1256
+ ## 0.6.1 — 2026-08-05
1257
+
1258
+ Icons survive a slow font. Goal: an icon assigned before its font finishes
1259
+ loading should still be drawn, instead of silently falling back.
1260
+
1261
+ ### Fixed
1262
+
1263
+ - **Icon UVs are re-resolved when a font arrives after the first attempt.** Assigning a category icon before its font had loaded resolved to nothing and stayed that way, so the glyph was dropped for the lifetime of the scene — hosts had to work around it by re-applying `setCategoryIcon` on a timer. `IconAtlasManager` now records unresolved requests and replays them once the font registers, and `GraphContext` re-runs resolution on font load. Covered by `tests/react/iconLateFontResolve.test.tsx`.
1264
+
1265
+ ### Added
1266
+
1267
+ - **`animals/horse` ontology glyph** (`0xe154`) in `@kineviz/icons`, with the ontology and UI fonts rebuilt. Note that `@kineviz/gl` does not ship font assets — consumers load the woff2 themselves, so picking up the new glyph means taking the rebuilt font from `@kineviz/icons`, not from this package.
1268
+
1269
+ ### Known issues
1270
+
1271
+ - **This fix is not sufficient to drop a `setCategoryIcon` re-apply timer** ([GXR-4478](https://kineviz.atlassian.net/browse/GXR-4478)). A geometry rebuild still erases icons that were already applied and drawn, which is a separate defect from the late-font resolution failure fixed above. A downstream app that removed its timer on the strength of this release regressed: 1 run in 5 lost 10 of 17 glyphs with the font confirmed loaded. If you hold such a workaround, keep it until GXR-4478 is fixed.
1272
+
5
1273
  ## 0.6.0 — 2026-06-29
6
1274
 
7
1275
  Node-anchored info cards. Goal: attach rich, interactive HTML cards to graph
@@ -52,7 +1320,7 @@ nearest geo neighbour as a readable, zoom-stable ego ring.
52
1320
 
53
1321
  New subpath entry exporting `METHOD_SCHEMAS`: an engine-owned registry of zod
54
1322
  schemas for 193 blockable API methods across the 13 flow-allowlisted
55
- namespaces (spec: `notes/specs/2026-06-12-api-method-schema-registry.md`).
1323
+ namespaces.
56
1324
  Each entry records the method's positional argument layout (plain params +
57
1325
  trailing options object) so tooling (flow blocks, agents, MCP) can render
58
1326
  parameter forms and reconstruct calls. Schemas live next to the API code in
@@ -62,7 +1330,7 @@ is kept under `scripts/` for reference only. A package `exports` map was
62
1330
  added — `"."`, `"./schemas"`, `"./dist/*"` (CSS deep imports preserved),
63
1331
  `"./assets/*"`.
64
1332
 
65
- contextValue identity redesign (spec: `notes/specs/2026-06-11-contextvalue-identity-redesign.md`). The `GraphContext` provider value is now an **identity-stable handle**: it is created once per engine lifecycle, its 13 reactive fields (`isMapMode`, `mapDamping`, `mapSphereRadius`, `is3D`, `effectiveMapProjection`, `theme`, `textScale`, `edgeTextScale`, the three atlas managers, `layoutController`, `layoutPositionProvider`) are live getters into an internal subscribable view-state store, and consumers subscribe per field.
1333
+ contextValue identity redesign. The `GraphContext` provider value is now an **identity-stable handle**: it is created once per engine lifecycle, its 13 reactive fields (`isMapMode`, `mapDamping`, `mapSphereRadius`, `is3D`, `effectiveMapProjection`, `theme`, `textScale`, `edgeTextScale`, the three atlas managers, `layoutController`, `layoutPositionProvider`) are live getters into an internal subscribable view-state store, and consumers subscribe per field.
66
1334
 
67
1335
  ### Added
68
1336