New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

seqcode

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seqcode

**UML sequence diagrams automatically translated from simple code**

latest
npmnpm
Version
0.1.23
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

SeqCode

UML sequence diagrams automatically translated from simple code

SeqCode (pronounced "seek code") is an easy to learn script in the style of a simple procedural programming language that is automatically translated into UML sequence diagrams.

This is a tool designed for programmers that want to capture the logic rather than mess with a modelling or drawing application.

The following shows an example script and the resulting SVG diagram:

a.get() {
    b > msg {
        db.store()
    }
}
c.destroy()

note( 60, 300, 280, seqcode - UML sequence diagrams automatically translated from simple code.)

Example seqcode diagram

For a live demonstration visit: https://seqcode.app

This repo contains the npm package that performs the script parsing, layout and svg generation. It can be used in node and in the browser.

SeqCode is licensed under the terms of the BSD 2-Clause License.

Installation

npm install seqcode

Usage

import seqcode from "seqcode";

const {svg,errors} = seqcode("a.do()", { /* options */ });
if (errors) console.error(errors)
const str = svg.svg()    // string of svg source
const element = svg.node // HTML Element

Node Dependencies

In a nodejs environment you need to create the dependencies for SVG creation (the tests do this):

import { createSVGWindow } from 'svgdom';
import { registerWindow } from '@svgdotjs/svg.js'

const window = createSVGWindow();
const document = window.document;
registerWindow(window, document);

Options

OptionDefaultTypeDescription
foreground"black"StringCSS color used for the text, lines, arrows and box outlines.
background"white"StringCSS color used for the background of the diagram.
fontFamily"verdana"StringCSS font-family for all text except notes.
fontSize12IntegerPixel size of the font
fontWeight100IntegerCSS font-weight for all text except notes.
fillLight"#eee"StringCSS color for the start of the gradient fill in execution boxes and frame labels.
fillDark"#ddd"StringCSS color for the end of the gradient fill in execution boxes and frame label.
dashStyle[8,5]Integer ArrayDash style for lines.
arrowSize7IntegerSize in pixels of the arrows
margin30IntegerMargin in pixels used around the diagram.
rowSpacing30IntegerVertical spacing in pixels between messages.
objectSpacing5IntegerHorizontal spacing between object life lines in pixels.
areaPadding15IntegerPadding in pixels added to the interior of frames
linkIconColor"#999"StringCSS color of the icon added when a note or frame is a link.
noteForeground"#0000CD"StringCSS color of the font used in notes.
noteFontFamily"verdana"StringCSS font-family of the text in notes.
noteFontSize12IntegerSize in pixels of the font used in notes.
noteFontWeight100IntegerCSS font-weight of the ont used in notes.
noteLight"#FFFDA1"StringCSS color for the start of the gradient fill in notes.
noteDark"#FFEB5B"StringCSS color of the end of the gradient fill used in notes.
noteStroke"#ccc"StringCSS color of the outline of notes.
linkHandlerLinkHandlerDefines how links are handled.

LinkHander

The linkHandler option is an object with the properties as per the table below. It is used to control how links in notes and ref frames are handled.

PropertyDefaultDescription
href(link) => "#"Function that returns the href value for the link element.
target(link) => ""Function that returns the target value for the link element.
onclick(link) => `alert(decodeURI("${encodeURI(link)}"))`Function that returns the onclick javascript code for the link element.

Errors

Errors returned are for information, SeqCode attempts to skip over errors and continue parsing the script.

PropertyTypeDescription
tokTokenThe unexpected token that was found or null if at the end of the file.
tok.lineIntegerThe line number that the error appears on.
tok.colIntegerThe column number that the error appears on.
tok.typeIntegerThe type of token that was found.
tok.strStringThe string/text value of the token.
expectedStringMessage describing what was expected instead of the token found.
idIntegerA unique id of the error that was raised, used for internal debugging.

Acknowledgements

SVG generation is done using svg.js

FAQs

Package last updated on 18 Jun 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