Repository navigation
Releases: m98/svg-interactive
Releases · m98/svg-interactive
Release list
Release v0.3.1
See CHANGELOG.md for details.
Release v0.3.0
See CHANGELOG.md for details.
v0.1.3 - Add support for selection with list of IDs
Added
- IDs Array Matching - Match specific elements by exact IDs for maximum control
- New
ids?: string[]option inFieldPatterninterface - Enables explicit element selection:
{ ids: ['sensor-1', 'sensor-2', 'sensor-3'], type: 'input' } - Perfect for complex diagrams with 100+ specific sensors or irregular naming conventions
- Field names use the full ID (no extraction like prefix/regex)
- Works with any attribute:
{ attribute: 'data-id', ids: ['temp-north', 'temp-south'], type: 'input' } - Mutual exclusivity validation: only one matching strategy (ids, prefix, or regex) per pattern
- Comprehensive validation: array must not be empty, all elements must be strings
- IDs array checked first in matching order (before prefix/regex) for performance
- New
Tests
- Added 15 new tests for IDs array functionality (total: 237 tests passing)
- 8 unit tests for matching logic
- 7 validation tests for mutual exclusivity and array validation
- 4 generic parser tests
- 2 draw.io parser tests
- 1 integration test
Documentation
- README.md - Added "Match by Exact ID List" section with use cases and examples
- docs/api.md - Comprehensive FieldPattern documentation with IDs array examples
- docs/hand-coded.md - Added sensor dashboard example showing IDs array usage
- CLAUDE.md - Updated architecture documentation with IDs array information
Examples
- examples/02-advanced/ids-array-matching.tsx - New working example demonstrating IDs array
- Sensor dashboard with 3 input sensors and 1 output (average calculation)
- Shows non-interactive elements being excluded from IDs array
- Integrated with site/playground via examples manifest
- Added new "Advanced" category to examples
v0.1.2 - Critical Bug Fix and defaultInputs
Fixed
- Critical: DOM ID Collision Bug - Fixed duplicate IDs breaking output field updates
- Input fields now use
id="input-field-{name}"pattern - Output fields now use
id="output-field-{name}"pattern - Previously both used
id="field-{name}", causinggetElementByIdto always return the first element - This broke all SVGs where inputs and outputs share the same base name (e.g.,
input-field-gasandoutput-field-gas) - Updated all 6 ID assignment locations in
useFieldOverlay.ts - Fixed 10+ test cases across 5 integration test files to use correct IDs
- Input fields now use
Added
defaultInputsprop - Pre-populate input fields with initial values- New optional prop on
InteractiveSVG:defaultInputs?: Record<string, string> - Allows setting initial values when component mounts
- Existing values take precedence over defaults
- Useful for examples, demos, and preset configurations
- New optional prop on
Changed
- Examples - Replaced heat exchanger with calculator example
- Added
Calculator (draw.io)example demonstrating simple addition - Removed outdated heat exchanger example
- New example better demonstrates draw.io integration with clear, simple use case
- Added comprehensive integration tests (10 test cases)
- Added
Documentation
- docs/api.md - Added
defaultInputsprop documentation with examples - docs/draw-io.md - Updated to reference new calculator example
- tests/integration/README.md - Updated to document all 3 fixtures and their tests
- site/Playground - Now passes
defaultInputsto InteractiveSVG component