Inital by-type split

Split type.class from CssTypeSelector to CssCompositeSelector, probably support type#id.class selectors

Apply review comments, refactor css-selectors internally

Applied refactoring, all tests pass, button does not notify changes

Add tests for the css selectors parser.

Added tests for css-selectors

Added basic implementation of mayMatch and changeMap for css match state

Implemented TKUnit.assertDeepEqual to check key and key/values in Map and Set

Watch for property and pseudoClass changes

Add one child group test

Add typings for animations

Added mechanism to enable/disable listeners for pseudo classes

Count listeners instead of checking handlers, reverse subscription and unsubscription
This commit is contained in:
Panayot Cankov
2016-06-22 13:13:53 +03:00
parent 0477c81dd5
commit c1aeeb51a7
33 changed files with 1560 additions and 1006 deletions

View File

@ -2,7 +2,7 @@
import definition = require("application");
import observable = require("data/observable");
import frame = require("ui/frame");
import cssSelector = require("ui/styling/css-selector");
import {RuleSet} from "ui/styling/css-selector";
import * as fileSystemModule from "file-system";
import * as styleScopeModule from "ui/styling/style-scope";
import * as fileResolverModule from "file-system/file-name-resolver";
@ -34,9 +34,9 @@ export var mainEntry: frame.NavigationEntry;
export var cssFile: string = "app.css"
export var appSelectors: Array<cssSelector.CssSelector> = [];
export var additionalSelectors: Array<cssSelector.CssSelector> = [];
export var cssSelectors: Array<cssSelector.CssSelector> = [];
export var appSelectors: RuleSet[] = [];
export var additionalSelectors: RuleSet[] = [];
export var cssSelectors: RuleSet[] = [];
export var cssSelectorVersion: number = 0;
export var keyframes: any = {};
@ -58,12 +58,12 @@ export var android = undefined;
export var ios = undefined;
export function loadCss(cssFile?: string): Array<cssSelector.CssSelector> {
export function loadCss(cssFile?: string): RuleSet[] {
if (!cssFile) {
return undefined;
}
var result: Array<cssSelector.CssSelector>;
var result: RuleSet[];
var fs: typeof fileSystemModule = require("file-system");
if (!styleScope) {
@ -89,7 +89,7 @@ export function mergeCssSelectors(module: any): void {
module.cssSelectorVersion++;
}
export function parseCss(cssText: string, cssFileName?: string): Array<cssSelector.CssSelector> {
export function parseCss(cssText: string, cssFileName?: string): RuleSet[] {
if (!styleScope) {
styleScope = require("ui/styling/style-scope");
}

View File

@ -2,7 +2,7 @@
* Contains the application abstraction with all related methods.
*/
declare module "application" {
import cssSelector = require("ui/styling/css-selector");
import {RuleSet} from "ui/styling/css-selector";
import observable = require("data/observable");
import frame = require("ui/frame");
import {View} from "ui/core/view";
@ -123,15 +123,15 @@ declare module "application" {
export var cssFile: string;
//@private
export var appSelectors: Array<cssSelector.CssSelector>;
export var additionalSelectors: Array<cssSelector.CssSelector>;
export var appSelectors: RuleSet[];
export var additionalSelectors: RuleSet[];
/**
* Cached css selectors created from the content of the css file.
*/
export var cssSelectors: Array<cssSelector.CssSelector>;
export var cssSelectors: RuleSet[];
export var cssSelectorVersion: number;
export var keyframes: any;
export function parseCss(cssText: string, cssFileName?: string): Array<cssSelector.CssSelector>;
export function parseCss(cssText: string, cssFileName?: string): RuleSet[];
export function mergeCssSelectors(module: any): void;
//@endprivate
@ -141,7 +141,7 @@ declare module "application" {
* Loads css file and parses to a css syntax tree.
* @param cssFile Optional parameter to point to an arbitrary css file. If not specified, the cssFile property is used.
*/
export function loadCss(cssFile?: string): Array<cssSelector.CssSelector>;
export function loadCss(cssFile?: string): RuleSet[];
/**
* Call this method to start the application. Important: All code after this method call will not be executed!