Spaces:
Sleeping
Sleeping
Download web/src/lib/architecture.ts from TBM99/CoverageCheck: direct link, hf CLI and curl.
- Browser
- Download file 907 Bytes
-
https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/lib/architecture.ts
- Command line
-
hf download hf://spaces/TBM99/CoverageCheck/web/src/lib/architecture.ts
-
curl -L -o architecture.ts https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/lib/architecture.ts
907 Bytes
| // The Architecture page's scroll logic (the content is architecture.json; the layouts | |
| // are the diagram components). | |
| /** Which step is being read: the last one whose top has passed the reading line (a | |
| * fraction of the scroll area's height from its top), so the step under the reader's | |
| * eyes lights its boxes up (scrollytelling: the step crossing the middle is active). | |
| * tops: each step's top relative to the scroll area, in order. -1 = none reached yet. */ | |
| export function activeStep(tops: number[], height: number, line = 0.45): number { | |
| let active = -1 | |
| tops.forEach((top, i) => { | |
| if (top <= height * line) active = i | |
| }) | |
| return active | |
| } | |
| /** A box is lit when the active step names it; with no active step nothing is dimmed. */ | |
| export function boxState(id: string, lit: string[] | null): 'lit' | 'dim' | 'plain' { | |
| if (!lit) return 'plain' | |
| return lit.includes(id) ? 'lit' : 'dim' | |
| } | |