Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function(target){
Metadata.on(target).add(new UseViewStrategy(path));
}
}
Decorators.configure.parameterizedDecorator('useView', useView);
export function noView(target){
var deco = function(target){
Metadata.on(target).add(new NoViewStrategy());
};
return target ? deco(target) : deco;
}
Decorators.configure.simpleDecorator('noView', noView);
export function elementConfig(target){
var deco = function(target){
Metadata.on(target).add(new ElementConfigResource());
};
return target ? deco(target) : deco;
}
Decorators.configure.simpleDecorator('elementConfig', elementConfig);
throw new Error(`'${name}' is not a valid ${type} name. Upper-case letters are not allowed because the DOM is not case-sensitive.`)
}
}
export function behavior(override){
return function(target){
if(override instanceof HtmlBehaviorResource){
Reflect.defineMetadata(Metadata.resource, override, target);
}else{
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
Object.assign(resource, override);
}
}
}
Decorators.configure.parameterizedDecorator('behavior', behavior);
export function customElement(name){
validateBehaviorName(name, 'custom element');
return function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.elementName = name;
}
}
Decorators.configure.parameterizedDecorator('customElement', customElement);
export function customAttribute(name, defaultBindingMode){
validateBehaviorName(name, 'custom attribute');
return function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.attributeName = name;
import {ElementConfigResource} from './element-config';
import {ViewStrategy, UseViewStrategy, NoViewStrategy} from './view-strategy';
import {HtmlBehaviorResource} from './html-behavior';
export function behavior(override):any{
return function(target){
if(override instanceof HtmlBehaviorResource){
Reflect.defineMetadata(Metadata.resource, override, target);
}else{
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
Object.assign(resource, override);
}
}
}
Decorators.configure.parameterizedDecorator('behavior', behavior);
export function customElement(name):any{
return function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.elementName = name;
}
}
Decorators.configure.parameterizedDecorator('customElement', customElement);
export function customAttribute(name):any{
return function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.attributeName = name;
}
}
export function singleton(keyOrRegisterInChild? : any, registerInChild? : boolean = false){
return registration(new SingletonRegistration(keyOrRegisterInChild, registerInChild));
}
export function instanceActivator(value : any){
return function(target){
Metadata.define(Metadata.instanceActivator, value, target);
}
}
export function factory(){
return instanceActivator(FactoryActivator.instance);
}
Decorators.configure.simpleDecorator('autoinject', autoinject);
Decorators.configure.parameterizedDecorator('inject', inject);
Decorators.configure.parameterizedDecorator('registration', registration);
Decorators.configure.parameterizedDecorator('transient', transient);
Decorators.configure.parameterizedDecorator('singleton', singleton);
Decorators.configure.parameterizedDecorator('instanceActivator', instanceActivator);
Decorators.configure.parameterizedDecorator('factory', factory);
export function instanceActivator(value: any) {
return function(target) {
Metadata.define(Metadata.instanceActivator, value, target);
};
}
export function factory() {
return instanceActivator(FactoryActivator.instance);
}
Decorators.configure.simpleDecorator('autoinject', autoinject);
Decorators.configure.parameterizedDecorator('inject', inject);
Decorators.configure.parameterizedDecorator('registration', registration);
Decorators.configure.parameterizedDecorator('transient', transient);
Decorators.configure.parameterizedDecorator('singleton', singleton);
Decorators.configure.parameterizedDecorator('instanceActivator', instanceActivator);
Decorators.configure.parameterizedDecorator('factory', factory);
import { ChildObserver } from './children';
import { ElementConfigResource } from './element-config';
import { ViewStrategy, UseViewStrategy, NoViewStrategy } from './view-strategy';
import { HtmlBehaviorResource } from './html-behavior';
export function behavior(override) {
return function (target) {
if (override instanceof HtmlBehaviorResource) {
Reflect.defineMetadata(Metadata.resource, override, target);
}
else {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
Object.assign(resource, override);
}
};
}
Decorators.configure.parameterizedDecorator('behavior', behavior);
export function customElement(name) {
return function (target) {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.elementName = name;
};
}
Decorators.configure.parameterizedDecorator('customElement', customElement);
export function customAttribute(name) {
return function (target) {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.attributeName = name;
};
}
Decorators.configure.parameterizedDecorator('customAttribute', customAttribute);
export function templateController(target) {
var deco = function (target) {
return registration(new SingletonRegistration(keyOrRegisterInChild, registerInChild));
}
export function instanceActivator(value) {
return function (target) {
Reflect.defineMetadata(Metadata.instanceActivator, value, target);
};
}
export function factory() {
return instanceActivator(FactoryActivator.instance);
}
Decorators.configure.simpleDecorator('autoinject', autoinject);
Decorators.configure.parameterizedDecorator('inject', inject);
Decorators.configure.parameterizedDecorator('registration', registration);
Decorators.configure.parameterizedDecorator('transient', transient);
Decorators.configure.parameterizedDecorator('singleton', singleton);
Decorators.configure.parameterizedDecorator('instanceActivator', instanceActivator);
Decorators.configure.parameterizedDecorator('factory', factory);
import { ChildObserver } from './children';
import { ElementConfigResource } from './element-config';
import { ViewStrategy, UseViewStrategy, NoViewStrategy } from './view-strategy';
import { HtmlBehaviorResource } from './html-behavior';
export function behavior(override) {
return function (target) {
if (override instanceof HtmlBehaviorResource) {
Reflect.defineMetadata(Metadata.resource, override, target);
}
else {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
Object.assign(resource, override);
}
};
}
Decorators.configure.parameterizedDecorator('behavior', behavior);
export function customElement(name) {
return function (target) {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.elementName = name;
};
}
Decorators.configure.parameterizedDecorator('customElement', customElement);
export function customAttribute(name) {
return function (target) {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.attributeName = name;
};
}
Decorators.configure.parameterizedDecorator('customAttribute', customAttribute);
export function templateController(target) {
var deco = function (target) {
resource.attributeName = name;
}
}
Decorators.configure.parameterizedDecorator('customAttribute', customAttribute);
export function templateController(target?):any{
var deco = function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.liftsContent = true;
};
return target ? deco(target) : deco;
}
Decorators.configure.simpleDecorator('templateController', templateController);
export function bindable(nameOrConfigOrTarget, key?, descriptor?):any{
var deco = function(target, key, descriptor){
var actualTarget = key ? target.constructor : target, //is it on a property or a class?
resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, actualTarget),
prop;
if(key){ //is it on a property or a class?
nameOrConfigOrTarget = nameOrConfigOrTarget || {};
nameOrConfigOrTarget.name = key;
}
prop = new BindableProperty(nameOrConfigOrTarget);
return prop.registerWith(actualTarget, resource, descriptor);
};
Metadata.on(target).add(new TransientRegistration(key));
}
}
export function singleton(keyOrRegisterInChild, registerInChild=false){
return function(target){
Metadata.on(target).add(new SingletonRegistration(keyOrRegisterInChild, registerInChild));
}
}
export function factory(target) {
Metadata.on(target).add(new FactoryActivator());
}
Decorators.configure.parameterizedDecorator('inject', inject);
Decorators.configure.parameterizedDecorator('transient', transient);
Decorators.configure.parameterizedDecorator('singleton', singleton);
Decorators.configure.parameterizedDecorator('factory', factory);