Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aurelia-binding-functions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurelia-binding-functions - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

33

dist/call-scope.js

@@ -7,3 +7,4 @@ define(["require", "exports", 'aurelia-binding'], function (require, exports, aurelia_binding_1) {

callScopeConnect.apply(this, arguments);
var bindingFunction = binding.lookupFunctions.bindingFunctions(this.name);
var lookupFunctions = binding.lookupFunctions || scope.resources.lookupFunctions;
var bindingFunction = lookupFunctions.bindingFunctions(this.name);
if (bindingFunction && typeof bindingFunction.connect === 'function') {

@@ -14,2 +15,3 @@ bindingFunction.connect(this, binding, scope);

aurelia_binding_1.CallScope.prototype.assign = function assign(scope, value, lookupFunctions) {
lookupFunctions = lookupFunctions || scope.resources.lookupFunctions;
var bindingFunction = lookupFunctions.bindingFunctions(this.name);

@@ -23,2 +25,3 @@ if (bindingFunction && typeof bindingFunction.assign === 'function') {

aurelia_binding_1.CallScope.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
lookupFunctions = lookupFunctions || scope.resources.lookupFunctions;
var bindingFunction = lookupFunctions.bindingFunctions(this.name);

@@ -29,3 +32,3 @@ if (bindingFunction) {

else
throw new Error('BindingFunction needs to implement evaluate()');
throw new Error('The BindingFunction needs to implement evaluate()');
}

@@ -35,2 +38,3 @@ return callScopeEvaluate.apply(this, arguments);

aurelia_binding_1.CallScope.prototype.bind = function bind(binding, scope, lookupFunctions) {
lookupFunctions = lookupFunctions || binding.lookupFunctions || scope.resources.lookupFunctions;
var bindingFunction = lookupFunctions.bindingFunctions(this.name);

@@ -42,3 +46,4 @@ if (bindingFunction && typeof bindingFunction.bind === 'function') {

aurelia_binding_1.CallScope.prototype.unbind = function unbind(binding, scope) {
var bindingFunction = binding.lookupFunctions.bindingFunctions(this.name);
var lookupFunctions = binding.lookupFunctions || scope.resources.lookupFunctions;
var bindingFunction = lookupFunctions.bindingFunctions(this.name);
if (bindingFunction && typeof bindingFunction.unbind === 'function') {

@@ -48,2 +53,22 @@ bindingFunction.unbind(this, binding, scope);

};
aurelia_binding_1.AccessMember.prototype.bind = function bind(binding, scope, lookupFunctions) {
if (this.object instanceof aurelia_binding_1.CallScope || this.object instanceof aurelia_binding_1.AccessMember || this.object instanceof aurelia_binding_1.AccessKeyed) {
this.object.bind(binding, scope, lookupFunctions);
}
};
aurelia_binding_1.AccessMember.prototype.unbind = function unbind(binding, scope) {
if (this.object instanceof aurelia_binding_1.CallScope || this.object instanceof aurelia_binding_1.AccessMember || this.object instanceof aurelia_binding_1.AccessKeyed) {
this.object.unbind(binding, scope);
}
};
aurelia_binding_1.AccessKeyed.prototype.bind = function bind(binding, scope, lookupFunctions) {
if (this.object instanceof aurelia_binding_1.CallScope || this.object instanceof aurelia_binding_1.AccessMember || this.object instanceof aurelia_binding_1.AccessKeyed) {
this.object.bind(binding, scope, lookupFunctions);
}
};
aurelia_binding_1.AccessKeyed.prototype.unbind = function unbind(binding, scope) {
if (this.object instanceof aurelia_binding_1.CallScope || this.object instanceof aurelia_binding_1.AccessMember || this.object instanceof aurelia_binding_1.AccessKeyed) {
this.object.unbind(binding, scope);
}
};
}

@@ -53,2 +78,2 @@ exports.patchCallScope = patchCallScope;

//# sourceMappingURL=call-scope.js.map
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsbC1zY29wZS5qcyIsInNvdXJjZVJvb3QiOiIvc291cmNlLyIsInNvdXJjZXMiOlsiY2FsbC1zY29wZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUdBO1FBQ0UsSUFBTSxnQkFBZ0IsR0FBYSwyQkFBUyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUE7UUFFOUQsMkJBQVMsQ0FBQyxTQUFTLENBQUMsT0FBTyxHQUF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UEiLCJzb3VyY2VzQ29udGVudCI6W119

35

dist/view-resources.js

@@ -1,16 +0,31 @@

define(["require", "exports", 'aurelia-templating'], function (require, exports, aurelia_templating_1) {
define(["require", "exports", 'aurelia-templating', 'aurelia-logging'], function (require, exports, aurelia_templating_1, LogManager) {
"use strict";
function patchViewResources(viewResources) {
var logger = LogManager.getLogger('templating');
aurelia_templating_1.ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext) {
var resources = new aurelia_templating_1.ViewResources(this.appResources, registryEntry.address);
if (!resources.lookupFunctions.bindingFunctions)
Object.assign(resources.lookupFunctions, { bindingFunctions: resources.getBindingFunction.bind(resources) });
if (!resources.bindingFunctions)
resources.bindingFunctions = {};
var dependencies = registryEntry.dependencies;
var importIds = void 0;
var names = void 0;
compileInstruction = compileInstruction || aurelia_templating_1.ViewCompileInstruction.normal;
if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
return Promise.resolve(resources);
}
importIds = dependencies.map(function (x) {
return x.src;
});
names = dependencies.map(function (x) {
return x.name;
});
logger.debug('importing resources for ' + registryEntry.address, importIds);
return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
};
aurelia_templating_1.ViewResources.prototype.registerBindingFunction = function (name, bindingFunction) {
if (!this.lookupFunctions.bindingFunctions)
Object.assign(this.lookupFunctions, { bindingFunctions: this.getBindingFunction.bind(this) });
if (!this.bindingFunctions)
this.bindingFunctions = {};
register(this.bindingFunctions, name, bindingFunction, 'a BindingFunction');
};
aurelia_templating_1.ViewResources.prototype.getBindingFunction = function (name) {
if (!this.lookupFunctions.bindingFunctions)
Object.assign(this.lookupFunctions, { bindingFunctions: this.getBindingFunction.bind(this) });
if (!this.bindingFunctions)
this.bindingFunctions = {};
return this.bindingFunctions[name] || (this.hasParent ? this.parent.getBindingFunction(name) : null);

@@ -37,2 +52,2 @@ };

//# sourceMappingURL=view-resources.js.map
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJma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vbnRlbnQiOltdfQ==
{
"name": "aurelia-binding-functions",
"version": "0.2.0",
"version": "0.2.1",
"description": "An Aurelia plugin that makes it possible create BindingFunctions.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -1,2 +0,2 @@

import {CallScope, Scope, Binding, Expression} from 'aurelia-binding'
import {CallScope, Scope, Binding, Expression, AccessMember, AccessKeyed} from 'aurelia-binding'
import {BindingFunction} from './index'

@@ -9,4 +9,5 @@

callScopeConnect.apply(this, arguments)
const bindingFunction = binding.lookupFunctions.bindingFunctions(this.name) as BindingFunction
const lookupFunctions = binding.lookupFunctions || scope.resources.lookupFunctions
const bindingFunction = lookupFunctions.bindingFunctions(this.name) as BindingFunction
if (bindingFunction && typeof bindingFunction.connect === 'function') {

@@ -18,2 +19,3 @@ bindingFunction.connect(this, binding, scope)

CallScope.prototype.assign = function assign(scope: Scope, value: any, lookupFunctions: any): any {
lookupFunctions = lookupFunctions || scope.resources.lookupFunctions
const bindingFunction = lookupFunctions.bindingFunctions(this.name) as BindingFunction

@@ -28,3 +30,4 @@ if (bindingFunction && typeof bindingFunction.assign === 'function') {

CallScope.prototype.evaluate = function evaluate(scope: Scope, lookupFunctions, mustEvaluate: boolean) {
CallScope.prototype.evaluate = function evaluate(scope: Scope, lookupFunctions?, mustEvaluate?: boolean) {
lookupFunctions = lookupFunctions || scope.resources.lookupFunctions
const bindingFunction = lookupFunctions.bindingFunctions(this.name) as BindingFunction

@@ -35,3 +38,3 @@ if (bindingFunction) {

else
throw new Error('BindingFunction needs to implement evaluate()')
throw new Error('The BindingFunction needs to implement evaluate()')
}

@@ -42,2 +45,3 @@ return callScopeEvaluate.apply(this, arguments)

CallScope.prototype.bind = function bind(binding: Binding, scope: Scope, lookupFunctions) {
lookupFunctions = lookupFunctions || binding.lookupFunctions || scope.resources.lookupFunctions
const bindingFunction = lookupFunctions.bindingFunctions(this.name) as BindingFunction

@@ -50,3 +54,4 @@ if (bindingFunction && typeof bindingFunction.bind === 'function') {

CallScope.prototype.unbind = function unbind(binding: Binding, scope: Scope) {
const bindingFunction = binding.lookupFunctions.bindingFunctions(this.name) as BindingFunction
const lookupFunctions = binding.lookupFunctions || scope.resources.lookupFunctions
const bindingFunction = lookupFunctions.bindingFunctions(this.name) as BindingFunction
if (bindingFunction && typeof bindingFunction.unbind === 'function') {

@@ -56,2 +61,26 @@ bindingFunction.unbind(this, binding, scope)

}
AccessMember.prototype.bind = function bind(binding: Binding, scope: Scope, lookupFunctions) {
if (this.object instanceof CallScope || this.object instanceof AccessMember || this.object instanceof AccessKeyed) {
this.object.bind(binding, scope, lookupFunctions)
}
}
AccessMember.prototype.unbind = function unbind(binding: Binding, scope: Scope) {
if (this.object instanceof CallScope || this.object instanceof AccessMember || this.object instanceof AccessKeyed) {
this.object.unbind(binding, scope)
}
}
AccessKeyed.prototype.bind = function bind(binding: Binding, scope: Scope, lookupFunctions) {
if (this.object instanceof CallScope || this.object instanceof AccessMember || this.object instanceof AccessKeyed) {
this.object.bind(binding, scope, lookupFunctions)
}
}
AccessKeyed.prototype.unbind = function unbind(binding: Binding, scope: Scope) {
if (this.object instanceof CallScope || this.object instanceof AccessMember || this.object instanceof AccessKeyed) {
this.object.unbind(binding, scope)
}
}
}

@@ -1,5 +0,40 @@

import {ViewResources} from 'aurelia-templating'
import {ViewResources, ViewEngine, ViewCompileInstruction} from 'aurelia-templating'
import * as LogManager from 'aurelia-logging'
export function patchViewResources(viewResources: ViewResources) {
const logger = LogManager.getLogger('templating');
/**
* from: https://github.com/aurelia/templating/blob/master/src/view-engine.js
*/
ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext) {
var resources = new ViewResources(this.appResources, registryEntry.address);
// START PATCH
// TODO: this should be done in a monkey-patched constructor of ViewResources
if (!resources.lookupFunctions.bindingFunctions) Object.assign(resources.lookupFunctions, { bindingFunctions: resources.getBindingFunction.bind(resources) })
if (!resources.bindingFunctions) resources.bindingFunctions = {}
// END PATCH
var dependencies = registryEntry.dependencies;
var importIds = void 0;
var names = void 0;
compileInstruction = compileInstruction || ViewCompileInstruction.normal;
if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
return Promise.resolve(resources);
}
importIds = dependencies.map(function (x) {
return x.src;
});
names = dependencies.map(function (x) {
return x.name;
});
logger.debug('importing resources for ' + registryEntry.address, importIds);
return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
};
/**
* Registers a binding behavior.

@@ -10,6 +45,2 @@ * @param name The name of the binding function.

ViewResources.prototype.registerBindingFunction = function(name: string, bindingFunction: Object): void {
// TODO: this should be done in a monkey-patched constructor
if (!this.lookupFunctions.bindingFunctions) Object.assign(this.lookupFunctions, { bindingFunctions: this.getBindingFunction.bind(this) })
if (!this.bindingFunctions) this.bindingFunctions = {}
register(this.bindingFunctions, name, bindingFunction, 'a BindingFunction')

@@ -24,10 +55,6 @@ }

ViewResources.prototype.getBindingFunction = function(name: string): Object {
// TODO: this should be done in a monkey-patched constructor
if (!this.lookupFunctions.bindingFunctions) Object.assign(this.lookupFunctions, { bindingFunctions: this.getBindingFunction.bind(this) })
if (!this.bindingFunctions) this.bindingFunctions = {}
return this.bindingFunctions[name] || (this.hasParent ? this.parent.getBindingFunction(name) : null)
}
// 2. patch global instance of ViewResources
// patch global instance of ViewResources
viewResources.bindingFunctions = {}

@@ -34,0 +61,0 @@ Object.assign(viewResources.lookupFunctions, { bindingFunctions: viewResources.getBindingFunction.bind(viewResources) })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc