The sandbox item created for this tour run, if any.
Configured item type (read from config.sandboxItemType).
Convenience getter — Foundry stores the step index in a private field.
Before each step renders, honour two custom step-config fields:
sheetTab: ".tab.<id>.active …) matches even if the user
clicked Next without clicking the highlighted tab first.
advanceOnClick: true After the step renders, wires a one-shot click listener on the targetElement that calls this.next(). Lets the user drive the flow by interacting with the actual UI; the Next button still works.
After the step renders, wire two recovery behaviours:
advanceOnClick — let clicks reach the highlighted element through
Foundry's .tour-fadeout + .tour-overlay (both block by default),
then advance to the next step after the underlying click's
side-effects (document update + sheet re-render) settle. Without the
wait, the next step's selector queries the DOM before the new sheet
paint and fails (e.g. .trigger-hook-select doesn't exist until
after the Add Trigger update + render finishes).
reanchor on sheet re-render — if anything else re-renders the
sandbox sheet (the user clicks a different tab, the data model fires
derived data, etc.), the tooltip's anchor element is detached and
the tour visually disappears. We re-progress to the same step,
which re-runs _preStep (sheetTab fallback) + re-resolves the
selector against the new DOM.
Create the sandbox item, open its sheet, and stash the reference. Default implementation is generic across types — subclasses can override to seed additional system data (e.g. an initial swing on the sandbox action so the swing-trigger step has something to point at).
Resolve once the given selector matches a node in the document, or after
timeoutMs (default 1500). Uses a MutationObserver and an immediate
pre-check so already-present nodes resolve synchronously.
On completion, post a chat card linking the sandbox item so the user can find / drag it without hunting through the hidden folder.
Override of Foundry's Tour.start. We only spawn the sandbox when the tour isn't already in progress (so that resuming a paused tour doesn't mint a second item).
Tour subclass used by every manual tour. Reads
sandboxItemTypefrom its config and, on first start, spawns a sandbox item of that type and opens its sheet. The tour then proceeds as a normal Foundry Tour, walking the user through real selectors on the live sheet.Subclasses or callers can override
_setupSandbox()to seed the sandbox item with extra system data before the first step renders.