feat(meta-to-blocks): lower _meta to a navigation document - #38
feat(meta-to-blocks): lower _meta to a navigation document#38pyramation wants to merge 1 commit into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Review complete. No issues found — approved ✅. This PR introduces an end-to-end navigation feature across three packages plus docs and demos.
Reviewed commit: 0cb7e50 |
Summary
A console needs a way in before it needs screens, and the table list is already in
_meta. This adds the one part of auto-admin that needs no query runtime: navigation as a document.The lowering is a pure function in
meta-to-blocks(src/nav.ts), so a sidebar follows the database instead of a hand-maintained route list:NavGroupperschemaName(titleized,countof its links), orflat: truefor a single group;table.relations.manyToMany[].junctionTable.name, not by name heuristics — unlessincludeJunctionTablesis set;href,label,tables/omitTables,tableOrder,schemaLabels, and per-table overrides (label,href,icon,omit) are the customization surface; the default route is`/${table.name}`.blocks-uiregisters the three types.NavLinkis a plain anchor and takes its current state from the scope rather than a second source of truth:A node with a
clickaction getspreventDefault+onAction, so a host keeps client-side routing either through actions or by overridingNavLinkwith its framework'sLink.Nav,NavGroup,NavLinkjoinBLOCK_NODE_TYPESinblocks-schema, which is additive — the vocabulary is a superset, so existing documents and registries are unaffected.Rendering
/blocks/documentsgains a "Navigation from database metadata" section: six fixture tables across two schemas render as a live sidebar next to the generated JSON, with ascope.pathnameselector so the active-link behavior is visible. The join table (post_categories) is absent from the nav by construction. Docs links are hash-based to keep the static-page reference check satisfied; the code sample shows the real/admin/:schema/:tableroute builder.Verification
pnpm checkandpnpm build:pagespass. 8 new tests (5 lowering, 3 rendering).Link to Devin session: https://app.devin.ai/sessions/027937d092794c92a31c6ee49c513f59
Requested by: @pyramation