@gluhar/fluid
尾风 CSS v4 插件:流体类型和间距通过 clamp(),与 设备带宽 打字法——每个设备波段一个坡道,堆放为分毫宽的查询,连续跨越波段边界.
框架-不可知:是Tailwind插件,不是Nuxt模块. @gluhar/theme 不依赖它.
使用
@import "tailwindcss";
@plugin "@gluhar/fluid" {
bands: mobile, tablet, desktop;
}
@theme {
/* min / design / max viewport, px. The LAST band listed is primary. */
--fl-band-mobile: 320 390 480;
--fl-band-tablet: 768 820 1200;
--fl-band-desktop: 1200 1600 1920;
/* Display: proportional. Plain token = primary band's design value. */
--text-5xl: 3.75rem;
--text-5xl--tablet: 2.4375rem 2.625rem 2.8125rem; /* lower base upper */
--text-5xl--mobile: 1.75rem 2.125rem 2.4375rem;
/* Body/UI: two values = linear between the band's own endpoints. */
--text-md: 1rem;
--text-md--desktop: 0.9375rem 1.05rem;
--text-md--tablet: 0.9rem 0.9375rem;
--text-md--mobile: 0.85rem 0.9rem;
}
礛 fl-text-5xl, (中文(简体) ), fl-text-md, (中文(简体) ), fl-p-4, (中文(简体) ), fl-gap-8, (中文(简体) ), fl-text-[32px], (中文(简体) ), fl-text-sm/xl, (中文(简体) ), fl-py-4/8。 。 。 .
规则
- 一旦项目使用带宽类型,使用
fl-text-*到处都是. 平面text-*获得没有斜坡的单一主值. - 永远不要把多值形式放在平地上
--text-*符号 . 尾风自己的text-*发射font-size: var(--text-*)逐字逐句,故原生用法寂灭. 插件警告 。 限制--text-<key>--<band>。 。 。 . - 使每个波段的上端点等同下个波段的下端点,因此分级在断点上没有步骤.
- 给正文/UI复制件的双值表(gentle spound); 显示大小的正文 / 三值表.
限制(已知,目前按设计)
- 间距公用设施没有被带宽——它们使用主带的窗口.
- 行高读取一次(
lineHeight: true选项),而不是每个带. - 任意价值
fl-text-[32px]决心只对主乐团.