Repository navigation
Add the mobile vocabulary (Phase 30 slice D) - #237
Merged
Merged
Conversation
The root now grows with long content and keeps its end padding, closing slice C's long-screen gap. status-bar, home-indicator, nav-bar, tab-bar, button, list-row and sheet render from shared geometry in src/primitives.ts; the renderer reserves room for pinned chrome. The primitives join mobile-touch-target, mobile-tab-bar registers, and mobile-safe-area learns fixed, sticky and pinned bars.
The root keeps filling with a 100%-height child, pinned chrome stays in the root's column at any capture width, and sheet rows scroll instead of shrinking. Mobile rules read instances with unique ids; pinned siblings no longer count as overlaps; truncation infos cannot hide a stress clip. The discoverability guard now sees every node type.
Long nav titles truncate between actions instead of under them; right-pinned nodes measure from the root edge; only fixed-height frames clip the end-of-scroll check; a top-pinned bar over content is still an overlap; mobile rules expand instances after resolution, as the renderer does.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 30 slice D. Slice C gave a phone screen rules, but nothing to build one with: no status bar, no tab bar, no pinned positioning, and a root that rendered at a fixed height, so a long screen ended under the home indicator. This PR adds the mobile vocabulary and fixes the root render.
The root grows with its content
The document root keeps its artboard height and now grows when the content is taller: it renders
height: <H>px; min-height: max-content. Its bottom padding,safeAreaincluded, now follows the last child, and children keep their authored heights. Before this, a long screen ended inside the home-indicator inset, and sixteen 56px rows rendered 48px tall. A design that fits renders pixel-identical to before. A root child withheight: "100%"fills whatever its siblings leave, so a web page'snav + mainlayout still fills the artboard. A root that setsoverfloworminHeightkeeps the author's choice.Pinned positioning
positiongains"fixed"(pinned to the screen) and"sticky"(sticks at its offset while its container scrolls), and nodes gainbottomandrightoffsets besidexandy. Fixed offsets are measured from the root's edges, so a pinned bar stays in the screen's column in a wider browser window or a wider capture. The renderer raises the root's top and bottom padding to at least the height of any pinned status bar, tab bar or home indicator, so content never starts or ends under chrome. WithsafeAreaand a tab bar the bottom reservation is 83px (49 + 34), not 117.Seven primitives
status-barhome-indicatornav-barlargeTitle), with a back action and up to two trailing actions, each a 44×44 targettab-barstandard,floatingorfab(a raised 56px centre action)buttonprimary,secondary,ghostordestructive; 32, 44 or 52 tall bysizelist-rowsheetEach primitive takes its colours from the design tokens and falls back to neutral colours on an unthemed canvas. Labels truncate to one line with an ellipsis. Their sizes live in one module (
src/primitives.ts) that the renderer and the rules both read, so a button's height cannot differ between what is drawn and what is judged. The viewport meta tag is now emitted, so the viewer's HTML page is not zoomed out on a phone; it changes no capture.The rules learn the vocabulary
size: "sm"button (32px) is an error there by design; the defaults all pass. Nodes inside a component instance are now judged as they render, and the finding names the instance.mobile-tab-bar(new, warning). A tab bar with fewer than 2 or more than 5 tabs, a tab without a label, or a bar not pinned to the bottom.fixedandstickycontent, treats pinned chrome as a reservation, and checks bars you pin yourself. Their own content must clear the inset, and the scroll must clear them: the finding names the height of the spacer to add to your content frame. A sheet's content is never judged.buttonas the fix.emptyandmany.Spec changes
The slice D build contract and its "As built" notes in
docs/specs/PHASE-30-SPEC.mdrecord every decision the FR rows left open. Two of them change what the spec said:paddingBottom: 46, cannot pass, because padding of 32px or more renders smaller on a phone (46 renders about 12px). The documented idiom is padding under 32 plus a 34px spacer as the bar's last child.Docs
The batch_design, canvas_create, canvas_evaluate, canvas_stress and screenshot docstrings,
INSTRUCTIONS,GOTCHAS, the README and a new "Mobile vocabulary" section indocs/GUIDELINES.mdcover the primitives, pinning, the pinned-bar idiom and the rule changes. The slice C caveats about long screens are gone.test-discoverability.tshad never seenskeleton,chartor any slice D type, because a;inside a comment cut the node-type match short; it now strips comments first.Testing
test-mobile-primitives.ts(Chrome-free) covers each primitive's markup, sizes, colour defaults, the root render, positioning CSS and the reservations.test-positioning.ts(Chrome) measures pinned bars, the root render, primitive sizes at 390 and 1440 in both themes, and render invariance.test-mobile-rules.ts,test-mobile-rules-detailed.tsandtest-stress-render.tsgained the slice D rule cases.npm run test:fullpasses (111/111), andtscis clean.