perf(types): decouple useComponentProps from the component-types barrel#230
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream
6576fb8—perf(types): decouple useComponentProps from the component-types barrel (#6648)Follow-up to #227 (
7eab4bc).useComponentProps.tswas the last file still importing the../typesbarrel — kept alive only because it hosted theThemeUI/ThemeDefaults/ThemeContextDefaults/ThemeSlotOverridestypes, which reference every component's*Props.Change
src/runtime/types/theme.ts— those four definitions moved out of the composable (which may legitimately pull the barrel viaimport type * as ComponentTypes from './index').useComponentProps.ts— drops the moved block and its 3 now-unused imports;ThemeContext.defaultsre-typed toComputedRef<Record<string, Record<string, any> | undefined>>(strict shape now intheme.ts). −179 lines.types/index.ts—export * from './theme'.Theme.vue+useComponentProps.spec.ts— type imports retargeted to../types/theme(value imports stay on the composable).eslint.config.mjs— removes theuseComponentProps.tsno-restricted-importsexemption 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
ThemeDefaultsis b24ui's own 114-key registry, not upstream's — it diverges (commented-out absent components like// authForm/// blogPost/// listbox/// tree, therange // this is sliderremap, a// custom ////block foradvice/countdown/descriptionList/tableWrapper, and the deprecatednavbar*/sidebar*families). The block was moved verbatim (imports adjusted:SlotClass←./tv,* as b24ui←#build/b24ui,* as ComponentTypes←./index). Theindex↔themetype-only cycle is fine, exactly as upstream.Tests
Types-only. The
ThemeDefaults registrytype-test (every themable#build/b24uicomponent has aThemeDefaultsentry, 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
.sync/log/6576fb8….md— port rationale.sync/nuxt-ui.json— add6576fb8asport, advance cursor; reconcile prior82cd5b5→ PR chore(deps): update dependency reka-ui to v2.10.1 #229 /75348073. (6576fb8itself stayspending-merge, reconciled next port.)🤖 Generated with Claude Code
Generated by Claude Code