npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@refinist/tw4-config

v1.0.0

Published

Tailwind CSS v4 utility preset for mobile and modern web development.

Readme

🎨 @refinist/tw4-config

npm downloads/month size

English Documentation | 中文文档

Tailwind CSS v4 utility preset,用于移动端和现代 Web 开发。

[!TIP] 使用这个库时,请先到官网安装 Tailwind CSS

✨ 特性

🔄 1. 增强的 flex-1 类

改进了 flex-1 类的实现,解决了内部内容宽度/高度过宽导致容器被撑开的问题:

.flex-1 {
  flex: 1;
  min-width: 0; /* 防止水平方向内容撑开 */
}

.flex-col > .flex-1 {
  min-width: auto;
  min-height: 0; /* 防止垂直方向内容撑开 */
}

📱 2. 移动端安全区域支持

提供完整的 safe-area-inset-bottom 解决方案,兼容 Android 和 iOS 设备:

🔧 基础类:

  • saib-pb - 底部安全区域内边距
  • saib-mb - 底部安全区域外边距
  • saib-b - 底部安全区域定位距离

⚡ 动态类(支持任意值和裸值):

  • saib-pb-* - 底部内边距 + 安全区域,如saib-pb-2(padding-bottom: calc(var(--saib-spacing) * 2) /* 0.5rem = 8px */), saib-pb-[24px]
  • saib-mb-* - 底部外边距 + 安全区域,如saib-mb-2(margin-bottom: calc(var(--saib-spacing) * 2) /* 0.5rem = 8px */), saib-mb-[24px]
  • saib-b-* - 底部定位 + 安全区域,如saib-b-2(bottom: calc(var(--saib-spacing) * 2) /* 0.5rem = 8px */), saib-b-[24px]
<!-- 基础使用 -->
<div class="saib-pb-2">底部内边距 8px + 安全区域</div>
<div class="saib-mb-2">底部外边距 8px + 安全区域</div>
<div class="fixed saib-b-2">底部定位 8px + 安全区域</div>

💡 更多想法,正在路上...

📦 安装

# npm
npm install @refinist/tw4-config

# pnpm
pnpm install @refinist/tw4-config

# yarn
yarn add @refinist/tw4-config

# bun
bun add @refinist/tw4-config

如果是基于 weapp-tailwindcss 的 uni-app/taro 微信小程序项目,还需要安装 weapp-tailwindcss

pnpm install weapp-tailwindcss

🚀 使用

Web / H5

先引入 Tailwind CSS,再引入本包:

/* app.css */
@import 'tailwindcss';
@import '@refinist/tw4-config';

如果不想使用 Tailwind Preflight,可以使用 Tailwind 的拆分入口,并省略 preflight.css

/* app.css */
@layer theme, base, components, utilities;
@import 'tailwindcss/theme.css' layer(theme);
@import 'tailwindcss/utilities.css' layer(utilities);
@import '@refinist/tw4-config';

微信小程序(如 uni-app)

先引入 weapp-tailwindcss(weapp-tailwindcss 更多用法请查阅 https://tw.icebreaker.top)再引入专门的 weapp-tailwindcss 入口:

/* app.css */
@import 'weapp-tailwindcss/index.css';
@import '@refinist/tw4-config/weapp-tailwindcss';
// vite.config.ts
import path from 'node:path';
import uni from '@dcloudio/vite-plugin-uni';
import tailwindcss from '@tailwindcss/postcss';
import { defineConfig } from 'vite';
import { WeappTailwindcss } from 'weapp-tailwindcss/vite';

export default defineConfig(() => {
  const isH5 = process.env.UNI_PLATFORM === 'h5';
  return {
    plugins: [
      uni(),
      WeappTailwindcss({
        disabled: isH5,
        rem2rpx: true,
        px2rpx: {
          rootValue: 1,
          minPixelValue: 2
        },
        cssPreflight: false,
        cssEntries: [path.resolve(import.meta.dirname, './src/app.css')]
      })
    ],
    css: {
      postcss: {
        plugins: [tailwindcss()]
      }
    }
  };
});

🌍 兼容性说明

  • ✅ 安全区域功能兼容支持 constant()env() 的现代浏览器
  • 🤖 Android 设备无安全区域时会使用 0.1px 的默认值确保计算正确
  • 🔧 所有功能都基于现代 CSS 特性,建议在支持 CSS 自定义属性的浏览器中使用

📄 License

MIT

Copyright (c) 2025-present, REFINIST