@dorsk/tsumikit

中文文档
0.83.0发布于 2026/11/10MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 5827

Svelte 5 UI components styled with plain CSS variables: 31 themes, WCAG AA contrast, no runtime dependencies.

原始使用文档
文档目录8 节
  1. Install
  2. Quick start
  3. Start a new project
  4. Theming
  5. Components
  6. Limitations
  7. Development
  8. License

@dorsk/tsumikit

Svelte 5 UI components styled with plain CSS variables: 31 themes, WCAG AA contrast, no runtime dependencies.

npm CI svelte license

tsumikit showcase page: breadcrumb, page header with actions, four metric cards, a settings form with inputs, selects, checkboxes, switches, slider, radio group and segmented control, and a panel of button variants, sizes, tones, split buttons and a menu

Every colour, space, radius and size is a CSS custom property: a theme is one block of variables, a component is restyled with style="--btn-bg: …". Interactive parts use <dialog>, the Popover API and native form controls; a design lint and design principles ship in the package.

Live demo with every component and prop

Install

npm i @dorsk/tsumikit

Peer: svelte@^5.0.0. Inter font bundled.

Quick start

<script lang="ts">
  import '@dorsk/tsumikit/styles/app.css';
  import { Button, Field, Input, Toaster, toasts } from '@dorsk/tsumikit';

  let name = $state('');
</script>

<Field label="Workspace name" for="name">
  <Input id="name" bind:value={name} />
</Field>
<Button variant="primary" onclick={() => toasts.ok(`Saved ${name}`)}>Save</Button>
<Toaster />

Import the stylesheet once at the app root. Pressing Save shows an ok toast.

Start a new project

Copy examples/starter and replace "file:../.." with a version. Contents: examples/starter/README.md.

Upgrading from 0.82 or older: docs/MIGRATION-0.83.md (and 0.82).

Theming

31 themes, all tested for WCAG AA contrast. <ThemePicker /> persists the choice in localStorage; auto follows prefers-color-scheme.

import { theme } from '@dorsk/tsumikit';
theme.register({ id: 'acme', label: 'Acme', mode: 'dark' });
theme.setDefault('acme');
/* brand.css, imported after the kit stylesheet */
[data-theme='acme'] {
  --c-bg: #2a2a2a;
  --c-accent: #5ac8c8;
  /* …the rest of the 19 --c-* palette tokens, shadows and --mach-* pairs */
}
<Button style="--btn-bg: var(--c-violet); --btn-fg: #fff; --btn-radius: 0">Ship</Button>

Theme contract, looks, stylesheets and typeface: docs/theming.md. Per-component custom properties and test ids: docs/styling.md.

Components

Layers: tokens.css, atoms (the only raw <button>/<input>/<select>), molecules, layouts. Each reaches one layer down (docs/design.md). Props, aria-* included, spread onto the underlying element.

LayerComponents
AtomsText, Heading, Button, Input, Textarea, Select, Switch, Checkbox, Slider, Gauge, Avatar, Card, Badge, Link, Icon
MoleculesField, Modal, Popover, Menu, Tabs, FilterChips, Combobox, Disclosure, Accordion, Toaster, ThemePicker, Drawer, SplitButton, SortableList
OrganismsDataTable, ConversationPanel, ConversationFeed, FilterSearchBar
LayoutsAppShell, NavBar, MasterDetail, Container, Stack, Cluster, AutoGrid
Mobile and mediaTabBar, SwipeRow, PullToRefresh, SeekSlider, VolumeSlider
Stores and helperstheme, toasts, fontScale, autoresize, copyToClipboard
GuideCovers
Patternsloading, reserving the final box, row actions and selection, choice controls, undo over confirm, URL state, breakpoints
Layout and sizingcontainer queries, rem sizing, control heights, 44px hit areas
Guardrailstsumikit-lint CLI, dev-mode warnings
Soundopt-in UI sounds
AccessibilityARIA patterns, platform features
Design principles30 principles, each with a check

Limitations

  • Svelte 5 only.
  • No bundled syntax highlighter: CodeBlock takes a highlight callback (details).
  • Internal class names (.btn) and data-tsu markers are private and may change in any release. Style through the published custom properties, not :global().
  • Pre-1.0: minor releases can change defaults. Migration notes are in docs/.

Development

git clone https://github.com/DorskFR/tsumikit && cd tsumikit
npm install
npm run dev          # showcase at the printed URL (+ /shell for the AppShell demo)
npm test             # contract tests (node --test)
npm run lint         # biome
npm run check        # svelte-check
npm run build        # prerendered static site in /build
npm run package      # publishable library in /dist (+ publint)

Hooks (lefthook, via prepare): Biome on commit, svelte-check on push. A v* tag publishes to npm through GitHub Actions trusted publishing.

License

MIT

版本与发布记录

@dorsk/tsumikit 共发布 153 个版本,首次发布于 2026/06/13;过去 12 个月发布了 153 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.83.0latest2026/11/103 天前
0.82.32026/11/094 天前
0.82.22026/11/058 天前
0.82.12026/11/058 天前
0.82.02026/11/058 天前
0.81.02026/11/049 天前

关于 @dorsk/tsumikit 的常见问题

@dorsk/tsumikit 是什么?

Svelte 5 UI components styled with plain CSS variables: 31 themes, WCAG AA contrast, no runtime dependencies.

如何安装 @dorsk/tsumikit?

在项目目录运行 npm install @dorsk/tsumikit,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:svelte(^5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 tsumikit-lint,可以用 npx tsumikit-lint 直接运行。

@dorsk/tsumikit 支持 TypeScript 吗?

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

@dorsk/tsumikit 支持 ESM 还是 CommonJS?

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

@dorsk/tsumikit 可以商用吗?

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

@dorsk/tsumikit 的下载量有多少?

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

@dorsk/tsumikit 还在维护吗?

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