Skip to content

docs: add SPEC.md to util and hook packages - #34

Merged
ivanbanov merged 1 commit into
mainfrom
docs/util-package-specs
Aug 11, 2026
Merged

docs: add SPEC.md to util and hook packages#34
ivanbanov merged 1 commit into
mainfrom
docs/util-package-specs

Conversation

@ivanbanov

Copy link
Copy Markdown
Member

What

Every package should carry a SPEC.md, but only the two dialog packages had one. This fills the gap for the remaining eight:

Scope Packages
Core utils controllable, overlay
DOM utils focus-trap, navigation, overlay, scroll-lock
React hooks use-focus-trap, use-scroll-lock

Approach

  • Core utils follow the behavior-contract shape of core/dialog/SPEC.md (Reference / Overview / Behavior / Constraints / Internals) plus an API table, since they're consumed as libraries.
  • React hooks follow the substrate-spec shape (Install / Usage / API), deferring behavior to their DOM counterpart and documenting only the React lifecycle.
  • Design rationale lives in each spec's Internals (Position/Why) table — the Symbol.for realm-global stores, selector-based focusability, the microtask-deferred back-guard consumption, etc. — cross-referencing the dialog spec rather than restating it.
  • Every load-bearing claim was checked against the package source; usage examples use the real APIs (e.g. isTopmostLayer(id)), matching how react-dialog wires them.

packages/react (the private Storybook host) is intentionally left without a spec.

Release

Docs only — no package changes. Ships with an empty changeset so no version bump is triggered.

Fill the SPEC.md gap for the eight packages that had none: the two core
utils (controllable, overlay), the four DOM utils (focus-trap, navigation,
overlay, scroll-lock), and the two React hooks (use-focus-trap,
use-scroll-lock). Core utils follow the behavior-contract shape; React
hooks defer behavior to their DOM spec and document their own API.

Docs only — empty changeset, no version bump.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ivanbanov
ivanbanov merged commit 8981df3 into main Aug 11, 2026
6 checks passed
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.

1 participant