@csstools/media-query-list-parser
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -1,3 +0,10 @@ | ||
### 1.0.0 | ||
### 2.0.0 (January 19, 2023) | ||
- Refactor `MediaFeatureBoolean` so that it follows the same structure as `MediaFeaturePlain` (breaking) | ||
- Change the `ParseError` interface, this is now a subclass of `Error` (breaking) | ||
- Add `getName` and `getNameToken` to all nodes that have a feature name. | ||
- Add `@custom-media` parsing. | ||
### 1.0.0 (November 14, 2022) | ||
- Initial version |
export { parse, parseFromTokens } from './parser/parse'; | ||
export { parseCustomMedia, parseCustomMediaFromTokens } from './parser/parse-custom-media'; | ||
export { NodeType } from './util/node-type'; | ||
export { isGeneralEnclosed, isMediaAnd, isMediaCondition, isMediaConditionList, isMediaConditionListWithAnd, isMediaConditionListWithOr, isMediaFeature, isMediaFeatureBoolean, isMediaFeatureName, isMediaFeaturePlain, isMediaFeatureRange, isMediaFeatureRangeNameValue, isMediaFeatureRangeValueName, isMediaFeatureRangeValueNameValue, isMediaFeatureValue, isMediaInParens, isMediaNot, isMediaOr, isMediaQuery, isMediaQueryInvalid, isMediaQueryWithType, isMediaQueryWithoutType, } from './util/type-predicates'; | ||
export { isCustomMedia, isGeneralEnclosed, isMediaAnd, isMediaCondition, isMediaConditionList, isMediaConditionListWithAnd, isMediaConditionListWithOr, isMediaFeature, isMediaFeatureBoolean, isMediaFeatureName, isMediaFeaturePlain, isMediaFeatureRange, isMediaFeatureRangeNameValue, isMediaFeatureRangeValueName, isMediaFeatureRangeValueNameValue, isMediaFeatureValue, isMediaInParens, isMediaNot, isMediaOr, isMediaQuery, isMediaQueryInvalid, isMediaQueryWithType, isMediaQueryWithoutType, } from './util/type-predicates'; | ||
export { CustomMedia } from './nodes/custom-media'; | ||
export { GeneralEnclosed } from './nodes/general-enclosed'; | ||
@@ -5,0 +7,0 @@ export { MediaAnd } from './nodes/media-and'; |
@@ -11,3 +11,3 @@ import { ComponentValue, ContainerNode } from '@csstools/css-parser-algorithms'; | ||
indexOf(item: ComponentValue): number | string; | ||
at(index: number | string): ComponentValue; | ||
at(index: number | string): ComponentValue | undefined; | ||
walk(cb: (entry: { | ||
@@ -24,3 +24,3 @@ node: GeneralEnclosedWalkerEntry; | ||
} | ||
export declare type GeneralEnclosedWalkerEntry = ComponentValue; | ||
export declare type GeneralEnclosedWalkerParent = ContainerNode | GeneralEnclosed; | ||
export type GeneralEnclosedWalkerEntry = ComponentValue; | ||
export type GeneralEnclosedWalkerParent = ContainerNode | GeneralEnclosed; |
@@ -12,3 +12,3 @@ import { CSSToken } from '@csstools/css-tokenizer'; | ||
indexOf(item: MediaInParens): number | string; | ||
at(index: number | string): MediaInParens; | ||
at(index: number | string): MediaInParens | null; | ||
walk(cb: (entry: { | ||
@@ -22,3 +22,3 @@ node: MediaAndWalkerEntry; | ||
} | ||
export declare type MediaAndWalkerEntry = MediaInParensWalkerEntry | MediaInParens; | ||
export declare type MediaAndWalkerParent = MediaInParensWalkerParent | MediaAnd; | ||
export type MediaAndWalkerEntry = MediaInParensWalkerEntry | MediaInParens; | ||
export type MediaAndWalkerParent = MediaInParensWalkerParent | MediaAnd; |
@@ -6,3 +6,3 @@ import { CSSToken } from '@csstools/css-tokenizer'; | ||
import { NodeType } from '../util/node-type'; | ||
export declare type MediaConditionList = MediaConditionListWithAnd | MediaConditionListWithOr; | ||
export type MediaConditionList = MediaConditionListWithAnd | MediaConditionListWithOr; | ||
export declare class MediaConditionListWithAnd { | ||
@@ -18,3 +18,3 @@ type: NodeType; | ||
indexOf(item: MediaInParens | MediaAnd): number | string; | ||
at(index: number | string): MediaInParens | MediaAnd; | ||
at(index: number | string): MediaInParens | MediaAnd | undefined; | ||
walk(cb: (entry: { | ||
@@ -28,4 +28,4 @@ node: MediaConditionListWithAndWalkerEntry; | ||
} | ||
export declare type MediaConditionListWithAndWalkerEntry = MediaAndWalkerEntry | MediaAnd; | ||
export declare type MediaConditionListWithAndWalkerParent = MediaAndWalkerParent | MediaConditionListWithAnd; | ||
export type MediaConditionListWithAndWalkerEntry = MediaAndWalkerEntry | MediaAnd; | ||
export type MediaConditionListWithAndWalkerParent = MediaAndWalkerParent | MediaConditionListWithAnd; | ||
export declare class MediaConditionListWithOr { | ||
@@ -41,3 +41,3 @@ type: NodeType; | ||
indexOf(item: MediaInParens | MediaOr): number | string; | ||
at(index: number | string): MediaInParens | MediaOr; | ||
at(index: number | string): MediaInParens | MediaOr | undefined; | ||
walk(cb: (entry: { | ||
@@ -51,3 +51,3 @@ node: MediaConditionListWithOrWalkerEntry; | ||
} | ||
export declare type MediaConditionListWithOrWalkerEntry = MediaOrWalkerEntry | MediaOr; | ||
export declare type MediaConditionListWithOrWalkerParent = MediaOrWalkerParent | MediaConditionListWithOr; | ||
export type MediaConditionListWithOrWalkerEntry = MediaOrWalkerEntry | MediaOr; | ||
export type MediaConditionListWithOrWalkerParent = MediaOrWalkerParent | MediaConditionListWithOr; |
@@ -13,3 +13,3 @@ import { CSSToken } from '@csstools/css-tokenizer'; | ||
indexOf(item: MediaNot | MediaInParens | MediaConditionListWithAnd | MediaConditionListWithOr): number | string; | ||
at(index: number | string): MediaInParens | MediaConditionListWithAnd | MediaConditionListWithOr | MediaNot; | ||
at(index: number | string): MediaNot | MediaInParens | MediaConditionListWithAnd | MediaConditionListWithOr | undefined; | ||
walk(cb: (entry: { | ||
@@ -23,3 +23,3 @@ node: MediaConditionWalkerEntry; | ||
} | ||
export declare type MediaConditionWalkerEntry = MediaNotWalkerEntry | MediaConditionListWithAndWalkerEntry | MediaConditionListWithOrWalkerEntry | MediaNot | MediaConditionListWithAnd | MediaConditionListWithOr; | ||
export declare type MediaConditionWalkerParent = MediaNotWalkerParent | MediaConditionListWithAndWalkerParent | MediaConditionListWithOrWalkerParent | MediaCondition; | ||
export type MediaConditionWalkerEntry = MediaNotWalkerEntry | MediaConditionListWithAndWalkerEntry | MediaConditionListWithOrWalkerEntry | MediaNot | MediaConditionListWithAnd | MediaConditionListWithOr; | ||
export type MediaConditionWalkerParent = MediaNotWalkerParent | MediaConditionListWithAndWalkerParent | MediaConditionListWithOrWalkerParent | MediaCondition; |
import { ComponentValue } from '@csstools/css-parser-algorithms'; | ||
import { MediaFeatureName } from './media-feature-name'; | ||
import { NodeType } from '../util/node-type'; | ||
@@ -6,14 +7,17 @@ import { CSSToken } from '@csstools/css-tokenizer'; | ||
type: NodeType; | ||
name: ComponentValue; | ||
before: Array<CSSToken>; | ||
after: Array<CSSToken>; | ||
constructor(name: ComponentValue, before?: Array<CSSToken>, after?: Array<CSSToken>); | ||
name: MediaFeatureName; | ||
constructor(name: MediaFeatureName); | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: ComponentValue): number | string; | ||
at(index: number | string): ComponentValue; | ||
indexOf(item: MediaFeatureName): number | string; | ||
at(index: number | string): MediaFeatureName | undefined; | ||
toJSON(): { | ||
type: NodeType; | ||
name: string; | ||
name: { | ||
type: NodeType; | ||
name: string; | ||
tokens: CSSToken[]; | ||
}; | ||
tokens: CSSToken[]; | ||
@@ -20,0 +24,0 @@ }; |
@@ -14,5 +14,5 @@ import { ComponentValue } from '@csstools/css-parser-algorithms'; | ||
} | ||
export declare type MediaFeatureComparison = MediaFeatureLT | MediaFeatureGT | MediaFeatureEQ; | ||
export type MediaFeatureComparison = MediaFeatureLT | MediaFeatureGT | MediaFeatureEQ; | ||
export declare function matchesComparison(componentValues: Array<ComponentValue>): false | [number, number]; | ||
export declare function comparisonFromTokens(tokens: [TokenDelim, TokenDelim] | [TokenDelim]): MediaFeatureComparison | false; | ||
export declare function invertComparison(operator: MediaFeatureComparison): MediaFeatureComparison | false; |
@@ -11,6 +11,7 @@ import { ComponentValue } from '@csstools/css-parser-algorithms'; | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: ComponentValue): number | string; | ||
at(index: number | string): ComponentValue; | ||
at(index: number | string): ComponentValue | undefined; | ||
toJSON(): { | ||
@@ -24,2 +25,2 @@ type: NodeType; | ||
} | ||
export declare function parseMediaFeatureName(componentValues: Array<ComponentValue>): false | MediaFeatureName; | ||
export declare function parseMediaFeatureName(componentValues: Array<ComponentValue>): MediaFeatureName | false; |
@@ -12,6 +12,8 @@ import { ComponentValue } from '@csstools/css-parser-algorithms'; | ||
constructor(name: MediaFeatureName, colon: TokenColon, value: MediaFeatureValue); | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: MediaFeatureName | MediaFeatureValue): number | string; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined; | ||
walk(cb: (entry: { | ||
@@ -38,4 +40,4 @@ node: MediaFeaturePlainWalkerEntry; | ||
} | ||
export declare type MediaFeaturePlainWalkerEntry = MediaFeatureValueWalkerEntry | MediaFeatureValue; | ||
export declare type MediaFeaturePlainWalkerParent = MediaFeatureValueWalkerParent | MediaFeaturePlain; | ||
export declare function parseMediaFeaturePlain(componentValues: Array<ComponentValue>): false | MediaFeaturePlain; | ||
export type MediaFeaturePlainWalkerEntry = MediaFeatureValueWalkerEntry | MediaFeatureValue; | ||
export type MediaFeaturePlainWalkerParent = MediaFeatureValueWalkerParent | MediaFeaturePlain; | ||
export declare function parseMediaFeaturePlain(componentValues: Array<ComponentValue>): MediaFeaturePlain | false; |
import { ComponentValue } from '@csstools/css-parser-algorithms'; | ||
import { CSSToken, TokenDelim } from '@csstools/css-tokenizer'; | ||
import { MediaFeatureComparison } from './media-feature-comparison'; | ||
import { MediaFeatureName } from './media-feature-name'; | ||
import { MediaFeatureValue, MediaFeatureValueWalkerEntry, MediaFeatureValueWalkerParent } from './media-feature-value'; | ||
import { NodeType } from '../util/node-type'; | ||
export declare type MediaFeatureRange = MediaFeatureRangeNameValue | MediaFeatureRangeValueName | MediaFeatureRangeValueNameValue; | ||
export type MediaFeatureRange = MediaFeatureRangeNameValue | MediaFeatureRangeValueName | MediaFeatureRangeValueNameValue; | ||
export declare class MediaFeatureRangeNameValue { | ||
@@ -13,7 +14,9 @@ type: NodeType; | ||
constructor(name: MediaFeatureName, operator: [TokenDelim, TokenDelim] | [TokenDelim], value: MediaFeatureValue); | ||
operatorKind(): false | import("./media-feature-comparison").MediaFeatureComparison; | ||
operatorKind(): MediaFeatureComparison | false; | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: MediaFeatureName | MediaFeatureValue): number | string; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined; | ||
walk(cb: (entry: { | ||
@@ -46,7 +49,9 @@ node: MediaFeatureRangeWalkerEntry; | ||
constructor(name: MediaFeatureName, operator: [TokenDelim, TokenDelim] | [TokenDelim], value: MediaFeatureValue); | ||
operatorKind(): false | import("./media-feature-comparison").MediaFeatureComparison; | ||
operatorKind(): MediaFeatureComparison | false; | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: MediaFeatureName | MediaFeatureValue): number | string; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined; | ||
walk(cb: (entry: { | ||
@@ -81,8 +86,10 @@ node: MediaFeatureRangeWalkerEntry; | ||
constructor(name: MediaFeatureName, valueOne: MediaFeatureValue, valueOneOperator: [TokenDelim, TokenDelim] | [TokenDelim], valueTwo: MediaFeatureValue, valueTwoOperator: [TokenDelim, TokenDelim] | [TokenDelim]); | ||
valueOneOperatorKind(): false | import("./media-feature-comparison").MediaFeatureComparison; | ||
valueTwoOperatorKind(): false | import("./media-feature-comparison").MediaFeatureComparison; | ||
valueOneOperatorKind(): MediaFeatureComparison | false; | ||
valueTwoOperatorKind(): MediaFeatureComparison | false; | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: MediaFeatureName | MediaFeatureValue): number | string; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue; | ||
at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined; | ||
walk(cb: (entry: { | ||
@@ -114,5 +121,5 @@ node: MediaFeatureRangeWalkerEntry; | ||
} | ||
export declare type MediaFeatureRangeWalkerEntry = MediaFeatureValueWalkerEntry | MediaFeatureValue; | ||
export declare type MediaFeatureRangeWalkerParent = MediaFeatureValueWalkerParent | MediaFeatureRange; | ||
export declare function parseMediaFeatureRange(componentValues: Array<ComponentValue>): false | MediaFeatureRangeNameValue | MediaFeatureRangeValueName | MediaFeatureRangeValueNameValue; | ||
export type MediaFeatureRangeWalkerEntry = MediaFeatureValueWalkerEntry | MediaFeatureValue; | ||
export type MediaFeatureRangeWalkerParent = MediaFeatureValueWalkerParent | MediaFeatureRange; | ||
export declare function parseMediaFeatureRange(componentValues: Array<ComponentValue>): MediaFeatureRange | false; | ||
export declare const mediaDescriptors: Set<string>; |
@@ -13,3 +13,3 @@ import { ComponentValue, ContainerNode } from '@csstools/css-parser-algorithms'; | ||
indexOf(item: ComponentValue): number | string; | ||
at(index: number | string): ComponentValue | ComponentValue[]; | ||
at(index: number | string): ComponentValue | Array<ComponentValue> | undefined; | ||
walk(cb: (entry: { | ||
@@ -27,6 +27,6 @@ node: MediaFeatureValueWalkerEntry; | ||
} | ||
export declare type MediaFeatureValueWalkerEntry = ComponentValue | Array<ComponentValue>; | ||
export declare type MediaFeatureValueWalkerParent = ContainerNode | MediaFeatureValue; | ||
export declare function parseMediaFeatureValue(componentValues: Array<ComponentValue>): false | MediaFeatureValue; | ||
export type MediaFeatureValueWalkerEntry = ComponentValue | Array<ComponentValue>; | ||
export type MediaFeatureValueWalkerParent = ContainerNode | MediaFeatureValue; | ||
export declare function parseMediaFeatureValue(componentValues: Array<ComponentValue>): MediaFeatureValue | false; | ||
export declare function matchesRatioExactly(componentValues: Array<ComponentValue>): -1 | number[]; | ||
export declare function matchesRatio(componentValues: Array<ComponentValue>): -1 | number[]; |
@@ -13,6 +13,8 @@ import { SimpleBlockNode } from '@csstools/css-parser-algorithms'; | ||
constructor(feature: MediaFeaturePlain | MediaFeatureBoolean | MediaFeatureRange, before?: Array<CSSToken>, after?: Array<CSSToken>); | ||
getName(): string; | ||
getNameToken(): CSSToken; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: MediaFeaturePlain | MediaFeatureBoolean | MediaFeatureRange): number | string; | ||
at(index: number | string): MediaFeatureBoolean | MediaFeaturePlain | MediaFeatureRange; | ||
at(index: number | string): MediaFeatureBoolean | MediaFeaturePlain | MediaFeatureRange | undefined; | ||
walk(cb: (entry: { | ||
@@ -26,6 +28,2 @@ node: MediaFeatureWalkerEntry; | ||
type: NodeType; | ||
name: string; | ||
tokens: CSSToken[]; | ||
} | { | ||
type: NodeType; | ||
name: { | ||
@@ -36,26 +34,3 @@ type: NodeType; | ||
}; | ||
value: { | ||
type: NodeType; | ||
value: any; | ||
tokens: CSSToken[]; | ||
}; | ||
tokens: CSSToken[]; | ||
} | { | ||
type: NodeType; | ||
name: { | ||
type: NodeType; | ||
name: string; | ||
tokens: CSSToken[]; | ||
}; | ||
valueOne: { | ||
type: NodeType; | ||
value: any; | ||
tokens: CSSToken[]; | ||
}; | ||
valueTwo: { | ||
type: NodeType; | ||
value: any; | ||
tokens: CSSToken[]; | ||
}; | ||
tokens: CSSToken[]; | ||
}; | ||
@@ -68,6 +43,6 @@ before: CSSToken[]; | ||
} | ||
export declare type MediaFeatureWalkerEntry = MediaFeaturePlainWalkerEntry | MediaFeatureRangeWalkerEntry | MediaFeaturePlain | MediaFeatureBoolean | MediaFeatureRange; | ||
export declare type MediaFeatureWalkerParent = MediaFeaturePlainWalkerParent | MediaFeatureRangeWalkerParent | MediaFeature; | ||
export type MediaFeatureWalkerEntry = MediaFeaturePlainWalkerEntry | MediaFeatureRangeWalkerEntry | MediaFeaturePlain | MediaFeatureBoolean | MediaFeatureRange; | ||
export type MediaFeatureWalkerParent = MediaFeaturePlainWalkerParent | MediaFeatureRangeWalkerParent | MediaFeature; | ||
export declare function parseMediaFeature(simpleBlock: SimpleBlockNode, before?: Array<CSSToken>, after?: Array<CSSToken>): false | MediaFeature; | ||
export declare function newMediaFeatureBoolean(name: string): MediaFeature; | ||
export declare function newMediaFeaturePlain(name: string, ...value: Array<CSSToken>): MediaFeature; |
@@ -23,3 +23,3 @@ import { ComponentValue, ContainerNode } from '@csstools/css-parser-algorithms'; | ||
indexOf(item: MediaCondition | MediaFeature | GeneralEnclosed): number | string; | ||
at(index: number | string): GeneralEnclosed | MediaFeature | MediaCondition; | ||
at(index: number | string): MediaCondition | MediaFeature | GeneralEnclosed | undefined; | ||
walk(cb: (entry: { | ||
@@ -33,3 +33,3 @@ node: MediaInParensWalkerEntry; | ||
} | ||
export declare type MediaInParensWalkerEntry = ComponentValue | Array<ComponentValue> | GeneralEnclosed | MediaAnd | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens; | ||
export declare type MediaInParensWalkerParent = ContainerNode | GeneralEnclosed | MediaAnd | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens; | ||
export type MediaInParensWalkerEntry = ComponentValue | Array<ComponentValue> | GeneralEnclosed | MediaAnd | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens; | ||
export type MediaInParensWalkerParent = ContainerNode | GeneralEnclosed | MediaAnd | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens; |
@@ -12,3 +12,3 @@ import { CSSToken } from '@csstools/css-tokenizer'; | ||
indexOf(item: MediaInParens): number | string; | ||
at(index: number | string): MediaInParens; | ||
at(index: number | string): MediaInParens | undefined; | ||
walk(cb: (entry: { | ||
@@ -22,3 +22,3 @@ node: MediaNotWalkerEntry; | ||
} | ||
export declare type MediaNotWalkerEntry = MediaInParensWalkerEntry | MediaInParens; | ||
export declare type MediaNotWalkerParent = MediaInParensWalkerParent | MediaNot; | ||
export type MediaNotWalkerEntry = MediaInParensWalkerEntry | MediaInParens; | ||
export type MediaNotWalkerParent = MediaInParensWalkerParent | MediaNot; |
@@ -12,3 +12,3 @@ import { CSSToken } from '@csstools/css-tokenizer'; | ||
indexOf(item: MediaInParens): number | string; | ||
at(index: number | string): MediaInParens; | ||
at(index: number | string): MediaInParens | undefined; | ||
walk(cb: (entry: { | ||
@@ -22,3 +22,3 @@ node: MediaOrWalkerEntry; | ||
} | ||
export declare type MediaOrWalkerEntry = MediaInParensWalkerEntry | MediaInParens; | ||
export declare type MediaOrWalkerParent = MediaInParensWalkerParent | MediaOr; | ||
export type MediaOrWalkerEntry = MediaInParensWalkerEntry | MediaInParens; | ||
export type MediaOrWalkerParent = MediaInParensWalkerParent | MediaOr; |
@@ -5,3 +5,3 @@ import { ComponentValue } from '@csstools/css-parser-algorithms'; | ||
import { MediaCondition, MediaConditionWalkerEntry, MediaConditionWalkerParent } from './media-condition'; | ||
export declare type MediaQuery = MediaQueryWithType | MediaQueryWithoutType | MediaQueryInvalid; | ||
export type MediaQuery = MediaQueryWithType | MediaQueryWithoutType | MediaQueryInvalid; | ||
export declare class MediaQueryWithType { | ||
@@ -17,6 +17,6 @@ type: NodeType; | ||
getMediaType(): string; | ||
tokens(): CSSToken[]; | ||
tokens(): Array<CSSToken>; | ||
toString(): string; | ||
indexOf(item: MediaCondition): number | string; | ||
at(index: number | string): MediaCondition; | ||
at(index: number | string): MediaCondition | undefined; | ||
walk(cb: (entry: { | ||
@@ -37,4 +37,4 @@ node: MediaQueryWithTypeWalkerEntry; | ||
} | ||
export declare type MediaQueryWithTypeWalkerEntry = MediaConditionWalkerEntry | MediaCondition; | ||
export declare type MediaQueryWithTypeWalkerParent = MediaConditionWalkerParent | MediaQueryWithType; | ||
export type MediaQueryWithTypeWalkerEntry = MediaConditionWalkerEntry | MediaCondition; | ||
export type MediaQueryWithTypeWalkerParent = MediaConditionWalkerParent | MediaQueryWithType; | ||
export declare class MediaQueryWithoutType { | ||
@@ -48,3 +48,3 @@ type: NodeType; | ||
indexOf(item: MediaCondition): number | string; | ||
at(index: number | string): MediaCondition; | ||
at(index: number | string): MediaCondition | undefined; | ||
walk(cb: (entry: { | ||
@@ -62,4 +62,4 @@ node: MediaQueryWithoutTypeWalkerEntry; | ||
} | ||
export declare type MediaQueryWithoutTypeWalkerEntry = MediaConditionWalkerEntry | MediaCondition; | ||
export declare type MediaQueryWithoutTypeWalkerParent = MediaConditionWalkerParent | MediaQueryWithoutType; | ||
export type MediaQueryWithoutTypeWalkerEntry = MediaConditionWalkerEntry | MediaCondition; | ||
export type MediaQueryWithoutTypeWalkerParent = MediaConditionWalkerParent | MediaQueryWithoutType; | ||
export declare class MediaQueryInvalid { | ||
@@ -84,3 +84,3 @@ type: NodeType; | ||
} | ||
export declare type MediaQueryInvalidWalkerEntry = ComponentValue; | ||
export declare type MediaQueryInvalidWalkerParent = ComponentValue | MediaQueryInvalid; | ||
export type MediaQueryInvalidWalkerEntry = ComponentValue; | ||
export type MediaQueryInvalidWalkerParent = ComponentValue | MediaQueryInvalid; |
@@ -1,9 +0,8 @@ | ||
import { ParserError } from '@csstools/css-parser-algorithms/dist/interfaces/error'; | ||
import { CSSToken } from '@csstools/css-tokenizer'; | ||
import { CSSToken, ParseError } from '@csstools/css-tokenizer'; | ||
import { MediaQuery } from '../nodes/media-query'; | ||
export declare type Options = { | ||
export type Options = { | ||
preserveInvalidMediaQueries?: boolean; | ||
onParseError?: (error: ParserError) => void; | ||
onParseError?: (error: ParseError) => void; | ||
}; | ||
export declare function parseFromTokens(tokens: Array<CSSToken>, options?: Options): MediaQuery[]; | ||
export declare function parse(source: string, options?: Options): MediaQuery[]; |
export declare enum NodeType { | ||
CustomMedia = "custom-media", | ||
GeneralEnclosed = "general-enclosed", | ||
@@ -3,0 +4,0 @@ MediaAnd = "media-and", |
@@ -15,2 +15,3 @@ import { GeneralEnclosed } from '../nodes/general-enclosed'; | ||
import { MediaQuery, MediaQueryInvalid, MediaQueryWithoutType, MediaQueryWithType } from '../nodes/media-query'; | ||
export declare function isCustomMedia(x: unknown): x is GeneralEnclosed; | ||
export declare function isGeneralEnclosed(x: unknown): x is GeneralEnclosed; | ||
@@ -17,0 +18,0 @@ export declare function isMediaAnd(x: unknown): x is MediaAnd; |
{ | ||
"name": "@csstools/media-query-list-parser", | ||
"description": "Parse CSS media query lists.", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"contributors": [ | ||
@@ -41,8 +41,9 @@ { | ||
"peerDependencies": { | ||
"@csstools/css-parser-algorithms": "^1.0.0", | ||
"@csstools/css-tokenizer": "^1.0.0" | ||
"@csstools/css-parser-algorithms": "^2.0.0", | ||
"@csstools/css-tokenizer": "^2.0.0" | ||
}, | ||
"scripts": { | ||
"prebuild": "npm run clean", | ||
"build": "rollup -c ../../rollup/default.mjs", | ||
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"", | ||
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"", | ||
"lint": "npm run lint:eslint && npm run lint:package-json", | ||
@@ -49,0 +50,0 @@ "lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119802
32
1069