@boost33/ui

中文文档
0.8.1发布于 2026/11/05UNLICENSEDTypeScriptES Module零依赖近 30 天下载 2715

The app shell every Boost33 product renders inside.

原始使用文档
文档目录7 节
  1. Getting oriented
  2. Commands
  3. Before the first AFK run
  4. Consumers
  5. Fonts: map the hooks on :root , not body
  6. Server Components: never pass a function to the kit's clien…
  7. The launch screen

@boost33/ui

The app shell every Boost33 product renders inside. Fourteen components and the design tokens they are drawn with, published to public npm. Eleven ship today; AccountMenu, NotificationCenter and CommandPalette are in v1's scope and not built yet. Outside the shell, it also ships LaunchLoader, the screen a product shows while another one opens, and the DotMatrixLoader it is drawn with.

Built because the product switcher and the wallet chip worked in the Wallet and nowhere else, and because a sidebar fixed in one app fixed nothing in the other three.

Getting oriented

How we build hereCLAUDE.md
What we are buildingLinear document The shared app shell
VocabularyCONTEXT.md, and the initiative's Vocabulary document
Settled decisionsdocs/adr/
What changed between versionsCHANGELOG.md
TicketsLinear, project Boost33 Shared UI

Commands

npm run typecheck
npm run test           # behaviour only — screenshots run in CI
npm run lint
npm run afk            # one Linear issue, unattended, in a container

Before the first AFK run

cp ~/.config/toolkit/afk.env .sandcastle/.env
npx sandcastle docker build-image              # once per machine
npm run afk                                    # watch the whole first iteration

Watch for real test output in the log, not the agent's summary of it.

Consumers

The Wallet migrates first, Score second. No 1.0 until both render from this package — until then it has one consumer, which is a fork with a version number.

Fonts: map the hooks on :root, not body

The kit's faces read three hooks, --boost33-font-display, --boost33-font-sans and --boost33-font-mono, and tokens.css resolves them on :root (--font-sans: var(--boost33-font-sans, Inter), …). A custom property resolves where it is declared, so a hook set only on body never reaches the kit, and the kit silently falls back to Inter, Outfit and Geist Mono.

With next/font, put each font's .variable class on <html>, not <body>, and map the hooks on :root:

:root {
  --boost33-font-display: var(--font-outfit);
  --boost33-font-sans: var(--font-inter);
}

To check it, inspect any kit element (a nav row) and read its computed font-family. One false alarm: on a dev run where Google Fonts cannot be reached, next/font substitutes its own 'Inter Fallback', and the dev log says Failed to download `Inter` . That is the network, not the mapping (found by Outbound).

Server Components: never pass a function to the kit's client components

Three modules in this package are client components ('use client'): AppSwitcher, WalletChip and the internal NavHeightBudgetWarning. Everything else -- AppShell, TopBar, Sidebar, NavItem, NavSection, NotificationButton, PageHeader, Wordmark and the marks -- renders on the server.

A Server Component cannot pass a function or a component to a client component: props cross that boundary serialised, and Next refuses anything that is not plain data. So from a Server Component, never pass linkComponent, onTopUp, onOpenChange or any other function to AppSwitcher or WalletChip. Next throws ("Functions cannot be passed directly to Client Components") and every signed-in render returns a 500 (found by Passport). renderToStaticMarkup tests do not catch it: they render one tree with no boundary.

Build the two instead inside one small 'use client' file of your own, which imports your router's Link and renders <AppSwitcher linkComponent={Link} …/> and <WalletChip onTopUp={…} …/>, and pass that file's components into AppShell's switcher and wallet slots. Serialisable props (products, labels, locale, the balances) can still come from the server through it. AppShell and NavItem take linkComponent safely: they are server modules, so the function never crosses a boundary.

The launch screen

LaunchLoader is presentational. The page that renders it owns the timing and passes in a caption and a progress (0–100, or null while there is no honest number). The background is built in and the same for every product: black, with one blurred brand-orange glow rising from below the middle of the screen. There are no product colours to pass; stops is deprecated and ignored since 0.5.1. The caption sits straight on the glow, and npm run launch-contrast-check measures it.

The glow is drawn by the package stylesheet and takes no prop, so both sides of a hop paint the identical screen. Inline the ground colour too, so the instant before the stylesheet and the markup arrive is already black rather than white:

import { LaunchLoader, launchBackdropCss } from '@boost33/ui'

<style dangerouslySetInnerHTML={{ __html: launchBackdropCss() }} />
<LaunchLoader caption={caption} progress={progress} />

An animated backdrop, when one exists, goes in the backdrop slot. The screen must stay complete without it. See CHANGELOG.md (B33-1389, B33-1401) for the full contract.

版本与发布记录

@boost33/ui 共发布 19 个版本,首次发布于 2026/09/09;过去 12 个月发布了 19 个版本。

版本发布日期距今
0.8.1latest2026/11/053 天前
0.8.02026/11/053 天前
0.8.0-next.5next2026/11/043 天前
0.8.0-next.42026/11/043 天前
0.8.0-next.32026/11/044 天前
0.8.0-next.22026/11/044 天前

关于 @boost33/ui 的常见问题

@boost33/ui 是什么?

The app shell every Boost33 product renders inside.

如何安装 @boost33/ui?

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

@boost33/ui 支持 TypeScript 吗?

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

@boost33/ui 支持 ESM 还是 CommonJS?

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

@boost33/ui 需要什么版本的 Node.js?

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

@boost33/ui 可以商用吗?

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

@boost33/ui 的下载量有多少?

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

@boost33/ui 还在维护吗?

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