Skip to content

Docs match the code: typecheck every example, check every props table - #206

Merged
lorant-one merged 1 commit into
previewfrom
docs/props-and-examples-accuracy-jm00xl
Oct 18, 2026
Merged

lorant-one merged 1 commit into
previewfrom
docs/props-and-examples-accuracy-jm00xl

Conversation

@lorant-one

Copy link
Copy Markdown
Member

Requested by Lorant · project thread

Before: nothing compiled the examples on the docs site or in the agent harness. 168 of them were wrong: Background opacities written as 0.5 on a 0–100 scale, radius="none" on Button/IconButton (the prop is corners), Timeline items in a "completed" state that doesn't exist, streaming-hook examples written against Recharts' API, Meta/Schema imported from the pre-package @/modules, OGCard instead of OgCard, missing required props, and more. 21 props tables were hand-written and could drift silently.

After: pnpm --filter @once-ui-system/docs check:docs typechecks 1,341 examples (docs previews and copyable code, fenced and inline examples in ai/rules*.md, recipes.md, layouts.md, gotchas.json, the READMEs) against the built package, and checks every PropsTable against ai/spec.json. Both pass with 0 problems, and CI runs them in the docs job before the docs build.

How:

  • apps/docs/scripts/check-examples.mjs pulls every preview={…} and code: block out of the MDX, wraps each in a TSX module and typechecks them in memory with the docs tsconfig. Names an example assumes (its data, handlers, the reader's own components) become any, so only unknown components, unknown props and wrong values fail. Unparsable notation (radius: xs | s | m) is skipped and counted.
  • apps/docs/scripts/check-props.mjs flags describe/exclude keys for props a component doesn't have, and hand-written rows whose literal values or defaults disagree with the spec. With --notes it lists hand tables that could read from the spec instead.
  • 21 hand-written tables now use component=, and HeadingNav, IconProvider, Meta, Schema and OgRoutesProvider get API tables.
  • Types that refused what the components already do are loosened: SegmentedControl onChange, StatusIndicator color, Skeleton shape, InteractiveDetails onClick and KbarItem shortcut/keywords are now optional. LetterFx charset takes a string, and CursorCard placement takes the corners its positioning code handles. These are in the CHANGELOG under Unreleased.

Checked locally: core typecheck clean, 155 test files / 1,982 tests pass, lint gate at baseline, docs typecheck and next build pass. Generated ai/ files are not committed, per AGENTS.md.


Generated by Claude Code

Two checkers in apps/docs, run in CI before the docs build:

- check-examples typechecks every preview and copyable code block on the
  docs site, the fenced and inline examples in the agent harness's rules,
  recipes and gotchas, and the READMEs, against the built package.
- check-props checks each PropsTable against ai/spec.json: describe and
  exclude keys, and hand-written rows' values and defaults.

Fixes the 168 problems they found (wrong opacity scale on Background,
radius="none" for corners, a Timeline state that does not exist, Recharts
examples on the streaming hooks, @/modules imports and more), moves 21
hand-written props tables onto the spec, and adds API tables for
HeadingNav, IconProvider, Meta, Schema and OgRoutesProvider.

Types that refused what the components already do are loosened:
SegmentedControl onChange, StatusIndicator color, Skeleton shape,
InteractiveDetails onClick, KbarItem shortcut and keywords are optional,
LetterFx charset takes a string, CursorCard placement takes corners.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01E5ivjExopsYxSMrNg18Ghm
@lorant-one lorant-one self-assigned this Oct 18, 2026
@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
core-docs Ignored Ignored Oct 18, 2026 7:19am UTC

@lorant-one
lorant-one merged commit c41438b into preview Oct 18, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 18, 2026
30 tasks done
lorant-one pushed a commit that referenced this pull request Oct 18, 2026
The docs example checker types a snippet with no Once UI import against
core, where ThemeProvider has no insets and Column no safeArea, so the
docs build on preview went red once both #204 and #206 were in.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0183UV8SQBGYKctRTFAv64N8
lorant-one added a commit that referenced this pull request Oct 18, 2026
* Accessibility drill, round 2: focus, keyboard and announcements

- Dialog and FocusTrap: Tab walks tabbables in document order and wraps;
  focus moves into a dialog when it opens.
- Select keeps an uncontrolled value and focuses its search field reliably;
  options show a visible keyboard focus.
- InfoTip and other hover triggers open with Enter and Space.
- ToggleButton defaults to type="button" with aria-pressed; Button and
  IconButton set aria-busy while loading.
- DropdownWrapper puts the button role on the element that takes focus.
- ContextMenu closes on Escape and marks disabled state.
- Feedback: danger/warning are alerts, info/success polite status.
- LinearGauge and RadialGauge are named meters with unique gradient ids.
- Reduced motion: transitions and animations end at once under
  prefers-reduced-motion; Spinner opts out as essential motion.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0183UV8SQBGYKctRTFAv64N8

* Docs: import the safe-area example's components from native

The docs example checker types a snippet with no Once UI import against
core, where ThemeProvider has no insets and Column no safeArea, so the
docs build on preview went red once both #204 and #206 were in.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0183UV8SQBGYKctRTFAv64N8

---------

Co-authored-by: Claude <[email protected]>
@lorant-one lorant-one mentioned this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants