@bluecateng/pelagos

中文文档
12.28.6发布于 2026/10/30ISCTypeScriptCommonJS构建来源已验证近 30 天下载 3483

UI components

原始使用文档
文档目录8 节
  1. Installation
  2. Getting started
  3. Fixed theme
  4. User-selectable theme
  5. Layout
  6. Storybook
  7. Example application
  8. Notes for AI coding agents

@bluecateng/pelagos GitHub license npm version

UI components.

Installation

npm i -S @bluecateng/pelagos

Getting started

Add the shared component styles to your application's entry .less file. Choose one theme setup below; the core and spinner theme must use the same light or dark variant.

Fixed theme

For an application that always uses one theme, import the fixed core and spinner theme files:

@import '@bluecateng/pelagos/less/core';
@import '@bluecateng/pelagos/less/core-dark'; // or core-light
@import '@bluecateng/pelagos/less/inputs';
@import '@bluecateng/pelagos/less/scrollbar';
@import '@bluecateng/pelagos/less/spinner-dark'; // or spinner-light

User-selectable theme

For runtime theme selection, import the theme and spinner bases, then bind their mixins to a root attribute. This is the setup used by the example application.

@import '@bluecateng/pelagos/less/core';
@import '@bluecateng/pelagos/less/themes';
@import '@bluecateng/pelagos/less/inputs';
@import '@bluecateng/pelagos/less/scrollbar';
@import '@bluecateng/pelagos/less/spinner';

[data-theme='light'],
[data-theme='auto'] {
    .theme-light();
}

[data-theme='dark'] {
    .theme-dark();
}

[data-theme='auto'] {
    @media (prefers-color-scheme: dark) {
        .theme-dark();
    }
}

.CssSpinner {
    .css-spinner();

    [data-theme='light'] &,
    [data-theme='auto'] & {
        animation-name: spinner-light;
    }

    [data-theme='dark'] & {
        animation-name: spinner-dark;
    }

    [data-theme='auto'] & {
        @media (prefers-color-scheme: dark) {
            animation-name: spinner-dark;
        }
    }
}

Set the attribute on the root element (<html data-theme="auto">) and update document.documentElement.dataset.theme to switch at runtime. The auto binding above follows the OS preference. Components take their colors from CSS custom properties supplied by the theme; importing core without either theme setup leaves them colorless or unstyled.

Layout

The core styles apply an opinionated reset (inside @layer pelagos): div, form, main, header, and footer default to

display: flex;
flex-direction: column;
flex: none;

Every plain div is therefore already a column flex container — lay out rows with flex-direction: row rather than adding wrapper elements to fight the default. flex: none also means children do not grow; set flex: 1 explicitly where content should fill the available space.

Storybook

For examples and documentation, please see the Storybook site

Example application

pelagos-example is a small runnable application whose examples are indexed by what each one demonstrates — including the theme switching and layout patterns described above.

Notes for AI coding agents

AGENTS.md is a compact list of the non-obvious contracts — the layout reset, theme wiring, components that clone their children, labeling rules — that agents (and humans) otherwise rediscover from source. It ships with the npm package, so it is available in node_modules at the point of use.

版本与发布记录

@bluecateng/pelagos 共发布 82 个版本,首次发布于 2022/10/19;过去 12 个月发布了 16 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
12.28.6latest2026/10/309 天前
12.28.52026/10/0930 天前
12.28.42026/09/171 个月前
12.28.32026/08/282 个月前
12.28.22026/08/152 个月前
12.28.12026/08/053 个月前

其他发布通道:alpha → 12.3.0-alpha.0。

关于 @bluecateng/pelagos 的常见问题

@bluecateng/pelagos 是什么?

UI components

如何安装 @bluecateng/pelagos?

在项目目录运行 npm install @bluecateng/pelagos,或使用 pnpm add / yarn add / bun add。

@bluecateng/pelagos 支持 TypeScript 吗?

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

@bluecateng/pelagos 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bluecateng/pelagos 可以商用吗?

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

@bluecateng/pelagos 的下载量有多少?

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

@bluecateng/pelagos 还在维护吗?

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