components
All repositories: gitoria
1.9 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 = ''// the page's data: row n is made up from n (a real app asks its server)makeRow(n) {return { id = 'song-' + n title = 'Song number ' + n 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 = (first, 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 = (id, index) => {tapped = id + ' (row ' + (index + 1) + ')'playingId = id}View {virtualListDemo {h1 { "Virtual list" }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 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
- 5e090ffdRecord IC28 review evidence and gate resultsmre
- adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre
- c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre
- bd4aa808Record VL24 deployment and live verificationmre
- e5b98ecfRun virtual-list gate before deploymentmre
- 2e9b4a8evirtual-list: into main, with centerId and scrollTop/onScroll (jukebox#20)mre
- 69954249Align all plugin sources with Hybriel day38bmre
- f740f666Re-vendor components to Hybriel set day38bmre
- 8176eb14Record CS23b deployment and live verificationmre
- 84e3ddaaRemove blank line before pagination Style closing bracemre
- a92298ddRecord exact CSS and same-date proof after specificity reviewmre
- c71a0abePreserve consumer theme specificity with nested tag rulesmre
- 64a2bc27Document CS23b style formatting proof and review statusmre
- a72b57cficons: nest Style rules in the language's formmre
- 927616e2pagination: nest Style rules in the language's formmre
- aab8ad29code-editor: nest Style rules in the language's formmre
- ba30727afile-upload: nest Style rules in the language's formmre
- 42fefa4emodal: nest Style rules in the language's formmre
- 6fd953e3range-picker: nest Style rules in the language's formmre
- f661951ddate-picker: nest Style rules in the language's formmre