Changelog
3.0.0 (September 11, 2024)
@container
at-rule@starting-style
at-rule@scope
at-rule@position-try
at-rule@layer
at-rulelayer
, layer()
and supports()
in the @media
at-rule (according to the @import rule in Cascading and Inheritance 5)Layer
and LayerList
node typesTokenStream#lookupTypeNonSC()
method<dashed-ident>
to generic typesmdn/data
to 2.10.0
<'font'>
to CSS Fonts 4<color>
to CSS Color 5Object.prototype
is extended or polluted (#262)fork()
method to consider the generic
option when creating a Lexer instance (#266)line
or offset
is specified via options (#251)speak
syntax patch (#241):lang()
to accept a list of <ident>
or <string>
per spec (#265)<'property'>
, when the syntax has a top-level #
-multiplier (#102)parseWithFallback()
to rollback tokenIndex
before calling a fallbackBlock
to not include {
and }
Atrule
and Rule
to include {
and }
for a blockRatio
parsing:
Ratio
can be omitted. While this can't be a parser output (which would produce a Number
node), it's feasible during Ratio
node construction or transformation.Added new node types:
Feature
: represents features like (feature)
and (feature: value)
, fundamental for both @media
and @container
at-rulesFeatureRange
: represents features in a range contextFeatureFunction
: represents functional features such as @supports
's selector()
or @container
's style()
Condition
: used across all query-like at-rules, encapsulating queries with features and the not
, and
, and or
operatorsGeneralEnclosure
: represents the <general-enclosed>
production, which caters to unparsed parentheses or functional expressionsNote: All new nodes include a
kind
property to define the at-rule type. Supported kinds aremedia
,supports
, andcontainer
.
Added support for functions for features and features in a range context, e.g. (width: calc(100cm / 6))
Added a condition
value for the parser's context option to parse queries. Use the kind
option to specify the condition type, e.g., parse('...', { context: 'condition', kind: 'media' })
.
Introduced a features
section in the syntax configuration for defining functional features of at-rules. Expand definitions using the fork()
method. The current definition is as follows:
features: {
supports: { selector() { /* ... */ } },
container: { style() { /* ... */ } }
}
Changes for @media
at-rule:
GeneralEnclosed
.(width > 100px)
or (100px < height < 400px)
MediaFeature
node type to the Feature
node type with kind: "media"
.MediaQuery
node structure into the following form:
type MediaQuery = {
type: "MediaQuery";
modifier: string | null; // e.g. "not", "only", etc.
mediaType: string | null; // e.g. "all", "screen", etc.
condition: Condition | null;
}
Changes for @supports
at-rule:
GeneralEnclosed
.(width > 100px)
or (100px < height < 400px)
SupportsDeclaration
node type to encapsulate a declaration in a query, replacing Parentheses
.Condition
or SupportsDeclaration
nodes of kind supports
instead of Parentheses
.selector()
feature via the FeatureFunction
node (configured in features.supports.selector
).Changelog
2.3.1 (December 14, 2022)
:host
, :host()
and :host-context()
pseudo class support (#216)generator
, parse
and parse-selector
entry points by adding missed NestedSelector
node typeChangelog
2.3.0 (November 30, 2022)
NestingSelector
node type for &
(a nesting selector) in selectors@nest
at-rule@media
inside a Rule
to parse its block content as a Declaration
firstDeclarationList
behaviour to follow the rules for Rule
's blockLexer#units
dictionary to provide unit groups (length
, angle
, etc.) used for matchingconfig.units
to override default unitsmdn-data
to 2.0.30
Changelog
2.2.1 (August 14, 2022)
2.2.0
for at-rule syntax matching when at-rule has no preludeChangelog
2.2.0 (August 10, 2022)
mdn-data
to 2.0.28
revert
and revert-layer
expression()
the same way as CSS wide keywordsbackground-clip
property definition to match Backgrounds and Borders 4 (#190)content
property definition to allow attr()
(#201)<delim-token>
@page
at-rule (#191)rex
, cap
, rcap
, rch
, ic
, ric
, lh
, rlh
, vi
, vb
, sv*
, lv*
, dv*
cqw
, cqh
, cqi
, cqb
, cqmin
, cqmax
vm
unit (supposed to be an old IE versions supported this unit instead of vmax
)+#
and #?
according to spec (#199)[-∞,∞]
rangesChangelog
2.1.0 (February 17, 2022)
mdn-data
to 2.0.27
module
field to package.json
css-tree/utils
export (#181)css-tree/convertor
exportcss-tree/selector-parser
export (~27kb when bundled, #183)css-tree/parser
50kb -> 41kbcss-tree/generator
46kb -> 23kbsyntaxes
into types
in css-tree/definition-syntax-data-patch
:is()
, :-moz-any()
, :-webkit-any()
and :where()
(#182, #184)Changelog
2.0.4 (December 17, 2021)
^10
generate()
in safe mode to add a whitespace between <dimension-token>
and <hash-token>
, otherwise some values are broken in IE11, e.g. border
properties (#173):
for an attribute name on AttributeSelector
parsing as it does not meet the CSS specs (details)Changelog
2.0.3 (December 14, 2021)
generate()
in safe
mode between type-selector
and id-selector
(e.g. a#id
). A regression was introduces in 2.0.2
since IE11 fails on values when <hash-token>
goes after <ident-token>
without a whitespace in the middle, e.g. 1px solid#000
. Thus, in one case, a space between the <ident-token>
and the <hash-token>
is required, and in the other, vice versa. Until a better solution found, a workaround is used on id-selector
generation by producing a <delim-token>
instead of <hash-token>
.Changelog
2.0.2 (December 10, 2021)
width
, min-width
and max-width
syntax definitionsmdn-data
source-map
with source-map-js
which reduce install size by ~700KBcalc()
function consumption on definition syntax matchinggenerate()
auto emitting a whitespace edge cases when next token starts with a dash (minus)generate()
safe mode to cover more cases for IE11dist/data.cjs
and dist/version.cjs
css-tree/definition-syntax-data
css-tree/definition-syntax-data-patch