Skip to content

Repository files navigation

Flowchart (@webwriter/flowchart@2.1.0)

License: MIT | Version: 2.1.0

Create programming flowcharts with interactive tasks. Use standardized Elements such as loops and Branchings.

Snippets

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

NameImport Path
Erklaerung@webwriter/flowchart/snippets/Erklaerung.html
For Schleife@webwriter/flowchart/snippets/For-Schleife.html
If Else@webwriter/flowchart/snippets/If-Else.html
Switch@webwriter/flowchart/snippets/Switch.html
Kontextbeispiel@webwriter/flowchart/snippets/Kontextbeispiel.html

FlowchartWidget (<webwriter-flowchart>)

Usage

Use with a CDN (e.g. jsdelivr):

<linkhref="https://cdn.jsdelivr.net/npm/@webwriter/flowchart/widgets/webwriter-flowchart.css" rel="stylesheet"><scripttype="module" src="https://cdn.jsdelivr.net/npm/@webwriter/flowchart/widgets/webwriter-flowchart.js"></script><webwriter-flowchart></webwriter-flowchart>

Or use with a bundler (e.g. Vite):

npm install @webwriter/flowchart
<linkhref="@webwriter/flowchart/widgets/webwriter-flowchart.css" rel="stylesheet"><scripttype="module" src="@webwriter/flowchart/widgets/webwriter-flowchart.js"></script><webwriter-flowchart></webwriter-flowchart>

Fields

Name (Attribute Name)TypeDescriptionDefaultReflects
localize--LOCALIZE
graphNodes (graphNodes)GraphNode[]Current list of graph nodes (programmatic API).[]
arrows (arrows)Arrow[]Current list of arrows between nodes (programmatic API).[]
getGraphNodes-Get the current nodes.-
getArrows-Get the current arrows.-
taskList (taskList)ItemList[]Tasks shown in the task menu.[]
helpList (helpList)ItemList[]Hints shown in the help menu.[]
height (height)numberCanvas height (px).400
zoomLevel (zoomLevel)numberCurrent zoom percentage (50–200).100
canvasOffsetX (canvasOffsetX)numberHorizontal pan offset (world units).0
canvasOffsetY (canvasOffsetY)numberVertical pan offset (world units).0
disableStudentEdit (disableStudentEdit)booleanDisables interactive editing (adding/dragging/deleting).false
disableStudentPan (disableStudentPan)booleanDisables panning/zooming interactions.false
font (font)stringFont family used for labels, spaces written as underscores.'Courier_New'
fontSize (fontSize)numberFont size used for labels.16
theme (theme)stringColor theme name.'standard'
fullscreen (fullscreen)booleanWhether the widget is currently in fullscreen mode.false
getSelectedSequence-Get the currently selected path sequence.-
isSelectingSequence-Set path-selection mode.-
solutionMessage (solutionMessage)stringMessage shown in the solution prompt.''
showSolution (showSolution)booleanWhether the solution prompt is visible.false
setSelectedSequence-Programmatically set the selected path sequence.
Overwrites the internal selectedSequence with the provided ordered descriptors.
-

Fields including properties and attributes define the current state of the widget and offer customization options.

Methods

NameDescriptionParameters
isEditableReturns whether the widget is currently in an editable state
based on the contenteditable attribute.
-
selectSequenceToggle path-selection mode for solution checking.
When turning off the mode, clears the current selected sequence, ends a running
task recording and drops any selected node/arrow/rectangle, then triggers a redraw.
-
checkSolutionCompare the currently selected path sequence with a task's expected sequence.
If length and element-wise id/type match, shows a success message; otherwise
shows a failure message. Uses showSolutionWithMessage() to display the result.
task: ItemList

Methods allow programmatic access to the widget.

Custom CSS properties

NameDescription
--offset-xInternal canvas left offset (managed by the widget).
--offset-yInternal canvas top offset (managed by the widget).
--widget-heightWorkspace height in pixels.

Custom CSS properties offer defined customization of the widget's style.

Editing config

NameValue

The editing config defines how explorable authoring tools such as WebWriter treat the widget.

No public slots, events, or CSS parts.


Generated with @webwriter/build@1.9.1

About

Create programming flowcharts with interactive tasks. Use standardized elements such as loops and branchings.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages