Skip to content

Releases: rafaeltonholo/svg-to-compose

2.0.0

26 Nov 22:04
8f05ecc
Compare
Choose a tag to compare

Introducing svg-to-compose Gradle Plugin

This release builds upon the svg-to-compose CLI tool code, turning it into a library, where you can use it via script as you are used to, or include it into your project, as a KMP library that parsers and generates code for you.

This release sets a big milestone in this project, evolving the project from only a KMP CLI tool to a KMP library, with a native CLI, and a Gradle Plugin.

The new svg-to-compose-gradle-plugin project was designed to simplify and enhance your workflow by automatically converting SVG/XML files into Jetpack Compose ImageVector assets. It adds seamless integration with your build process, enabling you to have a single source of truth for your vectors, which could be shared between teams like design and developers, making vector asset management easier than ever.

Additionally, we have introduced a few more options to the CLI tool such as --exclude, and --map-icon-from-to and removed the deprecated option context-receiver.

Documentation & Feedback

Check out the complete documentation here: svg-to-compose-gradle-plugin.

We value your feedback! If you encounter any issues or have suggestions for additional SVG feature support, please open an issue.

What's Changed

Breaking Changes

  • Removed deprecated flags -cp and --context-provider from the CLI tool.
  • The --kmp option, in the CLI, now is used to identify that the output targets KMP. That will change the Preview imports to use JetBrains instead.

Features

  • Introduce the svg-to-compose-gradle-plugin.
  • Added Dokka integration.
  • Introduced new CLI options for parser configuration:
    • --exclude: A regex used to exclude some icons from the parsing.
    • --map-icon-name-from-to, --from-to, or --rename: Replace the icon's name first value of this parameter with the second.
    • --silent: Runs the CLI without any output.
      See the svg-to-compose documentation for more details.

Bug fixes

  • RGB colors to Hex broken when RGB value results in a hex value started with 0.

Refactors

  • Enhanced logging capabilities with a new Logger interface.
  • Abstracting usage of okio.FileSystem with FileManager interface for better maintainability.
  • Refactored temporary file creating logic for better parsing handling.
  • Replaced com.codingfeline.buildkonfig:buildkonfig-gradle-plugin with com.github.gmazzo.buildconfig:plugin.

Chores

Full Changelog: v1.3.3...2.0.0

v1.3.3

08 Sep 22:12
4cc571f
Compare
Choose a tag to compare

What's Changed

  • Fixes for Relative Coordinates, and SVG Rect Node Improvements by @rafaeltonholo in #64
  • Dependencies upgrades

Full Changelog: v1.3.2...v1.3.3

v1.3.2

17 Aug 13:43
828066e
Compare
Choose a tag to compare

What's Changed

  • chore(deps): update dependency com.android.application to v8.4.2 by @renovate in #46
  • fix(deps): update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.2 by @renovate in #47
  • fix(deps): update dependency androidx.compose:compose-bom to v2024.06.00 by @renovate in #48
  • fix(deps): update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.4 by @renovate in #50
  • fix(deps): update dependency androidx.activity:activity-compose to v1.9.1 - autoclosed by @renovate in #52
  • fix: s2c script ignoring Apple Silicon's cpu other than M1 by @rafaeltonholo in #53
  • Fix path parsing not considering scientific notation by @rafaeltonholo in #58

Full Changelog: v1.3.1...v1.3.2

v1.3.1

10 Jun 18:50
6adf206
Compare
Choose a tag to compare

What's Changed

  • Bugfix: Add default fill color when neither fillColor or stroke are present by @rafaeltonholo in #45

Full Changelog: v1.3.0...v1.3.1

v1.3.0

07 Jun 11:31
Compare
Choose a tag to compare

What's Changed

Adding support for Gradient and other improvements by @rafaeltonholo in #32, closing issue #5. Thanks @t-regbs for the report

Features

  • SVG
    • Add support for use node
    • Parse clip path child in a group to as clip path data
    • Apply transform attribute to generated paths
    • Add support for polyline element
    • Add support for polygon element
    • Add support for ellipse element
  • Icons
    • Flatten groups that have no parameters
    • Split icon in smaller chunks in case of a large icon
  • Others
    • Bounding box calculation
    • Added silent run flag
    • Add inherited attribute to search over parent tag in case of missing
    • Add gradient tag support for svg files
    • Add gradient support for avg files
    • Add defs tag support for svg files
    • Add compose brush color representation
    • Add avg gradient node and its dependencies

Fixes

  • SVG
    • width/height when 100% no considering viewport when available
    • Gradient color not accounting stop-opacity
    • Enable use element to look for href without namespace
  • K2
    • Conflicting projection in type alias expansion in intermediate type after k2 upgrade
  • Icons
    • Typo on strokeLineMiter
  • AVG
    • Add support for missing group parameters
  • Others
    • SVG group unit tests
    • Minify option not working
    • horizontal/vertical line transformation and rotation calculation

Chores

  • SVG
    • Add inherited values
  • Gradient
    • Adding new gradient examples
  • Others
    • Improve .editorconfig
    • Add get operator to Matrix

Refactors

  • Icons
    • Improve import logic for both path and group
  • SVG
    • Add SvgElementNode and SvgChildNode to ensure type consistency
  • AVG
    • Add AvgElementNode and AvgChildNode to ensure type consistency
  • XML
    • Rename name property to tagName
  • Parser
    • Split XmlParser into SvgParser and AvgParser
  • Others
    • Split method in smaller methods to decrease complexity
    • Move ComposeProperty to compose package
    • Rename ComposeProperty to ComposeType
    • Create ComposeColor type to represent the Color class on Compose
    • Use let instead of if return
    • Use const instead hardcoded string
    • Method/parameter renaming

Others

  • docs: improve ktdocs

Full Changelog: v1.2.0...v1.3.0

v1.2.0

04 Jun 12:25
4cf06d4
Compare
Choose a tag to compare

What's Changed

Chores

Dependencies

  • Update dependency androidx.compose:compose-bom to v2024.04.01 by @renovate in #26
  • Update dependency androidx.activity:activity-compose to v1.9.0 by @renovate in #27
  • Update dependency androidx.core:core-ktx to v1.13.0 by @renovate in #28
  • Update dependency androidx.core:core-ktx to v1.13.1 by @renovate in #34
  • Update dependency com.android.application to v8.4.0 by @renovate in #33
  • Update dependency androidx.compose:compose-bom to v2024.05.00 by @renovate in #35
  • Update dependency com.google.android.material:material to v1.12.0 by @renovate in #36
  • Update dependency com.github.ajalt.clikt:clikt to v4.4.0 by @renovate in #30
  • Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.0 by @renovate in #38
  • Update dependency com.android.application to v8.4.1 by @renovate in #39
  • Update dependency androidx.lifecycle:lifecycle-runtime-ktx to v2.8.1 by @renovate in #42
  • Update dependency gradle to v8.8 by @renovate in #43

Full Changelog: v1.1.1...v1.2.0

v1.1.1

27 Apr 12:49
Compare
Choose a tag to compare

What's Changed

Fixes

  • ComposeProperty not considering lowercase input value fixing #25, thanks @StylianosGakis for the report.

Chores

  • Update dependency gradle to v8.7 by @renovate in #19
  • Update detekt to v1.23.6 by @renovate in #20
  • Update dependency com.github.ajalt.clikt:clikt to v4.3.0 by @renovate in #21
  • Update dependency androidx.compose:compose-bom to v2024.04.00 by @renovate in #22
  • Update dependency com.android.application to v8.3.2 by @renovate in #23

Full Changelog: v1.1.0...v1.1.1

v1.1.0

22 Mar 14:58
Compare
Choose a tag to compare

What's Changed

Improvements to SVG handling, add support for other path attributes, and code maintainability

Features

  • Add missing path parameters (Issue #4)
  • Add recursive directory file search
  • Create DSL to build PathNode command class
  • Improve String.toComposeColor() to handle RGB and RGBA colour formats
  • SVG:
    • Add SvgLength to handle different lengths for width and height on svg node
    • Calculate strokeWidth and strokeOpacity based on float or percentage
    • Add support to svg rect tag
    • Add support for circle tag
    • Add support to svg rect and circle tags with stroke-dasharray
    • Add support for svg clipPath tag
    • Add apply transformation logic

Fixes

  • Misinterpretation of half-hexadecimal color
  • IconWriter was not creating a directory if the parent doesn't exist
  • The normalizePath function was not considering arc flags without spaces
  • s2c Script
    • s2c script exit when the --upgrade flag is set.
    • Download binaries in the correct binary folder
  • Avg
    • The path can have children
  • svgo
    • Remove convertPathData from preset-default config
  • Svg
    • Svg length unit calculated looking wrong base dimension
  • Samples
    • Change Xml to Avg

Chores

  • Enhance the overall reliability and usability of the file conversion process.
  • Rename the contextProvider parameter in favour of receiverType
  • Add jvm target enabling debug
  • Move SvgNode to its class and extract asNode functions to the targeted file
  • Use ksoup to parse svg/avg instead of xmlutil
  • Improve readability and maintainability of a few files
  • Add sample app to test sample compose icons
  • Simply Processor file
  • Optimization
    • Remove svg2vectordrawable external dependency. Now we directly convert the svgo optimized SVG files as Svg, supporting more SVG's unique features
    • Enhance the exception message when the optimization command fails
  • s2c Script
    • Show an error message when failing to download/unzip binaries
  • Processor
    • Enhance error message

Documentation

  • Improve API documentation for better understanding
  • Update s2c help output

Others

  • refactor: modify PathNodes and related classes to improve readability and type safety when working with path commands.
  • ci(cli-integrity-check): add script to verify generated icons
  • ci(cli-integrity-check): change how to execute bash file
  • ci(cli-integrity-check): remove ./ from command

Full Changelog: v1.0.0...v1.1.0

v1.0.0

04 Mar 00:24
Compare
Choose a tag to compare

What's Changed

  • Migrate to KMP in #7
  • Fixes #3 by adding support for group tags on both SVG and XML
  • Fixes #6 by removing the dependency of xpath and other dependencies.
    • We still have external dependencies to perform the optimization
  • Add more platform support, now counting with MacOS, Linux and Windows (mingx64)

Changelog

Full Changelog: v0.0.4...v1.0.0

Features

  • Add minify option
  • Add mark internal option
  • Add support for nested groups
  • S2c script downloads binaries from GitHub
  • Add app.properties to hold app's version
  • Add support to q/Q and t/T SVG vector command
  • Add upgrade flag to s2c script
  • Add new s2c script using binaries
  • Add optimization
  • Add full normalized path to path instruction as a comment
  • Add context provider and add to material support
  • Create temp files
  • Add file writer
  • Add logger
  • Parse xml to icon file
  • Parse svg to icon file
  • Add optimizer check dependency
  • Setup CLI arguments
  • Add clikt dependency
  • Add build instruction if the bash script detects project

Chores

  • Properly configure detekt in the project style: fix detekt issues
  • Simplify normalizePath logic
  • Add unit tests for ImageVectorNode and PathNodes classes
  • Add more sample files to better test the CLI support
  • Add no preview flag enabling KMP support
  • Add XML sample files
  • Change the temporary generated folder path
  • Set optimization false by default (temp)
  • Merge FileMetadata file with Path.extension.kt
  • Remove old s2c script
  • Extract PathNodes to its own file
  • Remove warnings
  • Add xml parser library dependency
  • Improved error handling

Documentation

  • Change platform support for Windows
  • Add support to optimization on Linux
  • Add platform support table
  • README update

Fixes

  • Remove comments from path and group when minify is enabled
  • Svg2vectordrawable install command
  • Remove '/' from detekt path exclusion
  • Remove extra whitespace
  • Remove extra whitespace when normalizing paths
  • Path indentation
  • Subsequent coordinate pair after move to should be a line to
  • Path-normalizing logic not taking into consideration dots as separator
  • Print exception stacktrace when is on debug
  • External dependency check command by using --version instead of command (mingwX86 issue)
  • Generated file format
  • Add dot divisor to icon name
  • Svg path with breaking lines creating empty commands
  • Linux platform name
  • Create the parent directory when the output is a file
  • Optimize failing because temp file not moved
  • Correct extension based on the current platform
  • Indent size
  • Log error when can't parse without stopping the cli
  • Icon name not considering numbers
  • Log output
  • Close command added on all commands
  • Executable name