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.
npm install bodylight-componentsWeb components of the Bodylight library. For full documentation see https://bodylight.physiome.cz/Bodylight-docs/reference/. Project portal with links to samples at https://bodylight.physiome.cz/
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 https://aurelia.io
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: https://developer.mozilla.org/en-US/docs/Web/Web_Components
[^2]: Aurelia framework: https://aurelia.io
bdl-fmi component, and modelDescription.xml - standard FMU description with variable references.bdl-adobe component.https://bodylight.physiome.cz/Bodylight-docs/tutorial/#basic.md
1) Use bodylight.bundle.js from :
* from jsdelivr CDN:
``html`
npm i bodylight-components
* OR install bundle by npm: bodylight.bundle.js
* OR download locally and refer it from your
` aurelia-app="webcomponents"
2) Add attribute to div or body where web components will be located (note that web-components are distinguished by the prefix bdl- from other HTML elements:`html`
index.html
...
3) (optional) you may use any of bdl-markdown-* components to refer MD documents where you may use Bodylight webcomponents as well.doc/index.md
E.g. contains main content and summary.md contains sidebar with links to other docs.`html`
index.html
...

`markdown
doc/index.md
`markdown
summary.md
| EN | CZ |
* First Page
* Second Page
* Sub page of second page
`Bodylight webcomponents in Moodle
1. edit moodle page in HTML - use HTML source, click and then siwtch code - click
2. add the bodylight script
`html
`
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 cdn.jsdelivr.net/gh/ which is returning correct MIME Type.
`html
src="https://cdn.jsdelivr.net/gh/creative-connections/Bodylight-Scenarios@master/hemodynamics/index.cs.md"
base="https://cdn.jsdelivr.net/gh/creative-connections/Bodylight-Scenarios@master/">
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.: https://bodylight.physiome.cz/Bodylight-Scenarios/#hemodynamics/hemo2.cs.md&showmenu=false2. Aurelia web components
We recommend to use aurelia framework to build web application with Bodylight Web components.
Follow Aurelia doc's how to prepare your project and install
aurelia-bodylight-plugin by npm command-line:
`bash
npm i aurelia-bodylight-plugin
`In your
main.js file enable the plugin by aurelia.use.plugin(PLATFORM.moduleName('aurelia-bodylight-plugin')), so it may look like:
`javascript
//main.js
import {PLATFORM} from 'aurelia-pal';export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.plugin(PLATFORM.moduleName('aurelia-bodylight-plugin'))
aurelia.start().then(() => {
aurelia.setRoot(PLATFORM.moduleName('app'));
});
}
`
Bodylight web components are available in any template, use them without bdl- prefix:
`html
...
`
Developer's Guide
Download source code
*
git clone https://github.com/creative-connections/aurelia-bodylight-plugin.git
* git clone https://github.com/creative-connections/Bodylight.js-Components.gitTo develop
* components sources at
*
cd aurelia-bodylight-plugin
* npm i
* au build - builds the plugin
* build-all.sh - builds plugin and ../Bodylight.js-Components at onceTo 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 folderTo 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