🚀 New Features
- Offset Weeks: Added support for using
w(weeks) as a time unit in duration strings for history offsets.
⚡ Performance & Style Optimization
- Lifecycle & Reactive State: Refactored the update lifecycle by moving calculations out of the
renderloop and into thewillUpdatehook. Added proper@state()decorators to internal data properties for better rendering efficiency. - CSS Variable Caching: Implemented a caching mechanism (
cssVarCache) for resolving CSS variables, reducing redundant DOM computations. - Template Subscriptions: Added tracking for active template strings to prevent unnecessary background re-subscriptions when the template hasn't actually changed.
- Array Filtering: Optimized internal entity search and filtering logic by migrating to faster native JavaScript array methods.
🐛 Bug Fixes
- History Fetching Lock: Introduced a safeguard to prevent duplicate or overlapping history fetch requests from firing simultaneously.
- Negative Width Prevention: Added strict zero-bounding for state, main width, and percentage calculations to ensure gauge lines never attempt to render with negative values.
- Editor Sorting Placeholders: Fixed an issue in the visual editor where drag-and-drop sortable items (in both the severity and entity editors) improperly handled DOM comment placeholders.
- Memory Leaks in Action Handler: Fixed event listener cleanup for the custom action handler to properly detach events when the component is disconnected.
- Dynamic Schema Translation: Passed the current Home Assistant language locale directly into the editor schema, ensuring the editor UI properly translates when the language changes.
- Main Separator Overflow: Fixed a visual bug where the line separator width calculation could incorrectly exceed the main gauge width.
🤝 Contributing
Thanks to everyone for your feedback. All contributions are welcome!
🍻 Support the Project
Thank you for all your support and for using the Energy Line Gauge card!
If you enjoy using this card and want to support its development, consider buying me a beer!
Your support helps keep the project alive and well-maintained. Cheers!
🔗 Full Changelog: v2.3.0...v2.3.1