Repository navigation
Editor Components
Reference for every React component in the editor's components/ folder: what it shows, its props and
state, and which messages, storage keys or browser APIs it touches. Read Editor first for how
Editor.tsx owns the state these components receive.
Source: BlockNode.tsx, ConfigPanel.tsx, TemplateInput.tsx, PermissionNote.tsx, Screenshot.tsx, LogPanel.tsx, Sidebar.tsx, NewMenu.tsx, ImportButton.tsx, WorkflowActions.ts, WorkflowsPage.tsx, ReportsPage.tsx, DataPage.tsx, SecretsPage.tsx, PromptBanner.tsx
| Component | Where it appears | Side effects |
|---|---|---|
| BlockNode | every block on the canvas | none (reads two contexts) |
| ConfigPanel | right column, canvas view | sends bf:start-pick, listens for bf:pick-result / bf:pick-error
|
| TemplateInput | templated text settings | none |
| PermissionNote | ConfigPanel, blocks with permissions
|
permissions.contains / request
|
| Screenshot | step inspector, reports | IndexedDB read |
| LogPanel | bottom row, always | none (callbacks) |
| Sidebar | left column, always | none (callbacks) |
| NewMenu | sidebar, All workflows | none |
| ImportButton | sidebar, All workflows | file picker |
| WorkflowsPage |
manage view |
none (callbacks) |
| ReportsPage |
reports view |
IndexedDB read, downloads |
| DataPage |
data view |
IndexedDB read/delete (polls), downloads |
| SecretsPage |
secrets view |
reads/writes bf:secrets
|
| PromptBanner | top of the page, all views | sends bf:answer-prompt
|
Shared conventions: components are function components with props interfaces declared in the same file;
everything that changes workflows goes back to Editor through callbacks (no component writes
bf:workflows); confirmations use window.confirm; block metadata comes from the shared
registry.
How one block looks on the canvas. Registered in Editor as nodeTypes = { block: BlockNode }.
Exports
| Export | Kind | Purpose |
|---|---|---|
BlockNode |
component | Receives React Flow's NodeProps<BlockFlowNode> (id, data, selected). |
BlockFlowNode |
type |
Node<BlockNodeData, 'block'>, the node type used in Editor's state. |
IssuesContext |
context |
Map<nodeId, string[]> of validation messages. Provided by Editor. |
RunStatusContext |
context |
Map<nodeId, StepStatus> for the inspected run. Provided by Editor. |
What it renders
- Header:
def.icon,def.label(falls back to?/ the raw type for unknown blocks), a run badge (⏳ ✓ ✕ ↪ ⤼for running / passed / failed / handled / skipped) and a!badge when it has problems (the problems are the node'stitletooltip). -
def.summary(config)withdefaultConfigmerged in, the step note, and "Disabled: passes data through". - Handles: one target on the left. On the right, one source handle per port from
nodePorts(def, { step })insrc/core/ports.ts; the handleidis the port name, which becomes the edge'ssourceHandle. With a singleoutport it draws one plain handle; otherwise labelled handles spread evenly down the right side and the node gets aminHeightof22 + 20 × ports. - CSS classes:
bf-node+selected,has-problem,disabled,run-<status>,multi-port; the block's colour arrives as--accent.
Why contexts: issues and run status are not stored in node data, because data is written back to
the workflow by fromFlow (see Editor, gotchas).
The right column on the canvas view: settings of the selected block, generated from its fields
(FieldSpec[] in src/core/types.ts), so a new block needs no editor code.
Props (ConfigPanelProps)
| Prop | Type | Meaning |
|---|---|---|
node |
BlockFlowNode | undefined |
Selected node (first with selected). Undefined shows "Select a block…". |
problems |
string[] |
Validation messages for this node. |
onChange(nodeId, patch) |
callback | Shallow-merges into data.config (Editor.updateConfig). |
onStepChange(nodeId, patch) |
callback | Merges into data.step (Editor.updateStep). |
onDelete(nodeId) |
callback | Removes the node and its edges. |
lastStep |
StepRecord | undefined |
This node's last step in the inspected run. |
workflows |
{ id, name }[] |
Other workflows, for workflow fields (Run Workflow). |
suggestions |
string[] |
Names for {{ completion (see Editor, suggestions). |
State: pick (idle | waiting | done | error, message text, the field it belongs to, and alternative
locator candidates); refs pending (the current PickTarget) and configRef (latest merged config, read
by the message listener). Pick status resets whenever the selected node changes.
Layout, top to bottom: title and description; PermissionNote if def.permissions;
problems list; one control per field; StepResult if the block ran; StepSettingsEditor;
"Data this block passes on" (def.outputs); Delete block. Unknown block types get only an error and a
Delete button.
Field kind → control
field.kind |
Control |
|---|---|
boolean |
checkbox |
number |
number input (min/max/step); empty stores ''
|
select |
<select> of options
|
workflow |
<select> of the other workflows |
rows |
RowsInput table |
text kinds (text, selector, locator, …) |
TemplateInput when templated, else <textarea> (multiline) or text input |
selector, locator
|
additionally a 🎯 Pick on page button |
Values shown are { ...def.defaultConfig, ...node.data.config }; only what the user changes is written.
Element picking (messages). startPick(target, config) stores the target in pending and sends
bf:start-pick { url?, mode }:
-
urlis the value offield.pickerUrlKey(e.g. Watch Element's page URL) when set and not templated; without it the background uses the most recent web tab. -
modeis'form'for Detect fields, otherwise'element'.
A runtime.onMessage listener applies the answer to the pending target only (so another editor tab's pick
is ignored):
| Target | On bf:pick-result
|
|---|---|
field |
Sets the field to the first readable candidate (role=, text=…) unless field.pickPrefers === 'stable', then the CSS selector. Also writes the page URL into pickerUrlKey. Offers all candidates plus the selector as one-click alternatives. |
cell (a locator column of a rows field) |
Sets that cell to candidates[0] ?? selector. |
form |
Replaces the rows with the form's fields, keeping values already typed for locators still present, and copying hint. |
bf:pick-error shows the message; a failed sendMessage shows "Could not reach the background worker".
The other side is in Picker and Recorder and
Message Protocol.
| Function | Purpose |
|---|---|
RowsInput |
Table editor for rows fields (Fill Form, Extract List, Manual Start, Transform). Cells are TemplateInputs (suggestions only for column.templated), 🎯 per column.locator cell, + Add row, ✕ remove, and Detect fields when field.detectForm. A row's hint becomes the value placeholder. Rows are keyed by index. |
FieldInput |
The scalar control table above. |
StepSettingsEditor |
"Step settings" <details>, open when anything is set. On error (stop/continue/port), Retries (0..MAX_RETRIES), Timeout (placeholder = def.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS), Screenshot (error/always/never), Use real mouse and keyboard (asks for the debugger permission first; stays off if refused), Disabled, Note. Semantics: ARCHITECTURE.md, Engine model. |
StepResult |
"Last run" <details>: status, duration, attempts, chosen port, error, Screenshot, input and output as JSON. |
formatMs(ms) (exported) |
850 ms, 2.5 s, 12 s. Also used by LogPanel and ReportsPage. |
A text input or textarea that offers data names after {{, IDE style.
| Prop | Type | Meaning |
|---|---|---|
value, onChange(value)
|
string |
Controlled value. |
suggestions |
string[] |
Candidate names (url, item.title, secret.apiKey). |
placeholder, ariaLabel, title
|
string? |
Passed through. |
multiline |
boolean? |
<textarea rows=4> instead of <input>. |
State: menu: { items, start, active } | null.
-
look(text, caret)opens the menu when the caret is after an unclosed{{and what is typed since is a name ([\w.$-]); items are suggestions that start with it (case-insensitive), max 8, excluding an exact match. -
insert(item)replaces the typed part withitem}}(swallowing an existing}}right after the caret) and puts the caret after it on the next frame. - Keys while open: ↑/↓ move, Enter/Tab insert, Esc closes. Blur closes after 150 ms so a click on an item
still lands (items also
preventDefaulton mousedown).
Exports: PermissionNote({ permissions }) and requestPermission(permission).
-
permissions:('debugger' | 'userScripts')[]from the block definition. - On mount, checks each with
browser.permissions.containsand lists the missing ones with a reason and a Grant button. -
requestPermissioncallsbrowser.permissions.request. It must run inside a click handler (browsers only show the prompt on a user gesture). If the browser throws (Firefox/Safari lack these permissions) it alerts and returnsfalse.
userScripts also needs the user to switch on "Allow User Scripts" in chrome://extensions, which the
note says. Which builds declare these as optional is in wxt.config.ts; see
Build and Release.
Screenshot({ id, alt? }): loads a screenshot by id from IndexedDB (loadScreenshot in
src/browser/blobStore.ts) and shows it as a thumbnail link that opens full size in a new tab.
State src: undefined (loading), null (gone: only the newest 150 are kept), or the data URL. See
Browser Host for the blob store.
The bottom row, with two tabs.
| Prop | Meaning |
|---|---|
entries |
Log lines already filtered by Editor (active workflow, or all). |
labelFor(entry) |
Label for a line: block label, plus the workflow name in "all" mode. |
showAll, onToggleAll(next)
|
The "all workflows" checkbox; filters both tabs. |
onClear() |
Clear on the log tab (clearLogs). |
runs |
Runs to list (already filtered). |
inspectedRunId, onInspect(runId)
|
Highlight / choose the run shown on the canvas. Choosing a run of another workflow opens that workflow. |
onClearRuns() |
Clear on the runs tab (clearRuns, keeps running runs). |
workflowName(id) |
Name for a run's workflow in "all" mode. |
State: tab (log | runs). The log tab scrolls to the end when lines are added. The runs tab lists
newest first with status, start time, trigger, step count (including droppedSteps), duration and error.
The left column: workflows on top, block palette below.
Props: everything in WorkflowActions, plus workflows, activeId, and
onAddBlock(type).
State: query (workflow search, shown once there are more than 4), renaming (id being renamed),
blockQuery (palette filter).
| Part | Behaviour |
|---|---|
| Workflow row | Dot toggles on/off; name opens; double click or ✎ renames inline (Enter/blur saves a non-empty name, Esc cancels); ⧉ duplicate; ⬇ export; 🎭 Playwright; 🗑 delete. |
| Header | NewMenu and ImportButton. |
| Palette |
registry.list() grouped by CATEGORY_LABELS order, empty groups hidden. Filter matches label, description and type. Groups start, browser and page start open; all open while filtering. |
| Adding blocks | Click calls onAddBlock(type). Drag sets DRAG_MIME (application/x-blockflow-block) to the block type; Editor.onDrop reads it. |
Export: DRAG_MIME.
NewMenu({ onBlank, onTemplate, plain? }): a "+ New ▾" button with a small menu: Blank workflow and one
item per template (with "· N workflows" when a file holds several). Closes on a
mousedown outside. plain drops the link styling (used on the All workflows bar). State: open.
ImportButton({ onFiles, className? }): an "Import" button that clicks a hidden
<input type="file" accept=".json,application/json" multiple>. Calls onFiles(FileList) and clears the
input so picking the same file again still fires change.
WorkflowActions.ts is an interface, not a component: the operations the Sidebar and WorkflowsPage offer
(onOpen, onCreate, onCreateFromTemplate, onRename, onToggle, onDuplicate, onExport,
onExportPlaywright, onDelete, onImport). Editor builds one object and spreads it into both, so the
two lists can never behave differently. What each does is in
Editor, workflow actions.
The "All workflows" view: a file-manager table.
Props: WorkflowActions plus workflows, activeId, logs, errorCounts
(Map<id, number> of validation errors) and onSetAll(enabled).
State: query (name filter), picked (Set of selected ids).
- Bar: search, + New, Import, Export selected (n) or Export all, Turn all on / off.
- Columns: select, on/off switch, name (+ "n problems"), block icons (tooltip: block and connection counts),
Last activity (timestamp of the workflow's newest log line, from
logs), and Edit / Duplicate / Export / Playwright / Delete. - The switch is not disabled for workflows with problems:
onTogglerefuses and explains with an alert.
Test-report view over the stored runs.
Props: runs (all of bf:runs), onShowOnCanvas(run) (opens the workflow and inspects that run),
onClear().
State: workflow and status filters, openId (run shown in the detail pane).
- Filters: workflow (from the runs themselves, so deleted workflows still appear) and result; Failed
also matches
interruptedruns. - Totals line from
summarize(shown)(src/core/report.ts). - Detail: steps with status, block label, duration, attempts, port taken, error, Screenshot,
and open called run for Run Workflow steps (
childRunId). - Exports (of the filtered runs) through
downloadText: JSON, JUnit XML (toJUnitXml) and HTML (toHtmlReport, with screenshots loaded from IndexedDB and inlined as data URLs, so the file stands alone). Report formats are documented in Core Modules.
Browser for datasets written by Save to Dataset blocks (IndexedDB, src/browser/blobStore.ts).
State: datasets (null while loading), open (selected dataset name).
-
refresh()callslistDatasets()(sorted byupdatedAt, newest first) on mount, every 3 s while the page is open (runs keep adding rows), and on the Refresh button. - Detail: preview of the first 50 rows (
PREVIEW_ROWS); columns are the union of object keys in those rows, or a single "value" column for non-object rows. Objects in cells are shown as JSON. - Download CSV (
toCsvfromsrc/core/csv.ts) or JSON; Delete (deleteDataset, after confirm).
Editor for named secrets in bf:secrets (Record<string, string>), through
useStorageValue (hooks).
State: name, value (the new-secret row), shown (names whose value is visible).
- Names must match
/^[A-Za-z_][A-Za-z0-9_]*$/(so{{secret.name}}parses). Adding an existing name overwrites it. - Existing values are edited in place; every keystroke saves the whole map.
- Delete asks for confirmation (workflows using it will fail).
- Values are plain text in
storage.local; the page says so. Masking in logs and reports is done by the engine (see ARCHITECTURE.md, Engine model), and secrets are never part of a workflow export because they are never in a workflow.
PromptBanner({ prompts }): rendered above the app grid whenever Manual Steps are waiting
(usePrompts() → bf:prompts). One row per prompt: workflow name, message, Continue and
Fail the run, each sending bf:answer-prompt { runId, ok }. The background also shows a notification
with the same buttons; whichever is answered first wins, and the prompt disappears from storage. See
Background Worker.
- Editor: state, data flow, conversion, styling
- Message Protocol and Storage Keys
- Picker and Recorder: the other end of Pick on page
-
Block Internals:
fields,outputs,ports,permissionsthat drive these components - Adding a Block
Generated from docs/wiki in the repo by npm run wiki:publish. Edit the repo files, not this wiki.
Using BlockFlow
- What is BlockFlow
- Installing
- Getting Started
- Concepts
- Using the Editor
- Workflows as Scripts
- Recipes
- Capabilities and Limitations
- Troubleshooting
- Roadmap
Reference
Internals: engine
Internals: browser
Outside access (M4)
Internals: page and editor
Project