mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor(css-selector): export createSelector method (#4580)
needed for NativeScript Angular's animation driver
This commit is contained in:
@@ -24,7 +24,7 @@ export interface Declaration {
|
|||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelectorCore {
|
export interface SelectorCore {
|
||||||
/**
|
/**
|
||||||
* Dynamic selectors depend on attributes and pseudo classes.
|
* Dynamic selectors depend on attributes and pseudo classes.
|
||||||
*/
|
*/
|
||||||
@@ -74,3 +74,5 @@ export class SelectorsMatch<T extends Node> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function fromAstNodes(astRules: parser.Node[]): RuleSet[];
|
export function fromAstNodes(astRules: parser.Node[]): RuleSet[];
|
||||||
|
|
||||||
|
export function createSelector(sel: string): SelectorCore;
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ function createDeclaration(decl: cssParser.Declaration): any {
|
|||||||
return { property: decl.property.toLowerCase(), value: decl.value };
|
return { property: decl.property.toLowerCase(), value: decl.value };
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSelector(sel: string): SimpleSelector | SimpleSelectorSequence | Selector {
|
export function createSelector(sel: string): SimpleSelector | SimpleSelectorSequence | Selector {
|
||||||
try {
|
try {
|
||||||
let ast = selectorParser.parse(sel);
|
let ast = selectorParser.parse(sel);
|
||||||
if (ast.length === 0) {
|
if (ast.length === 0) {
|
||||||
|
|||||||
@@ -419,9 +419,8 @@ function isKeyframe(node: CssNode): node is KeyframesDefinition {
|
|||||||
return node.type === "keyframes";
|
return node.type === "keyframes";
|
||||||
}
|
}
|
||||||
|
|
||||||
class InlineSelector extends SelectorCore {
|
class InlineSelector implements SelectorCore {
|
||||||
constructor(ruleSet: RuleSet) {
|
constructor(ruleSet: RuleSet) {
|
||||||
super();
|
|
||||||
this.ruleset = ruleSet;
|
this.ruleset = ruleSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user