@steppy/angular

中文文档
0.9.0发布于 2026/11/02Apache-2.0TypeScriptES Module构建来源已验证

Angular adapter for the Steppy in-app tour overlay: provideSteppyTours(), and the SteppyTours service

原始使用文档
文档目录4 节
  1. Install
  2. Use
  3. What the adapter does for you
  4. Develop

@steppy/angular

The Angular adapter for Steppy's in-app tours: guided popovers over your live app, compiled from the same Markdown scenarios your end-to-end tests run. The overlay itself is <steppy-tour-host> from @steppy/player/tour; this package mounts it the Angular way.

  • provideSteppyTours({...}): configuration, in app.config.ts.
  • <steppy-tours />: the overlay, placed once in the app shell.
  • SteppyTours: a root service to start() / stop() / next() tours, with active, current and lastError signals and an events stream.
  • steppyTourStart: a directive that starts a tour on click.

Angular 20–22, zone.js or zoneless, SSR-safe (nothing renders or loads on the server). Your app needs no CUSTOM_ELEMENTS_SCHEMA.

Install

npm install @steppy/angular @steppy/player

@steppy/player is a peer dependency at the same version as the adapter.

To use an unreleased build, build both from a Steppy checkout:

npm --prefix packages/player ci
npm --prefix packages/player run build
npm --prefix packages/angular ci
npm --prefix packages/angular run build

Then, in your app, either depend on the folders ("@steppy/player": "file:<checkout>/packages/player", "@steppy/angular": "file:<checkout>/packages/angular/dist", and "preserveSymlinks": true in the build options so Angular is not loaded twice), or install the tarballs npm pack makes from those two folders.

Use

// app.config.ts
import { inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { TranslateService } from '@ngx-translate/core';
import { map } from 'rxjs';
import { provideSteppyTours } from '@steppy/angular';

export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routes),
    provideSteppyTours({
      // Written by `steppy tours` (an app-assets target in public/tours).
      fallbackManifest: 'tours/tours.manifest.json',
      // Optional: follow your i18n library. Without it the tours follow <html lang>.
      locale: () => {
        const translate = inject(TranslateService);
        return toSignal(translate.onLangChange.pipe(map((e) => e.lang)), { initialValue: translate.getCurrentLang() ?? '' });
      },
    }),
  ],
};
// app.component.ts
@Component({
  selector: 'app-root',
  imports: [RouterOutlet, SteppyToursComponent, SteppyTourStart],
  template: `
    <button steppyTourStart="create-invoice">Show me how</button>
    <router-outlet />
    <steppy-tours (tourComplete)="onDone($event)" />
  `,
})
export class AppComponent {}
// anywhere
const tours = inject(SteppyTours);
await tours.start('send-invoice', { params: { invoiceId: 1001 } });

What the adapter does for you

  • Lazy, browser-only loading. The overlay module is imported after the first render, and only in the browser.
  • Router navigation. A tour that starts away from its entry route navigates with Router.navigateByUrl, inside the Angular zone, so the routed view renders in zone.js apps. A guard that refuses or redirects the navigation fails the tour at once (tour-error, reason entry-params) instead of leaving it waiting for an element that will never render. Set navigate: 'document' for full page loads, or pass your own function.
  • Zones. The overlay's observers, polls and frames run outside the Angular zone, so they never drive change detection; events, outputs and the router come back inside it.
  • start() from anywhere. It waits for <steppy-tours> to mount and the overlay to load (readyTimeout, 10 s by default), the last call wins, and it resolves false — never rejects — when a tour cannot start.

Destroying <steppy-tours> suspends a running tour rather than dismissing it (the overlay keeps its resume record). Call tours.stop() first to end it.

Inputs on <steppy-tours> override the provideSteppyTours() settings: fallbackManifest, manifest, buildId, guideOrigin, locale, targetTimeout, baseZIndex, disabled, strings, source. Outputs: tourStart, tourStep, tourComplete, tourDismiss, tourOffpath, tourError.

Hash routing (withHashLocation()) is not supported by in-app tours.

The full reference — authoring tours, the overlay's options and events, remote mode, CSP and Trusted Types — is docs/tours.md in the Steppy repository.

Develop

npm ci
npm test        # the zoneless suite, then the zone.js suite (ng test --configuration zone)
npm run build   # ng-packagr → dist/; publish dist/, never this folder

The overlay is replaced by a fake element in the specs (src/testing/), except in real-overlay.spec.ts. The browser test against a real Angular + PrimeNG app is tests/integration/test_tour_angular_it.py (the demo is fixtures/tour-demo-angular/).

版本与发布记录

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

版本发布日期距今
0.9.0latest2026/11/02今天
0.8.12026/10/304 天前
0.8.02026/10/277 天前
0.7.02026/10/277 天前
0.6.02026/10/259 天前
0.5.02026/10/2410 天前

关于 @steppy/angular 的常见问题

@steppy/angular 是什么?

Steppy应用内游览覆盖的Angular适配器:provideSteppyTours(),以及SteppyTours服务

如何安装 @steppy/angular?

在项目目录运行 npm install @steppy/angular,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:rxjs(^7.4.0)、@angular/core(>=20.0.0 <23.0.0)、@steppy/player(0.9.0)、@angular/common(>=20.0.0 <23.0.0)、@angular/router(>=20.0.0 <23.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@steppy/angular 支持 TypeScript 吗?

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

@steppy/angular 支持 ESM 还是 CommonJS?

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

@steppy/angular 可以商用吗?

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

@steppy/angular 还在维护吗?

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