🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@webwriter/automaton

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webwriter/automaton

Build, visualize, and interact with different kinds of automata (DFA, NFA, PDA).

latest
npmnpm
Version
3.0.1
Version published
Maintainers
3
Created
Source

Automaton (@webwriter/automaton@3.0.1)

License: MIT | Version: 3.0.1

Build, visualize, and interact with different kinds of automata (DFA, NFA, PDA).

Snippets

Snippets are examples and templates using the package's widgets.

NameImport 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.

Usage

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>

Fields

Name (Attribute Name)TypeDescriptionDefaultReflects
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)AutomatonTypeThe 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)stringA 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)booleanEnables logging of numerous events to the console.-âś“
permissions (permissions)stringThe encoded permissions for the editor."777"âś“
showHelp (showHelp)stringIf true, the widget displays automaton error messages."true"âś“
showFormalDefinition (showFormalDefinition)stringIf true, the widget allows viewing the automaton's formal definition."true"âś“
showTransitionsTable (showTransitionsTable)stringIf 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.

Editing config

NameValue

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

Keywords

webwriter-widget

FAQs

Package last updated on 31 Aug 2025

Did you know?

Socket

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.

Install

Related posts