import { TemplateResult } from 'lit'; import { BahtElement } from './base.js'; import { FeatureFlags, NestedData, Registry, WorkflowDefinition } from '../core/types.js'; /** * — the optional brain (spec 03). Wraps the current form in an * internal , evaluates rules on every change, walks the visible forms * in linear `order`, and owns the single Next/Submit button. * Forms with kind 'approval' render a decision step instead (spec 03 §4): * a summary of earlier answers plus Approve/Reject (+ optional comment); the * decision lands in data as `.decision` so rules can branch on it. * The runtime navigates; the host acts (on baht-next / baht-submit / baht-approve / * baht-reject / baht-complete). */ export declare class BahtWorkflow extends BahtElement { workflow: WorkflowDefinition; value: NestedData; registry: Registry; validateGate: boolean; /** Label attributes beat the i18n catalog; unset = t('next')/t('submit')/t('back'). */ nextLabel?: string; submitLabel?: string; backLabel?: string; showBack: boolean; /** * Which way the last navigation went. Stamped on the step wrapper as * `baht-workflow-step--forward|--back` so the stylesheet can slide the new * step in from the matching side; null on first render (nothing to replay). */ private direction; /** Feature-flag values (spec 01 §12): flag-off steps/fields/rules vanish. */ flags: FeatureFlags; /** Render a progress indicator above the current form. */ showSteps: boolean; /** 'default' horizontal markers, or 'sidebar' vertical nav list — forwarded to . */ stepsVariant: 'default' | 'sidebar'; private data; private derived; private current; private approvalError; private history; get currentFormName(): string | null; /** applyFlags result, memoized on (workflow, flags) identity. */ private flagCache; /** * `workflow` as the host may actually have left it: a framework can connect the * element before it binds the property, so internally it is optional until then. */ private get assignedWorkflow(); private get effectiveWorkflow(); protected willUpdate(changed: Map): void; private reevaluate; /** Forms in ascending order whose derived visibility is true. */ private get visibleForms(); private get currentForm(); /** Where next() would go from here: a form_name or 'end' (spec 03 §6). */ private get navTarget(); private get isLast(); private fieldStatesFor; private get formEl(); getData(): NestedData; /** * Host/store write into one form's data — same path a user edit takes * (rules reevaluate, `baht-data-change` fires) but WITHOUT the step reset * that re-feeding the `value` prop causes. */ setValue(form_name: string, patch: Record): void; next(): void; /** Advance past the current form: submit+complete at 'end', else step to navTarget. */ private advance; /** Approve the current approval step (same as pressing its Approve button). */ approve(): void; /** Reject the current approval step (same as pressing its Reject button). */ reject(): void; private decide; /** Jump back to a visible form, truncating the history to that point. */ private gotoForm; back(): void; gotoStart(): void; private onFormChange; private onCommentInput; /** Forms the approval step summarizes: configured list, else every earlier plain form. */ private summary_forms; private renderApproval; protected render(): TemplateResult; } declare global { interface HTMLElementTagNameMap { 'baht-workflow': BahtWorkflow; } }