@openmockup/flow
v0.1.6
Published
Pluggable flow module for Open Mockup form navigation
Maintainers
Readme
@openmockup/flow
Pluggable flow runtime for Open Mockup forms.
- describe multi-form navigation in TS DSL
- map
actionRefto transitions - supports stack navigation, modal stack, and back behavior
Example
import { actionRef, dsl, field, form, page, text } from "@openmockup/dsl";
import { createFlowRuntime, flow, flowForm, flowFormRef, flowTransition, triggerAction } from "@openmockup/flow";
const checkout = flow({
initial: flowFormRef("contact"),
forms: [
flowForm({
id: flowFormRef("contact"),
doc: dsl({
page: page({
title: text("Contact"),
layout: form({
fields: [field({ key: "email", component: "textInput", label: text("Email") })],
}),
}),
}),
}),
],
transitions: [
flowTransition({ from: flowFormRef("contact"), action: actionRef("help"), to: flowFormRef("help-modal"), mode: "modal" }),
],
});
let runtime = createFlowRuntime(checkout);
runtime = triggerAction(checkout, runtime, actionRef("help"));