Skip to content

v0.9.0

Choose a tag to compare

@github-actions github-actions released this 11 Nov 02:37
· 82 commits to main since this release

Minor changes

  • 3ae8f98: The Rust crate kgdiff-layout carries a layout from one version of a graph to the next through their diff: layout_diff_on(&diff, &previous, &options) lays the diff out on the previous version's map, and layout_after(&diff, &layout, &options) gives the after version the positions of its diff without computing any (RFC 0003, part 1). Every node the previous layout places stays exactly where it is, whether it continues or was removed and under whatever id it has now, and only the new nodes are placed, clear of the removed ones; going from a version to the next one, and from either to their diff, moves no node. Laying the next version out with layout_graph and the previous positions as pins gives that only when no id changes: a node that continues under another id is placed again, and an id given to another node pins that node where the old one was. Both functions are held to the kgdiff.layout bytes of the same pins written by hand on every case of the conformance corpus. A pin of the caller wins over the previous layout; scope Changes and strategy Union are invalid-input, and so is, for layout_after, a layout that does not place every node of the after version. The functions are experimental for one minor release, and @kgdiff/layout has no counterpart. The embedding guide and its example (crates/kgdiff-report/examples/embedding.rs) now use them.

    @kgdiff/cli

  • 0a52a4d: The Rust crate kgdiff-layout lays out one graph: layout_graph(&graph, &options) gives the positions layout_diff gives the diff of that graph with itself, with every node in scope whatever the size of the graph, so an application that shows a graph and then a diff of it moves no node between the two (RFC 0003, part 1). The two are held to the same kgdiff.layout bytes on both graphs of every case of the conformance corpus. Known positions, as pins or as position on the nodes, are kept exactly and only the other nodes are placed, which is how the next version of a graph keeps the previous version's map; scope Changes is invalid-input. The function is experimental for one minor release. @kgdiff/layout has no counterpart: @kgdiff/compute will export it with the rest of the layout (RFC 0002, phase 5).

    @kgdiff/cli

  • 6c3a764: The payload of an HTML report has a JSON Schema: schema/report.v1.json describes kgdiff.report version 1 (format, version, the diff, packed or not, the optional layout of version 1 or 2, meta and the optional view), so an application that makes or reads reports can validate them as it can graphs, diffs and deltas. Members of view the schema does not name are allowed: later minor versions add optional ones, and viewers ignore those they do not know. The schema and schema/layout.v2.json, the layout document of kgdiff's Rust engine it refers to, are exported as @kgdiff/core/schema/report.v1.json and @kgdiff/core/schema/layout.v2.json (layout.v2.json was in the package already, without an export). In Rust, the kgdiff-report crate takes the layout of a report from its caller (RFC 0003, part 2): report_payload_with and build_report_html_with take a ReportLayout, which is Default (the layout of the default options, what report_payload and build_report_html keep writing, byte for byte), Given(&layout) (a layout the application has already, checked against the diff and refused with invalid-input when it places a node the diff does not have, or has scope all and leaves one out) or None (no layout: the viewer lays the diff out when the report opens). What kgdiff writes does not change.

    @kgdiff/core

  • d3e1dac: Layers: an application draws its own marks on the renderer's canvas, under and over the graph (RFC 0003, part 4a; experimental). renderer.addLayer({ order, draw(ctx, view) }) returns the function that removes the layer. An under layer is drawn after the background and the dot grid and before everything else, an over layer after the labels: a background behind a group of nodes, a certification mark or a count on a node, without a second canvas that follows the camera event. draw is called once per painted frame (once per side in a swipe view, clipped to it, with view.side), in CSS pixels, with view.worldToScreen, view.camera, view.viewport and view.pixelRatio; the renderer saves the context before each layer and restores it after. Layers are in toDataURL and in the frame event's ms, are not picked, and their text takes no part in label placement; a layer that throws is reported and the rest of the frame is painted. Without layers the renderer paints exactly as before. <kgdiff-stage> gains the same addLayer method (experimental) for the graph inside the viewer: layers added before the stage has a canvas are drawn once it has one, and they stay with the stage when it is bound to another root or moved in the document. @kgdiff/viewer exports the RendererLayer and LayerView types. Known limit: labels carry a halo in the canvas background color, which shows as a faint outline over a tinted under area; soft tints (the theme's soft colors, about 10% alpha) keep it unnoticeable.

    @kgdiff/renderer · @kgdiff/viewer

Patch changes

  • 9669b75: The canvas shows the whole frame under an emulated device scale factor. With Chromium's device emulation at a scale factor other than 1 (Playwright's deviceScaleFactor, as used for screenshots and browser tests), the graph was drawn enlarged and blurred with only its top-left corner on the canvas, on the first view and after "Fit view": a CLI report, the viewer and any page with createRenderer alike. The renderer sized the canvas's backing store by the browser's device-pixel box (devicePixelContentBoxSize), which stays in CSS pixels under that emulation, and painted at devicePixelRatio. It now takes that box only when it is the canvas's CSS size times the pixel ratio, within the snapping to whole device pixels, and sizes the backing store by the pixel ratio otherwise, as it always has in browsers without the box. A real high-density display (the box is in device pixels there) was drawn correctly before and is drawn exactly as before. The same check keeps the backing store and the painting in step under a CSS zoom on an ancestor, which the box includes and devicePixelRatio does not; the viewer's fits under a CSS zoom are still off.

    @kgdiff/renderer · @kgdiff/viewer


Every package is at 0.9.0: @kgdiff/cli · @kgdiff/core · @kgdiff/formats · @kgdiff/layout · @kgdiff/scene · @kgdiff/renderer · @kgdiff/viewer · @kgdiff/g6.

GitHub Action: uses: iiwish/kgdiff@v0.9.0.