feat: 完善 Tailwind v4 多平台 custom variant 与小程序状态伪类兼容 - #1052
Merged
Conversation
🦋 Changeset detectedLatest commit: ef3d0e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
sonofmagic
force-pushed
the
codex/platform-condition-variant
branch
from
August 6, 2026 06:16
5ee6406 to
c19e9d2
Compare
Merged
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.
变更说明
本次改动让 Tailwind CSS v4 继续作为唯一的样式生成源,并在
weapp-tailwindcss既有编译链中按目标平台处理 variant 输出,没有引入额外的 Tailwind 官方生成插件或独立 PostCSS 插件。:hover、:active、:focus、:focus-visible、:focus-within、:visited、:target、表单状态以及:open/:modal/:fullscreen等浏览器状态first、last、nth-*等结构伪类,以及 Tailwind selector 转换依赖的:is、:where、:notclassSet,模板、JS 和安全类名转换仍保持完整:active与:focus可分别通过cssOptions.cssRemoveActivePseudoClass: false、cssOptions.cssRemoveFocusPseudoClass: false显式恢复@source not inline("active:*")会在 Tailwind candidate 生成阶段全局排除类名,无法让同一份 uni-app 源码在小程序端删除、H5 端保留,因此本次实现选择在平台目标明确后处理 selector,并与 Tailwind v4 的编译结果和 AST 边界对齐。Tailwind CSS v4
@custom-variant@media语法active、focus等内置名称@custom-variant内部,或包裹整个定义,两种写法获得等价的平台输出#ifdef、#ifndef、平台别名以及多个 variant 共用条件块&:where([data-theme] *)在小程序 selector fallback 阶段被误删的问题依赖与文档
weapp-vite与wevu升级至6.19.1@custom-variant示例和小程序伪类兼容说明@weapp-tailwindcss/postcss、weapp-tailwindcss以及依赖升级测试覆盖
@weapp-tailwindcss/postcss:665 passed,3 skippedweapp-tailwindcss:3150 passed,29 skipped@custom-variant形态、内外层平台条件、H5/多小程序输出:通过git diff --check:通过行为边界
插件负责生成并转换目标端 CSS,但不会模拟浏览器交互状态。小程序需要按压或聚焦反馈时,应使用
hover-class、组件属性、事件或数据绑定 class;H5 继续使用 Tailwind 原生伪类。