Repository navigation
feat(virtual): add VirtualItems and El::virtual_items app-windowed keyed container - #2236
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #997
Adds
VirtualItemsandEl::virtual_items(Rc<dyn VirtualItems>)— an app-windowed keyed container for 2D canvases, node graphs, and LOD scenes positioned underEl::live_offset/El::live_scale— that remounts entering and leaving items without re-runningview. Part 2 (column windowing inrune-kitTable) stays open on #997.API
Follows the web split between spatial canvas culling (React Flow
onlyRenderVisibleElements/ XYFlow RFC #4239) and 1D scroll virtualizers, and W3C CSS Containment Level 2 (content-visibility: autokeeps focused elements and focused descendants relevant/mounted).Architecture
flowchart LR V["VirtualItems::version() O(1)"] --> C{"changed / pending / blurred pin?"} C -- no --> I["Idle (0 work)"] C -- yes --> R["CommitKind::Remount (0 view runs)"] R --> L["Leaving -> virtual_culled (instant unmount, unless focused)"] R --> S["Staying -> move_slice (keeps NodeId, PaintKeep epoch, memo, Live/LiveText)"] R --> E["Entering -> up to mount_budget by mount_priority (VIRTUAL_MOUNT)"] E --> F["virtual_items::fill::Fill (Idle | Filling | Waiting | Stalled)"]crates/rune/src/el/items.rs(re-exported asrune::VirtualItemsandrune::el::VirtualItems), stored onElCold::virtual_items(crates/rune/src/el/rare.rs), compared inmemo_reuse::same_el_cold, and excluded fromel_flatten_reusable/windowed_lists.virtual_items: virtual_items::VirtualItemsStatefield onCommitState(crates/rune/src/runtime/commit.rs), implemented incrates/rune/src/runtime/virtual_items/{mod,fill}.rs.Plan::{List, Items}incrates/rune/src/runtime/commit/remount.rssovirtual_itemsandvirtual_rowscoexist onCommitKind::Remount; nested virtual containers in entering items fall back toRemountOutcome::Fallback; unmounted containers prune incrates/rune/src/runtime/commit/prune.rs.focusable(true)items and items holding a focusedtext_inputstay pinned and mounted across omission fromkeys()until focus leaves, anda11y/tree.rsemits only mounted (+ pinned focused) items without auto-assigningsize_of_set/position_in_set.Paired benchmark (
--profile perf)cargo run --profile perf -p rune --example virtual_items_bench— 5 paired alternating runs × 120 frames, sliding 4 entering / 4 leaving items per frame plus 1LiveTextupdate, headlessRuntime(omitting GPU upload and presentation):viewrunsviewrebuildEl::virtual_itemsremountviewrebuildEl::virtual_itemsremountExample & docs
Lists/Virtual items canvasinexamples/playground/src/virtual_items_story.rs(2,500-node 2D canvas with drag-pan, zoom toggle,mount_budget(12), nearest-firstmount_priority, and focusable nodes).El::virtual_items,crates/rune/README.md,examples/README.md, andchangelog/unreleased/2026-11-25-virtual-items.md.Not checked interactively in a live GPU window.