components
All repositories: gitoria
2.5 KB
// demo.hl — `/virtual-list`: 13,449 generated rows, loaded 50 at a time by the page's own function (an app would ask its server here). The// page tells how many rows were loaded in total and which row was tapped. The list is 24 rows tall; the page shows the count of DOM rows.parent '../main.hl'import VirtualList from './virtual-list.hl'import { greyLighter } from '../../shared/base.hl'__title = 'Virtual list · Hybriel components'static count = 13449Hybrid chunk = []Number chunkFrom = 0Number fetches = 0String tapped = 'nothing yet'String playingId = ''String domRows = ''String resetToken = ''Boolean descending = falseNumber resetOffset = nullchangeSort(Number top) {descending = !descendingresetOffset = toploadRange(0, 30)resetToken = descending ? 'descending' : 'ascending'}// the page's data: row n is made up from n (a real app asks its server)makeRow(Number n) {item = descending ? count - 1 - n : nreturn { id = 'song-' + item title = 'Song number ' + item sub = 'Artist ' + (n % 97) + ' · Album ' + (n % 331) aside = '' + (n % 12) img = '' }}// the list asks for the rows near the viewport: load a chunk of 50 around themloadRange = (Number first, Number wanted) => {let start = first - 10if (start < 0) { start = 0 }let end = start + 50 + wantedif (end > count) { end = count }out = []let i = startwhile (i < end) { out.push(makeRow(i)) i = i + 1 }chunk = outchunkFrom = startfetches = fetches + 1}picked = (String id, Number index) => {tapped = id + ' (row ' + (index + 1) + ')'playingId = id}View {virtualListDemo {h1 { "Virtual list" }button { id = 'sortReset' type = 'button' 'Change sort, start at top' on click() { changeSort(null) } }button { id = 'offsetReset' type = 'button' 'Change sort, restore row 200' on click() { changeSort(11200) } }button { id = 'sameReset' type = 'button' 'Repeat reset key' on click() { resetToken = resetToken } }p { class = "muted" "13,449 rows; only the rows near the viewport exist in the page. The page loaded rows " output { id = "vl-fetches" fetches } " times." }div { id = "vl-box"VirtualList { itemCount = 13449 rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = playingId scrollTop = resetOffset resetKey = resetToken listLabel = "Songs" }}p { class = "muted" "Tapped: " output { id = "vl-tapped" tapped } }p { a { id = "readme" href = "/virtual-list/README.md" "README (how to use it)" } }}}Style {virtualListDemo {'#vl-box' {height = '24rem'background = greyLighter}}}
Branches
Latest commits
- b7e11e3bvirtual-list: the first resetKey is the baseline, so centerId and scrollTop keep their place at mount; gate for itAtlas
- 7e428ba6Re-vendor Hybriel day72 (day73 withdrawn: minifier breaks write sets)Atlas
- a06fc778Reset virtual-list window when the host changes resetKeyAtlas
- 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
- 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
- f5f131c5Record AP29 autoplay comparisons and passing gatesmre
- 51c38187Gate media autoplay on first load and after client mountmre
- a3f2223dRecord successful B44 deployment and live proofmre
- 06c1e021Record passing B44 browser rerunmre
- c9861533Record B44 component proof and browser gate blockermre
- 1b7413beIgnore detached media events and space demo option outputsmre
- ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
- df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
- 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
- 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
- 9b872cedRecord IC28 deployment and live icon verificationmre
- 46fefaa7Count the icons entry in the offline home-page checkmre
- c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
- 5e090ffdRecord IC28 review evidence and gate resultsmre