Share a component with the official repository
Prepare a component for the official catalogue and offer it to the Total.js repository.
On this page
The official components live in the public GitHub repository totaljs/flowstreamcomponents. When your component is useful to others, you can offer it there, and after it is accepted it appears in the catalogue of every Flow.
How the repository is organized
| Path | What it holds |
|---|---|
components/ | One HTML file for each component. The name of the file is the id of the component in the catalogue. |
db.json | The catalogue. |
db.js | The script that builds db.json from the files in components/. |
tester.js and tests/ | The tester and the tests. |
Prepare your component
- Name the file after the component, in lowercase, for example
components/uppercase.html. - Write each of
exports.id,exports.name,exports.group,exports.version,exports.icon,exports.author,exports.colorandexports.kindon one line that ends with a semicolon.db.jsreads these lines one by one to build the catalogue entry. - Write a
<readme>.db.jscopies it into the catalogue, and users read it under Read me and in Official components. - Put your name in
exports.author. Components whose author is not Total.js show a Community badge. - Add a test in
tests/, and run it. - Follow the coding standards that the repository links in its README.
Build the catalogue entry
db.js reads every file in components/ and writes db.json, sorted by name. The address of each file in the catalogue is:
https://cdn.totaljs.com/flowstream/webcomponents/<file name>Run it from the repository folder after npm install total4:
node db.jsCheck that db.json has an entry for your component with the right name, group, version and readme.
Offer it
Fork the repository on GitHub, add your component and its test on a branch, and open a pull request with a short description of what the component does. Total.js publishes the catalogue at the address above.
Change a component later
Raise exports.version with every change. Flow compares the version in the catalogue with the installed one, and shows an update badge in the Download components window when the catalogue has a newer version.