ednl-liftstatus-web-components
v1.64.0
Published
The EDNL LiftStatus web components
Readme
EDNL LiftStatus Web Components
The EDNL LiftStatus web components for use in web applications.
Installation
Copy or clone the repo and run npm install.
To get live data, you need an access token to put in the <ls-data> component inside index.html.
How to get an access token
For the time being, navigate to https://next.liftstatus.nl/ and login. On the left, click on "liften".
In the address bar you can append the url with a lift ID like so: https://next.liftstatus.nl/lifts/31901.
The below Lift ID's are great for testing.
| Lift ID | Usefulness | | :-----: | :--------------------------------------------------: | | 31901 | Has a lot of movement | | 32386 | Has a lot of movement | | 32383 | Has a lot of movement | | 31981 | Has a lot of movement | | 49234 | Good for testing status messages and has a back door | | 55040 | Good for testing status messages | | 33137 | Good for testing status messages |
Once on the selected elevator page, open the developer tools and navigate to the network tab. From here, filter on WS and select the request to api.liftstatus.nl/socket.io. You can find the token in the headers of this request.
Note: if you do not see a request, you might need to refresh the browser with the network tab open.
Start developing
Copy the access token and give it as a parameter in the <ls-data> component inside of index.html.
After that you can run npm run start to run the project. It should open to localhost:3000.
Linting and formatting
The setup follows the defaults of a freshly scaffolded Stencil project:
- ESLint (
eslint.config.ts) with@eslint/jsrecommended,typescript-eslintstrictTypeChecked+stylisticTypeChecked,@eslint-reactrecommended-type-checkedand the recommended rules of@stencil/eslint-plugin. The type-aware rules rely onstrictNullChecksintsconfig.json. - Prettier (
.prettierrc.json) for formatting TypeScript, TSX/JSX, CSS, JSON and Markdown: single quotes, print width 180.
| Script | What it does |
| ---------------------- | ---------------------------------------- |
| npm run lint | Lint the whole repository. |
| npm run lint:fix | Lint and auto-fix what can be fixed. |
| npm run format | Format all files with Prettier. |
| npm run format:check | Check formatting without changing files. |
lint, format:check and build run on every pull request, and again before a release. A PR that is not formatted fails its checks, so run npm run format before pushing.
Tip: enable "format on save" with the Prettier and ESLint extensions in your editor.
The Prettier reformat is listed in .git-blame-ignore-revs so git blame can skip it. Point Git at that file once per clone:
git config --local blame.ignoreRevsFile .git-blame-ignore-revsDemo
https://ednl-ls-web-components-demo.web.app/
UNPKG
https://unpkg.com/browse/ednl-liftstatus-web-components/dist/ednl-liftstatus-web-components/
Releasing
Releases and hotfixes are made with release-please. See RELEASING.md.
Implementation manual (docs)
https://springtree.github.io/ednl-liftstatus-web-components/
To edit it you can run npm run docs.
i18n
- Library:
i18next(single shared instance insrc/utils/i18n.ts). - Supported locales:
nlanden. - Default + fallback locale:
nl.
What is translated:
- UI copy and error messages (
ui:*,errors:*insrc/utils/translations.ts). - Sensor labels / short labels / mapped sensor values (
sensorLabels,sensorLabelsShort,sensorValues). - Locale-aware formatting used in components (for example percentages and relative time labels).
What is not translated:
- Raw API/socket payload values.
- Status code descriptions from the
status-codes/referenceAPI (used as-is).
Data flow:
languageis set on<ls-data>(nl/en).<ls-data>normalizes it viagetLocale()and stores it instore.state.locale.- Components read translations through store helpers (
store.t(...)) and/or locale utilities. - Components subscribe to locale changes (
watchStoreLocale), so changinglanguageat runtime updates connected components. - Locale scope is per installation (
id-key), so multiple instances can run different locales on the same page.
Naming conventions
We use Conventional Commits.
Format:
<type>(optional-scope): <short description>
Common types:
build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test
Examples:
feat(ls-date-picker): add support for selecting custom rangesfix(ls-data): prevent reconnect loop when token is missingdocs(readme): document local development setuprefactor(store): simplify idKey resolution for publish
