Custom elements enhancing HTML to enable model simulation in FMU, visualization using Adobe Animate exports or animated gifs, charts using chartjs and documenting in enhanced markdown.

Usage no npm install needed!

<script type="module">
  import bodylightComponents from '';



Project stage: Development Version Zenodo Published on

Web components of the Bodylight library. For full documentation see Project portal with links to samples at

Bodylight.js web components is a suite of custom elements enhancing HTML web documents with

  • FMU component able to be execute in browser. Modelica model is exported to FMU using FMI standard and Bodylight FMU Compiler can convert FMU with source codes and solver into WebAssembly script.
  • Adobe-Animate and Gif-Animate component able to control animation exported from Adobe-Animate or animated GIF and bind them to variables of model simulation.
  • ChartJS and DygraphJS components to visualise model variables in different chart types.
  • Following Web components standard.

All bodylight web components are registered with a bdl- prefix. Components are defined in source code without the prefix, which may be used to build application internally in an Aurelia framework This repository contains wrapper code for aurelia-bodylight-plugin registering all Aurelia[2] components as standard (framework agnostic) web components [1].

This plugin is part of broader tools to enable in-browser simulation using modern web technologies: Web Assembly, HTML, Javascript (ECMAScript6).

[^1]: Web Components:

[^2]: Aurelia framework:


To build web simulator:

  1. You need to export Modelica model into FMU with source codes including source codes for solver (Dymola exports CVODE, OpenModelica 1.14.x exports Euler and 1.16.x is declared to support CVODE export too).
  2. Then you need to convert the FMU into WebAssembly - using Bodylight FMU Compiler
  3. the exported ZIP contains JS file - to be reffered from bdl-fmi component, and modelDescription.xml - standard FMU description with variable references.
  4. optional - export Adobe Animate animation into CreateJS library usable by bdl-adobe component.
  5. use the Bodylight components, This plugin is distributed in 2 different way: 1) as standard web components or 2) as aurelia components.
    • 1. Standard web components - distribution recommended to build web simulator using enhanced HTML or Markdown.
    • 2. Aurelia web components - recommended for more complex web application, further info at aurelia-bodylight-plugin at GITHUB

Live demo and tutorial

1. Standard web components

  1. Use bodylight.bundle.js from :

    • from jsdelivr CDN:
      <script src=""></script>
    • OR install bundle by npm: npm i bodylight-components
    • OR download bodylight.bundle.js locally and refer it from your <script>:
        <script src="bodylight.bundle.js"></script>
  2. Add attribute aurelia-app="webcomponents" to div or body where web components will be located (note web-components are custom elements with prefix bdl-:

<body aurelia-app="webcomponents">
  <bdl-range id="id1" min="40" max="180" default="60" title="Heart rate"></bdl-range>
  <bdl-fmi ...></bdl-fmi>
  <bdl-chartjs ...></bdl-chartjs>
  1. (optional) you may use any of bdl-markdown-* components to refer MD documents where you may use Bodylight webcomponents as well. E.g. doc/ contains main content and contains sidebar with links to other docs.
<body aurelia-app="webcomponents">
    <bdl-markdown-book index="doc/" summary="doc/">
      <img src="docs/loading.gif"/>

# Introduction
Markdown syntax is interpretted. Syntax highlighting is enabled for source code. KATEX plugin is enabled to allow
basic equation e.g. $e = m c^2$

## bodylight web components
Use bodylight web components directly:
  <bdl-range id="id1" min="40" max="180" default="60" title="Heart rate"></bdl-range>
  <bdl-fmi ...></bdl-fmi>
  <bdl-chartjs ...></bdl-chartjs>
| EN | [CZ](#doc/ |   
  * [First Page](#doc/
  * [Second Page](#doc/
    * [Sub page of second page](#doc/

Bodylight webcomponents in Moodle

  1. edit moodle page in HTML - use HTML source, click and then siwtch code - click
  2. add the bodylight script
    <script type="module" src=""></script>
    <div aurelia-app="webcomponents"><br>
  3. add bodylight component, note that markdown component needs base to be specified so relative links are rendered correctly inside Moodle. For resources in github repo use which is returning correct MIME Type.
    bdl-markdown not supported
    This allows FMI scripts and MD content to be loaded correctly.

Bodylight webcomponents in Adobe Captivate

Bodylight Web Components cannot be inserted directly into Adobe Captivate, however, content created in HTML or MD and hosted in some domain can be added using direct URL as Web Object. You may use the showmenu=false URL parameter, e.g.:

Developer's Guide

Download source code

  • git clone
  • git clone

To develop

  • components sources at
  • cd aurelia-bodylight-plugin
  • npm i
  • au build - builds the plugin
  • - builds plugin and ../Bodylight.js-Components at once

To test

  • Either manually copy bodylight.bundle.js to /test directory
  • OR npm run build - this will copy bundle into /test dir
  • THEN serve http from /test folder

To publish

  • npm login - logs into npmjs
  • sudo npm i np -g - installs np tool globally
  • np - UI to publish bodylight-components into npm as package