gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit9b872ced9b872cedRecord IC28 deployment and live icon verificationmre9b872ced/components/virtual-list/demo.hl

1.9 KB

  1. // 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
  2. // 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.
  3. parent '../main.hl'
  4. import VirtualList from './virtual-list.hl'
  5. import { greyLighter } from '../../shared/base.hl'
  6. __title = 'Virtual list · Hybriel components'
  7. static count = 13449
  8. Hybrid chunk = []
  9. Number chunkFrom = 0
  10. Number fetches = 0
  11. String tapped = 'nothing yet'
  12. String playingId = ''
  13. String domRows = ''
  14. // the page's data: row n is made up from n (a real app asks its server)
  15. makeRow(n) {
  16. return { id = 'song-' + n title = 'Song number ' + n sub = 'Artist ' + (n % 97) + ' · Album ' + (n % 331) aside = '' + (n % 12) img = '' }
  17. }
  18. // the list asks for the rows near the viewport: load a chunk of 50 around them
  19. loadRange = (first, wanted) => {
  20. let start = first - 10
  21. if (start < 0) { start = 0 }
  22. let end = start + 50 + wanted
  23. if (end > count) { end = count }
  24. out = []
  25. let i = start
  26. while (i < end) { out.push(makeRow(i)) i = i + 1 }
  27. chunk = out
  28. chunkFrom = start
  29. fetches = fetches + 1
  30. }
  31. picked = (id, index) => {
  32. tapped = id + ' (row ' + (index + 1) + ')'
  33. playingId = id
  34. }
  35. View {
  36. virtualListDemo {
  37. h1 { "Virtual list" }
  38. 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." }
  39. div { id = "vl-box"
  40. VirtualList { itemCount = 13449 rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = playingId listLabel = "Songs" }
  41. }
  42. p { class = "muted" "Tapped: " output { id = "vl-tapped" tapped } }
  43. p { a { id = "readme" href = "/virtual-list/README.md" "README (how to use it)" } }
  44. }
  45. }
  46. Style {
  47. virtualListDemo {
  48. '#vl-box' {
  49. height = '24rem'
  50. background = greyLighter
  51. }
  52. }
  53. }

Branches

Latest commits

  • 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
  • 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