@@ -4,6 +4,13 @@ export type PseudoClassType = Exclude<'NoArgument' | AstPseudoClassArgument['typ
44export type PseudoElementType = Exclude < 'NoArgument' | AstPseudoElementArgument [ 'type' ] , 'Substitution' > ;
55export type CssLevel = 'css1' | 'css2' | 'css3' | 'selectors-3' | 'selectors-4' | 'latest' | 'progressive' ;
66
7+ /**
8+ * CSS Feature module name.
9+ * @example 'css-position-3'
10+ * @example 'css-scoping-1'
11+ */
12+ export type CssFeature = string ;
13+
714/**
815 * CSS Selector Syntax Definition can be used to define custom CSS selector parsing rules.
916 */
@@ -404,3 +411,39 @@ export const cssSyntaxDefinitions: Record<CssLevel, SyntaxDefinition> = {
404411 latest : selectors4SyntaxDefinition ,
405412 progressive : progressiveSyntaxDefinition
406413} ;
414+
415+ /**
416+ * CSS Feature modules with their syntax definitions.
417+ * These can be used to extend the parser with specific CSS features.
418+ *
419+ * @example
420+ * // Using the css-position-3 feature
421+ * createParser({ features: ['css-position-3'] })
422+ */
423+ export const cssFeatures : Record < string , SyntaxDefinition > = {
424+ 'css-position-3' : {
425+ pseudoClasses : {
426+ definitions : {
427+ NoArgument : [ 'sticky' , 'fixed' , 'absolute' , 'relative' , 'static' ]
428+ }
429+ }
430+ } ,
431+ 'css-position-4' : {
432+ pseudoClasses : {
433+ definitions : {
434+ NoArgument : [ 'sticky' , 'fixed' , 'absolute' , 'relative' , 'static' , 'initial' ]
435+ }
436+ }
437+ } ,
438+ 'css-scoping-1' : {
439+ pseudoClasses : {
440+ definitions : {
441+ NoArgument : [ 'host' , 'host-context' ] ,
442+ Selector : [ 'host' , 'host-context' ]
443+ }
444+ } ,
445+ pseudoElements : {
446+ definitions : [ 'slotted' ]
447+ }
448+ }
449+ } ;
0 commit comments