Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var deco = function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.skipContentProcessing = true;
};
if(typeof moduleInstance === 'function'){
moduleInstance = {'default': moduleInstance};
}
if(viewModelMember){
mainResource = new ResourceDescription(viewModelMember, moduleInstance[viewModelMember]);
}
for(key in moduleInstance){
exportedValue = moduleInstance[key];
if(key === viewModelMember || typeof exportedValue !== 'function'){
continue;
}
resourceTypeMeta = Metadata.get(Metadata.resource, exportedValue);
if(resourceTypeMeta){
if(resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null){
//no customeElement or customAttribute but behavior added by other metadata
HtmlBehaviorResource.convention(key, resourceTypeMeta);
}
if(resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null){
//no convention and no customeElement or customAttribute but behavior added by other metadata
resourceTypeMeta.elementName = hyphenate(key);
}
if(!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null){
mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta);
}else{
resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));
}else{
resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));
}
} else if(exportedValue instanceof ViewStrategy){
viewStrategy = exportedValue;
} else if(exportedValue instanceof TemplateRegistryEntry){
viewStrategy = new TemplateRegistryViewStrategy(moduleId, exportedValue);
} else {
if(conventional = HtmlBehaviorResource.convention(key)){
if(conventional.elementName !== null && !mainResource){
mainResource = new ResourceDescription(key, exportedValue, conventional);
}else{
resources.push(new ResourceDescription(key, exportedValue, conventional));
}
Reflect.defineMetadata(Metadata.resource, conventional, exportedValue);
} else if(conventional = ValueConverterResource.convention(key)) {
resources.push(new ResourceDescription(key, exportedValue, conventional));
Reflect.defineMetadata(Metadata.resource, conventional, exportedValue);
} else if(!fallbackValue){
fallbackValue = exportedValue;
fallbackKey = key;
}
}
}
if(!mainResource && fallbackValue){
mainResource = new ResourceDescription(fallbackKey, fallbackValue);
}
resourceModule.moduleInstance = moduleInstance;
resourceModule.mainResource = mainResource;
var deco = function (target) {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.hasDynamicOptions = true;
};
return target ? deco(target) : deco;
export function valueConverter(nameOrTarget){
if(nameOrTarget === undefined || typeof nameOrTarget === 'string'){
return function(target){
Reflect.defineMetadata(Metadata.resource, new ValueConverterResource(nameOrTarget), target);
}
}
Reflect.defineMetadata(Metadata.resource, new ValueConverterResource(), nameOrTarget);
}
var deco = function (target) {
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.targetShadowDOM = true;
};
return target ? deco(target) : deco;
var deco = function(target){
var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
resource.liftsContent = true;
};
constructor(key, exportedValue, resourceTypeMeta) {
if (!resourceTypeMeta) {
resourceTypeMeta = Metadata.get(Metadata.resource, exportedValue);
if (!resourceTypeMeta) {
resourceTypeMeta = new HtmlBehaviorResource();
resourceTypeMeta.elementName = hyphenate(key);
Reflect.defineMetadata(Metadata.resource, resourceTypeMeta, exportedValue);
}
}
if (resourceTypeMeta instanceof HtmlBehaviorResource) {
if (resourceTypeMeta.elementName === undefined) {
//customeElement()
resourceTypeMeta.elementName = hyphenate(key);
}
else if (resourceTypeMeta.attributeName === undefined) {
//customAttribute()
resourceTypeMeta.attributeName = hyphenate(key);
}
else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
constructor(key, exportedValue, resourceTypeMeta) {
if (!resourceTypeMeta) {
resourceTypeMeta = Metadata.get(Metadata.resource, exportedValue);
if (!resourceTypeMeta) {
resourceTypeMeta = new HtmlBehaviorResource();
resourceTypeMeta.elementName = hyphenate(key);
Reflect.defineMetadata(Metadata.resource, resourceTypeMeta, exportedValue);
}
}
if (resourceTypeMeta instanceof HtmlBehaviorResource) {
if (resourceTypeMeta.elementName === undefined) {
//customeElement()
resourceTypeMeta.elementName = hyphenate(key);
}
else if (resourceTypeMeta.attributeName === undefined) {
//customAttribute()
resourceTypeMeta.attributeName = hyphenate(key);
}
else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
//no customeElement or customAttribute but behavior added by other metadata
HtmlBehaviorResource.convention(key, resourceTypeMeta);
}
}