Comparing version 0.2.6 to 0.2.7
@@ -1,2 +0,2 @@ | ||
export declare class EventInit<D> implements CustomEventInit { | ||
export declare class REventInit<D> implements CustomEventInit { | ||
bubbles: boolean; | ||
@@ -3,0 +3,0 @@ cancelable: boolean; |
"use strict"; | ||
var EventInit = (function () { | ||
function EventInit(bubbles, cancelable, detail) { | ||
var REventInit = (function () { | ||
function REventInit(bubbles, cancelable, detail) { | ||
this.bubbles = bubbles; | ||
@@ -8,5 +8,5 @@ this.cancelable = cancelable; | ||
} | ||
return EventInit; | ||
return REventInit; | ||
}()); | ||
exports.EventInit = EventInit; | ||
exports.REventInit = REventInit; | ||
var REvent = (function () { | ||
@@ -13,0 +13,0 @@ function REvent(eventName) { |
@@ -8,2 +8,3 @@ import "./pollyfills"; | ||
protected _currentState: string; | ||
eventHandlers: any; | ||
getCurrentState(): string; | ||
@@ -30,5 +31,11 @@ setCurrentState(value: string): void; | ||
getAttribute(name: string): string; | ||
isInitialized(): boolean; | ||
protected createChildren(): void; | ||
protected childrenCreated(): void; | ||
protected validateState(): void; | ||
hasClass(name: string): boolean; | ||
removeClasses(names: string[]): void; | ||
addClasses(names: string[]): void; | ||
toggleClasses(names: string[]): void; | ||
protected trim(text: any): string; | ||
} |
@@ -18,2 +18,3 @@ "use strict"; | ||
_super.call(this, el); | ||
this._initialized = false; | ||
this._children = []; | ||
@@ -115,2 +116,5 @@ this._currentState = ""; | ||
} | ||
else { | ||
this[name] = value; | ||
} | ||
if (this._element instanceof Element) { | ||
@@ -126,2 +130,5 @@ this._element.setAttribute(name, value); | ||
}; | ||
UIElement.prototype.isInitialized = function () { | ||
return this._initialized; | ||
}; | ||
UIElement.prototype.createChildren = function () { | ||
@@ -134,4 +141,51 @@ //abstract | ||
}; | ||
UIElement.prototype.hasClass = function (name) { | ||
if (!this.getAttribute) | ||
return false; | ||
return ((" " + (this.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " "). | ||
indexOf(" " + name + " ") > -1); | ||
}; | ||
UIElement.prototype.removeClasses = function (names) { | ||
var _this = this; | ||
if (names) { | ||
names.forEach(function (cssClass) { | ||
_this.setAttribute('class', _this.trim((" " + (_this.getAttribute('class') || '') + " ") | ||
.replace(/[\n\t]/g, " ") | ||
.replace(" " + _this.trim(cssClass) + " ", " "))); | ||
}, this); | ||
} | ||
}; | ||
UIElement.prototype.addClasses = function (names) { | ||
var _this = this; | ||
if (names) { | ||
var existingClasses = (' ' + (this.getAttribute('class') || '') + ' ') | ||
.replace(/[\n\t]/g, " "); | ||
names.forEach(function (cssClass) { | ||
cssClass = _this.trim(cssClass); | ||
if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) { | ||
existingClasses += cssClass + ' '; | ||
} | ||
}); | ||
this[0].setAttribute('class', this.trim(existingClasses)); | ||
} | ||
}; | ||
UIElement.prototype.toggleClasses = function (names) { | ||
var _this = this; | ||
if (names) { | ||
names.forEach(function (className) { | ||
var classCondition = !_this.hasClass(className); | ||
if (classCondition) | ||
_this.addClasses([className]); | ||
else | ||
_this.removeClasses([className]); | ||
}); | ||
} | ||
}; | ||
UIElement.prototype.trim = function (text) { | ||
return text == null ? | ||
"" : | ||
(text + "").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); | ||
}; | ||
return UIElement; | ||
}(UIEventDispatcher_1.UIEventDispatcher)); | ||
exports.UIElement = UIElement; |
export declare function skinPart(required?: boolean): PropertyDecorator; | ||
export declare function event(name: string): Function; |
@@ -11,1 +11,9 @@ "use strict"; | ||
exports.skinPart = skinPart; | ||
function event(name) { | ||
return function (target) { | ||
if (!target.eventHandlers) | ||
target.eventHandlers = {}; | ||
target.eventHandlers[name] = []; | ||
}; | ||
} | ||
exports.event = event; |
@@ -7,2 +7,5 @@ export declare var rama: { | ||
export * from "./core/UIElement"; | ||
export * from "./core/collections/ArrayCollection"; | ||
export * from "./core/collections/ArrayList"; | ||
export * from "./core/collections/Dictionary"; | ||
export * from "./decorators"; | ||
@@ -9,0 +12,0 @@ export * from "./View"; |
@@ -17,2 +17,5 @@ "use strict"; | ||
__export(require("./core/UIElement")); | ||
__export(require("./core/collections/ArrayCollection")); | ||
__export(require("./core/collections/ArrayList")); | ||
__export(require("./core/collections/Dictionary")); | ||
__export(require("./decorators")); | ||
@@ -19,0 +22,0 @@ __export(require("./View")); |
{ | ||
"name": "ramajs", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "" |
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
88149
61
2298