
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@siteimprove/alfa-css
Advanced tools
@siteimprove/alfa-css
This package implements support for CSS syntax and values.
(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 support angle
and length
.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.The Value
type contains the shared structure of CSS values. Most notably:
Value
have a type
string parameter that can be used as a discriminating union field (e.g. in a switch
statement). However, it may sometimes be more convenient to use the Foo.isFoo
type predicates, notably in combination with a Selective
construct.Value
have a CALC
type parameter that indicates whether they may contain calculations (i.e. if CALC
is false
, we guarantee there is no calculation, but if CALC
is true
, we do not guarantee the presence of a calculation). This parameter can be accessed programmatically with the Value#hasCalculation()
type predicate.Value
have a Foo.Canonical
subtype representing the canonical form of the value. This includes resolving calculations, converting units to their canonical units (e.g. px
for lengths), and otherwise converting formats (e.g. canonical colors are in RGB format).Value
have a #resolve()
method to resolve calculations and provide the same value
in 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. Value
that need a resolver also have a Foo.Resolver
type to declare it.Value
, percentage resolution depends on data Alfa does not always have (usually, size of boxes). These also have a Foo.PartiallyResolved
type, and a Foo.partiallyResolve()
function (with its Foo.PartialResolver
interface). 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).Value
implement the Resolvable
interface, which state into what they resolve, and which resolver they need.0.93.0 (2024-10-03)
@siteimprove/alfa-dom: Element.hasDisplaySize()
now builds a Predicate<Element<"select">>
instead of a Predicate<Element>
. (#1683)
@siteimprove/alfa-dom: The helper Element.inputType(element)
has been replaced by a method element.inputType()
. (#1683)
@siteimprove/alfa-style, @siteimprove/alfa-css: Support for CSS properties scale
and translate
was added. (#1688)
@siteimprove/alfa-parser: A Parser.doubleBar
combinator is now available, to parse CSS "double bar". (#1691)
@siteimprove/alfa-style: A Style.hasUsedStyle
predicate builder is now available. (#1694)
@siteimprove/alfa-style: Style properties container-type
, mix-blend-mode
and isolation
are now supported. (#1675)
@siteimprove/alfa-style, @siteimprove/alfa-css: Style property contain
is now supported. (#1679)
@siteimprove/alfa-css: A Keyword#is
predicate is now available. (#1694)
@siteimprove/alfa-option: An Option.conditional
builder is now available, returning None
if the predicate is false. (#1694)
@siteimprove/alfa-dom: A method Element<"select">#displaySize()
is now available. (#1683)
@siteimprove/alfa-selector: The :checked
pseudo-class is now supported. (#1684)
@siteimprove/alfa-rules: Experimental rule SIA-ER8. It adds support for type="password"
and more. (#1667)
@siteimprove/alfa-style: Style
objects now have an optional owner
pointing to the element whose style it is. (#1694)
@siteimprove/alfa-dom: An Element<"select">#optionsList()
helper is now available. (#1683)
@siteimprove/alfa-style: Basic support for used values is now available. (#1689)
@siteimprove/alfa-css: Transform functions scale3d()
and scaleZ()
have been added and the scale transformation functions now accept percentages. (#1688)
@siteimprove/alfa-string: A String.hasWhitespace
predicate is now available. (#1694)
@siteimprove/alfa-rules: SIA-R83 is now better at handling white-space
and text-overflow
. (#1694)
@siteimprove/alfa-style: flex-wrap
now has a used value of None
on elements that are not flex containers. (#1694)
@siteimprove/alfa-style: <option>
elements that are hidden by their <select>
are now correctly considered as invisible. (#1683)
@siteimprove/alfa-style: overflow
and text-overflow
now have no used value on elements where they don't apply. (#1689)
@siteimprove/alfa-style: The computed value of display
for <button>
elements now correctly handles button layout. (#1694)
FAQs
Implementations of the core CSS syntax and value types
The npm package @siteimprove/alfa-css receives a total of 309 weekly downloads. As such, @siteimprove/alfa-css popularity was classified as not popular.
We found that @siteimprove/alfa-css demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.