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

@oriole-solid/css-in-js

v0.0.1-dev

Published

The SolidJS version of @ant-design/cssinjs. High-performance CSS-in-JS library for SolidJS.

Readme

@oriole-solid/css-in-js

npm version

这是一个为 SolidJS 设计的高性能 CSS-in-JS 库。本项目旨在成为 @ant-design/cssinjs 的 SolidJS 版本,并完整复刻其核心功能与特性,为 SolidJS 开发者提供熟悉且强大的动态样式生成、主题化及 SSR 支持。

✨ 特性

  • 🚀 专为 SolidJS 打造: 充分利用 SolidJS 的响应式 API,提供极致性能。
  • 🎨 动态样式生成: 在组件中编写 CSS,库会自动处理样式的生成、注入和缓存。
  • 💡 主题化支持: 通过 Theme 对象和 createTheme 轻松创建和管理设计系统的主题。
  • ⚙️ 服务端渲染 (SSR): 内建 extractStyle 函数,方便在 Node.js 环境中提取样式,实现 SSR。
  • ⚡️ 缓存优化: 智能缓存机制,避免重复样式计算,提升渲染性能。
  • 🛠️ CSS 变量集成: 支持使用 CSS 自定义属性进行更灵活的样式定制。
  • 🔄 样式转换: 支持 transformers (例如 px2rem) 对 CSS 进行预处理。
  • 🔍 样式检查: 支持 linters 对生成的 CSS 进行检查,保证代码质量。
  • 🎬 关键帧动画: 提供 Keyframes 辅助工具,方便定义 CSS 动画。
  • 📦 上下文 API: 通过 StyleProvider 灵活配置全局或局部的样式行为。
  • 🌐 现代 CSS 支持检测: 可选的实验性功能,用于检测浏览器对 :where 等现代 CSS 特性的支持。

📦 安装

npm install @oriole-solid/css-in-js
# 或者
yarn add @oriole-solid/css-in-js
# 或者
pnpm add @oriole-solid/css-in-js

🚀 基本用法 (示例)

import { createSignal, Component } from 'solid-js';
import { createTheme, StyleProvider, useStyleRegister, Keyframes } from '@oriole-solid/css-in-js';

// 1. 创建主题 (可选)
const theme = createTheme((token) => ({
  ...token,
  primaryColor: '#1890ff',
}));

// 2. 创建样式
const useStyles = (color: () => string) => {
  const hashId = useStyleRegister({ theme, path: ['my-component'] }, () => [
    {
      '.my-component': {
        color: color(),
        padding: '10px',
        border: '1px solid lightgray',
        animation: `${spin} 2s linear infinite`, // 使用 Keyframes
      },
    },
  ]);
  return hashId;
};

// 3. 定义动画 (可选)
const spin = new Keyframes('spin', {
  '0%': { transform: 'rotate(0deg)' },
  '100%': { transform: 'rotate(360deg)' },
});


// 4. 在组件中使用
const MyComponent: Component = () => {
  const [color, setColor] = createSignal('red');
  const hashId = useStyles(color); // 传递响应式信号

  return (
    <div class={`my-component ${hashId()}`}>
      Hello Solid CSS-in-JS!
      <button onClick={() => setColor(color() === 'red' ? 'blue' : 'red')}>
        Change Color
      </button>
    </div>
  );
};

// 5. 在应用入口处包裹 StyleProvider
const App: Component = () => {
  return (
    <StyleProvider cache={createCache()} theme={theme}>
      <MyComponent />
    </StyleProvider>
  );
};

export default App;

📄 License

MIT