Skip to content

waygraph / StubUi

Type Alias: StubUi ​

StubUi = object

Defined in: src/engine/stub/stub.ts:122

The demo UI a stub paints through: ctx.ui.ring(...), ctx.ui.todos(...), ...

Methods ​

bannerUi() ​

bannerUi(opts): void

Defined in: src/engine/stub/stub.ts:174

Banner UX: { collision: false } keeps it put even over a ring; { hidden: true } hides it.

Parameters ​

opts ​

BannerUiOpts

Returns ​

void

Example ​

ts
ctx.ui.bannerUi({ collision: false });

caption() ​

caption(text): void

Defined in: src/engine/stub/stub.ts:181

Bottom narration caption - a white rounded card (black text, shadow), bottom-centered above the step pill; distinct from StubUi.title, which is the top banner card. Fades in/out on change. Pass "" (or call StubUi.hideCaption) to clear.

Parameters ​

text ​

string

Returns ​

void

Example ​

ts
ctx.ui.caption("Click Add to cart to continue");

device() ​

device(preset): void

Defined in: src/engine/stub/stub.ts:145

Viewport / device fixture (0.13+). mobile | tablet | desktop. Omit on later blocks = keep (same persist as todos). Use StubUi.hideDevice or device("desktop") to return to desktop.

Parameters ​

preset ​

DevicePreset | DeviceState

Returns ​

void


hideBanner() ​

hideBanner(): void

Defined in: src/engine/stub/stub.ts:194

Shorthand for bannerUi({ hidden: true }).

Returns ​

void


hideCaption() ​

hideCaption(): void

Defined in: src/engine/stub/stub.ts:183

Clears the caption (fades it out).

Returns ​

void


hideDevice() ​

hideDevice(): void

Defined in: src/engine/stub/stub.ts:159

Reset to desktop viewport and clear touch mode. Omit device on a later block = keep; only hideDevice / device("desktop") clears.

Returns ​

void


hideNetworkTab() ​

hideNetworkTab(): void

Defined in: src/engine/stub/stub.ts:202

Hides the network-tab overlay (capture keeps running - only the panel disappears).

Returns ​

void


hideTodos() ​

hideTodos(): void

Defined in: src/engine/stub/stub.ts:139

Hide the floating todo dock. Omit todos on a later block = keep the previous dock (carry forward). Only hideTodos or an empty todos list clears it.

Returns ​

void


orientation() ​

orientation(o): void

Defined in: src/engine/stub/stub.ts:154

Rotate viewport to portrait or landscape (0.13.3+). Keeps current preset; swaps width/height. Toast + lerp like device().

Parameters ​

o ​

DeviceOrientation

Returns ​

void


ring() ​

ring(id, stub): void

Defined in: src/engine/stub/stub.ts:124

Paints one named ring this phase; the same id again replaces it.

Parameters ​

id ​

string

stub ​

WaygraphHighlightStub

Returns ​

void


showCalls() ​

showCalls(): void

Defined in: src/engine/stub/stub.ts:208

Opens the step's first HTTP call in the call modal (the request and the response) once the step ran: for a recorded demo of an API step, so the viewer reads what was sent and what came back without a click.

Returns ​

void

Example ​

ts
ctx.ui.showCalls();

showNetworkTab() ​

showNetworkTab(): void

Defined in: src/engine/stub/stub.ts:200

Shows the network-tab overlay (Postman-style inspector of real page traffic + defineApiBlock calls) - capture always runs in the background; this just reveals the panel. Hidden by default.

Returns ​

void

Example ​

ts
ctx.ui.showNetworkTab();

slides() ​

slides(slides): void

Defined in: src/engine/stub/stub.ts:192

Multi-step "yap" captions with Next between each, for explaining a longer process. In stubBefore they play before the step runs, in stubAfter after it lands; a slide with a selector rings it while it is up.

Parameters ​

slides ​

readonly WaygraphSlide[]

Returns ​

void

Example ​

ts
ctx.ui.slides([
  { caption: "Checkout is three screens", tag: "YAP" },
  { caption: "Overview confirms totals", selector: ".summary_info", duration: true },
]);

title() ​

title(text, opts?): void

Defined in: src/engine/stub/stub.ts:167

Top banner title (waygraph demo card). opts.pos also places it (left | center | right).

Parameters ​

text ​

string

opts? ​
pos? ​

BannerPos

Returns ​

void


titlePos() ​

titlePos(side): void

Defined in: src/engine/stub/stub.ts:169

Place the banner: left | center | right (authored; click / env are fallbacks).

Parameters ​

side ​

BannerPos

Returns ​

void


todoDockUi() ​

todoDockUi(opts): void

Defined in: src/engine/stub/stub.ts:215

Todo-dock UX: compact fold, collision flip, dim-behind-ring. Defaults are smart-on; pass false fields to opt out for this phase.

Parameters ​

opts ​

TodoDockUiOpts

Returns ​

void

Example ​

ts
ctx.ui.todoDockUi({ compact: false }); // always show the full list

todoGroups() ​

todoGroups(id, groups, opts?): void

Defined in: src/engine/stub/stub.ts:134

Several titled lists in one dock (e.g. Functional Requirements / Scenarios / ACs), with the same id and options as StubUi.todos.

Parameters ​

id ​

string

groups ​

readonly WaygraphTodoGroupInput[]

opts? ​

Omit<WaygraphTodosOpts, "index">

Returns ​

void


todoIndex() ​

todoIndex(n): void

Defined in: src/engine/stub/stub.ts:132

Moves the current dock's current item (sequential plans: a later step bumps it).

Parameters ​

n ​

number

Returns ​

void


todos() ​

todos(id, items, opts?): void

Defined in: src/engine/stub/stub.ts:130

Floating checklist: ctx.ui.todos("login", ["Enter email", "Enter password"], { title: "Sign in", index: 0 }). The id is the dock's data-wg-todo-id (stable through redirects). One dock at a time (setting todos replaces it); pass { parallel: true } to keep docks with other ids. An empty list hides the dock.

Parameters ​

id ​

string

items ​

readonly WaygraphTodoInput[]

opts? ​

WaygraphTodosOpts

Returns ​

void


touch() ​

touch(on?): void

Defined in: src/engine/stub/stub.ts:149

Enable / disable touch theater + touchscreen gestures.

Parameters ​

on? ​

boolean

Returns ​

void


viewport() ​

viewport(box): void

Defined in: src/engine/stub/stub.ts:147

Explicit CSS-pixel viewport (implies mobile-ish unless desktop-sized).

Parameters ​

box ​

DeviceViewport

Returns ​

void


zoom() ​

zoom(n): void

Defined in: src/engine/stub/stub.ts:161

Default camera zoom for rings without their own zoom.

Parameters ​

n ​

number

Returns ​

void


zoomOut() ​

zoomOut(keep): void

Defined in: src/engine/stub/stub.ts:165

Default zoomOut for rings in this phase. false = keep camera between rings.

Parameters ​

keep ​

boolean

Returns ​

void

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed