@cssints/apg-specs

中文文档
0.35.1发布于 2026/11/07MITTypeScriptES Module构建来源已验证近 30 天下载 6735

APG widget specs: Quint sources, generated models, scenario bridges and ported scenario sets, the test oracle of headless widgets

原始使用文档
文档目录3 节
  1. Layout
  2. Commands
  3. Install and use

@cssints/apg-specs — APG widget specs

The Quint specs behind @cssints/headless: one spec per WAI-ARIA APG pattern, one per non-APG pattern composed of them (resizable panels), and the model of a plugin's runtime (reactive), plus the canvas camera/pointer contract; the generated models and typed scaffolding, the SpecBridge for each pattern, the scenario sets (ported upstream ones and our own), and the spec-only verification. It is the test oracle of the widgets and of native/headless, and it is published so that widget libraries outside this repository can replay the same specs and scenarios against their own code.

The generated files (*.model.generated.json, *.scaffolding.generated.ts) are written by the code generation of @quint-machine/core and are never edited by hand. Ticket ids like effects-of-atmosphere-dx00 in the comments of the specs and tests are tickets of the repository these files came from.

Layout

specs/apg/<pattern>.qnt                           # APG pattern specs (one behavior-machine each)
specs/canvas/<machine>.qnt                        # canvas camera + pointer specs
specs/patterns/<machine>.qnt                      # non-APG patterns composed of APG widgets (resizable-panels), a plugin runtime (reactive)
shared/<module>.qnt                               # vocabulary + pure defs: aria, focusgroup, popover, invokers, details-group
src/<service>/<machine>.model.generated.json      # generated model document
src/<service>/<machine>.scaffolding.generated.ts  # generated typed scaffolding
src/apg/<pattern>.bridge.ts                       # scenario vocabulary <-> spec events/state
src/patterns/<machine>.bridge.ts                  # the same, for a non-APG pattern
src/scenario.ts                                   # scenario decoder + replay/differential-walk runtime
scenarios/apg/*.json, scenarios/canvas/*.json     # ported upstream scenario sets
scenarios/patterns/*.json                         # scenarios written from our own pattern specs
scenarios/parts.json                              # part names per pattern
test/<service>/<machine>.test.ts                  # spec-only verification
scripts/generate-all.ts                           # regenerates every spec under specs/

Platform-contract modules (shared/focusgroup.qnt roving tabindex, shared/popover.qnt light dismiss, shared/invokers.qnt commandfor/command, shared/details-group.qnt <details name>) are one per native web feature; a pattern imports one and models only its delta. shared/ holds vocabulary and pure defs only.

Commands

Run in packages/apg-specs:

  • bun run generate:all [specs/apg/tabs.qnt ...] — regenerate artifacts (node scripts/generate-all.ts). Each generated file carries the sha256 of its spec; edit a spec, then regenerate. The formatter skips the generated files (.prettierignore).
  • bun run typecheck:quint — Quint's own typechecker over every spec (~90 s).
  • bun run test — spec-only verification (vp test run). The exhaustive explorations (player, camera) take a minute each and can time out on a loaded machine; run them alone before calling a failure real.
  • bun run typecheck — effect-tsrs over src, test and scripts.
  • bun run check — all of the above, in order.
  • bun run build — vp pack: dist/ (the runner and the bridges as ESM with .d.mts, the generated models as .json).

Install and use

npm install @cssints/apg-specs effect @quint-machine/core

effect (^4.0.0) is a peer, @quint-machine/core a dependency. The package has subpath exports only:

SpecifierWhat
@cssints/apg-specs/scenariothe scenario decoder, replayScenario, differentialWalk, specDriver, Unsupported, driver and bridge types
@cssints/apg-specs/apg/<pattern>.bridgethe SpecBridge, <pattern>Config, <pattern>Steps and <pattern>Probe of a pattern
@cssints/apg-specs/apg/<pattern>.model.jsonthe generated model document (src/apg/<pattern>.model.generated.json in the repository)
@cssints/apg-specs/patterns/<machine>.bridgethe same for a non-APG pattern composed of APG widgets (resizable-panels, reactive)
@cssints/apg-specs/patterns/<machine>.model.jsonits generated model document (src/patterns/<machine>.model.generated.json)
@cssints/apg-specs/canvas/{canvas.bridge,camera.model.json,pointer.model.json}the canvas bridge and models
@cssints/apg-specs/scenarios/apg/<pattern>.<set>.jsona ported scenario set (also scenarios/canvas/*.json, scenarios/parts.json)
@cssints/apg-specs/scenarios/patterns/<machine>.spec.jsona scenario set written from our own pattern spec
@cssints/apg-specs/specs/apg/<pattern>.qntthe raw Quint spec (also specs/canvas/*.qnt, specs/patterns/*.qnt, shared/*.qnt, which the specs import)
import {
  Unsupported,
  differentialWalk,
  replayScenario,
  specDriver,
} from "@cssints/apg-specs/scenario";
import { buttonBridge, buttonConfig } from "@cssints/apg-specs/apg/button.bridge";
import buttonModel from "@cssints/apg-specs/apg/button.model.json" with { type: "json" };
import baseUi from "@cssints/apg-specs/scenarios/apg/button.base-ui.json" with { type: "json" };

In this repository the development (vite, tsc) and bun export conditions point at src/. The scenario format is specified in scenarios/apg/README.md; scenarios/patterns/ holds the scenarios of our own non-APG patterns (same format, no upstream).

版本与发布记录

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

版本发布日期距今
0.35.1latest2026/11/073 天前
0.35.02026/11/073 天前
0.34.02026/11/073 天前
0.33.02026/11/046 天前
0.32.02026/11/046 天前
0.31.02026/11/047 天前

关于 @cssints/apg-specs 的常见问题

@cssints/apg-specs 是什么?

APG widget specs: Quint sources, generated models, scenario bridges and ported scenario sets, the test oracle of headless widgets

如何安装 @cssints/apg-specs?

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

@cssints/apg-specs 支持 TypeScript 吗?

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

@cssints/apg-specs 支持 ESM 还是 CommonJS?

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

@cssints/apg-specs 需要什么版本的 Node.js?

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

@cssints/apg-specs 可以商用吗?

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

@cssints/apg-specs 的下载量有多少?

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

@cssints/apg-specs 还在维护吗?

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