@lapismd/design-core

中文文档
0.10.1发布于 2026/11/02Apache-2.0TypeScriptES Module构建来源已验证

Shared Lapis design system, forms, shell, and workspace primitives

原始使用文档
文档目录14 节
  1. Current package status
  2. Install
  3. Public layers
  4. Component coverage
  5. Styling contract
  6. Layout conventions
  7. Usage examples
  8. shadcn primitive
  9. Shell layout
  10. Forms
  11. Storybook and local documentation
  12. CI and local parity
  13. Release and validation
  14. Further reading

@lapismd/design-core

Release public packages Storybook Pages npm version Storybook

Svelte 5 design-system package for LapisMD applications. It provides native-CSS component families, form primitives, search/filter controls, AI chat presentation, diff views, shell layout, and a workspace framework.

Design Core owns reusable presentation and controller behavior. Consumers own routing, data loading, persistence, domain state, transport, and application policy.

Current package status

Install

This release requires the user-authorized temporary [email protected] pnpm patch. Each installation root must explicitly configure the identical patch and frozen lockfile; Design Core's dependency metadata does not propagate that setup. Follow the packaged patch contract and its checksum manifest before qualifying runtime behavior. The patch retains Link Preview and Slider teardown safety and keyboard focus during repeated FocusScope mounting.

pnpm add @lapismd/design-core svelte

Import the shared stylesheet once at the application boundary:

import "@lapismd/design-core/styles.css";

Then import component families from their public layer:

<script lang="ts">
  import { Button } from "@lapismd/design-core/shadcn/button";
  import { StructuredForm } from "@lapismd/design-core/forms";
  import * as AppShell from "@lapismd/design-core/shell";
</script>

Public layers

LayerImportUse for
Styles and themes@lapismd/design-core/styles.css, @lapismd/design-core/themes/lapis.cssTheme tokens, base package styles, Lapis theme assets
shadcn primitives@lapismd/design-core/shadcn/<family>Low-level buttons, inputs, dialogs, popovers, menus, tabs, scroll areas, and layout primitives
Forms@lapismd/design-core/forms, @lapismd/design-core/forms/coreStructured forms, field renderers, form controls, editors, review/diff affordances
Filter@lapismd/design-core/filterSearch bars, power-search tokens, and the filter-query CodeMirror language
AI@lapismd/design-core/ai, @lapismd/design-core/ai/chatHost-controlled chat layout, messages, composer, tool-call, dictation, and status presentation
AI experimental@lapismd/design-core/ai/experimentalLab-derived chat affordances marked experimental
Diff@lapismd/design-core/diffFile listings, change stats, file diffs, merge presentation, and headless diff models
Shell@lapismd/design-core/shellBounded app chrome, sidebars, body regions, responsive shell state, and shell layout persistence adapters
Workspace@lapismd/design-core/workspaceRegistered views, tabs, splits, sidebars, panels, plugins, commands, settings, and workspace persistence adapters

Focused component subpaths are also exported for compatibility, especially under forms and workspace. Treat package.json exports as the supported import boundary.

Component coverage

Implemented shadcn families include:

accordion, alert, alert-dialog, badge, breadcrumb, button, button-group, card, checkbox, code, code-block, collapsible, column-canvas, command, command-view, context-menu, dialog, drawer, dropdown-menu, empty, field, hover-card, input, input-group, label, pagination, popover, progress, resizable, scroll-area, select, separator, sheet, sidebar, skeleton, slider, spinner, swipe-item, switch, table, tabs, textarea, toggle, toggle-group, and tooltip.

The higher layers compose these primitives:

  • Forms provide structured rendering, YAML/JSON-backed editing, list editors, autocomplete/chip inputs, date/time/reference pickers, code/YAML editors, and patch review surfaces.
  • Filter provides reusable search chrome plus parser/language helpers for the filter-query syntax.
  • AI provides presentation-only chat parts. It does not own model calls, network transport, conversation storage, or host actions.
  • Diff provides file/change/merge UI. Hosts own repository state and file contents.
  • Shell provides application chrome and responsive sidebars without owning application navigation.
  • Workspace provides the heavier app framework for registered views, layout persistence, commands, panels, and plugins.

Use Shell for application chrome. Use Workspace when the host needs registered views, tab/split layout, plugins, settings, command palette, or full workspace persistence.

Styling contract

Design Core uses native CSS and public custom properties. Consumers should style through tokens and typed props rather than patching internal selectors.

  1. Import @lapismd/design-core/styles.css once.
  2. Override public --ui-* variables on :root or a shared ancestor.
  3. Prefer component props for variants, density, layout, and state.
  4. Avoid overriding private DOM structure or internal class names.

Published archives contain prepared browser CSS and font assets. Consumers do not need Tailwind, its Vite plugin, or a source-scanning configuration. Tailwind compilation stays in internal authoring and conversion; generated private CSS variables remain ordinary browser CSS. The existing Mira dependency can still install a Tailwind peer, but Design Core's prepared styles do not use it. Use pnpm package:local when validating the archive boundary rather than importing the unprepared authoring stylesheet.

The source and archive gates reject utility selectors, including compound and nested selectors. Component state cleanup is covered by the slice 2 record. Theme/import restructuring and downstream release remain separate reviewable slices.

Token families:

ScopeToken examplesSource
Global theme--background, --foreground, --primary, --border, --radiussrc/theme.css
shadcn family tokens--ui-button-*, --ui-input-*, --ui-card-*colocated family token files
Forms--ui-form-*@lapismd/design-core/forms/form.tokens.css
AI--ui-ai-*@lapismd/design-core/ai/tokens
Diff--ui-diff-*@lapismd/design-core/diff/tokens
Shell--ui-shell-*@lapismd/design-core/shell/shell.tokens.css
Workspace--ui-workspace-*@lapismd/design-core/workspace/workspace.tokens.css

Component roots stamp stable data-ui-component and data-ui-part attributes for package-owned styling. Consumers may use side-channel attributes for their own selectors, but should not overwrite Design Core identity attributes on package components.

Layout conventions

Source layout follows the public catalog and package layers:

src/
  styles.css, theme.css, storybook.css
  shared/
    shadcn/<family>/
    forms/<family>/
    filter/<family>/
    ai/<component>/
    ai/experimental/<component>/
    diff/<family>/
    shell/app-shell/
    workspace/<family>/

One directory owns one independent component family or one compound family. Multipart components stay together in the owning family folder. Public barrels live at the layer root or family root.

Usage examples

shadcn primitive

<script lang="ts">
  import { Button } from "@lapismd/design-core/shadcn/button";
</script>

<Button variant="default" size="sm">Save</Button>

Shell layout

<script lang="ts">
  import * as AppShell from "@lapismd/design-core/shell";

  const shell = AppShell.createAppShellController({
    layoutId: "app",
  });
</script>

<AppShell.Root controller={shell}>
  <AppShell.Sidebar side="left">
    <AppShell.Sidebar.Header>Navigation</AppShell.Sidebar.Header>
    <AppShell.Sidebar.Body>...</AppShell.Sidebar.Body>
  </AppShell.Sidebar>

  <AppShell.Main>
    <AppShell.Toolbar>Toolbar</AppShell.Toolbar>
    <AppShell.Body>
      <AppShell.Body.Content>Application content</AppShell.Body.Content>
    </AppShell.Body>
  </AppShell.Main>
</AppShell.Root>

Forms

<script lang="ts">
  import { FormField } from "@lapismd/design-core/forms";
  import { Textarea } from "@lapismd/design-core/shadcn/textarea";
</script>

<FormField label="Summary" description="Short text shown in previews">
  <Textarea bind:value={summary} />
</FormField>

Storybook and local documentation

Run the local catalog:

pnpm storybook

Build the static catalog:

pnpm build-storybook

Offline package guidance:

pnpm ui guide
pnpm ui guide styling
pnpm ui components
pnpm ui components button

The canonical specification lives in spec/src. Use it for package behavior, architecture, style rules, and verification evidence:

pnpm spec:search "tokens"
pnpm spec:check

CI and local parity

pnpm checks runs the nonvisual governance, quality, unit, Storybook, pointer, and AI browser lanes through Turbo. Governance, quality, and unit work executes concurrently with half the available processors, capped at four. Resource-heavy Storybook and browser suites run one at a time locally so catalog startup and interaction readiness remain deterministic; set TURBO_CONCURRENCY to a positive number or percentage to override the general task bound.

Local task output is cached under .turbo/. The same tasks use the signed organization cache in CI and fail open to normal execution when it is unavailable. To use the remote cache locally, copy .env.example to the ignored root .env and provide TURBO_TOKEN and TURBO_REMOTE_CACHE_SIGNATURE_KEY. Never commit those credentials.

CI fans the nine nonvisual lanes out in parallel, including separate Workspace, Shell, Shadcn, and AI browser runners. It runs full and production dependency audits after they pass and reports one stable Validate result. Visual comparison remains an explicit, separate command.

Release and validation

Common validation commands:

pnpm spec:first
pnpm spec:check
pnpm check
pnpm test:unit
pnpm build-storybook
pnpm checks:release

Release planning and package artifacts:

pnpm changeset
pnpm release:check
pnpm release:plan --registry https://registry.npmjs.org
pnpm packages:pack

@lapismd/[email protected] was manually bootstrapped from a reviewed tarball. Future releases use Changesets and the repository release workflow.

Further reading

ResourceUse
spec/src/index.mdCanonical Design Core specification
spec/src/component-inventory.mdImplemented component inventory
spec/src/styling-and-themes.mdStyling and token contract
spec/src/packages.mdPublic export requirements
AGENTS.mdContributor and agent workflow

版本与发布记录

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

版本发布日期距今
0.10.1latest2026/11/021 天前
0.10.02026/11/011 天前
0.9.12026/11/012 天前
0.9.02026/11/012 天前
0.8.02026/11/012 天前
0.7.42026/10/312 天前

其他发布通道:next → 0.1.0。

关于 @lapismd/design-core 的常见问题

@lapismd/design-core 是什么?

共享的Lapis设计系统、表单、外壳和工作空间原语

如何安装 @lapismd/design-core?

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

@lapismd/design-core 支持 TypeScript 吗?

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

@lapismd/design-core 支持 ESM 还是 CommonJS?

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

@lapismd/design-core 需要什么版本的 Node.js?

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

@lapismd/design-core 可以商用吗?

@lapismd/design-core 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@lapismd/design-core 还在维护吗?

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