tracker
All repositories: gitoria
4.5 KB
// pagination.hl — THE PAGINATION: "Previous 1 .. 44 45 46 .. 89 Next". Buttons for the first and last page, the current page// and its neighbours, "…" for the pages left out. Previous is missing on the first page, Next on the last. Plain Hybriel, no// script. The page reads `page` (1-based) and `pages` (how many there are) as its own members — set `pages` on the tag:// `Pagination { pages = 89 }`. USE ONE PER PAGE: a composed component's members are the page's state (COMPONENTS.md §12).// Every entry is a button (an `if` or a conditional attribute would re-create the DOM, hybriel#41); the "…" ones// only differ by class, and a click on them does nothing. Each button carries its target page in `data-page` (0 for "…"): a bound// attribute on a row follows the reassigned list (hybriel#100).// DATA OUT (ticket #16): the host hands a function, `Pagination { pages = 89 page = page onPage = goPage }`; a click (pointer or// keyboard) calls `onPage(target)` with the page it goes to — Previous / Next / a number resolved against the page shown BEFORE the// buttons change (hybriel#87: a child talks upward through a function its host gives it; the function writes the host's members).Number page = 1Number pages = 10String previousLabel = 'Previous'String nextLabel = 'Next'onPage = nullHybrid items = build(page, pages)entry(label, target, cls) {return { label = label target = target cls = cls }}// the page numbers to show: first, last, current ± 1; at either end four in a row; 0 = a gapnumbers(p, n) {want = []let i = 1while (i <= n) {let near = i == 1 || i == n || (i >= p - 1 && i <= p + 1)if (p <= 3 && i <= 4) { near = true }if (p >= n - 2 && i >= n - 3) { near = true }if (near) { want.push(i) }i = i + 1}out = []let last = 0let k = 0while (k < want.length) {let v = want[k]if (v == last + 2) { out.push(v - 1) }else if (v > last + 2) { out.push(0) }out.push(v)last = vk = k + 1}return out}build(p, n) {out = []if (p > 1) { out.push(entry(previousLabel, p - 1, 'step')) }nums = numbers(p, n)let k = 0while (k < nums.length) {let v = nums[k]if (v == 0) { out.push(entry('…', 0, 'gap')) }else { out.push(entry('' + v, v, v == p ? 'page current' : 'page')) }k = k + 1}if (p < n) { out.push(entry(nextLabel, p + 1, 'step')) }return out}show(p) {if (p < 1 || p > pages) { return }page = pitems = build(p, pages)}// Look: black, white and the greys #555 #999 #ddd #f2f2f2 (the library's base, named in shared/base.hl; README "Look"). Every colour is a semantic token// with its base value as fallback, `var(--color-…, #000)`, so a bare copy looks right and an app that declares the tokens (layouts.worldapi.org's// theme) restyles it. No frames: a border or ring only where it means something. A component's browser module// cannot import tokens itself.Style {pagination { display = 'block' }'pagination ol' { display = 'flex' flexWrap = 'wrap' gap = '.3rem' margin = '0' padding = '0' listStyle = 'none' }'pagination button' { font = 'inherit' fontWeight = '600' minWidth = '2.2rem' padding = '.35rem .6rem' color = 'var(--color-text, #000)' background = 'transparent' border = '0' borderRadius = '.4rem' cursor = 'pointer' }'pagination button:hover' { background = 'var(--color-surface, #f2f2f2)' }// a keyboard focus ring in the base grey (else Chrome draws its own coloured one — seen at 390 px in mission 005)'pagination button:focus-visible' { outline = '2px solid var(--color-accent, #555)' outlineOffset = '1px' }'pagination li.current button' { color = 'var(--color-accent-text, #fff)' background = 'var(--color-accent, #000)' border = '0' }'pagination li.gap button' { color = 'var(--color-text-muted, #555)' background = 'transparent' border = '0' minWidth = '0' padding = '.35rem .2rem' cursor = 'default' pointerEvents = 'none' }}View {pagination {nav { title = "Pagination"ol { id = "pagination-items" for (it of items) { li { class = it.cls button { type = "button" class = "quiet" 'data-page' = it.target it.label on click(e) { emit paginationGo(e) } } } } }}}}// the target is read from the clicked button FIRST (its `data-page`, written for the page shown now), then the list is rebuilt and// the host told — so neither a real click (the rebuild can run before a host's own listener) nor a script's `click()` sees another pageon paginationGo(e) {b = e.target.closest('button')to = b == null ? null : toNumber(b.getAttribute('data-page'))if (to == null || to < 1 || to > pages || to == page) { return null }show(to)if (onPage != null) { onPage(to) }}
Branches
Latest commits
- fb057680mission 044: jobs.hl imports mergeLeft (gate found it), mission file, slices benchmre
- d25bd14amission 044: sliced merge prepare + sliced collections prepare; jobs-dump old/new check + bulk fixturemre
- 633ee210mission 044: sliced table scans (slices.hl, pk-range slices) for the adult/kind/status/art/credits/details-repair queuesmre
- 6648ba44mission 042: real-browser E2E on ce6f2e0a re-vendor 69/0 at 390 + 1280mre
- 3ed3a0efmission 042: gates old/new equal (browser #41 route-table regex accepts unescaped hl:web output), real-data TTFB, E2E blocked by lisbeth lockmre
- d5b61e90LOG 042mre
- 4acdbaccmission 042: memory comparison old vs ce6f2e0a (stopped: warm VmHWM higher), reportmre
- d0f620d6mission 042: re-vendor Hybriel ce6f2e0a (plugins incl. mpackdb; bin runtime built from the same archive, git-ignored), compact=false keptmre
- 5bd14e12mission 040: theme 76f99f6 gates + E2E green; 44 px fixes (skeleton row, type-word, genre-link/pill); README, reportmre
- 77cfa45cmission 040: partial report (theme/modal/pagination re-copied, tilelist onPage, 44 px taps; gates new + E2E pending)mre
- 4b14822fe2e-theme: menu marker by colourmre
- 09780f4emission 040 WIP: theme, modal, pagination, tokens re-copied from layouts 76f99f6; tilelist uses onPage; tap sizes 44 px for tracker's own small buttons; tests/e2e-theme.mjsmre
- fb80bb8chotfix: open the 5 show stores without compaction (compact = false) — compact-on-open left another handle on stale offsets, every read gave a bare Number (hybriel mpackdb refresh after a shrink); live down 2026-10-20 05:11mre
- e00d3bf7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- a8c7f234tracker#36 (mission 039): tools/tmdb-check.hl survives a dropped connection (on Error, asked again, failed lines) and resumes with --from N; tests/tmdbcheck.mjs 6/6 against a fake TMDBmre
- 9c230516mission brief w39mre
- 3609121dmission 038 docs + report (quota stop): README/kinds.md for #43 #42 #36, STATUS, LOG; HEAD browser gate 374/8 in the in-app daily run block (hour-boundary suspected, rerun pending), other gates green; #36 real run needs TMDB_READ_TOKENmre
- a5d06e79tracker#36 (mission 038): tools/tmdb-check.hl + lib/tmdbcheck.hl — every live migrated title's migrated title + year against its TMDB entry (one GET /movie|tv/<id>?append_to_response=alternative_titles, 260 ms apart, passing failures asked once more): ok / ambiguous (one of title, year disagrees) / clear (both, or 404); read-only; token only from TMDB_READ_TOKEN; --stored = a title-only preview from the TMDB names already stored (no request). Tested against a fake TMDB (.scratch/w38/t36): 7 titles, 3 ok, 2 ambiguous, 2 clear, data unchangedmre
- 982554f3tracker#42 (mission 038): series pages — an unknown slug no longer scans every title (lib/shows.hl showBySlug: the slug map only; new titles are noted by refreshTitleCaches, which both title puts already reach): 10.7–15.7 s → 0.013 s on the real copy (the one-request-at-a-time server was blocked meanwhile); cast/crew rows take name + slug from a person-link cache (personLinkOf) instead of whole person records (SNL: 303 cast with 4,761 credits, ~49k allocations per render) — allocations per series page −5…−40 %; HTML of 20 pages identical to beforemre
- 4586b6e3docker-compose: init: true (hybriel#156)mre