@cruglobal/cornerstone-design-system

中文文档
0.10.0发布于 2026/10/24BSD-3-ClauseTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 2940

Design tokens and primitives for the Cornerstone Design System.

原始使用文档
文档目录13 节
  1. Using Cornerstone
  2. 1. Install
  3. 2. Import CSS
  4. 3. Use tokens in CSS
  5. 4. JavaScript / TypeScript
  6. Icons
  7. Material Sharp
  8. Cru Ministry Icons
  9. Get set up faster with Claude Code
  10. Contributing to Cornerstone
  11. Prerequisites
  12. Commands
  13. Token architecture

Cornerstone Design System

Design tokens and primitives for Cru Global's Cornerstone design system. Ships CSS custom properties, SCSS variables, ESM/CJS JavaScript, and TypeScript declarations for the Cru and FamilyLife (FL) brands across light and dark themes.


Using Cornerstone

1. Install

npm install @cruglobal/cornerstone-design-system

2. Import CSS

Import the baseline ref tokens and the file that matches your brand and theme. Apply data-brand and data-theme attributes to your root element to activate the right variables.

<!-- HTML root element -->
<html data-brand="cru" data-theme="light">
/* CSS or JS entry point */
@import "@cruglobal/cornerstone-design-system/css/ref.css";
@import "@cruglobal/cornerstone-design-system/css/cru-light.css";
BrandThemeFile
CruLightcss/cru-light.css
CruDarkcss/cru-dark.css
FamilyLifeLightcss/fl-light.css
FamilyLifeDarkcss/fl-dark.css

For dynamic theme switching, import all mode files you need and toggle the data-theme attribute at runtime.

3. Use tokens in CSS

Tokens follow a three-layer naming convention. In most cases, use sys (semantic) tokens in your components:

.my-button {
  background-color: var(--sys-color-primary);
  color: var(--sys-color-on-primary);
  border-radius: var(--sys-number-border-radius-medium);
  font-size: var(--sys-number-font-size-body-medium);
}

Token layers:

PrefixPurposeWhen to use
--ref-*Raw primitives (hex colors, unitless values)Only when building custom sys aliases
--sys-*Semantic aliases per brand/themePrimary choice for component styles
--cmp-*Component-specific tokensWhen styling a specific Cornerstone component

4. JavaScript / TypeScript

Resolved token values are available as named exports for use in JS-based styling (e.g. React Native, runtime style calculations):

// ESM
import { RefColorCruBlue500 } from '@cruglobal/cornerstone-design-system';

// Per-mode tokens
import * as cruLight from '@cruglobal/cornerstone-design-system/js/cru-light';

TypeScript declarations are included automatically.


Icons

Material Sharp

Cornerstone uses the Material Symbols Sharp icon set. Add the Google Fonts stylesheet to your app:

<link rel="stylesheet"
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />

Use icons with the material-symbols-sharp class:

<span class="material-symbols-sharp">home</span>
<span class="material-symbols-sharp">arrow_forward</span>
<span class="material-symbols-sharp">favorite</span>

Browse the full catalog at fonts.google.com/icons.

Cru Ministry Icons

Custom Cru ministry topic SVG icons ship with this package under libraries/cru-icons/:

node_modules/@cruglobal/cornerstone-design-system/libraries/cru-icons/<icon-name>.svg

Reference them in <img> tags or inline them as SVG. With a bundler that supports SVG imports (Vite, webpack with file-loader):

import bibleStudyIcon from '@cruglobal/cornerstone-design-system/libraries/cru-icons/bible-study.svg';

Get set up faster with Claude Code

If you're using Claude Code, Cornerstone ships a plugin carrying Daniel, a design-system assistant who knows this package. Install it once:

/plugin marketplace add CruGlobal/cornerstone-design-system
/plugin install cornerstone@cru

There is no command to type. Daniel becomes your session's default assistant and answers in your own project's terms — which mode file to import and in what order, which --sys-* token carries the role you're reaching for, why a --cs-* variable isn't resolving, and whether the thing you're building already ships. Ask him in plain language.

Note: /pull-tokens is an internal command for syncing tokens from Figma into this repository. It is not part of the consumer plugin.


Contributing to Cornerstone

The following sections are for contributors to this repository.

Prerequisites

The /pull-tokens command syncs design tokens from the Figma source file and requires the Figma plugin for Claude Code.

  1. Run /plugins in Claude Code to open the plugin marketplace
  2. Search for Figma and install it
  3. Authenticate with your Figma account when prompted
  4. Restart Claude Code

Commands

npm run validate       # lint the token tree (exits 1 on any error)
npm run build          # compile tokens → build/ via Style Dictionary
npm run version        # consume changesets → bump package.json + write CHANGELOG.md
npm run release        # publish to npm (runs automatically via release.yml)
npx changeset          # interactively add a changeset before merging a PR
npx changeset status   # preview what the next version bump would be

build/ is gitignored. Built artifacts live only in the published npm package.

Token architecture

Tokens are organized in three layers with strict aliasing rules:

tokens/
  ref.json          # _ref.*  — raw primitives
  sys/
    cru-light.json  # _sys.*  — semantic aliases per brand × theme
    cru-dark.json
    fl-light.json
    fl-dark.json
  cmp/
    *.json          # _cmp.*  — component-level aliases

All files use W3C DTCG format ($type / $value). See CLAUDE.md for the aliasing rules and changeset conventions, and packages/tokens/build.mjs for the build pipeline.

版本与发布记录

@cruglobal/cornerstone-design-system 共发布 15 个版本,首次发布于 2026/05/14;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.10.0latest2026/10/2418 天前
0.9.02026/10/2220 天前
0.8.12026/10/1526 天前
0.8.02026/10/1527 天前
0.7.12026/10/101 个月前
0.7.02026/10/101 个月前

关于 @cruglobal/cornerstone-design-system 的常见问题

@cruglobal/cornerstone-design-system 是什么?

Design tokens and primitives for the Cornerstone Design System.

如何安装 @cruglobal/cornerstone-design-system?

在项目目录运行 npm install @cruglobal/cornerstone-design-system,或使用 pnpm add / yarn add / bun add。

@cruglobal/cornerstone-design-system 支持 TypeScript 吗?

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

@cruglobal/cornerstone-design-system 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cruglobal/cornerstone-design-system 可以商用吗?

@cruglobal/cornerstone-design-system 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@cruglobal/cornerstone-design-system 的下载量有多少?

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

@cruglobal/cornerstone-design-system 还在维护吗?

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