color-scheme (for example
* :root[data-theme='light'] { color-scheme: light }, as Starlight sets it) and
* updates when the page switches theme; when the page declares none, it falls back to the OS
* preference.
* @summary Dark, light, or follow the system or the page
* @group Theme
*/
@property({ type: String, attribute: "color-scheme", reflect: true })
colorScheme: "dark" | "light" | "system" | "auto" = "dark";
/**
* expanded shows each step's inputs and actions in its box;
* compact shows the operation, the values that come from the
* inputs or earlier steps, and the gotos and retries whose lines leave the box.
* @group Workflow
*/
@property({ type: String, reflect: true })
view: "expanded" | "compact" = "expanded";
/**
* false hides the Compact / Expanded switch.
* @group Workflow
*/
@property({ type: String, attribute: "show-view-toggle" })
showViewToggle: "true" | "false" = "true";
/**
* true shows a box above the diagram to load any Arazzo
* spec by URL (YAML or JSON; the server must allow cross-origin requests). Loading one shows
* its first workflow. The element then manages the Arazzo spec: with for, whenever the Arazzo spec changes (from the box or arazzo-url), each paired element loads its OpenAPI source, unless it already
* shows that OpenAPI spec, so steps resolve and runs go to that API.
* @group Workflow
*/
@property({ type: String, attribute: "allow-arazzo-url-load" })
allowArazzoUrlLoad: "true" | "false" = "false";
/**
* true keeps the shown workflow and the selected step in the
* page's address as query parameters, ?workflow=<id>&step=<id>,
* so a link opens that workflow with that step selected and scrolled into view. It uses the query
* string, not the hash, which <rapi-doc> keeps for its
* operations; the address is replaced (no history entries) and history.state is kept for the page's router. Set it on one element per page.
* @group Workflow
*/
@property({ type: String, attribute: "update-route" })
updateRoute: "true" | "false" = "false";
/**
* false hides the run panel: the diagram only.
* @group Run
*/
@property({ type: String, attribute: "allow-run" })
allowRun: "true" | "false" = "true";
/**
* Base URL the first OpenAPI source's requests go to in runs, instead of the server its paired
* element selected or the OpenAPI spec's first server.
* @group Run
*/
@property({ type: String, attribute: "server-url" })
serverUrl = "";
/**
* true says the server runs go to is a mock that picks its
* response status from a Prefer: code= header, such as
* rapidoc mock or Prism. The run panel then shows Mock Response
* Status, sent with each step's request, and the button reads "RUN WORKFLOW (Mock)". Not needed
* when the paired elements have mock-server="true"; against a real API, leave it off: the header is ignored.
* @group Run
*/
@property({ type: String, attribute: "server-is-mock" })
serverIsMock: "true" | "false" = "false";
/**
* true shows an Export MCP Server button that downloads an MCP
* server with one tool per workflow of the Arazzo spec (every one the runtime can run), and
* no tool per operation. Its steps call every API source of the Arazzo spec; <rapi-doc>'s own export covers one API's operations.
* @group MCP
*/
@property({ type: String, attribute: "mcp" })
mcp: "true" | "false" = "false";
/**
* Name of the exported MCP server. Defaults to the Arazzo spec's title.
* @group MCP
*/
@property({ type: String, attribute: "mcp-server-name" })
mcpServerName = "";
@state() private doc: any = null;
@state() private sources: Map
Make the mock answer with an HTTP status, to try the workflow's failure paths: its
retries, gotos and ends. Enter one code (404), or several separated by
commas (503, 503, 200) to give a step's attempts one each, in turn;
random:200, 500 picks one at random for each attempt. Leave a field empty
for the success response; a step's own field overrides Every step. A step's
x-mock-server-status-code in the workflow fills its field.
${e.failedCriterion ? html`Check Failed:${e.failedCriterion}` : nothing}
${e.action ? html`→ ${e.action.type}${e.action.stepId ? ` ${e.action.stepId}` : ""}` : nothing}
${e.attempt > 1 ? html`attempt ${e.attempt}` : nothing}
${e.mocked && showMocked ? html`mocked response` : nothing}
This step calls a URL outside the workflow's APIs (x-operation): that server must allow cross-origin requests from this page.
${pretty(e.request.body)}` : nothing}
${e.response ? html`${pretty(e.response.body)}` : nothing}
${e.outputs && Object.keys(e.outputs).length ? html`${pretty(e.outputs)}` : nothing}
${JSON.stringify(this.maskSecrets(graph, this.runSentInputs), null, 2)}`
: nothing
}
${
this.trace.length
? html`Cannot run this workflow: ${this.runProblem}
` : nothing} ${ this.runResult ? this.runResult.isError ? html`${this.runResult.content[0].text}`
: html`${this.runResult.content[0].text}`
: nothing
}
Arazzo ${this.arazzoUrl}
` : nothing; } const submit = (e: Event) => { e.preventDefault(); const input = (e.target as HTMLFormElement).querySelector("input"); const url = input?.value.trim(); if (!url) return; this.beforeBoxLoad = { arazzoUrl: this.arazzoUrl, workflowId: this.workflowId, specUrl: this.specUrl, }; this.boxError = ""; this.followArazzo = true; this.workflowId = ""; // A page's spec-url belonged to the previous document this.specUrl = ""; if (url === this.arazzoUrl) this.load(); else this.arazzoUrl = url; }; return html` ${this.boxError ? html`${this.boxError}
` : nothing}`; } render() { return html`${graph.description}
` : nothing }${p.path} ` : nothing}${p.message}