Repository navigation
v1.2.0
Full Changelog: v1.1.2...v1.2.0
[1.2.0] - 2026-02-08
Added
- Improved ViewBox Adjustment with Transforms: Significantly improved viewBox adjustment accuracy for SVGs with transforms. The svgelements-based bbox calculation now correctly handles transformed elements (translate, scale, rotate, skew, matrix) while still excluding non-rendering containers (defs, clipPath, mask, symbol, pattern, marker). This reduces unnecessary padding in many real-world icons that use transforms, which are common in exported SVGs. The manual fallback still conservatively skips transforms for compatibility.
- Enhanced CSS Injection: Significantly improved CSS class generation for color editing in DrawIO with support for real-world SVG authoring patterns:
- CSS Modes: New
--css-modeoption with three modes:fill(default): Generate CSS rules for fill colors onlystroke: Generate CSS rules for stroke colors onlyboth: Generate CSS rules for both fill and stroke colors
- Style Attribute Parsing: Now parses
style="fill:#fff;stroke:#000"attributes in addition to directfillandstrokeattributes - fill="none" Handling: Properly respects
fill="none"andstroke="none"- no longer forces colors on stroke-only or fill-only paths - currentColor Support: New
--preserve-current-colorflag (default: true) to preservecurrentColorvalues for theme-aware icons - Default Stroke Color: New
--css-stroke-coloroption to set default stroke color (used with--css-mode strokeorboth) - Available in both
createandaddcommands - Makes split-paths workflow more consistently colorable in DrawIO
- CSS Modes: New
- Extract Command: New
extractCLI command for extracting icons from DrawIO libraries back to individual SVG files. This is the inverse operation ofcreate, allowing users to recover SVG files from library files. Supports extracting all icons or specific icons by name, with optional overwrite functionality. - Rename Command: New
renameCLI command for renaming icons within a DrawIO library. Allows renaming a single icon while preserving its content. Supports optional--overwriteflag to replace an existing icon with the new name. - Inspect Command: New
inspectCLI command for displaying detailed information about icons in a DrawIO library. Shows dimensions, shape type, CSS classes, and inline styles for each icon. Supports inspecting all icons or specific icons by name, with optional--show-svgflag to display the decoded SVG content. Includes--jsonflag for machine-readable JSON output. - Validate Command: New
validateCLI command for comprehensive validation of DrawIO library files. Validates XML structure, JSON format, icon integrity (required fields, dimensions, base64 encoding, compression), mxGraphModel structure, and SVG content (namespace, viewBox/dimensions, empty SVG detection). Provides detailed error and warning messages with color-coded status output. IncludesLibraryValidatorservice class following SOLID principles for separation of concerns. - CLI Command Groups: Reorganized CLI commands into three logical groups for better discoverability: Library Management Commands (create, add, remove, extract, rename), Library Inspection Commands (list, inspect, validate), and SVG Processing Commands (split-paths).
- Split by Folder: New
--split-by-folderflag forcreatecommand that creates separate library files for each subdirectory when used with--recursive. Output filename is modified with subdirectory name (e.g.,FontAwesome.xmlbecomesFontAwesome-Regular.xml,FontAwesome-Solid.xml,FontAwesome-Brands.xml). This is useful for organizing icon sets that are already grouped by category in the filesystem.
Changed
- Refactored CLI Commands: Improved separation of concerns following SOLID principles. Business logic has been extracted from CLI commands into reusable service classes:
- Created
IconAnalyzerservice for extracting and analyzing icon content (used byextractandinspectcommands) - Added
LibraryManager.rename_icon()method for icon renaming logic (used byrenamecommand) - CLI commands are now thin orchestration layers that delegate to service classes
- All business logic is now testable independently of the CLI layer
- Created
- Test Organization: Improved test file organization for consistency. Each CLI command now has its own dedicated test file (
test_cli_extract.py,test_cli_rename.py, etc.) following the same pattern as other command tests.
Fixed
- List Command Table Width: Fixed table width calculation in
listcommand to prevent title text wrapping. The table now properly sizes to accommodate whichever is wider: the title text, column header, or icon names. This ensures clean, readable output regardless of filename or icon name length. - Type Checking Configuration: Fixed mypy configuration inconsistency between local pre-commit and GitHub CI. Removed CLI directory exclusion from local pre-commit config and added tests directory to both local and CI mypy checks. All 107 type errors across test files have been resolved with proper type annotations and assertions. Both local and CI environments now run
mypy --strict src testsconsistently.