Skip to content

v4.0.0: The TypeScript release

Latest

Choose a tag to compare

@krissen krissen released this 07 Jul 14:05
be3dfb2

The TypeScript release: a rebuilt engine under the same hood ⚙️

Pollen forecast card

Version 4.0.0 is a rebuild more than a feature release: the whole codebase has
moved from JavaScript on Lit 2 to strict TypeScript on Lit 3, and the level
rings are drawn by an in-house SVG renderer instead of Chart.js. The card still
supports 11 integrations across 15 languages; it is now about 30 %
lighter
on the wire.

If we did this right, you won't notice anything at all. If you do notice
something, that's exactly the kind of thing we'd like to hear about.


Heads up before you upgrade ⚠️

Two deliberate fixes change runtime behaviour for some existing configurations:

  • A configured tap_action now actually runs. Until now, tapping a badge
    or card with a tap_action opened the sensor's more-info dialog instead;
    the level ring covers most of the element and its built-in click handler won.
    From 4.0.0 the whole element runs your action. If you had a tap_action
    configured and still want icon taps to open more-info, add
    link_to_sensors: true.
  • String-typed YAML now means what it says. A hand-written
    minimal: "false" used to enable minimal mode (any non-empty string was
    truthy); quoted values are now read as the booleans and numbers they spell.
    Configs made in the visual editor were always canonical and are unaffected.

The rewrite you hopefully won't notice

Every source file, test and build script is now strict TypeScript, the editor
has been broken up into per-section modules, and adapter behaviour is pinned by
characterization tests so the migration renders identically by construction.
This is groundwork: the card should be easier to maintain and extend from here,
and the adapter contract that new integrations build against is now an actual
type rather than folklore.

Lighter rings, same look

Chart.js served the level rings well for years, but a doughnut chart is a lot
of library for a ring. The rings are now a small SVG renderer of our own,
pixel-matched against the old output; with the dependency gone, the bundle
drops from about 289 kB to about 203 kB gzipped.

Bugs that leave with the old engine

The migration flushed out a handful of long-standing issues, all fixed in this
release: badge and card tap_action: navigate never actually navigated
(#279, reported by @GuiGui2, who also kindly beta-tested the fix); the German
labels for the native 5-level scale topped out at "hohe Belastung" instead of
"sehr hohe Belastung" (#277, affects Polleninformation EU, MeteoSwiss and
IRM KMI); Atmo France days reported as Indisponible rendered as an empty
green ring that read as "no pollen" rather than "no data"; and one of the card
editor's SILAM auto-detection paths crashed on a missing import.


Full details in the CHANGELOG.