Skip to content

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 18 Aug 20:02
· 147 commits to main since this release
5d7d494

Added

  • GraphCanvas — centerOnSelect prop (default false): pans to keep selectedNodeId
    centered in the viewport whenever it changes, preserving the current zoom (never re-fits or
    re-zooms). Off by default so existing consumers relying on selectedNodeId purely for
    highlighting/inspector wiring see no behavior change. Motivating case: an external selection
    origin — a sidebar, a nav tree — can select a node that's currently off-screen, unlike clicking
    a node directly on the canvas (you had to see it to click it); centerOnSelect closes that gap.
    Skipped until the initial mount center/fit has run and while pan/zoom is locked, and only acts
    on a genuine change to selectedNodeId — it never fights a user's own subsequent pan away from
    the selected node on a re-render. Combining centerOnSelect with fitView and an already-set
    selectedNodeId at mount correctly uses the post-fit zoom rather than a stale pre-fit one; a
    selectedNodeId that isn't resolvable yet (e.g. inside a currently-collapsed subtree) is
    retried on a later render instead of being silently given up on.
  • GraphCanvas — fullscreenContainerRef prop: pass a ref to an ancestor element and the
    built-in toolbar's Fullscreen button (and toggleFullscreen/isFullscreen from
    useGraphCanvas()) request/track fullscreen on that ancestor instead of GraphCanvas's own root.
    Motivating case: GraphCanvas doesn't accept children — it fully owns its internal tree — so a
    consumer composing sibling overlay content next to it (a control strip above it, a
    DetailDrawer beside it, the same pattern GraphLayoutsShowcase itself uses) previously lost
    that content the instant Fullscreen was used, since the native Fullscreen API only renders the
    fullscreened element's own DOM subtree. GraphCanvas still measures and lays out against its own
    container's size regardless of which ancestor is actually fullscreened, so nothing else about
    its behavior changes; omitting the prop is identical to previous behavior. Entering/exiting
    fullscreen is bounded and failure-safe: a rejected requestFullscreen()/exitFullscreen() (no
    permissions-policy grant, a detached or mid-unmount target, ...) is caught and logged via
    console.warn instead of surfacing as an unhandled rejection, and the fit applied on entering
    fullscreen no longer stays armed indefinitely waiting for a container resize that may never
    come (a target that's already viewport-sized on entry, say) — it's bounded to a short window
    after entry, so it can't fire later against an unrelated resize instead.