Skip to content

P5.3 — Component override contract, styles.scope(), and classname snapshot tooling#119

Merged
dbanksdesign merged 5 commits into
mainfrom
p5.3-component-override-contract
Jul 4, 2026
Merged

P5.3 — Component override contract, styles.scope(), and classname snapshot tooling#119
dbanksdesign merged 5 commits into
mainfrom
p5.3-component-override-contract

Conversation

@dbanksdesign

Copy link
Copy Markdown
Collaborator

Summary

  • Adds styles.scope({ root, to?, layer? }, className, overrides) for proximity-correct nested theme overrides via CSS @scope, reusing existing serializeStyle, applyLayerToRules, and insertRules.
  • Ships typestyles snapshot-classnames --write and the opt-in @typestyles/no-removed-public-classname ESLint rule to guard semver-breaking semantic class renames in publishable packages.
  • Documents the two-tier override model (CSS vars first, plain CSS / @scope as escape hatches) and the public semantic class name contract across theming, components, and publishing docs.

Test plan

  • pnpm --filter typestyles test (includes scope.test.ts and snapshot-classnames.test.ts)
  • pnpm --filter @typestyles/eslint-plugin test (includes no-removed-public-classname rule fixtures)
  • pnpm --filter typestyles build (bundle size budget still passes)
  • Manual: node packages/typestyles/dist/cli/snapshot-classnames.js --root examples/design-system lists scoped semantic class names

Made with Cursor

dbanksdesign and others added 5 commits July 4, 2026 16:07
…pshot tooling

Formalize the two-tier override model in docs, add styles.scope() for nested
theme conflicts via @scope, and ship snapshot-classnames CLI plus an opt-in ESLint
rule guarding removed semantic class names in publishable packages.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Move classname snapshot scanning out of the core typestyles package so runtime
deps stay limited to csstype, and expose `typestyles snapshot` via a generic CLI
entry point for future commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
Include layer in scope rule keys to avoid sheet collisions, add a removed-variant
ESLint fixture test, and document project-level diagnostics plus static-scan limits.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dbanksdesign dbanksdesign merged commit 10edb85 into main Jul 4, 2026
7 checks passed
@dbanksdesign dbanksdesign deleted the p5.3-component-override-contract branch July 4, 2026 23:51
@github-actions github-actions Bot mentioned this pull request Jul 4, 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.

1 participant