Skip to content

docs: elevate the Entity class reference to peak quality#8814

Merged
willeastcott merged 1 commit into
mainfrom
docs/entity-peak-quality
May 30, 2026
Merged

docs: elevate the Entity class reference to peak quality#8814
willeastcott merged 1 commit into
mainfrom
docs/entity-peak-quality

Conversation

@willeastcott
Copy link
Copy Markdown
Contributor

Description

First page in a page-by-page effort to bring flagship API reference pages up to the standard already set by the best pages in the engine (e.g. GSplatComponent, Vec3). Entity is the pilot that locks the bar for the rest.

What changed

  • Rewrote the Entity class overview into an authored introduction rather than a bare definition:
    • the mental model — an Entity is a named node in the scene graph that gains behavior from the {@link Component}s attached to it;
    • the two facets it combines — a transform (from {@link GraphNode}) and a set of components;
    • the typical workflow — addComponent → access via the matching property → removeComponent, plus group enable/disable via GraphNode#enabled and removal via destroy;
    • tight cross-links to Component, GraphNode, AppBase#root, and the common components.
  • Added two runnable class-level @examples (create a camera entity and add it to the scene; parent/child transform inheritance).
  • Accuracy fix: findComponent() was typed {Component} but documents and can return undefined → now {Component|undefined}.

Deliberately unchanged: the 21 component accessors stay terse (they already link their component type), and the other methods (addComponent, destroy, clone, …) were already at the bar.

Verification

  • npm run lint
  • npm run docs — 0 errors, no new warnings; all new {@link}s resolve; overview renders as a bulleted list with both examples ✅
  • npm run build:types + npm run test:types

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

🤖 Generated with Claude Code

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the Entity API reference by replacing the terse class overview with a more complete conceptual introduction and examples, while also updating findComponent() documentation.

Changes:

  • Expanded Entity class-level JSDoc with workflow guidance and cross-links.
  • Added two class-level examples for camera creation and hierarchy transforms.
  • Updated findComponent() return documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/framework/entity.js Outdated
First page in a page-by-page effort to bring flagship API reference pages up to
the standard already set by the best pages (e.g. GSplatComponent, Vec3).

- Rewrites the Entity class overview into an authored introduction: the mental
  model (a scene-graph node plus a set of components), the two facets it combines
  (transform from GraphNode + components), and the typical workflow
  (addComponent / accessor / removeComponent / enabled / destroy), with tight
  cross-links to Component, GraphNode, AppBase#root and the common components.
- Adds two canonical, runnable class-level `@example`s (create a camera entity
  and add it to the scene; parent/child transform inheritance).
- Fixes an accuracy bug: `findComponent()` was typed `{Component}` but actually
  returns `null` when nothing is found (via `GraphNode#findOne`) - now
  `{Component|null}`.

The 21 component accessors are intentionally left terse, and the other methods
were already at the bar.

Verified: lint clean, docs build with 0 errors and no new warnings, build:types
and test:types pass (`findComponent(type: string): Component | null`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@willeastcott willeastcott force-pushed the docs/entity-peak-quality branch from c1f5189 to 63b8bc5 Compare May 30, 2026 17:02
@willeastcott willeastcott merged commit 23d440a into main May 30, 2026
8 checks passed
@willeastcott willeastcott deleted the docs/entity-peak-quality branch May 30, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation related enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants