
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@webwriter/automaton
Advanced tools
Build, visualize, and interact with different kinds of automata (DFA, NFA, PDA).
@webwriter/automaton@3.0.1)License: MIT | Version: 3.0.1
Build, visualize, and interact with different kinds of automata (DFA, NFA, PDA).
Snippets are examples and templates using the package's widgets.
| Name | Import Path |
|---|---|
| Dfa Simple | @webwriter/automaton/snippets/dfa-simple.html |
| Dfa Complex | @webwriter/automaton/snippets/dfa-complex.html |
| Nfa Simple | @webwriter/automaton/snippets/nfa-simple.html |
| Nfa Complex | @webwriter/automaton/snippets/nfa-complex.html |
| Pda Simple | @webwriter/automaton/snippets/pda-simple.html |
| Pda Complex | @webwriter/automaton/snippets/pda-complex.html |
AutomatonComponent (<webwriter-automaton>)Represents an Automaton Component. This component is responsible for rendering and managing the automaton editor and simulator.
Use with a CDN (e.g. jsdelivr):
<link href="https://cdn.jsdelivr.net/npm/@webwriter/automaton/widgets/webwriter-automaton.css" rel="stylesheet">
<script type="module" src="https://cdn.jsdelivr.net/npm/@webwriter/automaton/widgets/webwriter-automaton.js"></script>
<webwriter-automaton></webwriter-automaton>
Or use with a bundler (e.g. Vite):
npm install @webwriter/automaton
<link href="@webwriter/automaton/widgets/webwriter-automaton.css" rel="stylesheet">
<script type="module" src="@webwriter/automaton/widgets/webwriter-automaton.js"></script>
<webwriter-automaton></webwriter-automaton>
| Name (Attribute Name) | Type | Description | Default | Reflects |
|---|---|---|---|---|
nodes (nodes) | Node[] | Each automaton state is encoded as a string using the following format:[#][%]<id>[<label>](<x>|<y>)Regex: `^(#)?(%)?(\d+)(?:[([^]](?:\.[^]])*)])?((-?\d+)\ | (-?\d+))$<br><br>Explanation:<br>#: Optional - marks the initial state.<br>%: Optional - marks the final (accepting) state.<br>: Required non-negative integer - unique state ID.<br>[]: Optional - URI-encoded label. Defaults to q if omitted.<br>(|): Required coordinates - signed integers representing the node's position.<br><br>Multiple nodes are separated by semicolons (;). Example:<br>#0(-150|0);%1accept;2sink`Requirements: Coordinates are mandatory, and there must be at least 150 units of distance between any two nodes. In the case of DFAs, the automaton MUST be complete, i.e. every node MUST have EXACTLY one transition for every input symbol. Correspondingly, a sink should be non-final and have self-loops on all inputs. Implicit sinks are NOT allowed. | [] |
transitions (transitions) | Transition[] | Each automaton transition is encoded as:<from>-<to>[<symbolsOrStackOps>][~<roundness>][@<angle>]Multiple transitions are separated by semicolons ( ;).Regex: `^(?:;\d+-\d+(?:[(?:[^,{]\ | ]+(?:,[^,{]\ | ]+)*|[^,{]\ |
type (type) | AutomatonType | The type of the automaton. Can be 'dfa', 'nfa', or 'pda'. | "dfa" | âś“ |
mode (mode) | "edit" | "simulate" | The current mode. Can be 'edit', or 'simulate'. | "edit" | âś“ |
testLanguage (testLanguage) | string | A regular expression to check the language of the automaton against. | "" | âś“ |
forcedAlphabet (forcedAlphabet) | string[] | The alphabet that the automaton is forced to use as characters separated by spaces. | [] | âś“ |
testWords (testWords) | string[] | Words used for automatically testing the automaton as a string separated by spaces. | [] | âś“ |
verbose (verbose) | boolean | Enables logging of numerous events to the console. | - | âś“ |
permissions (permissions) | string | The encoded permissions for the editor. | "777" | âś“ |
showHelp (showHelp) | string | If true, the widget displays automaton error messages. | "true" | âś“ |
showFormalDefinition (showFormalDefinition) | string | If true, the widget allows viewing the automaton's formal definition. | "true" | âś“ |
showTransitionsTable (showTransitionsTable) | string | If true, the widget allows viewing the automaton's transition table. | "true" | âś“ |
allowedTypes (allowedTypes) | string[] | The types of automata that are allowed in the editor. | ["dfa", "nfa", "pda"] | âś“ |
allowedModes (allowedModes) | string[] | The modes that are allowed in the editor. | ["edit", "simulate"] | âś“ |
allowedTransformations (allowedTransformations) | string[] | The transformations that are allowed in the editor. | ["sink"] | âś“ |
Fields including properties and attributes define the current state of the widget and offer customization options.
| Name | Value |
|---|
The editing config defines how explorable authoring tools such as WebWriter treat the widget.
No public methods, slots, events, custom CSS properties, or CSS parts.
Generated with @webwriter/build@1.6.0
FAQs
Build, visualize, and interact with different kinds of automata (DFA, NFA, PDA).
We found that @webwriter/automaton demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.