This is a web viewer for event flowcharts and timelines. It's a single-page app written in TypeScript with Preact and built with Vite. Graph layout is done by dagre, and pan and zoom by d3-zoom.
The viewer doesn't include any game data. generator/ writes it from the game files: see generator/README.md.
/<Flow>shows a whole flowchart or a timeline./<Flow>/<EntryPoint>only shows the part of a flowchart that can be reached from that entry point./?q=<terms>lists every search match.
The view settings are kept in the query string: params=0, names=1 and messages=0. Only non-default values are written. node=<EventName> is the selected event, and for games with versions, version=<Version> is the version.
Old links (/viewer.html?data=..., /index.html, /search.html?q=...) still work. They get rewritten to the new URLs in the browser.
The app fetches these files, relative to its base path:
d/__INDEX__.json: the list of flows. Each entry has atypethat says whether it's a flowchart or a timeline.d/<Flow>.json: one flowchart or timelined/__MESSAGE_SEARCH__.jsonandd/__EVENT_SEARCH__.json: search indexes for message text and flowchart events. They're only fetched once you search for something.msg/<Dir>/<File>.json: message text, keyed byDir/File:label
Games with versions also have:
d/__VERSIONS__.json. If it's missing, the game is treated as having no versions.d/__CHANGES__/<Flow>.json: the events added, removed and changed between consecutive versions of a flow.
The index and __VERSIONS__.json are always revalidated. Every other data file is fetched with ?v=<token>, where the token is the index's ETag (or Last-Modified). That way, browsers pick up regenerated data even if they have older files cached.
npm ci
EVENTVIEWER_DATA_DIR=path/to/data npm run dev
npm run dev and npm run preview serve the data from EVENTVIEWER_DATA_DIR, which must be set. msg/ comes from EVENTVIEWER_MSG_DIR if it's set, and from $EVENTVIEWER_DATA_DIR/msg otherwise.
src/ is split by area:
core/- data types, fetching and plain helpers. Doesn't import anything else fromsrc/.widgets/- reusable UI components (combobox, badges, highlighting). Only importscore/.home/,search/andviewer/- the home page, the search box and results page, and the viewer, with flowcharts inviewer/flowchart/and timelines inviewer/timeline/. They can importcore/andwidgets/, but not each other orapp/. The flowchart and timeline folders don't import each other either.app/- wires everything together: page state, URLs and routing, page loading, keyboard shortcuts and the page layout.
Every folder except core/ has its own stylesheet. src/style.css imports them after src/base.css, in cascade order.
EVENTVIEWER_GAME=botw npm run build
EVENTVIEWER_GAME picks the site title and the credits on the home page. It can be botw, la, totk or oot (the default). Set it for npm run dev and npm run preview too.
To serve the site under a subdirectory instead of the domain root, set EVENTVIEWER_BASE:
EVENTVIEWER_BASE=/events/ npm run build
Then copy dist/* next to d/ and msg/.
URLs like /<Flow> only work if the server serves index.html for unknown paths. The build also writes index.html as dist/404.html, so hosts that serve 404.html for missing paths (GitHub Pages, Cloudflare Pages, Netlify) just work. For nginx:
location / { try_files $uri $uri/ /index.html; }
location ^~ /d/ { try_files $uri =404; }
location ^~ /msg/ { try_files $uri =404; }
The last two lines make missing data files return a 404 instead of the page.