@stylable/core
Advanced tools
Comparing version 4.8.1 to 4.8.3
export declare const nativePseudoClasses: string[]; | ||
/** | ||
* list names of pseudo classes that cannot be override by custom states | ||
* // [breaking] ToDo: add names of general pseudo classes that are not specific to elements | ||
* // like: root, only-child, nth-of-type, nth-last-child, nth-last-of-type, only-of-type... | ||
* list names of functional pseudo classes | ||
* - cannot be overridden by custom states | ||
* - might contain nested selectors | ||
*/ | ||
export declare const reservedPseudoClasses: string[]; | ||
export declare const reservedFunctionalPseudoClasses: string[]; | ||
export declare const knownPseudoClassesWithNestedSelectors: string[]; | ||
export declare const nativePseudoElements: string[]; | ||
@@ -9,0 +10,0 @@ export declare const reservedKeyFrames: string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isCssNativeFunction = exports.nativeFunctionsDic = exports.reservedKeyFrames = exports.nativePseudoElements = exports.reservedPseudoClasses = exports.nativePseudoClasses = void 0; | ||
exports.isCssNativeFunction = exports.nativeFunctionsDic = exports.reservedKeyFrames = exports.nativePseudoElements = exports.knownPseudoClassesWithNestedSelectors = exports.reservedFunctionalPseudoClasses = exports.nativePseudoClasses = void 0; | ||
// MDN reference: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes | ||
@@ -56,7 +56,7 @@ exports.nativePseudoClasses = [ | ||
/** | ||
* list names of pseudo classes that cannot be override by custom states | ||
* // [breaking] ToDo: add names of general pseudo classes that are not specific to elements | ||
* // like: root, only-child, nth-of-type, nth-last-child, nth-last-of-type, only-of-type... | ||
* list names of functional pseudo classes | ||
* - cannot be overridden by custom states | ||
* - might contain nested selectors | ||
*/ | ||
exports.reservedPseudoClasses = [ | ||
exports.reservedFunctionalPseudoClasses = [ | ||
`not`, | ||
@@ -68,2 +68,8 @@ `any`, | ||
`has`, | ||
`host`, | ||
`host-context`, | ||
`nth-child`, | ||
`nth-last-child`, | ||
`nth-of-type`, | ||
`nth-last-of-type`, | ||
// not native | ||
@@ -73,2 +79,12 @@ `global`, | ||
]; | ||
exports.knownPseudoClassesWithNestedSelectors = exports.reservedFunctionalPseudoClasses.filter(name => { | ||
switch (name) { | ||
case `global`: | ||
case `local`: | ||
case `nth-of-type`: | ||
case `nth-last-of-type`: | ||
return false; | ||
} | ||
return true; | ||
}); | ||
exports.nativePseudoElements = [ | ||
@@ -75,0 +91,0 @@ 'after', |
@@ -42,3 +42,3 @@ "use strict"; | ||
} | ||
else if (native_reserved_lists_1.reservedPseudoClasses.includes(stateDefinition.value)) { | ||
else if (native_reserved_lists_1.reservedFunctionalPseudoClasses.includes(stateDefinition.value)) { | ||
diagnostics.warn(decl, exports.stateErrors.RESERVED_NATIVE_STATE(stateDefinition.value), { | ||
@@ -45,0 +45,0 @@ word: stateDefinition.value, |
@@ -417,3 +417,3 @@ "use strict"; | ||
} | ||
else if (node.value === `global`) { | ||
else if (!native_reserved_lists_1.knownPseudoClassesWithNestedSelectors.includes(node.value)) { | ||
return selector_1.walkSelector.skipNested; | ||
@@ -420,0 +420,0 @@ } |
{ | ||
"name": "@stylable/core", | ||
"version": "4.8.1", | ||
"version": "4.8.3", | ||
"description": "CSS for Components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -54,7 +54,7 @@ // MDN reference: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes | ||
/** | ||
* list names of pseudo classes that cannot be override by custom states | ||
* // [breaking] ToDo: add names of general pseudo classes that are not specific to elements | ||
* // like: root, only-child, nth-of-type, nth-last-child, nth-last-of-type, only-of-type... | ||
* list names of functional pseudo classes | ||
* - cannot be overridden by custom states | ||
* - might contain nested selectors | ||
*/ | ||
export const reservedPseudoClasses = [ | ||
export const reservedFunctionalPseudoClasses = [ | ||
`not`, | ||
@@ -66,2 +66,8 @@ `any`, | ||
`has`, | ||
`host`, | ||
`host-context`, | ||
`nth-child`, | ||
`nth-last-child`, | ||
`nth-of-type`, | ||
`nth-last-of-type`, | ||
// not native | ||
@@ -71,3 +77,14 @@ `global`, | ||
]; | ||
export const knownPseudoClassesWithNestedSelectors = reservedFunctionalPseudoClasses.filter(name => { | ||
switch(name) { | ||
case `global`: | ||
case `local`: | ||
case `nth-of-type`: | ||
case `nth-last-of-type`: | ||
return false; | ||
} | ||
return true; | ||
}); | ||
export const nativePseudoElements = [ | ||
@@ -74,0 +91,0 @@ 'after', |
@@ -20,3 +20,3 @@ import type * as postcss from 'postcss'; | ||
import { stripQuotation } from './utils'; | ||
import { reservedPseudoClasses } from './native-reserved-lists'; | ||
import { reservedFunctionalPseudoClasses } from './native-reserved-lists'; | ||
import cssesc from 'cssesc'; | ||
@@ -65,3 +65,3 @@ | ||
}); | ||
} else if (reservedPseudoClasses.includes(stateDefinition.value)) { | ||
} else if (reservedFunctionalPseudoClasses.includes(stateDefinition.value)) { | ||
diagnostics.warn(decl, stateErrors.RESERVED_NATIVE_STATE(stateDefinition.value), { | ||
@@ -68,0 +68,0 @@ word: stateDefinition.value, |
@@ -8,3 +8,3 @@ import path from 'path'; | ||
import { murmurhash3_32_gc } from './murmurhash'; | ||
import { reservedKeyFrames } from './native-reserved-lists'; | ||
import { reservedKeyFrames, knownPseudoClassesWithNestedSelectors } from './native-reserved-lists'; | ||
import { StylableMeta } from './stylable-meta'; | ||
@@ -507,3 +507,3 @@ import type { | ||
} | ||
} else if (node.value === `global`) { | ||
} else if (!knownPseudoClassesWithNestedSelectors.includes(node.value)) { | ||
return walkSelector.skipNested; | ||
@@ -510,0 +510,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
899101
15326