Add crosshair and shared cursor primitives - #55
Conversation
|
Important Review skippedToo many files! This PR contains 155 files, which is 55 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (155)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fbfc053 to
9ba42ff
Compare
9ba42ff to
7aab62c
Compare
|
View your CI Pipeline Execution ↗ for commit 7aab62c
☁️ Nx Cloud last updated this comment at |
Summary
crosshairx/y rules, labels, markers, and categorical cursor bands with clipping, ordering, facets, motion, live-viewport projection, and public type exportscursorHostbindings for browser and React Native synchronization, pinning, ownership, and accessibilityresolveCrosshairGuidefrom@tanstack/charts/crosshairfor custom focus-guide renderersBehavior
Case 119 uses an x band that follows the focused period and extends 4 px beyond each bar edge, for 8 px additional width. Its x label names the period. A dotted y rule follows the focused stacked-segment endpoint, and its label shows that endpoint rather than the segment delta.
Both guides use spring motion across pointer focus and keyed data updates. Retained presentation points animate from their prior geometry while carrying the destination datum and semantic values, so the visible guide, focus callbacks, and labels remain consistent throughout an update. Semantic cursors and crosshairs project through
ResolvedScale.viewport.mapand remain aligned during transient live-viewport translation.Matching controlled cursor values preserve the focused mark's plotted subgroup and stacked-endpoint geometry; genuinely different controlled values still override local focus. Pointer and keyboard hosts publish through ownership-safe cursor sessions, and leaving either interaction path clears only transient state owned by that host.
Issue #32 exposed the underlying gap: focus filters could reveal pre-authored marks, but they could not express one stable renderer-native cursor that follows focus. The new crosshair and cursor primitives provide that ownership model without application-authored SVG or rectangle overlays.
Validation
pnpm validate— 148 test files and 983 tests, plus TypeScript, formatting, docs, packages, adapters, SSR, catalog, and bundle gatespnpm bundle:checkandpnpm benchmark:checkpnpm canvas:checkBundle impact
All locked bundle ceilings and comparison checks pass. Isolated gzip sizes are 353 B for the application cursor controller, 3,936 B for the cursor host policy, and 2,993 B for the crosshair extension.
The shared default host capability adds 2,655–2,827 gzip bytes, or 7.43–8.35%, across the 12 controlled TanStack comparison bundles versus the rebased
main. The resulting controlled range is 34.03–39.56 KiB gzip. The baseline records that shared renderer capability explicitly; all 48 external-library rows remain unchanged.Fixes #32