feat(theme): allow replacing slot classes with a function#183
Open
IgorShevchik wants to merge 1 commit into
Open
feat(theme): allow replacing slot classes with a function#183IgorShevchik wants to merge 1 commit into
IgorShevchik wants to merge 1 commit into
Conversation
Port of nuxt/ui ea576e2f (#6562). Let a slot class be a function `(defaults) => classes` that replaces a slot's default classes (instead of merging) via :b24ui, the class prop, or app.config.b24ui: - types/tv.ts: add SlotClassReplacer/SlotClass; widen base/slots/ComponentSlots from ClassValue to SlotClass. useComponentProps.ts: same. - utils/tv.ts: rewrite tv as a Proxy (findReplacer/plainClasses/applyReplacer/ wrapSlots/extractDirectives + WideTV), preserving b24ui's twMergeConfig and b24ui?.tv config source. - tests: tv.spec.ts (verbatim) + a Button :b24ui replacer case. - playgrounds: cast forwarded props.b24ui?.root|body to ClassValue in Matrix/PlaygroundPage (nuxt+demo) now that slots accept the replacer fn. - docs: function-form note in 3.components.md (b24ui-prop section). Skipped the larger global-config/Theme-component doc restructure + the skills file (b24ui's docs/skills are structured differently). Also records the merge sha for the previous port (#182, 52367b1a) and advances the sync cursor. https://claude.ai/code/session_01Qz7EXMncvEGiCj4WbmYgJo
3 tasks
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.
Port of upstream nuxt/ui
ea576e2f—feat(theme): allow replacing slot classes with a function (#6562).Changes
A slot class can now be a function
(defaults) => classesthat replaces the slot's default classes (instead of merging) — via:b24ui, theclassprop, orapp.config.b24ui.types/tv.ts: addSlotClassReplacer+SlotClass; widenbase/slotsinTVConfigandComponentSlotsfromClassValue→SlotClass.useComponentProps.ts:ClassValue→SlotClass.utils/tv.ts: rewritetvas a Proxy (findReplacer/plainClasses/applyReplacer/wrapSlots/extractDirectives+WideTV/Widen), preserving b24ui's owntwMergeConfig(air class groups) and theb24ui?.tvconfig — the sharedconfigis reused forcreateTVand thecnMerge(...)(config)calls.test/utils/tv.spec.ts(verbatim) + a Button:b24uireplacer case (+34 across nuxt/vue).slotstoSlotClassbroke typecheck inMatrix.vue/PlaygroundPage.vue(they forwardprops.b24ui?.root|bodyinside aClassValuearray toB24Card's:b24ui). Cast those forwarded values toClassValuein nuxt + demo (dev helpers only merge strings).:b24uiexample +theme.unstyledtip in the### b24ui propsection.Deviation
Skipped upstream's larger global-config / "Theme component" doc restructure in
3.components.mdand theskills/nuxt-ui/...design-system.mdedit — b24ui's theme doc and skills (skills/b24-ui-nuxt/) are structured differently. The runtime feature + per-component note are covered.Verification (pnpm 11.5.2, gate ON)
dev:prepare · lint · typecheck (incl. docs + both playgrounds) · test (5086 passed, 6 skipped) · module build — all green.
Ledger: records the merge sha for the previous port (#182,
52367b1a) and advances the sync cursor toea576e2f.https://claude.ai/code/session_01Qz7EXMncvEGiCj4WbmYgJo
Generated by Claude Code