@duskmoon-dev/art-components

中文文档
0.6.4发布于 2026/11/13MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 2064

React components for @duskmoon-dev/css-art pure CSS illustrations

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Components
  4. CSS and browser contracts
  5. Development

@duskmoon-dev/art-components

React wrappers for @duskmoon-dev/css-art.

Installation

bun add @duskmoon-dev/art-components @duskmoon-dev/css-art react react-dom

Import the CSS once in your app:

@import "@duskmoon-dev/art-components/styles.css";

Usage

import { ArtMoon, ArtPlasmaBall } from "@duskmoon-dev/art-components";

export function Demo() {
  return (
    <>
      <ArtMoon crescent glow size="lg" />
      <ArtPlasmaBall defaultChecked />
    </>
  );
}

Components

  • ArtMoon
  • ArtSun
  • ArtAtom
  • ArtEclipse
  • ArtMountain
  • ArtSnowflake
  • ArtPlasmaBall
  • ArtCircularGallery
  • ArtCatStargazer
  • ArtFlowerAnimation
  • ArtColorSpin
  • ArtSynthwaveStarfield
  • ArtCsswitch / ArtCSSwitch
  • ArtSnowballPreloader
  • ArtGeminiInput

ArtCircularGalleryItem is exported as the item type for ArtCircularGallery.

ArtCircularGallery keeps its image links accessible by default. Use decorative only when the gallery is purely visual; its links are then removed from keyboard tab order. An explicit aria-hidden value on the root takes precedence.

ArtCsswitch buttons are keyboard accessible and named by default. Set decorative when the console is only an illustration; its buttons then leave the tab order. An explicit root aria-hidden value takes precedence.

ArtGeminiInput names its default + and > buttons Add and Send. When replacing either glyph with custom icon content, provide an accessible button name through beforeButtonProps or afterButtonProps if the content has none.

Most decorative components accept size="sm" | "default" | "lg"; ArtMoon and ArtSun also accept size="xl". Components forward refs to their root element, accept className, style, and DuskMoon CSS custom properties through style.

CSS and browser contracts

The wrappers supply the HTML required by CSS Art 1.21.0. They do not add JavaScript animation engines or browser polyfills. CSS art uses modern CSS; check feature support in your supported browsers, especially the following:

  • ArtCircularGallery uses CSS Motion Path, :has(), @property, and CSS Anchor Positioning. The upstream design has 20 items indexed 1–20; smaller arrays remain supported but occupy only part of that arc. An item opens its native hash-target preview when its href is omitted or points to its own ID. A custom href performs ordinary link navigation. The published CSS sets card width to 0.09 * --art-circular-gallery-size (the upstream docs token table's 0.07 differs from the shipped stylesheet). CSS Art 1.20.7 fixes native preview centering (duskmoonui#77); upgrade the CSS dependency to receive that fix. The wrapper uses upstream positioning without a local override.
  • ArtCsswitch changes its layout at viewport widths 1010, 670, 460, and 360px. These are viewport breakpoints, independent of the size prop. Its native buttons provide press feedback; app actions are consumer-owned.
  • ArtSnowballPreloader requires --art-snowball-preloader-bg to match the surrounding background so its track mask blends in. Upstream documents relative-color support as Chrome 119+, Firefox 128+, or Safari 16.4+; verify the features in your actual browser. Its snow texture loads from the URL in upstream CSS. It is decorative by default; add a separate status message when announcing loading.
  • ArtGeminiInput uses field-sizing: content for multiline growth and @property, gradients, and masks for its border. It defaults to rows={1}; callers can set rows explicitly. Give the textarea an accessible name with textareaProps={{ "aria-label": "Message" }} or an associated <label>. The Add and Send buttons have no default application action. Set afterButtonProps={{ type: "submit" }} to submit a surrounding form, or provide button callbacks. disabled disables the textarea and both actions.
<ArtSnowballPreloader
  style={{ "--art-snowball-preloader-bg": "#101827" }}
/>
<ArtGeminiInput
  placeholder="Write a message"
  textareaProps={{ "aria-label": "Message" }}
  afterButtonProps={{ type: "submit" }}
/>

Animation customization stays in CSS. Moon glow, Sun rays/pulse, Atom orbits, Eclipse layers, Mountain aurora, falling Snowflake, Cat blinking, Flower garden growth, ColorSpin rings, and Snowball orbit have no additional React activation API. ArtSynthwaveStarfield paused freezes the upstream scene animations. ArtPlasmaBall provides native checkbox state through checked, defaultChecked, onCheckedChange, and inputProps; use inputProps={{ disabled: true }} to prevent activation. Its checkbox precedes the glass ball so upstream checked/hover selectors remain effective.

Development

# Build the wrapper package
bun run build

# Run wrapper tests
bun run test

# Typecheck
bun run typecheck

版本与发布记录

@duskmoon-dev/art-components 共发布 24 个版本,首次发布于 2026/06/11;过去 12 个月发布了 24 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.6.4latest2026/11/131 天前
0.6.32026/11/122 天前
0.6.22026/11/086 天前
0.6.12026/11/086 天前
0.6.02026/11/077 天前
0.5.72026/11/077 天前

关于 @duskmoon-dev/art-components 的常见问题

@duskmoon-dev/art-components 是什么?

React components for @duskmoon-dev/css-art pure CSS illustrations

如何安装 @duskmoon-dev/art-components?

在项目目录运行 npm install @duskmoon-dev/art-components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=19.0.0)、react-dom(>=19.0.0)、@duskmoon-dev/css-art(>=1.17.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@duskmoon-dev/art-components 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@duskmoon-dev/art-components 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@duskmoon-dev/art-components 可以商用吗?

@duskmoon-dev/art-components 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@duskmoon-dev/art-components 的下载量有多少?

根据 npm 官方下载统计,@duskmoon-dev/art-components 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,064 次,日均约 69 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@duskmoon-dev/art-components 还在维护吗?

最新版本 0.6.4 发布于 2026/11/13(1 天前);至今共发布 24 个版本,其中过去 12 个月发布了 24 个;首次发布于 2026/06/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。