Skip to content

Component docs: playground.mobile for a phone-width render (AppShell's mobile layout) - #12477

Merged
josephfarina merged 5 commits into
mainfrom
cli-playground-phone
Nov 18, 2026
Merged

josephfarina merged 5 commits into
mainfrom
cli-playground-phone

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

A component whose layout changes at phone width had no way to say what that layout is in its doc. AppShell's mobile layout (the menu button in the top bar, the open drawer) only renders when AppShell reports a phone breakpoint, so tools that render docs server-side never see it; the theme editor's part census, which records what each part draws, misses those parts, and a theme cannot reach them by role.

playground.mobile is an optional doc-type field: the props of a second render at a phone viewport, merged over defaults. AppShell declares mobile: {mobileNav: {defaultIsMobile: true, isOpen: true}}; its playground defaults (what the docsite playground shows) are unchanged.

  • packages/cli/authoring/doctypes/base/type.ts: ComponentPlaygroundConfig.mobile?: Record<string, unknown>, documented with an example (authoring contract; typecheck:authoring passes).

  • component.doc.mjs (the component doc type's own doc): the playground description names mobile.

  • AppShell.doc.mjs: declares its phone layout.

  • Test: the contract types it, the doc type describes it, AppShell declares it and its defaults stay as they were.

  • api/theme-edit/_project.mjs reads mobile, and _parts.mjs's catalog renders it over the demo as one more census item, so the parts only the mobile layout draws are recorded.

  • docs/architecture/cli-surface.md INV7: one line naming the field.

Test plan: vitest playground-mobile.test.mjs theme-census-mobile-layout.test.mjs (4 pass), pnpm -F @astryxdesign/cli typecheck:authoring, prettier.

Scope

  • Components: ComponentPlaygroundConfig (new optional field mobile).

Phone menu links

AppShell's playground.mobile also gives its TopNav two links, so the open phone menu draws them as its own rows (TopNavItem's mode=drawer) and the census sees that placement; the theme editor uses it to keep a link colored for a dark top bar readable in the menu.

Writing rubric results

Record rubric over the one sentence added to cli-surface INV7:

  • R1 narration: present tense, states what the system does.
  • R2 research: none.
  • R3 evidence: no pull request or commit cited.
  • R4 rejected alternatives: none recorded.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none.

…th render; AppShell declares its mobile layout there
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 5:50am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 5:58 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1797c8b

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
AppShell · Storybook 98.8 kB (0) · 14.4 kB CSS (0) 1,173 (0) ✗ · ✓ · ✓
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
AppShell · Playground (neutral, light) · inheritance unknown: not found in the 5 newest reports of other pull requests before frame after frame diff frame
AppShell · Playground (neutral, dark) · inheritance unknown: not found in the 5 newest reports of other pull requests before frame after frame diff frame

Inheritance checked against the 5 newest reports of other pull requests.

Package size:

  • @astryxdesign/cli 5.38 MB packed (+536 B); no new dependencies
  • @astryxdesign/core 7.65 MB packed (+177 B); no new dependencies

API changes: cli +1 · ~0 · −0

1 API change (advisory)
Package Where Signature Usage
+ cli ./authoring · Types · interface ComponentPlaygroundConfig mobile?: Record<string, unknown> import type {ComponentPlaygroundConfig} from '@astryxdesign/cli/authoring'; const x: ComponentPlaygroundConfig = {mobile: …}

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision: ComponentPlaygroundConfig.phone is a new field on the published @astryxdesign/cli/authoring type, and no current spec decides the playground config fields or the field's name (phone, or the "mobile" wording that appShellMobile and defaultIsMobile already use). An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; as an engineering owner, the author may do so.

These need changes whatever the decision:

  • The changeset, the field's JSDoc, the component doc type's playground description and AppShell's doc comment say the theme editor's part census renders phone, but the census never reads it (packages/cli/api/theme-edit/_project.mjs copies only defaults, wrapper and overlay), so either ship the reader with a test here or drop the census claim from all four places.
  • ComponentPlaygroundConfig.phone is a public API row outside this pull request's declared scope (the title has no conventional-commit scope and the body no ## Scope section), so name it under ## Scope with Components: ComponentPlaygroundConfig.

Non-blocking: the JSDoc says values are primitives or ElementDescriptors, but its own example is a plain config object.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: playground.phone declares a phone-viewport render's props, merged over defaults: verified as a declaration (packages/cli/authoring/doctypes/base/type.ts:322-334); no code merges or renders it yet.
  • Claim: the theme editor's part census renders it: false; the census copies only defaults, wrapper and overlay (packages/cli/api/theme-edit/_project.mjs:237-245).
  • Claim: AppShell declares its mobile layout there: verified (packages/core/src/AppShell/AppShell.doc.mjs:189).
  • Claim: AppShell's playground defaults are unchanged: verified (the diff adds only phone; the new test checks it).
  • Claim: AppShell's mobile layout renders only when it reports a phone breakpoint, so server-side renders miss it: verified (AppShell.tsx:639-642, useMediaQuery.ts:87).
  • Claim: the census misses those parts: verified (_parts.mjs:188-193 renders from defaults).
  • Claim: the component doc type's playground description names phone: verified (component.doc.mjs:190).
  • Claim: the new test covers the type, the doc-type text, AppShell's value and its unchanged defaults, and passes: verified (2 of 2 pass).
  • Claim: typecheck:authoring and Prettier pass: verified.
  • Claim: the census reader ships separately: not in this repository at this head, which matches the missing reader.
  • Claim: no spec record changes: verified.
  • File .changeset/cli-playground-phone.md: false census claim.
  • File packages/cli/authoring/doctypes/base/type.ts: new field awaiting an owner decision; false census claim and the values sentence in its JSDoc.
  • File packages/cli/authoring/doctypes/component/component.doc.mjs: false census claim.
  • File packages/cli/authoring/doctypes/component/playground-phone.test.mjs: clear.
  • File packages/core/src/AppShell/AppShell.doc.mjs: declared props fit AppShell's contract; its comment repeats the census claim.

Automated review (maintainer link)

Comment thread .changeset/cli-playground-phone.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): the authoring type's playground config gains an optional, additive mobile field (named to match the existing appShellMobile and defaultIsMobile wording), so a component doc can declare a mobile-width playground render; AppShell declares its mobile layout. The authoring docs describe the field, and architecture:cli-surface INV7 names it in one line.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f0dbc71

@josephfarina josephfarina changed the title Component docs: playground.phone for a phone-width render (AppShell's mobile layout) Component docs: playground.mobile for a phone-width render (AppShell's mobile layout) Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 0a7902d

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: two fixes, both small. The field's direction is settled, since the new CLI surface sentence carries an engineering owner's /approve-spec for this head.

  • DOCS_VERSION in packages/cli/api/theme-edit/_project.mjs stays 8 although the cached component docs now carry mobile, so a project whose editor cache an earlier CLI wrote for the same Core keeps entries without it and the census never renders AppShell's mobile layout; bump it to 9, as the description, prop default and vars fields did.
  • The description says the component doc type's playground description names phone, but component.doc.mjs names mobile; update that bullet.

Non-blocking: the new INV7 sentence says "the tools that render docs read it", which is true only of the theme editor's census today; the JSDoc's "Values are primitives or ElementDescriptors" leaves out the plain config object its own example uses; and ## Writing rubric results would be complete with one line per rubric item (R1–R7), all of which find nothing in the added sentence.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: AppShell's mobile layout renders only at a phone breakpoint, so server-side doc renders miss it: verified (AppShell.tsx:639-642, useMediaQuery.ts:73-84).
  • Claim: the census missed those parts, so a theme could not reach them: verified; with the new item TopNav's mobile-bar mode and the open drawer's paint enter the census.
  • Claim: playground.mobile is an optional field holding a phone render's props, merged over defaults: verified (type.ts:322-334).
  • Claim: AppShell declares its mobile layout and its playground defaults are unchanged: verified (AppShell.doc.mjs:189, playground-mobile.test.mjs).
  • Claim: the authoring typecheck passes: verified.
  • Claim: the component doc type's playground description names phone: false; it names mobile (component.doc.mjs:190).
  • Claim: the tests cover the type, the doc-type text, AppShell's value and its unchanged defaults: verified.
  • Claim: the editor reads mobile and its catalog renders it over the demo as one more census item, so the mobile-only parts are recorded: verified on a fresh editor cache; not where an earlier CLI's cache for the same Core is reused (_project.mjs:82).
  • Claim: the CLI surface record gains one sentence naming the field: verified (cli-surface.md:169-171).
  • Claim: the test plan's four tests, the typecheck and Prettier pass: verified.
  • Claim: the scope names ComponentPlaygroundConfig: verified.
  • Release note: the field holds a second render's props merged over defaults, the census renders it, AppShell declares its mobile layout, its defaults are unchanged: verified, with the cache caveat above.
  • Writing rubric results: one sentence instead of the seven item lines (non-blocking).
  • File .changeset/cli-playground-mobile.md: clear.
  • File docs/architecture/cli-surface.md: owner-approved sentence; "the tools that render docs" is broader than the code (non-blocking).
  • File packages/cli/api/theme-edit/_parts.mjs: clear.
  • File packages/cli/api/theme-edit/_project.mjs: DOCS_VERSION not bumped (blocking).
  • File packages/cli/api/theme-edit/theme-census-mobile-layout.test.mjs: clear; it checks the catalog, not the census (non-blocking).
  • File packages/cli/authoring/doctypes/base/type.ts: values sentence (non-blocking).
  • File packages/cli/authoring/doctypes/component/component.doc.mjs: clear.
  • File packages/cli/authoring/doctypes/component/playground-mobile.test.mjs: clear.
  • File packages/core/src/AppShell/AppShell.doc.mjs: clear.

Automated review (maintainer link)

Comment thread docs/architecture/cli-surface.md Resolved
…NV7 and the field's JSDoc say what reads it and what it holds
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f061053

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one fix. The playground.mobile field, the census reader and AppShell's declaration match the INV7 sentence an engineering owner approved for this head, and the earlier cache-version and wording points are fixed.

  • The last commit deletes two current passages from docs/architecture/cli-surface.md (the bullet saying a hosted render outside a project takes the packages its root's package.json lists, with the matching clause of the enumeration bullet, and the foundation/render/client-bundle.mjs line in Owning code), so the record now contradicts spec:AST-081 FR3 and the shipped code; restore them exactly as on main, keeping only the new INV7 sentence.

Once they are restored, the description's "one line in INV7" holds as written.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: AppShell's phone layout renders only at a phone breakpoint, so server-side doc tools never see it: verified (AppShell.tsx:638-642, useMediaQuery.ts:73-89).
  • Claim: playground.mobile is an optional field holding phone-render props merged over defaults: verified (type.ts:322-334, _parts.mjs:470).
  • Claim: AppShell declares mobile: {mobileNav: {defaultIsMobile: true, isOpen: true}} and its playground defaults are unchanged: verified (AppShell.doc.mjs:189, playground-mobile.test.mjs).
  • Claim: the authoring type documents the field with an example and the authoring typecheck passes: verified (type.ts:322-334; typecheck:authoring passes).
  • Claim: the component doc type's playground description names mobile: verified (component.doc.mjs:190).
  • Claim: the tests cover the type, the description, AppShell's declaration and its unchanged defaults: verified (playground-mobile.test.mjs).
  • Claim: the theme editor reads mobile and renders it over the demo as one more census item: verified (_project.mjs:239-244, _parts.mjs:459-472, theme-census-mobile-layout.test.mjs).
  • Claim: the CLI surface record changes by one INV7 line naming the field: false (the file also loses base lines 675-682 and 782).
  • Claim: test plan (4 tests pass, authoring typecheck, prettier): verified (all pass at this head).
  • Claim: scope names ComponentPlaygroundConfig only: verified (the only public API row).
  • Claim: writing rubric over the one added INV7 sentence: incomplete (it does not cover the deleted passages).
  • Changeset: the field holds phone-render props merged over defaults, the census renders it, AppShell declares its mobile layout with unchanged defaults: verified (same evidence; the patch [feat] entry passes the changeset check).
  • File .changeset/cli-playground-mobile.md: clear.
  • File docs/architecture/cli-surface.md: finding (deleted passages).
  • File packages/cli/api/theme-edit/_parts.mjs: clear.
  • File packages/cli/api/theme-edit/_project.mjs: clear.
  • File packages/cli/api/theme-edit/theme-census-mobile-layout.test.mjs: clear (non-blocking: it asserts the catalog item, not the census output).
  • File packages/cli/authoring/doctypes/base/type.ts: clear.
  • File packages/cli/authoring/doctypes/component/component.doc.mjs: clear.
  • File packages/cli/authoring/doctypes/component/playground-mobile.test.mjs: clear.
  • File packages/core/src/AppShell/AppShell.doc.mjs: clear.

Automated review (maintainer link)

Comment thread docs/architecture/cli-surface.md Resolved
Comment thread docs/architecture/cli-surface.md Resolved
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cbd7a1d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the CI run on this head found no room under the CI ceiling and was cancelled, so its required checks have not run yet; re-run CI before this merges.

The playground.mobile field, the census reader and AppShell's declaration match the INV7 sentence an engineering owner approved for this head, and the two cli-surface passages from the last round are restored exactly as on main. One optional suggestion is inline: the field's JSDoc could say that the census renders on the server with no viewport, so the props select the phone layout themselves, as defaultIsMobile does.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: AppShell's phone layout renders only when it reports a phone breakpoint, so server-side doc tools never saw it: verified (AppShell.tsx:638-645, useMediaQuery.ts:73-89).
  • Claim: the census missed what that layout draws: verified with one nuance; the drawer and top nav were already recorded from their own entries, while TopNav's mobile-bar paint, the menu button and the drawer's contents inside AppShell were not (census built with and without the new item).
  • Claim: playground.mobile is an optional field holding the phone render's props, merged over defaults: verified (type.ts:322-334, _parts.mjs:470); the merge is one level deep.
  • Claim: AppShell declares mobile: {mobileNav: {defaultIsMobile: true, isOpen: true}} and its playground defaults are unchanged: verified (AppShell.doc.mjs:189, playground-mobile.test.mjs).
  • Claim: the authoring type documents the field with an example and typecheck:authoring passes: verified (type.ts:322-334; the typecheck exits 0).
  • Claim: the component doc type's playground description names mobile: verified (component.doc.mjs:190).
  • Claim: the tests cover the contract, the doc type text, AppShell's declaration and its unchanged defaults: verified (playground-mobile.test.mjs, 2 tests pass).
  • Claim: _project.mjs reads mobile and _parts.mjs renders it over the demo as one more census item: verified (_project.mjs:239-244, _parts.mjs:462-472, theme-census-mobile-layout.test.mjs, 2 tests pass).
  • Claim: cli-surface INV7 gains one sentence naming the field: verified (cli-surface.md:169-172; the rest of the record equals main).
  • Claim: test plan (4 tests, typecheck:authoring, prettier): verified (4 pass; typecheck exits 0; prettier reports no change).
  • Claim: the writing rubric results for the INV7 sentence: verified (present tense, no pull request, history or status text).
  • Changeset: a patch for the CLI and Core adding playground.mobile, rendered by the census, with AppShell's mobile layout declared and its defaults unchanged: verified (as above).
  • File .changeset/cli-playground-mobile.md: clear.
  • File docs/architecture/cli-surface.md: clear.
  • File packages/cli/api/theme-edit/_parts.mjs: clear.
  • File packages/cli/api/theme-edit/_project.mjs: clear.
  • File packages/cli/api/theme-edit/theme-census-mobile-layout.test.mjs: clear.
  • File packages/cli/authoring/doctypes/base/type.ts: one non-blocking wording suggestion (inline).
  • File packages/cli/authoring/doctypes/component/component.doc.mjs: clear.
  • File packages/cli/authoring/doctypes/component/playground-mobile.test.mjs: clear.
  • File packages/core/src/AppShell/AppShell.doc.mjs: clear.

Automated review (maintainer link)

* drawer open state interactive, and notes the simulation under the
* rendered component (#4983). */
appShellMobile?: boolean;
/** Props merged over `defaults` for a second render at a phone viewport

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the census, the only reader, renders this on the server with no viewport, so the phone layout appears only because these props select it (defaultIsMobile: true becomes useMediaQuery's server answer). A doc author whose component switches layout in script could declare props that rely on the viewport and get a desktop render. Consider adding: "The census renders it on the server, with no viewport, so these props select the phone layout themselves, as defaultIsMobile does."

…inks, so the census draws them in their menu placement
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1797c8b

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not finished on this head yet.

playground.mobile, the census reader and AppShell's phone-layout props match the CLI surface sentence an engineering owner approved for this head. The two TopNav links added to AppShell's props render as rows in the phone menu, so the theme editor now flags a light link on a dark top bar there and offers a fix that paints the menu; every earlier fix still holds.

  • Non-blocking: the field's JSDoc (packages/cli/authoring/doctypes/base/type.ts:322) promises "a second render at a phone viewport", but the census renders on the server with no viewport, so the props must select the phone layout themselves, as defaultIsMobile does; one sentence saying so keeps doc authors from relying on the viewport.
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: AppShell's phone layout renders only when it reports a phone breakpoint, so a server render never sees it: verified (AppShell.tsx:638-645).
  • Claim: the theme editor's census missed those parts: verified in substance; the part names existed, but what they draw in the phone layout was missing (census with and without the field).
  • Claim: playground.mobile is an optional field holding the props of a second render, merged over defaults: verified (type.ts:322-334, _parts.mjs:470; the merge is one level deep).
  • Claim: AppShell declares mobileNav: {defaultIsMobile: true, isOpen: true} and its playground defaults are unchanged: verified (AppShell.doc.mjs:191, playground-mobile.test.mjs).
  • Claim: the authoring type documents the field with an example and the authoring typecheck passes: verified (type.ts:322-333; typecheck:authoring exits 0).
  • Claim: the component doc type's playground description names mobile: verified (component.doc.mjs:190).
  • Claim: tests cover the contract, the doc type, AppShell's declaration and its unchanged defaults: verified (playground-mobile.test.mjs).
  • Claim: the editor reads mobile and its catalog renders it as one more census item: verified (_project.mjs:239-244, _parts.mjs:459-472, theme-census-mobile-layout.test.mjs).
  • Claim: the CLI surface record gains one sentence naming the field: verified (cli-surface.md:169-172, the only change against main).
  • Claim: test plan (the two test files, 4 tests; the authoring typecheck; prettier): verified, all pass on this head.
  • Claim: the scope is ComponentPlaygroundConfig's new optional field: verified (the only public API change).
  • Claim: AppShell's mobile props give TopNav two links that the open phone menu draws as drawer rows, and the census sees them there: verified (AppShell.doc.mjs:193-206, TopNav.tsx:291-313, TopNavItem.tsx:281-306; the census records top-nav-item in drawer mode).
  • Claim: the theme editor uses that placement to keep a link colored for a dark top bar readable in the menu: verified (a dark top bar with light links lists the menu link at 1:1 with a fix that paints the menu; the base lists nothing for it).
  • Claim: the writing rubric over the added record sentence finds no narration, history, status or open question: verified.
  • Changeset: patch bumps for the CLI and Core: consistent with an additive optional type field and doc data.
  • Changeset: the field holds the props of a second render at a phone viewport, merged over defaults, and the census renders it: verified, with the non-blocking viewport note above.
  • Changeset: AppShell declares its mobile layout (menu button, open drawer) and its playground defaults are unchanged: verified.
  • File .changeset/cli-playground-mobile.md: clear.
  • File docs/architecture/cli-surface.md: clear.
  • File packages/cli/api/theme-edit/_parts.mjs: clear.
  • File packages/cli/api/theme-edit/_project.mjs: clear.
  • File packages/cli/api/theme-edit/theme-census-mobile-layout.test.mjs: clear.
  • File packages/cli/authoring/doctypes/base/type.ts: non-blocking JSDoc note.
  • File packages/cli/authoring/doctypes/component/component.doc.mjs: clear.
  • File packages/cli/authoring/doctypes/component/playground-mobile.test.mjs: clear.
  • File packages/core/src/AppShell/AppShell.doc.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit f5bd0f8 into main Nov 18, 2026
84 checks passed
@github-actions
github-actions Bot deleted the cli-playground-phone branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 1797c8b3 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant