Skip to content

feat(site): add util reference pipeline#537

Draft
decepulis wants to merge 1 commit intomainfrom
feat/util-reference-pipeline
Draft

feat(site): add util reference pipeline#537
decepulis wants to merge 1 commit intomainfrom
feat/util-reference-pipeline

Conversation

@decepulis
Copy link
Collaborator

@decepulis decepulis commented Feb 16, 2026

Note

Marked as draft while under human review. I'm mostly worried about the mdx. Did we document the right APIs? If so, how's the copy? How are the examples?

Summary

Adds a complete API reference documentation system for non-component exports — React hooks, HTML controllers/mixins, factory functions, selectors, contexts, and utilities. This complements the existing component reference pipeline and brings full API documentation coverage.

Util auto-discovery builder

  • Convention-based scanner in site/scripts/api-docs-builder/src/util-handler.ts
  • Classifies exports by naming convention (use* → hook, *Controller → controller, create* → factory, select* → selector) or @public JSDoc tag
  • Extracts type information via typescript-api-extractor with raw TS AST fallback
  • Generates JSON to generated-util-reference/ consumed by new Astro components
  • Handles overload collapsing (identical return types → widest signature kept)

Framework metadata

  • Framework-specific entries (hooks → react, controllers → html) serialize frameworks: ['react'] or frameworks: ['html'] in JSON
  • Framework-agnostic entries (selectors, createSelector) omit the frameworks field entirely, meaning they apply to all frameworks
  • Slug collisions use the actual framework prefix (${framework}-${slug}) instead of hardcoded html-

Reference pages (29 util APIs documented)

  • ReactusePlayer, useMedia, useStore, useButton, useSelector, useSnapshot, useMediaRegistration, usePlayerContext, createPlayer, mergeProps, renderElement
  • HTMLPlayerController, StoreController, SnapshotController, playerContext, PlayerMixin, ContainerMixin, ProviderMixin, createPlayer
  • SelectorscreateSelector, selectBuffer, selectControls, selectFullscreen, selectPiP, selectPlayback, selectSource, selectTime, selectVolume

Astro components

  • UtilReference.astro — main component, handles single/multi-overload rendering
  • UtilParamsTable.astro — parameter table (reuses PropRow)
  • UtilReturnTable.astro — return value table with object field expansion
  • Renames ApiReference.astroComponentReference.astro to disambiguate

Other changes

  • Interactive demos for key utils (usePlayer, useStore, useMedia, createPlayer, mergeProps, etc.)
  • Sidebar updated with Selectors, Hooks & Utilities, and Controllers & Mixins sections
  • remarkConditionalHeadings updated to inject <UtilReference> TOC headings
  • Controller extraction now handles single constructors (not just overload declarations), fixing the SubscriptionController warning
  • Removed unused _sourceFile parameter from getJSDocParamDescription
  • Replaced local toKebab with kebabCase from es-toolkit (already a dependency)
  • JSDoc added to package source files for richer extracted descriptions

Preview

Selectors

Hooks & Utilities (React)

Controllers & Mixins (HTML)

Test plan

  • pnpm api-docs generates 29 util JSON files with correct framework metadata
  • pnpm -F site test — all 270 tests pass (19 util-handler tests)
  • Verified create-selector.json has kind: 'factory', no frameworks field
  • Verified selector JSONs have no frameworks field (agnostic)
  • Verified React util JSONs have frameworks: ['react']
  • Verified HTML util JSONs have frameworks: ['html']
  • All files pass biome check

Closes #466

🤖 Generated with Claude Code

…s, selectors, and utilities

Introduces a convention-based auto-discovery system that generates API reference
documentation for non-component exports: React hooks, HTML controllers/mixins,
factory functions, selectors, contexts, and utilities.

The builder scans package entry points, classifies exports by naming convention
(`use*`, `*Controller`, `create*`, `select*`) or `@public` JSDoc tag, extracts
type information via typescript-api-extractor and raw TS AST, and outputs JSON
consumed by new Astro components (`UtilReference`, `UtilParamsTable`,
`UtilReturnTable`).

Key design decisions:
- Framework-agnostic entries (selectors, createSelector) omit the `frameworks`
  JSON field, meaning they apply to all frameworks
- Framework-specific entries (hooks → react, controllers → html) get
  `frameworks: ['react']` or `frameworks: ['html']`
- Slug collisions use the actual framework prefix (not hardcoded `html-`)
- Discovery casts a wide net; only exports with both generated JSON AND a
  manually-created MDX page appear in the docs
- Controller extraction handles both overload declarations and single
  constructors with a body

Also renames ApiReference → ComponentReference to disambiguate from the new
UtilReference, adds interactive demos for key utils, and updates the sidebar
with Selectors, Hooks & Utilities, and Controllers & Mixins sections.

Closes #466

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 16, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
vjs-10-demo-react Ignored Ignored Feb 16, 2026 9:19pm

Request Review

@netlify
Copy link

netlify bot commented Feb 16, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit b2421ae
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/699389e34092580008d00e91
😎 Deploy Preview https://deploy-preview-537--vjs10-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@decepulis decepulis marked this pull request as draft February 16, 2026 21:19
@github-actions
Copy link
Contributor

📦 Bundle Size Report

Package Size Diff %
@videojs/core 5.37 kB 0 B ░░░░░░░░ 0%
@videojs/element 1.60 kB 0 B ░░░░░░░░ 0%
@videojs/html 8.64 kB 0 B ░░░░░░░░ 0%
@videojs/icons 6.40 kB 0 B ░░░░░░░░ 0%
@videojs/react 8.20 kB 0 B ░░░░░░░░ 0%
@videojs/store 1.94 kB 0 B ░░░░░░░░ 0%
@videojs/utils 2.35 kB 0 B ░░░░░░░░ 0%

Total: 34.51 kB · 0 B · 0%


Entry Breakdown

Subpath sizes are the additional bytes on top of the root entry point, measured by bundling root + subpath together and subtracting the root-only size.

@videojs/core
Entry Base PR Diff %
. 2.77 kB 2.77 kB 0 B 0%
./dom 2.60 kB 2.60 kB 0 B 0%
total 5.37 kB 5.37 kB 0 B 0%
@videojs/element
Entry Base PR Diff %
. 817 B 817 B 0 B 0%
./context 823 B 823 B 0 B 0%
total 1.60 kB 1.60 kB 0 B 0%
@videojs/icons
Entry Base PR Diff %
./react 4.77 kB 4.77 kB 0 B 0%
./html 1.64 kB 1.64 kB 0 B 0%
total 6.40 kB 6.40 kB 0 B 0%
@videojs/react
Entry Base PR Diff %
. 7.67 kB 7.67 kB 0 B 0%
./audio 267 B 267 B 0 B 0%
./background 40 B 40 B 0 B 0%
./video 244 B 244 B 0 B 0%
total 8.20 kB 8.20 kB 0 B 0%
@videojs/store
Entry Base PR Diff %
. 1.29 kB 1.29 kB 0 B 0%
./html 468 B 468 B 0 B 0%
./react 199 B 199 B 0 B 0%
total 1.94 kB 1.94 kB 0 B 0%
@videojs/utils
Entry Base PR Diff %
./array 104 B 104 B 0 B 0%
./dom 684 B 684 B 0 B 0%
./events 227 B 227 B 0 B 0%
./function 197 B 197 B 0 B 0%
./object 119 B 119 B 0 B 0%
./predicate 265 B 265 B 0 B 0%
./string 110 B 110 B 0 B 0%
./style 63 B 63 B 0 B 0%
./time 478 B 478 B 0 B 0%
./number 158 B 158 B 0 B 0%
total 2.35 kB 2.35 kB 0 B 0%

ℹ️ How to interpret

Sizes are minified + brotli, measured with esbuild.
Package totals are computed as root size + marginal subpath costs.
Subpath marginal cost = (root + subpath bundled together) − root alone.

Icon Meaning
No change
🔺 Increased ≤ 10%
🔴 Increased > 10%
🔽 Decreased
🆕 New (no baseline)

Run pnpm size locally to check current sizes.

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.

Non-component API reference

1 participant