Releases: interacta-io/css-labels
Releases · interacta-io/css-labels
Release v0.6
Fixes & improvements
-
Less label flicker — When overlapping labels have equal weight and neither is forced to show, the collision resolver now favors the label that was already visible. This prevents labels from flickering between frames when competing labels have the same priority.
CssLabelexposesgetPrevVisible(); the collision logic uses it as the tie-breaker. -
Cached bounding rect — Size and overlap use a cached
getBoundingClientRect(), so multiline and rotated labels get the correct overlap box. Fixes #9 (multiline HTML) and #14 (rotated labels).
Release v0.5
New
- Label rotation — Labels support an optional
rotation(degrees). Use therotationfield in label options withLabelRenderer, orsetRotation(degrees)withCssLabel.0= horizontal; positive = clockwise; rotation is around the label’s bottom-center.
Release v0.4
Bug fixes
- Default font size and padding — Labels now always get the default font size and padding on the element, even when you don’t pass them or pass the same values as the defaults. Fixes #10
- Labels with
draw(false)— When you calldraw(false)to skip overlap detection, labels are still shown. Visibility is set from whether they’re on screen before drawing. Fixes #7
Improvements
- Label text — You can pass label text as a number; it’s converted to a string automatically.
Security
- XSS prevention — Label text is set via
textContentby default. UsedangerouslySetHtml()or thedangerousHtmloption only for trusted or sanitized HTML.
Release v0.3
What's New
Fixes & improvements
- Empty/whitespace labels are now correctly treated as not visible in
getVisibility. - Label overlap detection uses Sweep and Prune for better performance when many labels are on screen.
For developers
- Storybook is available: run
npm run storybookfor docs and interactive demos.
Release v0.2
What's New
Content Security Policy (CSP) Support
- New
dontInjectStylesoption added to bothCssLabelconstructor andLabelRendereroptions - Allows users to disable automatic CSS injection for CSP compliance
- The CSS can be imported directly via
@interacta/css-labels/styles.css - Use this option when your app has strict CSP rules that prevent dynamic style injection
Usage:
// Import CSS manually in your app
import '@interacta/css-labels/styles.css'
// Then disable auto-injection
const renderer = new LabelRenderer(canvas, { dontInjectStyles: true })Individual Label Styling And Performance Improvements
- Per-label customization: Set
fontSizeandpaddingfor individual labels - Faster rendering: Optimized text measurements and reduced redundant calculations
- Better label management: Improved performance for frequent updates