@microcharts/react@0.4.0
Minor Changes
-
#38
0796194Thanks @ganapativs! - Pre-launch quality pass — expanded annotation hosting, correctness fixes, and internal
consolidation. All changes are backward-compatible at their defaults; existing charts render
identically.Annotations on 17 value-series charts (was 2).
Threshold,TargetZone,Marker, and
Callout(from@microcharts/react/annotations) can now be passed as children to Sparkline,
SparkBar, MiniBar, CyclePlot, CitySkyline, ChangePoint, DualSparkline, SpreadBand, ForecastCone,
ControlStrip, QueueDepth, BurnChart, Waterfall, PercentileTrace, RetentionCurve, WinProbWorm, and
ErrorBudget. Every host resolves annotation coordinates through the same shared path, so label
sizing and containment are identical across charts.Correctness fixes:
weekGridno longer crashes on aNaNweek count or hangs onInfinity— non-finite inputs
clamp to a single row.divergingStackno longer emitsNaNsegments whenneutralIndexis out of range — an
out-of-range index is treated as "no neutral".stepOpacityno longer divides by zero atsteps === 1(wasInfinity).- The interactive MinimapStrip slider always has an accessible name, even when
summary={false}
and notitleis given (falls back to the localized viewport sentence). - Consumer-supplied annotation labels are now truncated to fit the chart's box, closing the one
text path that could paint outside the viewBox. - The trend-percentage in generated summaries now routes through the locale formatter, so
non-ASCII-digit locales no longer mix numeral systems in one sentence.
Summary strings (i18n):
- TokenConfidence's empty-state string moved from the shared
noDatakey to its ownnoTokens
key onSummaryStrings, so it is no longer silently overridden by other charts'noData. If
you supply customstringsto TokenConfidence, renamenoData→noTokens. Rendered output is
unchanged ("No tokens."). compass8is now canonically lowercase across WindBarb and StationGlyph (WindBarb capitalizes
its sentence-initial octant in its own template), fixing lowercase sentence starts when both
charts' strings were merged. Standalone output is unchanged.heartbeatWindownow reports clean multiples of an hour as hours ("2 hours") instead of minutes
("120 minutes").
Internally, duplicated label-sizing, live-region, gutter, and summary-resolution logic was
consolidated into shared helpers, and several unused internal exports were removed. No public
export, prop, or chart was added or removed. -
#38
0796194Thanks @ganapativs! - Deepen the theming surface — all additive, backward-compatible, and identity at
their defaults (no visual change to existing charts):defineTheme()— a new opt-in@microcharts/react/themesubpath (zero
runtime deps, ~2 kB gzip, tree-shaken when unused). Give it one brand accent
and it derives a harmonized, colour-blind-safe categorical palette and
hand-tuned-style dark twins in-house in OKLCH — never moving the
positive/negative hues off their CVD-safe split. Extend a preset, pin any
token, pass an explicit palette, orextend()a variant; returns
vars/style/css(selector)(with aprefers-color-scheme: darkblock).- New tokens —
--mc-font-numeric(a dedicated face for figures, tracks
--mc-fontby default),--mc-label-weight, and--mc-density(one scalar
that scales stroke weight, label size, and small-multiple gap together for
compact vs comfortable layouts; the plot box is untouched). colorsprop — per-instance series colours on the categorical charts
(SegmentedBar,StackedArea,PartitionStrip,Hypnogram,MicroDonut),
overriding--mc-cat-*just there.printandeinkpresets — output-context token bundles for paper and
grayscale e-paper, answeringdata-mc-theme/data-mc-presetlike the rest.
The
MicrochartCommonPropsshared-grammar type is now enforced as a single
source of truth: a guard test holds every chart's shared props to its canonical
types.
Patch Changes
-
#38
0796194Thanks @ganapativs! - Ship a minifiedstyles.css.@microcharts/react/styles.css(and the
per-chartstyles/*.cssescape-hatch files) now resolve to minified copies in
dist/— the shared stylesheet drops from ~8.7 kB to ~2.8 kB gzip. The
minifier only strips comments and whitespace (no rule merging), so@layer
membership and cascade order are unchanged. The repo-rootstyles.cssstays the
unminified source of truth; no API or visual changes. -
#38
0796194Thanks @ganapativs! - Improve npm and search discoverability: expandkeywords, add afundinglink
(GitHub Sponsors), and a structuredauthor(name/email/url). Metadata only — no
API, runtime, or visual changes.