@asante-org/atlascopco-vt-litesitegenerator

中文文档
3.9.0发布于 2026/10/30UNLICENSEDTypeScriptESM + CJS近 30 天下载 2927

Atlas Copco VT Lite Site Generator

原始使用文档
文档目录15 节
  1. Tech stack
  2. Getting started
  3. Scripts
  4. Project structure
  5. Architecture layers
  6. How themes work
  7. 1. Base components
  8. 2. Theme components
  9. 3. Brand variables
  10. Storybook theme behavior
  11. Production theme outputs
  12. When to use each layer
  13. Adding a new themed component
  14. Adding components
  15. Design tokens

Atlas Copco VT Lite Site Generator

Standalone Lite Site Generator package for Atlas Copco VT. This package contains the LSG component set, Storybook documentation, and themed AEM-ready CSS/JS outputs.

Tech stack

  • React 18 + TypeScript
  • Storybook 7 with @storybook/nextjs
  • SCSS + Tailwind CSS + PostCSS
  • Next.js 13 to preserve the existing Storybook/runtime foundation

Getting started

# Install dependencies
npm install

# Run Storybook (default: http://localhost:6006)
npm run storybook

# Build static Storybook
npm run build-storybook

Scripts

ScriptDescription
npm run storybookStart Storybook dev server
npm run build-storybookBuild static Storybook
npm run build:npmBuild the component library plus all themed assets
npm run build:themes:cssEmit theme-1.css, theme-2.css, theme-3.css
npm run build:themes:jsEmit theme-1.js, theme-2.js, theme-3.js
npm run devStart Next.js dev server
npm run buildBuild Next.js app
npm run lintRun ESLint

Project structure

.storybook/           # Storybook config, theme, preview
src/
  components/lsg/     # Shared base LSG React components, docs, and clientlib runtime
  themes/             # Theme component wrappers plus Theme 1 / 2 / 3 CSS and JS entry points
  stories/foundation/_components/  # Minimal Storybook layout helpers used by LSG docs
  utils/styles/       # Shared spacing/style primitives still used by LSG SCSS
public/               # Static assets

Architecture layers

  1. Base layer: src/components/lsg/ contains the shared structural components and the common SCSS each theme builds from.
  2. Theme layer: each folder under src/themes/ exposes its own themed component set that wraps the base components and can add extra theme-specific styling on top.
  3. Brand layer: the --lsg-* CSS custom properties define the brand contract for colours, fonts, radii, and sizes. Each brand/theme supplies its own values for that contract.

How themes work

Themes are built as an extension model, not as separate rewrites of the component library.

1. Base components

The shared implementation lives under src/components/lsg/.

  • This layer contains the React structure and the common SCSS for LsgButton, LsgHeader, LsgFooter, and the rest of the LSG set.
  • Base components should own the shared markup, accessibility, interaction logic, and stable AEM-facing class names.
  • Base SCSS should use the --lsg-* token contract instead of hardcoding a brand style.

This is the layer every theme builds on top of.

2. Theme components

Each theme has its own component entrypoint under src/themes/<theme>/components.tsx.

  • Theme components are wrappers around the base components.
  • The wrapper generation happens in src/themes/createThemeComponents.tsx.
  • Each wrapper adds theme-specific classes such as lsg-themed-component--theme-1 so a theme can target the base component with extra styling.

That means the theme can keep the shared functionality from the base component while still changing the presentation or adding a branded treatment.

Example flow:

  1. Theme1LsgButton renders the shared LsgButton.
  2. The wrapper adds the lsg-themed-component--theme-1 class.
  3. src/themes/theme-1/components.scss applies extra styles to the shared .lsg-button markup inside that theme wrapper.

3. Brand variables

The brand layer is the CSS variable contract.

  • Tokens such as --lsg-color-primary, --lsg-font-family-primary, and --lsg-radius-rounded define the brand values.
  • The default contract lives in src/components/lsg/lsg-tokens.scss.
  • Each theme entry file overrides those same variables in its own :root block.

This keeps the API stable. Components always read the same variables, while each brand provides different values for them.

Storybook theme behavior

Storybook switches themes at runtime.

  • The toolbar is configured in .storybook/preview.tsx through globalTypes.lsgTheme.
  • The LSG_THEMES object maps a theme name to a set of --lsg-* values.
  • The withLsgTheme decorator turns the selected theme into a :root CSS block and injects it into the preview document.
  • The decorator also sets document.documentElement.dataset.lsgTheme = themeKey.

That data-lsg-theme attribute is important because the theme SCSS can target either:

  • the whole Storybook canvas through :root[data-lsg-theme="theme-x"]
  • a specific themed wrapper through .lsg-themed-component--theme-x

So in Storybook you get both:

  • brand token swapping for colours, typography, spacing, and radii
  • theme-specific component styling layered on top of the shared components

Production theme outputs

Each theme has its own CSS and JS bundle.

  • src/themes/theme-1/theme.scss, src/themes/theme-2/theme.scss, and src/themes/theme-3/theme.scss import the shared LSG styles and their own theme component styles.
  • Those files also override the :root token contract for that theme.
  • build:themes:css emits one CSS file per theme.
  • build:themes:js emits one JS file per theme for clientlib runtime behavior.

This is the AEM delivery model:

  1. Shared component structure comes from the base implementation.
  2. Theme CSS adds component-level extensions.
  3. Theme variables apply the brand colours, fonts, and sizes.
  4. Theme JS boots the runtime behavior for that theme.

When to use each layer

  • Use the base component layer when the change should apply to every theme.
  • Use the theme component layer when a theme needs a distinct visual treatment on top of the shared component behavior.
  • Use the token layer when the change is a brand value such as colour, typeface, size, or border radius.

As a rule, put structure and behavior in the base component first. Only move into src/themes/ when the theme genuinely needs its own component styling on top of that shared core.

Adding a new themed component

  1. Add or update the shared component in src/components/lsg/.
  2. Keep the base SCSS driven by var(--lsg-*) tokens.
  3. Add theme-specific styling in src/themes/<theme>/components.scss if that theme needs more than token changes.
  4. Export the theme wrapper from src/themes/<theme>/components.tsx.
  5. If needed in Storybook, add or update the theme values in .storybook/preview.tsx.

Adding components

  1. Add a component under src/components/lsg/<Name>/ and keep its styles as plain .scss so AEM-facing class names stay stable.
  2. Add *.stories.tsx or MDX docs alongside that component in src/components/lsg/.
  3. If a theme needs more than brand variables, add its component-level extensions under src/themes/<theme>/components.scss and expose a themed wrapper from src/themes/<theme>/components.tsx.
  4. Use the root token contract from src/components/lsg/lsg-tokens.scss and prefer var(--lsg-*) values over hardcoded theme colours.

Design tokens

  • Core colours: --lsg-color-primary, --lsg-color-secondary, --lsg-color-tertiary, --lsg-color-light, --lsg-color-dark, --lsg-color-black, --lsg-color-white
  • Typography: --lsg-font-family-primary, --lsg-font-family-secondary, plus --lsg-size-* scale tokens
  • Shape: --lsg-radius-square, --lsg-radius-rounded, --lsg-radius-pill

Theme-specific overrides live under src/themes/, but they extend the shared base components instead of replacing the root --lsg-* contract.

版本与发布记录

@asante-org/atlascopco-vt-litesitegenerator 共发布 97 个版本,首次发布于 2026/06/04;过去 12 个月发布了 97 个版本。

版本发布日期距今
3.9.0latest2026/10/308 天前
3.8.182026/10/2315 天前
3.8.162026/10/1919 天前
3.8.152026/10/1919 天前
3.8.142026/10/1622 天前
3.8.132026/10/1623 天前

关于 @asante-org/atlascopco-vt-litesitegenerator 的常见问题

@asante-org/atlascopco-vt-litesitegenerator 是什么?

Atlas Copco VT Lite Site Generator

如何安装 @asante-org/atlascopco-vt-litesitegenerator?

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

@asante-org/atlascopco-vt-litesitegenerator 支持 TypeScript 吗?

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

@asante-org/atlascopco-vt-litesitegenerator 支持 ESM 还是 CommonJS?

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

@asante-org/atlascopco-vt-litesitegenerator 可以商用吗?

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

@asante-org/atlascopco-vt-litesitegenerator 的下载量有多少?

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

@asante-org/atlascopco-vt-litesitegenerator 还在维护吗?

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