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

theme-transition

v2.0.1

Published

提供 CSS/SCSS/Tailwind 插件的主题过渡能力,适配 weapp-tailwindcss。

Readme

theme-transition

Usage

0. Install

npm i theme-transition
yarn add theme-transition
pnpm add theme-transition

1. Import Style

Scss

@use 'theme-transition/scss/mixins.scss' as M;
// pass your theme css selector
@include M.theme-transition('[data-theme="dark"]');

Tailwindcss Plugin

Tailwind CSS v3
// tailwind.config.cjs
const { themeTransitionPlugin } = require('theme-transition/tailwindcss')

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
  plugins: [themeTransitionPlugin()],
}

or with ESM syntax:

// tailwind.config.ts
import type { Config } from 'tailwindcss'
import { themeTransitionPlugin } from 'theme-transition/tailwindcss'

export default {
  content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
  plugins: [themeTransitionPlugin()],
} satisfies Config
Tailwind CSS v4

With the new Tailwind CSS v4 tooling, plugins are registered directly from your CSS entry file via the @plugin directive:

/* tailwind.css */
@import 'tailwindcss';
@plugin 'theme-transition/tailwindcss';

To customise the plugin you can pass an options object to @plugin:

@import 'tailwindcss';

@plugin 'theme-transition/tailwindcss' ({
  zIndex: {
    ceiling: 9999,
  },
});

This works out of the box with any of the official v4 runners such as @tailwindcss/postcss or @tailwindcss/vite.

Css

in your css file.

@import 'theme-transition/css';

or in your js file.

import 'theme-transition/css'

css only .dark selector, so use scss or tailwindcss plugin

2. Import Js

import { useToggleTheme } from 'theme-transition'

const { toggleTheme, capabilities, environment } = useToggleTheme({
  isCurrentDark: () => {
    return isDark.value
  },
  toggle: () => {
    isDark.value = !isDark.value
  },
})

toggleTheme(MouseEvent)

if (!capabilities.hasViewTransition) {
  // gracefully handle browsers that do not support the API
}

console.log(environment.target)

API

export interface UseToggleThemeOptions {
  /**
   * isDark.value = !isDark.value
   * @returns
   */
  toggle?: () => void | Promise<void>
  /**
   * isDark.value
   * @returns
   */
  isCurrentDark?: () => boolean
  viewTransition?: {
    before?: () => void | Promise<void>
    /**
     * await nextTick()
     * @returns
     */
    after?: () => void | Promise<void>
    callback?: () => void | Promise<void>
  }
  duration?: number

  easing?: string
  document?: Document
  window?: Window & typeof globalThis
  animationTarget?: Element | (() => Element | null)
  fallbackCoordinates?: { x: number, y: number } | ((context: { viewportWidth: number, viewportHeight: number, target: Element | null }) => { x: number, y: number } | null | undefined)
  logger?: Pick<Console, 'warn'>
}

export interface UseToggleThemeResult {
  toggleTheme: (event?: { clientX: number, clientY: number }) => Promise<void>
  isAppearanceTransition: boolean
  capabilities: {
    hasViewTransition: boolean
    prefersReducedMotion: boolean
    supportsAnimate: boolean
  }
  environment: {
    document: Document | undefined
    window: (Window & typeof globalThis) | undefined
    target: Element | null
  }
}

fallbackCoordinates lets you define a focal point for keyboard-triggered toggles, ensuring the transition still animates even without a pointer event. Supply either a static point or a function that receives the viewport size.

capabilities exposes the detected browser support flags so you can degrade gracefully, while environment surfaces the resolved DOM handles used internally if you need to customise behaviour further.

ShowCases

https://icebreaker.top/

https://tw.icebreaker.top/

https://vite.icebreaker.top/