import type CssParseError from './CssParseError'; import type Position from './CssPosition'; export enum CssTypes { stylesheet = 'stylesheet', rule = 'rule', declaration = 'declaration', comment = 'comment', atRule = 'at-rule', container = 'container', charset = 'charset', counterStyle = 'counter-style', document = 'document', customMedia = 'custom-media', fontFace = 'font-face', fontFeatureValues = 'font-feature-values', host = 'host', import = 'import', keyframes = 'keyframes', keyframe = 'keyframe', layer = 'layer', media = 'media', namespace = 'namespace', page = 'page', pageMarginBox = 'page-margin-box', positionTry = 'position-try', property = 'property', scope = 'scope', startingStyle = 'starting-style', supports = 'supports', viewTransition = 'view-transition', } export type CssCommonAST = { type: CssTypes; }; export type CssCommonPositionAST = CssCommonAST & { position?: Position; parent?: unknown; }; export type CssStylesheetAST = CssCommonAST & { type: CssTypes.stylesheet; stylesheet: { source?: string; rules: Array; parsingErrors?: Array; }; }; export type CssRuleAST = CssCommonPositionAST & { type: CssTypes.rule; selectors: Array; declarations: Array; }; export type CssDeclarationAST = CssCommonPositionAST & { type: CssTypes.declaration; property: string; value: string; }; export type CssCommentAST = CssCommonPositionAST & { type: CssTypes.comment; comment: string; }; export type CssContainerAST = CssCommonPositionAST & { type: CssTypes.container; container: string; rules: Array; }; export type CssCharsetAST = CssCommonPositionAST & { type: CssTypes.charset; charset: string; }; export type CssCustomMediaAST = CssCommonPositionAST & { type: CssTypes.customMedia; name: string; media: string; }; export type CssDocumentAST = CssCommonPositionAST & { type: CssTypes.document; document: string; vendor?: string; rules: Array; }; export type CssFontFaceAST = CssCommonPositionAST & { type: CssTypes.fontFace; declarations: Array; }; export type CssHostAST = CssCommonPositionAST & { type: CssTypes.host; rules: Array; }; export type CssImportAST = CssCommonPositionAST & { type: CssTypes.import; import: string; }; export type CssKeyframesAST = CssCommonPositionAST & { type: CssTypes.keyframes; name: string; vendor?: string; keyframes: Array; }; export type CssKeyframeAST = CssCommonPositionAST & { type: CssTypes.keyframe; values: Array; declarations: Array; }; export type CssLayerAST = CssCommonPositionAST & { type: CssTypes.layer; layer: string; rules?: Array; }; export type CssMediaAST = CssCommonPositionAST & { type: CssTypes.media; media: string; rules: Array; }; export type CssNamespaceAST = CssCommonPositionAST & { type: CssTypes.namespace; namespace: string; }; export type CssPageAST = CssCommonPositionAST & { type: CssTypes.page; selectors: Array; declarations: Array; }; export type CssSupportsAST = CssCommonPositionAST & { type: CssTypes.supports; supports: string; rules: Array; }; export type CssStartingStyleAST = CssCommonPositionAST & { type: CssTypes.startingStyle; rules: Array; }; export type CssCounterStyleAST = CssCommonPositionAST & { type: CssTypes.counterStyle; name: string; declarations: Array; }; export type CssFontFeatureValuesAST = CssCommonPositionAST & { type: CssTypes.fontFeatureValues; fontFamily: string; rules: Array; }; export type CssPositionTryAST = CssCommonPositionAST & { type: CssTypes.positionTry; name: string; declarations: Array; }; export type CssPropertyAST = CssCommonPositionAST & { type: CssTypes.property; name: string; declarations: Array; }; export type CssScopeAST = CssCommonPositionAST & { type: CssTypes.scope; scope: string; rules: Array; }; export type CssViewTransitionAST = CssCommonPositionAST & { type: CssTypes.viewTransition; declarations: Array; }; export type CssPageMarginBoxAST = CssCommonPositionAST & { type: CssTypes.pageMarginBox; name: string; declarations: Array; }; export type CssGenericAtRuleAST = CssCommonPositionAST & { type: CssTypes.atRule; name: string; prelude: string; rules?: Array; }; export type CssAtRuleAST = | CssRuleAST | CssCommentAST | CssContainerAST | CssCharsetAST | CssCounterStyleAST | CssCustomMediaAST | CssDocumentAST | CssFontFaceAST | CssFontFeatureValuesAST | CssHostAST | CssImportAST | CssKeyframesAST | CssLayerAST | CssMediaAST | CssNamespaceAST | CssPageAST | CssPageMarginBoxAST | CssPositionTryAST | CssPropertyAST | CssScopeAST | CssSupportsAST | CssStartingStyleAST | CssViewTransitionAST | CssGenericAtRuleAST; export type CssAllNodesAST = | CssAtRuleAST | CssStylesheetAST | CssDeclarationAST | CssKeyframeAST;