@akcelik/strct

中文文档
7.9.1发布于 2026/11/05MITTypeScriptES Module构建来源已验证近 30 天下载 4638

UIStruct — a standalone Angular component library with a tokenised, multi-palette theme system, built for datacenter / infrastructure management UIs.

原始使用文档
文档目录7 节
  1. Install
  2. Theme setup
  3. Components
  4. Examples
  5. Design tokens
  6. Accessibility & eye comfort
  7. License

@akcelik/strct

Live documentation & demo →

A standalone Angular component library built around a tokenised, multi-palette theme system. Everything is driven by CSS custom properties, so a single attribute swap re-skins the whole library.

  • 3 palettes — Arctic, Ember, Sage
  • 2 modes — Dark, Light
  • Standalone components, signal inputs, OnPush everywhere
  • ControlValueAccessor support on every form control
  • No runtime CSS framework dependency
  • WCAG-AA text contrast · OS-aware theming · prefers-contrast / prefers-reduced-motion honoured

Install

npm install @akcelik/strct

@angular/core, @angular/common, @angular/forms, @angular/platform-browser and @angular/router are peer dependencies (Angular 22+). Keep your own copies patched — npm audit in your app is what sees them.

Consuming a local build? Install the packed tarball (ng build strct && npm pack dist/strct, then npm i ../akcelik-strct-x.y.z.tgz) rather than a file: symlink — a symlinked dependency resolves its own copy of @angular/core, which can trip an InputSignal brand mismatch (TS2551) across Angular patch versions.

Theme setup

Import the theme once in your global stylesheet (ships tokens + base reset + form-control styles):

// styles.scss
@use '@akcelik/strct/styles/theme';

The theme self-hosts its fonts (DM Sans + JetBrains Mono, OFL) — they ship as woff2 under styles/fonts/ and are referenced by @font-face, so there is no external request and nothing else to load.

Set the scheme on the document root (or let StrctThemeService manage it):

<html data-palette="arctic" data-theme="dark"></html>
import { StrctThemeService } from '@akcelik/strct';

const theme = inject(StrctThemeService);
theme.setPalette('ember'); // 'arctic' | 'ember' | 'sage'
theme.setMode('light'); // 'dark' | 'light'  (persisted to localStorage)
theme.toggleMode();

By default StrctThemeService follows the operating system's light/dark preference (prefers-color-scheme) — and tracks it live — until the user makes an explicit choice, which is then persisted and wins.

Drop the ready-made switcher anywhere:

<strct-theme-switcher />

Components

Import only what you use — every component is standalone.

AreaComponents
Layoutstrct-shell, strct-header, strct-footer, strct-vertical-nav, strct-nav / strct-nav-item, strct-rail (collapsible icon nav), strct-login
Controlsbutton[strct-button], strct-button-group, strct-speed-dial, strct-badge, strct-tag, strct-avatar, strct-progress, strct-spinner, strct-skeleton
Surfacesstrct-card (+ header/block/footer), strct-accordion, strct-tabs, strct-tree, strct-modal, strct-drawer (edge-anchored panel), strct-dropdown (+ strct-submenu), [strctContextMenu] (data-driven), strct-wizard, strct-divider
Navigationstrct-breadcrumb / strct-breadcrumb-item, strct-pagination
FormsstrctInput, strct-checkbox, strct-toggle, strct-radio-group / strct-radio, strct-range, strct-combobox, strct-cascade-select, strct-datepicker, strct-password, strct-file, strct-color-picker, strct-rating, strct-chips, strct-input-otp, strct-knob, strct-input-mask
Datastrct-table, strct-datagrid (sort / select / expandable rows / detail pane / batch bar / per-row kebab menu / resizable / column chooser), strct-timeline / strct-timeline-item, strct-stack / strct-stack-item
Chartsstrct-sparkline, strct-chart (line / area / bar), strct-donut, strct-gauge
Feedbackstrct-alert, strctTooltip, strct-signpost, strct-toast-outlet + StrctToastService
Foundationsstrct-icon (datacenter icon set + status badge), strct-theme-switcher

Examples

<button strct-button variant="primary">Save</button>
<button strct-button variant="outline" size="sm">Cancel</button>

<strct-badge status="success">Active</strct-badge>

<strct-modal [(open)]="show" title="Confirm">
  Body…
  <ng-container strctModalFooter>
    <button strct-button (click)="show = false">Cancel</button>
    <button strct-button variant="primary" (click)="show = false">OK</button>
  </ng-container>
</strct-modal>

<input strctInput placeholder="Name" [(ngModel)]="name" />
<strct-checkbox [(ngModel)]="agree">I agree</strct-checkbox>

Design tokens

Components reference these CSS variables only — never hard-coded colors:

--bg-0..--bg-a surfaces · --hdr header · --b1/--b2/--b3 borders · --t1..--t4 text · --inv inverse · --acc (+ --acc-m/-s/50/30/18) accent · --success / --warning / --critical semantic (+ *-bg) · --sh / --shh shadows · --sb scrollbar.

Accessibility & eye comfort

Reviewed against WCAG and display-ergonomics / vision science to limit eye strain in long, all-day console sessions:

  • WCAG AA text contrast — --t1/--t2/--t3 all meet AA (≥ 4.5:1) in every palette and mode, with a preserved t1 > t2 > t3 hierarchy.
  • OS-aware theming — follows prefers-color-scheme until an explicit choice.
  • prefers-contrast: more — stronger borders, text and focus ring on request.
  • prefers-reduced-motion — animations collapse to instant state changes.
  • 12px type-size floor, 1.5 body line-height, softened (non-pure-white) light surfaces.

License

MIT © Serkan Akcelik

版本与发布记录

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

版本发布日期距今
7.9.1latest2026/11/05今天
7.9.02026/11/051 天前
7.8.12026/11/051 天前
7.8.02026/11/051 天前
7.7.02026/11/051 天前
7.6.12026/11/051 天前

关于 @akcelik/strct 的常见问题

@akcelik/strct 是什么?

UIStruct — a standalone Angular component library with a tokenised, multi-palette theme system, built for datacenter / infrastructure management UIs.

如何安装 @akcelik/strct?

在项目目录运行 npm install @akcelik/strct,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/core(^22.0.0)、@angular/forms(^22.0.0)、@angular/common(^22.0.0)、@angular/router(^22.0.0)、@angular/platform-browser(^22.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@akcelik/strct 支持 TypeScript 吗?

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

@akcelik/strct 支持 ESM 还是 CommonJS?

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

@akcelik/strct 可以商用吗?

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

@akcelik/strct 的下载量有多少?

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

@akcelik/strct 还在维护吗?

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