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

@nanarino/lit

v1.1.0

Published

[![pnpm v9](https://img.shields.io/badge/maintained%20with-pnpm%209.15-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/) [![nodejs v22](https://img.shields.io/badge/Node.js-v22.12-026e00.svg?style=for-the-badge&logo=nodedotjs)](https://nodejs.

Readme

@nanarino/lit

pnpm v9 nodejs v22

一個 @nanarino/stylus 主題的 lit 元件合集

開發

pnpm i
pnpm dev

约束

爲了可以源碼引入,不要使用路徑別名如 @

爲了在 html 内能直接引入,lit 模板内不要第三方元件如 <iconify-icon />

爲了在不安全的域下運行,不要使用安全性高的 API 如 CSS.paintWorklet

~~爲了在 win7 裏能勉强運行,lit css 模板内不要使用 chrome 109 以上的 API 如 nesting style~~

構建

pnpm build

利用

先決條件是引入 @nanarino/stylus,以 astro 為例

pnpm i @nanarino/stylus
---
import stylus from "@nanarino/stylus?url"
import ChienChiaF from "@/assets/fonts/ChienChia-F.styl?url"
---
<html lang="zh-TW">
    <head>
        <!-- 先引入樣式套件 並標記 [data-nanarino-lit-provide] -->
        <link rel="stylesheet" href={stylus} data-nanarino-lit-provide />
        <link
            rel="stylesheet"
            href={ChienChiaF}
            data-nanarino-lit-provide
            onload="document.documentElement.style.setProperty('--font-family-base', 'ChienChia-F')"
        />
        <!-- 初始化客户端 -->
        <script src="@/scripts/client/init"></script>
    </head>
    <body>
        <slot />
    </body>
</html>
pnpm install @nanarino/lit

為了減小包體積,樣式是額外注入的

實際上這裏利用的 LitElement.prototype.styles 就是原生的 shadowRoot.adoptedStyleSheets (不可用時回退)

// @/scripts/client/init
// import 立即註冊元件 作為副作用
import { NanarinoLitComponent } from "@nanarino/lit/dist/all.js"
// 或按需:
import { NanarinoLitComponent } from "@nanarino/lit/dist/base"

const provides = Array.from(
    document.querySelectorAll("link[data-nanarino-lit-provide]")
) as HTMLLinkElement[]

for (const css of provides
    .reduce(
        (rules: CSSRule[], link) => [...rules, ...(link.sheet?.cssRules ?? [])],
        []
    )
    .reverse()) {
    // 點解要用try 見 https://github.com/nanarino/lit/issues/1
    try {
        NanarinoLitComponent.adoptedStyle.insertRule(css.cssText)
    } catch (error) {
        console.warn(error)
    }
}

頁面中使用,如

<section>
    <na-pagination total="36"></na-pagination>
</section>

按需須要單獨註冊,如 import "@nanarino/lit/dist/Pagination/index.js" 以使用 <na-pagination />

避免FOUC

不只本套件,這對於所有元件適用

na-svg-icon:not(:defined) {
    opacity: 0;
}