Skip to content

Releases: m98/svg-interactive

Release v0.3.1

Choose a tag to compare

@github-actions github-actions released this 28 Nov 14:57

See CHANGELOG.md for details.

Release v0.3.0

Choose a tag to compare

@github-actions github-actions released this 20 Nov 16:41

See CHANGELOG.md for details.

v0.1.3 - Add support for selection with list of IDs

Choose a tag to compare

@m98 m98 released this 16 Nov 22:27

Added

  • IDs Array Matching - Match specific elements by exact IDs for maximum control
    • New ids?: string[] option in FieldPattern interface
    • 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

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

Choose a tag to compare

@m98 m98 released this 16 Nov 20:14

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}", causing getElementById to always return the first element
    • This broke all SVGs where inputs and outputs share the same base name (e.g., input-field-gas and output-field-gas)
    • Updated all 6 ID assignment locations in useFieldOverlay.ts
    • Fixed 10+ test cases across 5 integration test files to use correct IDs

Added

  • defaultInputs prop - 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

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)

Documentation

  • docs/api.md - Added defaultInputs prop 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 defaultInputs to InteractiveSVG component