This file documents breaking changes introduced in major releases of the
@webref/css NPM package.
Webref adheres to Semantic Versioning, applied to data. A new major version is released whenever a breaking change is made to the data structure.
Subsidiary at-rules are now reported at the root level, scoped to their parent at-rule through a for property.
Unless you're processing at-rules and only expecting unscoped ones, upgrade from version 7 should not require any code update. If you need to list only unscoped at-rules, filter out those that have a for property.
CSS extracts are now consolidated into a single file.
- A single consolidated
css.jsonfile replaces CSS extracts per spec.
In version 6, listAll() resolved with an object where the keys were spec shortnames, and the values mostly matched the structure of the consolidated object that the function now returns. On top of the consolidation itself, main differences are:
- Functions and types were merged in a
valuescategory in version 6, they now appear in separatefunctionsandtypescategories. - Functions and types that were scoped to another CSS feature appeared nested under that CSS feature in version 6. They now appear directly under
functionsandtypeswith aforkey that contains the list of scoping features for that feature. A scoping feature may be a property, a function or a type. When the scoping feature is a type, its name in theforkey is enclosed between<and>. - Feature syntaxes were stored in a
valuekey. That key is now namedsyntax. Actual syntax values are the same as before and can be parsed with CSSTree. - The shortname of the spec (or specs) that defines a feature is no longer readily available (but note the
hrefkey targets the defining spec). If you need the specs' shortnames, please raise an issue to describe your use case. - The consolidation removes duplicates, merging extended definitions into a single feature. The definition from the latest spec level is used when a feature is defined in more than one level. If you need the definition from earlier levels, please raise an issue to describe your needs!
- Some of the possible values that a CSS feature could take appeared nested under that feature definition in a
valueskey in version 6. Such values are no longer reported in the new version: they were confusing in any case because they did not cover the whole range of values that a feature could take, and could contain values that were not atomic keyword values. Values could be re-introduced when CSS specs are more systematic about them. In the meantime, you will need to parse the feature's syntax (thesyntaxkey) to extract keyword values.
Additionally, the package now also exposes a new index() async method that resolves with an object similar to that returned by listAll(), except that lists of features under each category are indexed by feature names. For scoped features, the feature name is used as identifier when it is unambiguous. If a feature is defined differently for different scopes, the feature name is completed with the name of the first scoping feature to disambiguate. For example, type() for @function, type() for attr().
Major re-write of CSS extracts listed in the package, following the release of Reffy v11.0.0
- Arrays are now used throughout instead of indexed objects.
- Function names are no longer enclosed in
<and>because they are not defined in specs with these characters (as opposed to types). Beware though, references to functions in value syntax do use enclosing<and>characters. - The property
valuespacesat the root level is now namedvalues. An array is used there as well. Thevaluesproperty lists bothfunctionandtypedefinitions that are not namespaced to anything in particular (it used to also contain namespaced definitions).
- Selectors are now reported under a
selectorsproperty at the root level. - Possible values that some definition may take are now reported under a
valuesproperty directly within the definition. - Functions and types that are namespaced to some other definition are included
in the list of
valuesof that definition. - Anomalies detected in the spec are now reported under a
warningsproperty at the root of the extract. Four types of anomalies are reported:- Missing definition: when a production rule was found but when the spec
does not include a corresponding
<dfn>(or when that<dfn>does not have adata-dfn-typeattribute that identifies a CSS construct) - Duplicate definition: when the spec defines the same term twice.
- Unmergeable definition: when the spec defines the same property twice and both definitions cannot be merged.
- Dangling value: when the spec defines a CSS "value" definition
(
value,functionortype) for something and that something cannot be found in the spec
- Missing definition: when a production rule was found but when the spec
does not include a corresponding
- To distinguish between
function,typeandvaluedefinitions listed in avaluesproperty, definitions that appear in avaluesproperty have atypeproperty.
- Only namespaced values associated with a definition are listed under its
valuesproperty. Non-namespaced values are not. For instance,<quote>is not listed as a value of the<content-list>type, even though its value syntax references it. This is to avoid duplicating constructs in the extracts. - Values are only listed under the deepest definition to which they apply. For
instance,
open-quoteis only listed as a value of<quote>but neither as a value of the<content-list>type that references<quote>nor as a value of thecontentproperty that references<content-list>. This is also to avoid duplicating constructs in the extracts. - Some of the extracts contain things that may look weird at first, but that is
"by design". For instance, CSS Will
change defines a
<custom-ident>valueconstruct whose actual value is the<custom-ident>typeconstruct defined in CSS Values. Having both a namespacedvalueand a non-namespaced<type>is somewhat common in CSS specs.