@adobe/spectrum-wc-core

中文文档
2.0.0-beta.7发布于 2026/11/10Apache-2.0TypeScriptES Module近 30 天下载 3458

Abstract base classes for Spectrum Web Components

原始使用文档
文档目录4 节
  1. Folder structure
  2. Naming
  3. Imports
  4. Migration

@adobe/spectrum-wc-core

Abstract base classes for Spectrum Web Components.

This package provides the behavior layer for gen2 Spectrum Web Components and is not intended for direct external use. It is independent from 1st-gen — there is no runtime dependency between them.

For more information, visit the Spectrum Web Components repository.

Folder structure

The core package is private/internal, so we can organize foundational code for discoverability and incremental migration.

core/
  element/      # SpectrumElement, defineElement, and element infrastructure
  mixins/       # Reusable mixins (SizedMixin, ObserveSlotPresence, etc.)
  controllers/  # Reactive controllers (Lit controllers, observers, etc.)
  utils/        # Utility functions (DOM helpers, label extraction, etc.)
  components/   # Component base classes (already established)

Naming

All new folders and files in /core should be kebab-case.

Imports

Prefer the new top-level paths for new code:

  • @adobe/spectrum-wc-core/element
  • @adobe/spectrum-wc-core/mixins
  • @adobe/spectrum-wc-core/controllers
  • @adobe/spectrum-wc-core/utils

New code should use the top-level paths above.

Migration

See MIGRATION.md for guidance on where to place migrated code.

版本与发布记录

@adobe/spectrum-wc-core 共发布 24 个版本,首次发布于 2026/07/14;过去 12 个月发布了 24 个版本。

版本发布日期距今
2.0.0-beta.7latest2026/11/10今天
0.0.0-snapshot.20261104103440snapshot2026/11/045 天前
0.0.0-snapshot.202611041020142026/11/045 天前
2.0.0-beta.62026/10/2714 天前
2.0.0-beta.52026/10/1526 天前
2.0.0-beta.42026/09/301 个月前

其他发布通道:next → 2.0.0-next.20260915131013,snapshot-test → 2.0.0-snapshot-test.20260917153929,snapshot → 0.0.0-snapshot.20261104103440。

关于 @adobe/spectrum-wc-core 的常见问题

@adobe/spectrum-wc-core 是什么?

Abstract base classes for Spectrum Web Components

如何安装 @adobe/spectrum-wc-core?

在项目目录运行 npm install @adobe/spectrum-wc-core,或使用 pnpm add / yarn add / bun add。

@adobe/spectrum-wc-core 支持 TypeScript 吗?

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

@adobe/spectrum-wc-core 支持 ESM 还是 CommonJS?

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

@adobe/spectrum-wc-core 可以商用吗?

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

@adobe/spectrum-wc-core 的下载量有多少?

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

@adobe/spectrum-wc-core 还在维护吗?

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