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

@ -6,8 +6,7 @@ import view = require("ui/core/view");
import utils = require("utils/utils");
import enums = require("ui/enums");
import dependencyObservable = require("ui/core/dependency-observable");
import styleScope = require("../styling/style-scope");
import {Property} from "ui/core/dependency-observable";
import {PseudoClassHandler} from "ui/core/view";
class TapHandlerImpl extends NSObject {
private _owner: WeakRef<Button>;
@ -43,27 +42,6 @@ export class Button extends common.Button {
this._tapHandler = TapHandlerImpl.initWithOwner(new WeakRef(this));
this._ios.addTargetActionForControlEvents(this._tapHandler, "tap", UIControlEvents.UIControlEventTouchUpInside);
this._stateChangedHandler = new stateChanged.ControlStateChangeListener(this._ios, (s: string) => {
this._goToVisualState(s);
});
}
public onLoaded() {
super.onLoaded();
this._updateHandler();
}
public onUnloaded() {
super.onUnloaded();
this._stateChangedHandler.stop();
}
public _onPropertyChanged(property: Property, oldValue: any, newValue: any) {
super._onPropertyChanged(property, oldValue, newValue);
if (property.affectsStyle) {
this._updateHandler();
}
}
get ios(): UIButton {
@ -88,16 +66,17 @@ export class Button extends common.Button {
this.style._updateTextDecoration();
}
private _updateHandler() {
if (this.parent !== null && this.page !== null) {
let rootPage = this.page;
let scope: styleScope.StyleScope = (<any>rootPage)._getStyleScope();
if (scope.getVisualStates(this) !== undefined) {
this._stateChangedHandler.start();
}
else {
this._stateChangedHandler.stop();
@PseudoClassHandler("normal", "highlighted")
_updateHandler(subscribe: boolean) {
if (subscribe) {
if (!this._stateChangedHandler) {
this._stateChangedHandler = new stateChanged.ControlStateChangeListener(this._ios, (s: string) => {
this._goToVisualState(s);
});
}
this._stateChangedHandler.start();
} else {
this._stateChangedHandler.stop();
}
}
}