Spaces:
Running

tfrere HF Staff Cursor commited on
Commit
39a61da
·
1 Parent(s): e9eb9ae

Split demo.html into modular CSS/JS assets

Browse files

demo.html had grown to 6477 lines with a single inline <style> (1240
lines) and a single inline <script> (4358 lines) — every change meant
hunting through one giant scrollback and risked breaking unrelated
sections. Extracted into /assets/:

styles/ 14 files, ~1280 lines: base, header, banner, layout
(incl. new section--two-col), controls, sequence,
section-{folding,umap,tree,vep,species}, recipe, sandbox,
footer
js/shared/ helpers.js (lerp, logprobRgb, renderSeq…) + config.js
(fetchConfig, loadConfig, loadGenes)
js/sections/ one IIFE per demo card: completion, vep, track, species,
folding, tokenizer, loss, data, architecture, sandbox,
umap, tree
js/ banner.js (DNA helix Canvas 2D), tabs.js (hash routing
+ bootstrap loadConfig)

Strategy: plain <script> tags, not ES modules. Each IIFE was extracted
verbatim and globals stay global — minimum behavioural risk. Migrating
to import/export is a separate refactor.

demo.html is now 918 lines of pure structure + <link>/<script> tags.
app.py mounts /assets as StaticFiles and the no-cache middleware
(previously /experiments/-only) now also covers /assets/ so Safari
doesn't serve stale CSS/JS during the design loop.

Also includes the §5 Folding two-column layout (.section--two-col):
narrative rail (eyebrow + title + lede + takeaway) sticks at 248px on
the left, demo claims the rest. Takeaway is softened to a margin-note
treatment in 2-col mode and restored to its green-bar look on mobile
where it stacks back to single-col.

Co-authored-by: Cursor <cursoragent@cursor.com>

32 files changed +5721 -5537
Files changed (32)
app.py+24-8
assets/js/banner.jsAdded+308
assets/js/sections/architecture.jsAdded+37
assets/js/sections/completion.jsAdded+337
assets/js/sections/data.jsAdded+115
assets/js/sections/folding.jsAdded+647
assets/js/sections/loss.jsAdded+163
assets/js/sections/sandbox.jsAdded+465
assets/js/sections/species.jsAdded+241
assets/js/sections/tokenizer.jsAdded+81
assets/js/sections/track.jsAdded+261
assets/js/sections/tree.jsAdded+340
assets/js/sections/umap.jsAdded+926
assets/js/sections/vep.jsAdded+274
assets/js/shared/config.jsAdded+33
assets/js/shared/helpers.jsAdded+75
assets/js/tabs.jsAdded+52
assets/styles/banner.cssAdded+92
assets/styles/base.cssAdded+26
assets/styles/controls.cssAdded+64
assets/styles/footer.cssAdded+11
assets/styles/header.cssAdded+61
assets/styles/layout.cssAdded+160
assets/styles/recipe.cssAdded+10
assets/styles/sandbox.cssAdded+177
assets/styles/section-folding.cssAdded+137
assets/styles/section-species.cssAdded+38
assets/styles/section-tree.cssAdded+207
assets/styles/section-umap.cssAdded+126
assets/styles/section-vep.cssAdded+32
assets/styles/sequence.cssAdded+139
demo.html
The diff for this file is too large to render. See raw diff