Skip to content

v1.8.3

Compare
Choose a tag to compare
@devongovett devongovett released this 12 May 19:00
· 398 commits to master since this release

This release includes enhancements to the Parcel CSS Rust API, and some bug fixes.

New Rust API features

CSSOM

This release begins to implement the CSS Object Model (CSSOM) API. For now, that includes some new methods in the Rust API to get, set, and remove properties. This supports reading and writing both shorthand (e.g. border) and longhand (e.g. border-left-width) properties, no matter which properties were originally written in the rule. The Property and PropertyId enums have also been updated to expose some metadata about shorthand and longhand properties as well. Check out the docs for more details.

Source locations

Also in this release is a new way to lazily compute the original line and column ranges for a CSS property. This information is not stored during parsing because would use a lot of memory, and it is rarely used except in error scenarios. However, it can be recomputed on demand when needed. This can be done using the property_location method of a StyleRule. You must provide the original source string that was used to parse the stylesheet along with the index of the property to retrieve the location for.

Serde support

Finally, we added Serde support for all nodes in the AST, so you can serialize or deserialize from JSON and other formats. Given Parcel CSS has such a detailed parsing of each CSS rule, property, and value, this may be useful for applications written in other languages that want to manipulate parsed CSS values. This is enabled behind the serde feature flag. Check out the example of how to serialize a stylesheet for more details.

Fixes

  • Fix compat data for margin-inline and padding-inline shorthand properties – 0d7e4c6
  • Parse z-index property and fix rounding issue with serialization – 839bcd1