Comparing version 0.2.8 to 0.3.0
@@ -27,3 +27,3 @@ import "./pollyfills"; | ||
removeAllChildren(): void; | ||
setAttribute(name?: string, value?: string): void; | ||
setAttribute(name?: string, value?: any): void; | ||
getAttribute(name: string): string; | ||
@@ -30,0 +30,0 @@ isInitialized(): boolean; |
@@ -67,2 +67,3 @@ "use strict"; | ||
this._element = node; | ||
this[0] = node; | ||
}; | ||
@@ -119,3 +120,8 @@ UIElement.prototype.getElementRef = function () { | ||
} | ||
if (this._element instanceof Element) { | ||
//adding eventListener if the attributename starts with on | ||
var searchPattern = new RegExp('^on'); | ||
if (searchPattern.test(name)) { | ||
this.addEventListener(name.substring(2), value); | ||
} | ||
if (this._element instanceof Element && (typeof value === 'string')) { | ||
this._element.setAttribute(name, value); | ||
@@ -122,0 +128,0 @@ } |
import { UIElement } from "../UIElement"; | ||
import { Dictionary } from "../collections/Dictionary"; | ||
export declare var eventMetadata: Dictionary<Function, string[]>; | ||
export interface VNode { | ||
@@ -3,0 +5,0 @@ type: string | Function; |
@@ -6,2 +6,4 @@ "use strict"; | ||
var DOMElement_1 = require("../DOMElement"); | ||
var Dictionary_1 = require("../collections/Dictionary"); | ||
exports.eventMetadata = new Dictionary_1.Dictionary(); | ||
function createVNode(ele, props) { | ||
@@ -89,5 +91,16 @@ var args = []; | ||
registerStateManagedComponent(element, stateManagedProperties, vnode.stateManagedProps); | ||
registerEvents(element, vnode.props); | ||
return element; | ||
} | ||
exports.createElement = createElement; | ||
function registerEvents(element, props) { | ||
var events = exports.eventMetadata.get(element.constructor); | ||
if (events) { | ||
events.forEach(function (eventName) { | ||
if (props[eventName]) { | ||
element.addEventListener(eventName, props[eventName]); | ||
} | ||
}); | ||
} | ||
} | ||
function registerRefs(refs, props, element) { | ||
@@ -94,0 +107,0 @@ if (refs && props.id) { |
export declare function titleCase(string: any): any; | ||
export declare function camelCase(name: any): any; | ||
export declare function trim(text: any): string; |
@@ -9,2 +9,10 @@ "use strict"; | ||
exports.titleCase = titleCase; | ||
function camelCase(name) { | ||
return name. | ||
replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) { | ||
return offset ? letter.toUpperCase() : letter; | ||
}). | ||
replace(MOZ_HACK_REGEXP, 'Moz$1'); | ||
} | ||
exports.camelCase = camelCase; | ||
function trim(text) { | ||
@@ -11,0 +19,0 @@ return text == null ? |
@@ -7,2 +7,11 @@ "use strict"; | ||
}; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var GroupBase_1 = require("./core/GroupBase"); | ||
@@ -12,2 +21,3 @@ var ClassFactory_1 = require("./core/ClassFactory"); | ||
var CollectionEvent_1 = require("./core/collections/events/CollectionEvent"); | ||
var decorators_1 = require("./decorators"); | ||
var DataGroup = (function (_super) { | ||
@@ -234,4 +244,9 @@ __extends(DataGroup, _super); | ||
}; | ||
DataGroup = __decorate([ | ||
decorators_1.event("rendererAdded"), | ||
decorators_1.event("rendererRemoved"), | ||
__metadata('design:paramtypes', [Object]) | ||
], DataGroup); | ||
return DataGroup; | ||
}(GroupBase_1.GroupBase)); | ||
exports.DataGroup = DataGroup; |
export declare function skinPart(required?: boolean): PropertyDecorator; | ||
export declare function event(name: string): ClassDecorator; |
"use strict"; | ||
var dom_1 = require("./core/utils/dom"); | ||
function skinPart(required) { | ||
@@ -11,1 +12,11 @@ if (required === void 0) { required = false; } | ||
exports.skinPart = skinPart; | ||
function event(name) { | ||
return function (constructor) { | ||
if (!dom_1.eventMetadata.get(constructor)) | ||
dom_1.eventMetadata.set(constructor, []); | ||
var events = dom_1.eventMetadata.get(constructor); | ||
if (events.indexOf(name) == -1) | ||
events.push(name); | ||
}; | ||
} | ||
exports.event = event; |
{ | ||
"name": "ramajs", | ||
"version": "0.2.8", | ||
"version": "0.3.0", | ||
"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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
89536
2328
60
2
0