Socket
Socket
Sign inDemoInstall

@csstools/media-query-list-parser

Package Overview
Dependencies
2
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.4 to 2.1.0

10

CHANGELOG.md
# Changes to Media Query List Parser
### 2.1.0 (June 1, 2023)
- Fix `walk` for `MediaFeatureValue` with complex component values.
- Add `state` to `walk` methods.
This makes it possible pass down information from a parent structure to children.
e.g. you can set `entry.state.inInPrintQuery = true` for `print and (min-width: 30cm)`.
### 2.0.4 (April 10, 2023)

@@ -8,4 +16,2 @@

### 2.0.3 (April 10, 2023)

@@ -12,0 +18,0 @@

@@ -12,6 +12,7 @@ import { ComponentValue, ContainerNode } from '@csstools/css-parser-algorithms';

at(index: number | string): ComponentValue | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: GeneralEnclosedWalkerEntry;
parent: GeneralEnclosedWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -18,0 +19,0 @@ type: NodeType;

@@ -13,6 +13,7 @@ import { CSSToken } from '@csstools/css-tokenizer';

at(index: number | string): MediaInParens | null;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaAndWalkerEntry;
parent: MediaAndWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): unknown;

@@ -19,0 +20,0 @@ isMediaAnd(): this is MediaAnd;

@@ -18,6 +18,7 @@ import { CSSToken } from '@csstools/css-tokenizer';

at(index: number | string): MediaInParens | MediaAnd | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaConditionListWithAndWalkerEntry;
parent: MediaConditionListWithAndWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): unknown;

@@ -40,6 +41,7 @@ isMediaConditionListWithAnd(): this is MediaConditionListWithAnd;

at(index: number | string): MediaInParens | MediaOr | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaConditionListWithOrWalkerEntry;
parent: MediaConditionListWithOrWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): unknown;

@@ -46,0 +48,0 @@ isMediaConditionListWithOr(): this is MediaConditionListWithOr;

@@ -14,6 +14,7 @@ import { CSSToken } from '@csstools/css-tokenizer';

at(index: number | string): MediaNot | MediaInParens | MediaConditionListWithAnd | MediaConditionListWithOr | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaConditionWalkerEntry;
parent: MediaConditionWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): unknown;

@@ -20,0 +21,0 @@ isMediaCondition(): this is MediaCondition;

@@ -18,6 +18,7 @@ import { ComponentValue } from '@csstools/css-parser-algorithms';

at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaFeaturePlainWalkerEntry;
parent: MediaFeaturePlainWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -24,0 +25,0 @@ type: NodeType;

@@ -21,6 +21,7 @@ import { ComponentValue } from '@csstools/css-parser-algorithms';

at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaFeatureRangeWalkerEntry;
parent: MediaFeatureRangeWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -56,6 +57,7 @@ type: NodeType;

at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaFeatureRangeWalkerEntry;
parent: MediaFeatureRangeWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -94,6 +96,7 @@ type: NodeType;

at(index: number | string): MediaFeatureName | MediaFeatureValue | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaFeatureRangeWalkerEntry;
parent: MediaFeatureRangeWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -100,0 +103,0 @@ type: NodeType;

7

dist/nodes/media-feature-value.d.ts

@@ -14,6 +14,7 @@ import { ComponentValue, ContainerNode } from '@csstools/css-parser-algorithms';

at(index: number | string): ComponentValue | Array<ComponentValue> | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaFeatureValueWalkerEntry;
parent: MediaFeatureValueWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -27,3 +28,3 @@ type: NodeType;

}
export type MediaFeatureValueWalkerEntry = ComponentValue | Array<ComponentValue>;
export type MediaFeatureValueWalkerEntry = ComponentValue;
export type MediaFeatureValueWalkerParent = ContainerNode | MediaFeatureValue;

@@ -30,0 +31,0 @@ export declare function parseMediaFeatureValue(componentValues: Array<ComponentValue>): MediaFeatureValue | false;

@@ -19,6 +19,7 @@ import { SimpleBlockNode } from '@csstools/css-parser-algorithms';

at(index: number | string): MediaFeatureBoolean | MediaFeaturePlain | MediaFeatureRange | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaFeatureWalkerEntry;
parent: MediaFeatureWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -25,0 +26,0 @@ type: NodeType;

@@ -26,6 +26,7 @@ import { ComponentValue, ContainerNode } from '@csstools/css-parser-algorithms';

at(index: number | string): MediaCondition | MediaFeature | GeneralEnclosed | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaInParensWalkerEntry;
parent: MediaInParensWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -40,3 +41,3 @@ type: NodeType;

}
export type MediaInParensWalkerEntry = ComponentValue | Array<ComponentValue> | GeneralEnclosed | MediaAnd | MediaNot | MediaOr | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens;
export type MediaInParensWalkerEntry = ComponentValue | GeneralEnclosed | MediaAnd | MediaNot | MediaOr | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens;
export type MediaInParensWalkerParent = ContainerNode | GeneralEnclosed | MediaAnd | MediaNot | MediaOr | MediaConditionList | MediaCondition | MediaFeatureBoolean | MediaFeatureName | MediaFeaturePlain | MediaFeatureRange | MediaFeatureValue | MediaFeature | GeneralEnclosed | MediaInParens;

@@ -13,6 +13,7 @@ import { CSSToken } from '@csstools/css-tokenizer';

at(index: number | string): MediaInParens | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaNotWalkerEntry;
parent: MediaNotWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -19,0 +20,0 @@ type: NodeType;

@@ -13,6 +13,7 @@ import { CSSToken } from '@csstools/css-tokenizer';

at(index: number | string): MediaInParens | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaOrWalkerEntry;
parent: MediaOrWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -19,0 +20,0 @@ type: NodeType;

@@ -20,6 +20,7 @@ import { ComponentValue } from '@csstools/css-parser-algorithms';

at(index: number | string): MediaCondition | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaQueryWithTypeWalkerEntry;
parent: MediaQueryWithTypeWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -47,6 +48,7 @@ type: NodeType;

at(index: number | string): MediaCondition | undefined;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaQueryWithoutTypeWalkerEntry;
parent: MediaQueryWithoutTypeWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -69,6 +71,7 @@ type: NodeType;

toString(): string;
walk(cb: (entry: {
walk<T extends Record<string, unknown>>(cb: (entry: {
node: MediaQueryInvalidWalkerEntry;
parent: MediaQueryInvalidWalkerParent;
}, index: number | string) => boolean | void): false | undefined;
state?: T;
}, index: number | string) => boolean | void, state?: T): false | undefined;
toJSON(): {

@@ -75,0 +78,0 @@ type: NodeType;

{
"name": "@csstools/media-query-list-parser",
"description": "Parse CSS media query lists.",
"version": "2.0.4",
"version": "2.1.0",
"contributors": [

@@ -17,6 +17,12 @@ {

"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/csstools"
},
{
"type": "opencollective",
"url": "https://opencollective.com/csstools"
}
],
"engines": {

@@ -23,0 +29,0 @@ "node": "^14 || ^16 || >=18"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc