@galaxy-io/dls

中文文档
2.13.5发布于 2026/11/05UNLICENSEDTypeScriptES Module近 30 天下载 2505

Galaxy Design Language System

原始使用文档
文档目录5 节
  1. Install
  2. Quick start
  3. Documentation
  4. Migrating from 1.x
  5. Claude skill

@galaxy-io/dls

The Galaxy Design Language System: the one React component library for Filament, the GX app and every Galaxy React surface. Monochrome, dense, hairline-quiet; precompiled Linaria CSS read through CSS custom properties, so a theme switch never re-renders the app.

NPM Version

Install

pnpm add @galaxy-io/dls

Node ≥ 22, React 18 or 19, ESM. Heavy single-component libraries (charts, tables, the code editor, code highlighting, Markdown, the cron and color inputs, 3D and animated brand marks) are optional peers; getting-started.md lists which subpath needs which.

Quick start

A new app in one command: Vite with the DLS Linaria preset, Biome with the DLS rules, the three stylesheets, GalaxyProvider, and a thin Filament-shaped app: file routes, ConnectRPC queries on a mock transport, the frame and two pages.

pnpm create @galaxy-io/galaxy-app my-app

--template blank writes the provider and one page only. getting-started.md lists the options; this is what the root of any Galaxy app looks like:

// Once, at the app root: component styles, tokens, fonts.
import "@galaxy-io/dls/styles.css";
import "@galaxy-io/dls/tokens.css";
import "@galaxy-io/dls/fonts.css";

import { PlusIcon } from "@phosphor-icons/react";
import Button, { ButtonVariant } from "@galaxy-io/dls/buttons/Button";
import Flex, { FlexDirection } from "@galaxy-io/dls/layout/Flex";
import Text, { TextSize, TextWeight } from "@galaxy-io/dls/text/Text";
import GalaxyProvider from "@galaxy-io/dls/theme/GalaxyProvider";

export function App() {
  return (
    <GalaxyProvider>
      <Flex direction={FlexDirection.COLUMN} gap={16} padding={24}>
        <Text as="h1" size={TextSize.HEADING_MD} weight={TextWeight.MEDIUM}>
          Sources
        </Text>
        <Flex gap={8}>
          <Button label="New source" icon={PlusIcon} />
          <Button label="Import" variant={ButtonVariant.SECONDARY} />
        </Flex>
      </Flex>
    </GalaxyProvider>
  );
}
  • Import every component from its own subpath; its enums come from the same module. There is no barrel.
  • GalaxyProvider is the one root: theme (System / Dark / Light), the overlay stack and toasts.
  • Style your own code with Linaria and the token accessor t (@galaxy-io/dls/theme/tokens/t), set up with galaxyDls() from @galaxy-io/dls/vite. Lint with "extends": ["@galaxy-io/dls/biome"].

Documentation

Getting startedInstall, Vite, stylesheets, provider, SSR
ThemingThemes and every token
ComponentsEvery component, when to use it, examples
PatternsHow Galaxy screens are built
AccessibilityThe floor and the keyboard maps
Migrating from 1.xThe codemod and every change since 1.6.1
ContributingWorking on this repository (AGENTS.md has the rules)
StorybookEvery component, prop and state, in both themes

Migrating from 1.x

npx @galaxy-io/dls-codemod src --report dls-migrate.json

The codemod rewrites everything mechanical and marks the rest with @dls-migrate <id> comments; docs/MIGRATION.md explains every id.

Claude skill

skills/galaxy-ui teaches Claude to design, build and structure Galaxy apps with this package: the app architecture create-galaxy-app scaffolds (stack, files and naming, routing and URL state, the ConnectRPC data layer and mocks, screen shells, forms, mountable modules), the brand rules, the component decision tables, tokens, patterns and complete screen recipes. Its DLS examples are type-checked against this repository (pnpm skill:check).

  • Claude Code: copy the folder into your skills directory: cp -R skills/galaxy-ui ~/.claude/skills/ (or a project's .claude/skills/).
  • Claude apps: run pnpm skill:pack and upload dist-skill/galaxy-ui.zip as a skill (Settings → Capabilities → Skills).

Details: skills/galaxy-ui/README.md.

版本与发布记录

@galaxy-io/dls 共发布 102 个版本,首次发布于 2026/07/14;过去 12 个月发布了 102 个版本。

版本发布日期距今
2.13.5latest2026/11/0510 天前
2.13.42026/11/0312 天前
2.13.32026/10/3116 天前
2.13.22026/10/2917 天前
2.13.12026/10/2917 天前
2.13.02026/10/2917 天前

关于 @galaxy-io/dls 的常见问题

@galaxy-io/dls 是什么?

Galaxy Design Language System

如何安装 @galaxy-io/dls?

在项目目录运行 npm install @galaxy-io/dls,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18 || ^19)、react-dom(^18 || ^19)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@galaxy-io/dls 支持 TypeScript 吗?

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

@galaxy-io/dls 支持 ESM 还是 CommonJS?

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

@galaxy-io/dls 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@galaxy-io/dls 可以商用吗?

@galaxy-io/dls 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@galaxy-io/dls 的下载量有多少?

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

@galaxy-io/dls 还在维护吗?

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