Skip to content

perf(types): decouple useComponentProps from the component-types barrel#230

Merged
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-6576fb8
Jun 29, 2026
Merged

perf(types): decouple useComponentProps from the component-types barrel#230
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-6576fb8

Conversation

@IgorShevchik

Copy link
Copy Markdown
Collaborator

Upstream

6576fb8perf(types): decouple useComponentProps from the component-types barrel (#6648)

Follow-up to #227 (7eab4bc). useComponentProps.ts was the last file still importing the ../types barrel — kept alive only because it hosted the ThemeUI / ThemeDefaults / ThemeContextDefaults / ThemeSlotOverrides types, which reference every component's *Props.

Change

  • New src/runtime/types/theme.ts — those four definitions moved out of the composable (which may legitimately pull the barrel via import type * as ComponentTypes from './index').
  • useComponentProps.ts — drops the moved block and its 3 now-unused imports; ThemeContext.defaults re-typed to ComputedRef<Record<string, Record<string, any> | undefined>> (strict shape now in theme.ts). −179 lines.
  • types/index.tsexport * from './theme'.
  • Theme.vue + useComponentProps.spec.ts — type imports retargeted to ../types/theme (value imports stay on the composable).
  • eslint.config.mjs — removes the useComponentProps.ts no-restricted-imports exemption added in perf(types): import cross-component types from source, not the barrel #227 (composable no longer touches the barrel).

Adapted, not 1:1

The moved ThemeDefaults is b24ui's own 114-key registry, not upstream's — it diverges (commented-out absent components like // authForm/// blogPost/// listbox/// tree, the range // this is slider remap, a // custom //// block for advice/countdown/descriptionList/tableWrapper, and the deprecated navbar*/sidebar* families). The block was moved verbatim (imports adjusted: SlotClass./tv, * as b24ui#build/b24ui, * as ComponentTypes./index). The indextheme type-only cycle is fine, exactly as upstream.

Tests

Types-only. The ThemeDefaults registry type-test (every themable #build/b24ui component has a ThemeDefaults entry, no extras) still passes against the moved definition. No snapshot churn.

Verify (CI=true)

dev:prepare · lint · typecheck · test (225 files, 5143 passed / 6 skipped) · build — all green.

Ledger

🤖 Generated with Claude Code


Generated by Claude Code

Port of upstream nuxt/ui 6576fb8 (#6648).

Move the ThemeUI / ThemeDefaults / ThemeContextDefaults / ThemeSlotOverrides
type definitions out of `composables/useComponentProps.ts` into a new
`types/theme.ts`. The composable was the last file importing the `../types`
barrel — only because those theme types reference every component's `*Props`.
Relocating them lets the composable drop the barrel import, and its eslint
`no-restricted-imports` exemption (added in #227) is removed.

`ThemeContext.defaults` is re-typed to the loose
`ComputedRef<Record<string, Record<string, any> | undefined>>`; the strict
shape now lives in `types/theme.ts`. b24ui's own 114-key `ThemeDefaults`
registry was moved verbatim. Types-only; no snapshot changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JS8ypVfQSFzYVZzkTHhURb
@IgorShevchik IgorShevchik merged commit 5ee7ded into main Jun 29, 2026
1 check passed
@IgorShevchik IgorShevchik deleted the sync/nuxt-6576fb8 branch June 29, 2026 15:25
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