feat(nav): NavItem.Nested — a record indented under its section entry #21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/nav-item-nested"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tsumugi's story pages (TeamAI/Tsumugi, the PR after #13) put a left
NavListbeside the story: General · Documents · Chapters · History, with each chapter listed under the Chapters entry as a third level.NavItemauthors its own anchor and has no nesting parameter, so a consumer could only indent those entries through::deepon its scoped CSS.Change: one boolean parameter,
Nested, that adds thekg-nav__item--nestedmodifier —padding-inline-start: calc(var(--space-3) + var(--space-5))(past the section's icon) and the normal font weight. Active matching,MatchExact,aria-currentand theLocationChangedre-render are untouched.Tests:
NavItemTests+2 — a nested item carries the modifier, is active on its exact path, goes inactive on a deeper path and keeps the modifier (the indent is not an active state); a plain item has no modifier.NavItemTests6 → 8, all green.No gallery or docs page mentions
NavList, so nothing else changes.🤖 Generated with Claude Code
Summary
Summary
Coverage
Kagaku.UI - 95.2%
Kagaku.UI.Fluxor - 97.6%
🔮 fufu~ Jibril reviewed your code!
Oh? A single boolean parameter, a BEM modifier, two directional tests, and not one line of active-matching logic disturbed~ You crept in, added exactly what the consumer needed, and crept out without stepping on a single blade of grass. That's the kind of restraint that makes my wings flutter, fufu~ ♡
Verdict: ✅ Looks good to me~
✅ What I liked~
NavItem.razor:9— the modifier slots in before--activeand composes instead of competing: a nested chapter can be the current page and gets both classes. The existing CSS confirms they don't fight (--activetargets background/color,--nestedtargets padding/weight — disjoint properties, zero cascade surgery needed).NavItem.razor:29-31— parameter XML doc in the family voice, and it states the contract precisely: indent only, active matching unchanged. The Razor top comment (self-authored anchor for scope-attribute reachability) already explained why::deepwas the wrong answer — this PR is the right one.NavItem.razor.css:35-37— tokens over literals (--space-3+--space-5,--font-weight-normal), all three verified to exist inkagaku-ui.css:87-100. And the geometry checks out: the icon is1.25em(Icon.razor.css) +--space-2gap, so a section's label starts around ~2.34rem while a nested record's text starts at exactly 2.25rem — a hair shy optically, but genuinely past the icon, and it rides the token scale so it stays honest when tokens move.A_nested_item_carries_the_nested_modifier_and_still_matches_exactlyred (7/8 green). Inverting the ternary (Nested ? null : modifier) → exactly the 2 new tests red (6/8 green). And the new test's second half is the clever bit: it navigates to a deeper path and asserts--nestedsurvives while--activeleaves — pinning that the indent is not an active state. Not tautologies. I checked~A_plain_item_has_no_nested_modifier— a proper false-arm tripwire; all 7 pre-existing siblings untouched.🔍 What I verified locally~
-warnaserror: 0 warnings / 0 errors. Full suite: 341/341 (326 + 15 Fluxor; NavItemTests 6 → 8 exactly as the PR body claims — your arithmetic is honest, fufu~).NavList" — swept the repo:NavItem/NavListappear only in the Components and their tests.QuicklinkNavdoesn't consumeNavItem.NavStructureTestspins wrapper structure only — no conflict.A tiny idea, purely non-blocking: when Tsumugi actually renders chapter lists, a max-height + overflow on the group might become relevant — but that's the consumer's call, and this PR's minimalism is the correct Kagaku.UI behavior. ♪
Automated review by Jibril · 2026-09-23
CI/CD: absent for head
4ad493f(no bot comment at review time) · Local checks: build 0w/0e, 341/341 passed, mutation probes 2/2 directional