0.103.3 • Published 6 months ago
@siteimprove/alfa-css v0.103.3
Package @siteimprove/alfa-css
Description
This package implements support for CSS syntax and values.
Package organisation
(all paths are relative to src/)
syntax: Support for the CSS syntax and parsers for the basic tokens.unit: Model of CSS units. We currently only supportangleandlength.calculation: Model of CSS calculations. This contains base (non calculated) numeric types, and calculations themselves.value: Model for the CSS values themselves. This includes another copy of the numeric types, but this time including potential calculation. Most of the actual work is likely to involve this directory. It is further split into the various types.
Value structure
The Value type contains the shared structure of CSS values. Most notably:
Valuehave atypestring parameter that can be used as a discriminating union field (e.g. in aswitchstatement). However, it may sometimes be more convenient to use theFoo.isFootype predicates, notably in combination with aSelectiveconstruct.Valuehave aCALCtype parameter that indicates whether they may contain calculations (i.e. ifCALCisfalse, we guarantee there is no calculation, but ifCALCistrue, we do not guarantee the presence of a calculation). This parameter can be accessed programmatically with theValue#hasCalculation()type predicate.Valuehave aFoo.Canonicalsubtype representing the canonical form of the value. This includes resolving calculations, converting units to their canonical units (e.g.pxfor lengths), and otherwise converting formats (e.g. canonical colors are in RGB format).Valuehave a#resolve()method to resolve calculations and provide the samevaluein its canonical form. These may need a resolver to help with some types (mostly lengths and percentages). The type system should ensure that#resolve()is always called with the correct resolver.Valuethat need a resolver also have aFoo.Resolvertype to declare it.- For many
Value, percentage resolution depends on data Alfa does not always have (usually, size of boxes). These also have aFoo.PartiallyResolvedtype, and aFoo.partiallyResolve()function (with itsFoo.PartialResolverinterface). Note that partially resolved values will possibly include calculations, including mixed ones (length-percentage) and that needs to be handled downstream (e.g. with the computed values of the CSS properties using these). Valueimplement theResolvableinterface, which state into what they resolve, and which resolver they need.
0.99.0
8 months ago
0.95.0
12 months ago
0.94.1
12 months ago
0.96.0
11 months ago
0.97.0
11 months ago
0.98.0
9 months ago
0.94.0
12 months ago
0.103.0
7 months ago
0.103.1
7 months ago
0.103.2
6 months ago
0.103.3
6 months ago
0.100.0
8 months ago
0.101.0
8 months ago
0.100.1
8 months ago
0.102.0
8 months ago
0.93.6
1 year ago
0.93.7
1 year ago
0.93.8
1 year ago
0.93.2
1 year ago
0.93.0
1 year ago
0.93.1
1 year ago
0.92.0
1 year ago
0.91.2
1 year ago
0.91.0
1 year ago
0.90.1
1 year ago
0.89.5
1 year ago
0.89.4
1 year ago
0.89.3
1 year ago
0.89.2
1 year ago