Map front door + notebook code
Transcript
Thinking19:29:32
I should look into the renderer directory to see how it's structured.
Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && ls -la && echo "---RE...19:29:32Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && ls -la && echo "---RE...Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && wc -l collections.lua...19:29:32Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && wc -l collections.lua...Thinking19:29:37
I should check REDESIGN.md sections 5 and 6 along with the relevant top sections of PLAN.md.
Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && grep -n "^#" REDESIGN...19:29:38Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && grep -n "^#" REDESIGN...Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && grep -n "^#" PLAN.md ...19:29:38Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && grep -n "^#" PLAN.md ...ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\REDESIGN.md19:29:38Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\REDESIGN.mdReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\PLAN.md19:29:38Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\PLAN.mdNow let's dig into the actual code files.
Grep^local function |^function |^collections_|^front_door_|^local FD_|^front_door\b19:29:46Output not recorded
^local function |^function |^collections_|^front_door_|^local FD_|^front_door\bGrep^local function |^function |^notebook_19:29:46Output not recorded
^local function |^function |^notebook_Thinking19:29:51
I got matches but not the actual content, so I need to re-run with the content output mode to see the full results.
Grep^local function |^function |^collections_|^front_door_|^local FD_|^front_door\b19:29:51Output not recorded
^local function |^function |^collections_|^front_door_|^local FD_|^front_door\bGrep^local function |^function |^notebook_19:29:51Output not recorded
^local function |^function |^notebook_Now let's read the full notebook.lua (it's short) and the key parts of collections.lua.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\notebook.lua19:29:56Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\notebook.luaThinking19:30:01
I notice `entry_doc_new` is called from notebook.lua but the comment suggests it's actually defined in homepage.lua for loading and stripping ::solo—I should track down its real definition there. I also need to find where `notebook_entries()` is defined, likely in works.lua or main.lua.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.lua19:30:01Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.luaGrepfunction notebook_entries|function entry_doc_new|function entry_info19:30:01Output not recorded
function notebook_entries|function entry_doc_new|function entry_infoNow let's read the notebook_column, front_items, front_modules, continue_band, entry_header, work_row, draw_cover, and collections_front functions in detail.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.lua19:30:06Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.luaReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.lua19:30:06Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.luaThinking19:30:19
This is helpful — collections_front applies a single shared scroll offset to both columns when drawing, confirming the whole page scrolls together as one view rather than the works and notebook columns scrolling independently. That settles the scroll behavior question and feeds into the side-by-side layout question too.
Now I want to trace where `scroll` actually comes from — who owns that state, who calls collections_front, and where the scrollbar itself gets drawn, since it's likely main.lua holds the scroll variable and routes it in. I should grep main.lua for collections_front, collections_draw, nav_to_path, and any scroll-related state.
Grepcollections_front|collections_draw|collections_enter|collections_invalidate|collections_hot19:30:19Output not recorded
collections_front|collections_draw|collections_enter|collections_invalidate|collections_hotGrepfunction canvas_layout|function canvas_draw|function canvas_link_at|function canvas_clickable_at|function canvas_hover|function elements_set_band|function elements_band_19:30:19Output not recorded
function canvas_layout|function canvas_draw|function canvas_link_at|function canvas_clickable_at|function canvas_hover|function elements_set_band|function elements_band_ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:30:19Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaThinking19:30:29
So scroll_y is a single shared global scroll variable used across all views, not a per-view state. I need to track down where it's defined, where the wheel input handler updates it, and where the scrollbar rendering reads it.
Grepscroll_y\s*=|local scroll_y|max_scroll\s*=|local max_scroll19:30:29Output not recorded
scroll_y\s*=|local scroll_y|max_scroll\s*=|local max_scrollGrepscrollbar|draw_scrollbar|sb_thumb|scroll_thumb19:30:29Output not recorded
scrollbar|draw_scrollbar|sb_thumb|scroll_thumbThinking19:30:37
This confirms the scrollbar is a single page-wide right-edge element drawn generically in main.lua, shared across all views via scroll_y/max_scroll — so it's main.lua's generic scrollbar logic, not anything in collections.lua.
Now I want to check how collections_enter sets `kind` around line 1253 and how it interacts with top-level state, so let me look at main.lua around 1240-1290 for the collections_enter/nav dispatch logic and search for `nav_to_path`.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:30:37Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaGrepfunction nav_to_path19:30:37Output not recorded
function nav_to_pathThinking19:30:42
I notice the notebook uses view='article' rather than 'collection', tying it to reader machinery instead of the front door/collections which use view='home'/'collection'. Now I want to read through nav_to_path in full.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:30:42Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaThinking19:30:47
I see that `show_home` is where view='home' gets set, so I should check that function along with site_debug.view() to trace this further.
Grepfunction show_home\b|site_debug\s*=|site_debug\.view|function view\(\)|view = function|\.view = function|view =\s*'home'19:30:47Output not recorded
function show_home\b|site_debug\s*=|site_debug\.view|function view\(\)|view = function|\.view = function|view =\s*'home'Grepsite_debug\s*=\s*\{|^site_debug|SITE_DEBUG19:30:47Output not recorded
site_debug\s*=\s*\{|^site_debug|SITE_DEBUGReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:30:47Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:30:47Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaThinking19:30:58
That covers Q1 and Q6 sufficiently. Next I want to check input dispatch functions for wheel, keys, and clicks, the main update() structure, mobile breakpoints, and that 200-local ceiling note, so I'll search PLAN.md, REDESIGN.md, and main.lua comments for references to "local ceiling" or "200 local".
Grep200.local|local.*ceiling|too many local|local variable limit19:30:58Output not recorded
200.local|local.*ceiling|too many local|local variable limitGrep200.local|ceiling|local variable limit|too many local19:30:58Output not recorded
200.local|ceiling|local variable limit|too many localReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:30:58Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaThinking19:31:09
Confirmed the mobile and split breakpoints, and how new shell state gets grouped into tables like NAV, shell, hp rather than new locals, similar to how the CL table groups state in collections.lua. Now I want to trace the wheel-handling code around lines 3106-3260 back to its enclosing function to identify the main input dispatch function.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:31:09Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaThinking19:31:18
I see now that there's no separate registration system for views—it's all one big update function with conditionals checking the view string throughout. I'm noticing that view=='home' seems to be reused for both the old homepage feed and the new front door, so I need to check whether the front door actually sets view to 'home' too.
Grep^function update|^local function update19:31:18Output not recorded
^function update|^local function updateReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.lua19:31:18Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\main.luaThinking19:31:26
I see the update function is one monolithic dispatch with no per-view registration—views are handled through if-checks throughout, which fully answers that question. Now I'm moving to canvas_layout, canvas_draw, canvas_link_at, and canvas_clickable_at, looking at their signatures and how hit testing handles column versus screen coordinates, plus whether multiple documents can be laid out side by side.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\canvas.lua19:31:26Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\canvas.luaReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\canvas.lua19:31:26Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\canvas.luaThinking19:31:36
I'm digging into how canvas_link_at and canvas_clickable_at work, and checking how layout_list positions elements — specifically that x/y coordinates get baked in absolutely at layout time, with only the vertical offset applied separately during drawing and hit-testing. This matters for figuring out how multiple documents could be displayed side by side, since the column position would need to be fixed when canvas_layout runs.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\canvas.lua19:31:36Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\canvas.luaThinking19:31:53
I've confirmed that canvas_link_at uses the element's x coordinate directly since it's baked in at layout time, only adding the vertical offset oy dynamically. So the horizontal position is fixed by the column_x layout parameter rather than being adjustable at runtime like the vertical offset is.
This differs from reader.lua's page mechanism, which translates the x-axis externally via layer_push around canvas_draw calls (per REDESIGN.md section 5) rather than inside canvas.lua itself. That means multiple docs could theoretically lay out side-by-side using different column_x values, but nothing currently does this — front_items/notebook_column stacks entries in a single vertical queue rather than placing documents side-by-side. I should check reader.lua directly to confirm how it wraps canvas_draw with layer_push for x-translation.
For Q3, I've already found entry_header, draw_cover, and work_row in collections.lua; now I need to check works.lua to see how the action field (Read/Steam/Play) resolves for each work entry.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\works.lua19:31:53Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\works.luaGrepaction\s*=|action\.label|action\.route|action\.url|work_kind_label|function works_all|function works_by_slug|WORKS\s*=\s*\{" 19:31:53Output not recorded
action\s*=|action\.label|action\.route|action\.url|work_kind_label|function works_all|function works_by_slug|WORKS\s*=\s*\{" Thinking19:32:00
I've confirmed the action structure differs for in-app versus external links, resolved through text_link which likely calls hit() and follow() to route based on whether the target starts with '/'. I should check the follow function around line 75 in collections.lua to verify this routing logic.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.lua19:32:00Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.luaThinking19:32:07
This confirms how Q3's action-link resolution works: internal routes starting with '/' go through go(path), which sets ACT and propagates up through collections_front/collections_draw to main.lua's site_go call, while external URLs open in the browser instead. Now I'm moving to Q4 and checking positions.lua's reader_positions() function.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\positions.lua19:32:07Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\positions.luaGrepfunction reader_positions|function pos_remember|function pos_save|function pos_load|a327ex_positions19:32:07Output not recorded
function reader_positions|function pos_remember|function pos_save|function pos_load|a327ex_positionsThinking19:32:16
This confirms positions.lua stores a Lua table keyed by slug, with each record holding element index, line index, page, page count, title, and place label plus timestamp. I trace how continue_items() in collections.lua pulls this via reader_positions(), which wraps pos_load to read either the desktop file or the web storage key.
Now I want to check reader.lua around lines 305-380 for pos_remember, since that's likely what triggers saving positions (probably on reader_leave), to cite where remembered positions actually come from.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\reader.lua19:32:16Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\reader.luaNow let's look at homepage.lua entry_doc_new, and the untitled feed to compare with notebook selection logic, plus works.lua notebook_entries/entry_info for index item fields.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\homepage.lua19:32:21Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\homepage.luaGrepfunction works_init|W\.entries|W\.entry\[|untitled|function notebook_entries|function entry_info19:32:21Output not recorded
function works_init|W\.entries|W\.entry\[|untitled|function notebook_entries|function entry_infoThinking19:32:28
Confirmed entry_doc_new is defined at homepage.lua:380 as the shared loader used by the front door, collections, and notebook — one function serving three consumers, which directly answers how an entry's document gets built. Now I want to check works.lua:240-300 for the full index item fields, id numbering scheme, untitled flag detection, and whether titled posts still get numbered ids.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\works.lua19:32:28Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\works.luaThinking19:32:39
This confirms notebook_entries comes from filtering the index for posts, stories, or prototypes marked untitled, preserving the index's original newest-first order when building W.entries.
Each entry record stores slug, id, date, tags, words, and title, with newer/older links determined purely by array position rather than any stored flag. I notice essays (titled posts) don't include an id field in their W.essays row — just slug, title, date, and words — which raises the question of whether titled posts even carry an id in the underlying index data, so I need to check main.lua or the content converter for where `.id` gets assigned.
Grep\.id\s*=|entry_info\(|for i, e in ipairs\(index\)|assign.*id|\bid\s*=\s*i\b19:32:39Output not recorded
\.id\s*=|entry_info\(|for i, e in ipairs\(index\)|assign.*id|\bid\s*=\s*i\bGrep\bid\b19:32:39Output not recorded
\bid\bThinking19:32:48
I see that `e.id` comes straight from the index entries built by the converter rather than being computed in main.lua or works.lua. Now I want to check homepage.lua around lines 480-560 to see how it builds the unified feed model, since that's where I can confirm whether the dark-theme feed includes both messages and posts, titled and untitled alike.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\homepage.lua19:32:48Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\homepage.luaReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\homepage.lua19:32:48Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\homepage.luaThinking19:33:07
This confirms the homepage builds its unified feed from the entire index — every item type (posts, untitled posts/messages, stories, logs) — with the `untitled` flag controlling inline vs row display rather than excluding anything, and each item's id maps directly from `e.id`.
But this raises the question of whether titled posts (essays) actually carry an id in the underlying data, or if that field is only populated for untitled ones. I should check data/index.lua for a titled entry to see if it has an id field.
Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && grep -n "untitled" to...19:33:07Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer" && grep -n "untitled" to...Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\data" && head -c 2000 ind...19:33:07Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\data" && head -c 2000 ind...Thinking19:33:13
I see the id field is actually global across the whole index, not just for untitled posts—log entries have ids too. Now I want to check whether titled posts (type=post, not untitled) also carry an id alongside their title.
Bashcd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\data" && grep -o '{sectio...19:33:13Output not recorded
cd "C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\data" && grep -o '{sectio...Thinking19:33:27
So titled essays also carry an id in the index, meaning ids are shared globally across all item types rather than being exclusive to untitled entries — a solid finding for Q5. Now I'm looking at how works.lua builds the W.essays rows to see how this interacts with that logic.
I want to check the mobile stacking behavior more closely — in narrow non-mobile mode covers appear as a row using larger 140x196 thumbnails, while true mobile stacks the work_row full width. Let me read further into collections.lua, from around line 527 to 560, to nail down this distinction.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.lua19:33:27Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.luaThinking19:33:37
Below the split breakpoint, covers render in a single row that clips extra items when they overflow the width rather than wrapping — a quirk worth flagging — with the notebook column full-width beneath. On mobile it switches to a full-width stacked row layout instead.
Now I want to check elements.lua for the pick_text_font/pick_text_color functions and canvas.lua's layout_list signature, since Q2 specifically asks for the exact functions and signatures involved in layout, draw, and hit-testing.
Grep^local function layout_list|^function layout_list|^local function layout_el|^function layout_el19:33:37Output not recorded
^local function layout_list|^function layout_list|^local function layout_el|^function layout_elGrepfunction pick_text_font|function pick_text_color|kind == 'meta'|kind == 'title'|mono = true|current = true19:33:37Output not recorded
function pick_text_font|function pick_text_color|kind == 'meta'|kind == 'title'|mono = true|current = trueThinking19:33:58
I've traced layout_list as the actual per-element layout recursion invoked by canvas_layout, and identified pick_text_font and pick_text_color as the functions resolving mono/meta/tag/current run styles used by header_el and entry_header.
Checking the "documents side by side" question now — reader.lua's spread rendering is one document split across two windows, not two separate documents, and neither collections.lua nor notebook.lua currently lays out multiple docs side-by-side (front_items stacks them vertically at one x). Mechanically it looks feasible since canvas_layout/canvas_draw/canvas_link_at take explicit column_x/doc parameters with no shared state blocking multiple calls per frame, but this path isn't currently exercised.
Actually, digging into canvas.lua, I find a real obstacle: spoiler_reveal_doc is a module-global overwritten on every canvas_draw call, so drawing doc A then doc B in the same frame leaves it pointing at doc B, meaning a spoiler-reveal click test afterward would target the wrong document for A. That's worth flagging as a genuine blocker for side-by-side multi-doc rendering. I'm also checking elements_set_band/elements_band_hits, reader.lua's page-culling band mechanism which is global rather than per-document — that could conflict for a two-doc spread, but since it's only invoked by reader.lua and not by collections.lua's plain scroll draw, it's likely not relevant here.
Other module-level globals like hover_link look fine since they're per-frame single values, and I confirm main.lua's `doc` singleton used for hit-testing in update() is specific to the article view, not to collections.lua's own per-item hit-testing via canvas_link_at(it.doc, ...), which already works correctly across multiple docs in a vertical list.
So a side-by-side layout should work similarly to the existing precedent of drawing multiple docs in sequence — just need distinct x-offsets per doc's column, since layout already bakes x. The real obstacle remains the spoiler_reveal_doc singleton at line 537, so I should check canvas.lua for any other similar "= doc" module-level assignments before draw functions.
Grep^spoiler_reveal_doc|^local spoiler_reveal_doc|spoiler_reveal_doc\b19:33:58Output not recorded
^spoiler_reveal_doc|^local spoiler_reveal_doc|spoiler_reveal_doc\bThinking19:34:09
I've confirmed spoiler_reveal_doc is a genuine global variable, not local, which creates a real singleton-per-frame issue for side-by-side multi-doc rendering—a "reveal all" click in one doc's spoiler would flip the flag based on whichever doc was drawn last that frame.
I also verified the front door's input handling has no formal registration system, just an if/elseif chain baked into the monolithic update and draw functions. I think I have enough material now, though I want to quickly check the collections_invalidate and collections_enter functions to understand the cache invalidation mechanism and what state the front door keeps.
ReadC:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.lua19:34:09Output not recorded
C:\Users\a327e\Desktop\a327ex\a327ex-site\renderer\collections.luaI now have thorough coverage of all seven questions. Let me compile the final report.
ccd session: mark_chapter{"title": "Writing final report"}19:34:13Output not recorded
{"title": "Writing final report"}Front door / notebook / collections map
1. Front door structure
- Entry point:
collections_front(scroll)—collections.lua:483-550. Called frommain.lua:3811only whenview == 'home' and prose.treat.next(i.e. Reading theme); the plain-themeview == 'home'branch (main.lua:3818-3822) instead callshomepage_build/homepage_draw. So the front door literally rides the sameviewstate as the old feed homepage, gated by the theme flag — there's no separateviewvalue for it. - Layout split:
collections.lua:489-512.split = (cssw >= SPLIT_BP) and not mobilewithSPLIT_BP = 1024(collections.lua:35). When split:lw = floor((w-GAP)*0.38),rw = w-GAP-lw,rx = x+lw+GAP— works column 38%, notebook column 62%,GAP = px(32)(collections.lua:34,494-496). - Below 1024 (
collections.lua:514-549): one column; ≥768 (mobile==false) shows a single row of 140×196 covers (clipped, not wrapped, when it overflows —if cx+cw > x+w then breakatcollections.lua:532) then the notebook column below; below 768 (mobile) work rows stack full-width, then the notebook column. - Scrolling: it is ONE tall scrolling view. Both columns receive the identical
oy = -(scroll or 0)(collections.lua:488,498,509,510) — there is no independent per-column scroll. The offset itself is the single globalscroll_ylocal inmain.lua:360, shared by every scrolling view (home/collection/article);collections_front(scroll_y)is simply called with it (main.lua:3811). Max extent is written back to the sharedmax_scroll(main.lua:3813). The scrollbar is not drawn by collections.lua at all — it's the site-wide right-edge bar:scrollbar_geom()(main.lua:2457) + draw atmain.lua:3881-3882and drag/click handling atmain.lua:3217-3227, all keyed off the samescroll_y/max_scroll. - State table:
CL(collections.lua:24-32) —kind,slug(current collection page),chip/cell(experiments/logs filters),hot(clickable-under-cursor flag main.lua reads for the hand cursor,main.lua:3136),fd = {w, items}(front-door notebook-column item cache),ch(per-work chapter-list cache). - Top-level functions (one-line purposes),
collections.lua:collections_hot()(51) — a clickable is under the cursor this frame.entry_header(rec,x,y,w)(227) — draws a notebook entry's id/date/tags header line.work_row(w0,x,y,w)(258) — one Works-column row (cover, title, meta, action).continue_items()(291) /continue_band(x,y,w,items)(312) — gather and draw the Continue band.front_modules(x,y,w)(351) — Essays/Experiments/AI Logs "newest two" modules.front_items(rx,rw)(418) — cached slice of the newestFRONT_N=60notebook entries.notebook_column(x,y,w,oy)(429) — draws the notebook column (headers + lazily-built bodies).collections_front(scroll)(483) — builds/draws the whole front door, returnsroute, bottom.draw_works/draw_work/draw_essays/draw_experiments/draw_logs(564,611,723,764,836) — the five collection pages.collections_enter(kind,slug)(943),collections_kind()(948),collections_draw(scroll)(950),collections_invalidate()(968).
2. How entry bodies are drawn at an offset
- Building:
entry_doc_new(slug)—homepage.lua:380-392. Loadsdata/<slug>.luaviacanvas_load, strips::soloelements. Comment athomepage.lua:377-379: "GLOBAL because the front door and the notebook (collections.lua / notebook.lua) build the same entries at their own widths — one loader, three consumers." - Layout to a width:
canvas_layout(doc, column_x, column_w, top_y)—canvas.lua:374-380, which callslayout_list(doc.elements, column_x, w, top_y or 0, nil)(canvas.lua:231islayout_list's definition).column_xis baked into every element's.xat layout time — there is no runtime x-parameter afterward. - Drawing at (x,y):
canvas_draw(layer, doc, oy)—canvas.lua:536-539. Only a vertical offsetoyis a draw-time parameter; horizontal position comes solely from the.xbaked in during layout.notebook_columncalls this per entry:canvas_layout(d, x, w, 0)thencanvas_draw(ui_layer, it.doc, cs)wherecs = y + oy(collections.lua:452,459). - Hit-testing:
canvas_link_at(doc, oy, px, py)(canvas.lua:732-750) andcanvas_clickable_at(doc, oy, px, py)(canvas.lua:638) both compare the mouse's screenpx,pydirectly againstel.x(absolute/baked) plusel.y + oy. There is no separate column→screen translate step for x, andoyis the only offset argument — same patterncanvas_code_at,canvas_details_at,canvas_details_body_atuse.notebook_columncallscanvas_link_at(it.doc, cs, mx, my)with raw mouse coords (collections.lua:465). - Contrast with the reader: REDESIGN.md §5 (
reader.lua) additionally translates the x axis vialayer_pushper page and shifts hit-tests by subtractingdx(reader_mouse), because it shows several windows onto one document. Plaincanvas.luahas no such x-translate primitive — canvas.lua'soycovers only vertical shift. - Side-by-side today: mechanically possible, not exercised. Nothing in
canvas_layout/canvas_draw/canvas_link_at/canvas_clickable_atprevents laying out two different docs at two differentcolumn_xvalues and drawing/hit-testing each with its ownoyin one frame (notebook_columnalready loops and lays out/draws multiple different documents per frame today, just stacked vertically at onex, budgeted atbudget = 2new layouts/frame —collections.lua:441,449-457). The one real obstacle:canvas_drawsets a module-globalspoiler_reveal_doc = doc(canvas.lua:537, nolocal) — drawing doc A then doc B in the same frame leavesspoiler_reveal_docpointing at B, so a spoiler "reveal all" hit-test (canvas.lua:460-462) after both draws would target the wrong document if A also has spoilers.
3. Entry header + work rows
- Notebook entry header:
entry_header(rec,x,y,w)—collections.lua:227-251(front-door instance) draws the gold-mono#idlink (hit+followto/posts/<slug>), a middot, the date, and truncated tags. The notebook's own paginated-document version isheader_el(rec)—notebook.lua:29-41, which returns a text element with runs styled{mono=true, current=true}(id),{meta=true, dim=true}(date),{tag=true, dim=true}(tags) — resolved bypick_text_font/pick_text_color(elements.lua:90,119). - Typographic cover:
draw_cover(x,y,w,h,title)—collections.lua:171-223. No cover art exists; picks the largest font from{h1,h2,ITEM,UIB,META}that fits the box, falls back to a character-level word-break for narrow covers (the 64×96 work-row size), and draws a centered gold rule under the title. Used atCOVER_W,COVER_H = px(64),px(96)inwork_row(collections.lua:256,266). - Work row:
work_row(w0,x,y,w)—collections.lua:258-286. Draws the 64×96 cover, title (truncated),work_kind_label(w0.kind) .. ' / ' .. year, and the action link viatext_link(a.label, tx, ty, a.route or a.url)(collections.lua:279). The whole row is also a click target to/works/<slug>, tested withover_rectafter the inner action link's ownhit()has first refusal (commentcollections.lua:261-262). - Action resolution (Read/Steam/Play): the work's
actionfield inworks.luais either{label, route}(in-app, e.g. It Follows{label='Read', route='/stories/it_follows'}atworks.lua:42, Horse Game/Skyland{label='Play', route='/posts/...'}atworks.lua:64,69) or{label, url}(external, e.g. SNKRX/BYTEPATH{label='Steam', url='https://store.steampowered.com/...'}atworks.lua:47,52).text_link→hit→follow(url)(collections.lua:75-78) decides:url:sub(1,1)=='/'→go(url)(in-app route, returned asACTand dispatched bymain.luaviasite_go); otherwiseopen_link(url)(external browser).
4. The continue band
- Source:
reader_positions()—reader.lua:376, wrappingpos_load()(reader.lua:311-327), which readsrenderer/positions.lua(desktop, gitignored per REDESIGN.md §5) orweb_store_get('a327ex_positions')on web. Positions are written bypos_remember()(reader.lua:361-373) on every page turn, debounced bypos_save(reader.lua:329-344,SAVE_DEBOUNCE). - Reader for the band:
continue_items()—collections.lua:291-305. Iteratesreader_positions(), keeps records withv.t(title), sorts newest (ts) first, keeps at most 3. - Item shape:
{slug, title = v.t, place = v.c (chapter/month label) or nil, page = v.p, pages = v.n, ts}. On disk each record is{e=<element idx>, l=<line idx>, p=<page>, n=<page count>, t=<title>, c=<place label>, ts=<unix time>}(seepositions.luaandreader.lua:336-337,369-372).resume_route(slug)(collections.lua:307-310) mapsslug=='notebook'→/notebook, elseurl_for_slug(slug)or/posts/<slug>.
5. The notebook sequence
- Selection:
works_init(index)—works.lua:278-295— walks the wholeindex(newest-first) and, fortype in {post, story, prototype}withe.untitledtruthy, appends{slug, id=e.id, date, tags, words, title}toW.entries(works.lua:283-287); exposed asnotebook_entries()(works.lua:184, returnsW.entries). Titled posts of typepost(not inNOT_ESSAY) instead go intoW.essaysgrouped by year with only{slug, title, date, words}— noidfield carried on that row, even though the underlying index item has one (see below). - Ordering/count: newest first (index order), REDESIGN.md §6: "182 untitled posts as ONE document";
notebook.lua:47-65walksnotebook_entries()in that order, inserting a month_chapterh1 (works_month_label) wheneverrec.date:sub(1,7)changes, and anhrbetween same-month entries. - Index-item fields: from
data/index.lua(converter output), every entry — titled or not — carries{section, slug, title, date, untitled(true|nil), words, type, tags, id}, e.g. an untitled post:{..., untitled = true, ..., id = 540}and a titled essay:{slug="what-predicts-indie-success", title="...", ..., id = 454}with nountitledkey. So id numbering is global across the whole index (posts, logs, stories) and titled essays DO carry an id number, even thoughcollections.lua's Essays page/module doesn't surface it (works.lua's essay row dropsid). - Dark-theme unified feed (
homepage.lua):homepage_build(index,...)(homepage.lua:522-546) buildsfeedfrom the entireindex, every section (kind_for(e.section)), withinline = e.untitled or nildeciding whole-body vs title-row rendering (commenthomepage.lua:7-19,528-530: "posts, messages, stories and logs are one kind of thing... TITLED = a ROW... UNTITLED = INLINE"). So "all posts" under Dark = every index item (titled essays/logs/stories as rows + untitled posts inline), unfiltered by kind.
6. Routing + views in main.lua
nav_to_path(path, push)—main.lua:1296-1339. For/:show_home(np)(1302). For collection paths (COLLECTION_ROUTEtable atmain.lua:1234-1235, or^/works/): gated byprose.treat.next— falls back toshow_homeunder any other theme (main.lua:1306);/notebook→show_notebook(np)(rides the reader,view='article', not'collection'—main.lua:1266-1289);/works/<slug>→show_collection('work', slug, np); the other four →show_collection(COLLECTION_ROUTE[path], nil, np).- View representation: a single top-level local
viewstring ('home' | 'collection' | 'article' | 'search' | 'settings' | 'admin' | 'loading'), reported bysite_debug.view()→return view, (doc and doc.slug) or active_slug(main.lua:1712);site_debug.state()(main.lua:1740-1745) adds theme/top_nav/collection-kind. Front door and old feed shareview=='home', distinguished at draw time only byprose.treat.next(main.lua:3809,3818). - Input dispatch: there is no per-view registration mechanism. Everything funnels through one monolithic
function update(dt)(main.lua:2612) withif view == 'article' ...,view == 'home' ...branches inline (e.g. wheel routingmain.lua:3143-3148, text-selection dragmain.lua:3092-3107, cursor affordance includingcollections_hot()atmain.lua:3136, page-scrollbar dragmain.lua:3217-3227, keysmain.lua:3230-3250). The front door gets input "for free" because it reuses theview=='home'branches. - Mobile breakpoints:
MOBILE_BP = 768(CSS px,main.lua:133, compared aswidth < MOBILE_BP*UI_Sincompute_layout,main.lua:176) — below this the top nav collapses to the 44pxTOPBAR_Hbar + hamburger and content goes full-width (main.lua:179-182). Collections-specificSPLIT_BP = 1024(collections.lua:35) governs only the front door's two-column vs one-column switch, and is checked in CSS px (cssw,collections.lua:489-490) independent ofMOBILE_BP. - 200-local ceiling: noted explicitly at
main.lua:141-142("the main chunk is at Lua's 200-local ceiling, so new shell values ride these instead of taking a slot") next to theNAVtable (main.lua:143-168), and again atmain.lua:204for whyreader_env()is a global function rather than a local. New state for the redesign is grouped the same way collections.lua does withCL— a single table rather than new top-level locals.
7. Reusable pieces / obstacles for a "book spread" layout
- Reusable:
canvas_layout(doc, column_x, column_w, top_y)/canvas_draw(layer, doc, oy)/canvas_link_at/canvas_clickable_at(allcanvas.lua) already take an explicit per-doc x at layout time and an independent per-doc verticaloyat draw/hit-test time, with no shared mutable layout state between docs — this is the load-bearing precedent for a two/N-document side-by-side spread.notebook_column(collections.lua:429-481) is already a working "N documents laid out and drawn per frame, budgeted, cached onit.doc" loop — it would need to place items at different x columns instead of stacking them at one x + increasing y. - Reusable:
entry_doc_new(slug)(homepage.lua:380) is explicitly the single shared loader for "the front door and the notebook... at their own widths" — safe to call again for a spread's per-page slice. - Obstacle:
spoiler_reveal_docglobal singleton incanvas_draw(canvas.lua:537) — breaks correctness if two different docs with spoilers are drawn in the same frame. - Obstacle: front door's shared single
scroll_y/oy(collections.lua:488) means both columns — and any new side-by-side column — currently scroll in lockstep; independent per-column/per-page scrolling would need new state outside the sharedscroll_y. - Obstacle:
front_items/CL.fdcache keys only onw(collections.lua:418-427) — a spread with multiple simultaneous widths (e.g. two half-width pages) would collide on that cache key as written. - Obstacle: the narrow-viewport cover row (
collections.lua:528-542) silently clips overflowing covers (if cx+cw > x+w then break) rather than wrapping/scrolling — a pattern to avoid copying into a spread layout.
Obstacles / surprises
spoiler_reveal_docis a module-global incanvas.lua, not per-document — a latent bug for any simultaneous multi-doc draw (front door already draws several docs/frame vertically, so this may already be live).- Front door and the old feed homepage share one
view=='home'state, branching only onprose.treat.next— there's no dedicated "front door" view value. - The notebook itself does NOT use
collections.lua's draw path at all —/notebooksetsview='article'and hands a synthetic document to the paginated reader (show_notebook,main.lua:1266-1289); only the front door's preview of notebook entries lives incollections.lua. - Ids are global across the whole content index (titled and untitled), but
works.lua's essay-row builder drops theidfield, so collections.lua's Essays page can't currently show an essay's id even though the data has one. - The <1024px cover row hard-clips extra works instead of wrapping/scrolling them off-screen.
- Horizontal position in
canvas.luais baked in at layout time (no runtime x offset like reader.lua'slayer_push), so any spread implementation must re-layout (not just re-draw) a document if its column x changes.