Skip to content

Commit

Permalink
chore(all): prepare release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jun 27, 2017
1 parent 62137ef commit 62b0673
Show file tree
Hide file tree
Showing 199 changed files with 5,579 additions and 1,130 deletions.
4 changes: 3 additions & 1 deletion dist/amd/aurelia-validation.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export * from './controller-validate-result';
export * from './get-target-dom-element';
export * from './property-info';
export * from './property-accessor-parser';
export * from './validate-binding-behavior';
export * from './validate-event';
export * from './validate-instruction';
export * from './validate-result';
export * from './validate-trigger';
Expand All @@ -15,7 +17,7 @@ export * from './implementation/rule';
export * from './implementation/rules';
export * from './implementation/standard-validator';
export * from './implementation/validation-messages';
export * from './implementation/validation-parser';
export * from './implementation/validation-message-parser';
export * from './implementation/validation-rules';
import { Container } from 'aurelia-dependency-injection';
import { Validator } from './validator';
Expand Down
11 changes: 7 additions & 4 deletions dist/amd/aurelia-validation.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Exports
define(["require", "exports", "./get-target-dom-element", "./property-info", "./validate-binding-behavior", "./validate-result", "./validate-trigger", "./validation-controller", "./validation-controller-factory", "./validation-errors-custom-attribute", "./validation-renderer-custom-attribute", "./validator", "./implementation/rules", "./implementation/standard-validator", "./implementation/validation-messages", "./implementation/validation-parser", "./implementation/validation-rules", "aurelia-pal", "./validator", "./implementation/standard-validator", "./implementation/validation-parser", "./implementation/validation-rules"], function (require, exports, get_target_dom_element_1, property_info_1, validate_binding_behavior_1, validate_result_1, validate_trigger_1, validation_controller_1, validation_controller_factory_1, validation_errors_custom_attribute_1, validation_renderer_custom_attribute_1, validator_1, rules_1, standard_validator_1, validation_messages_1, validation_parser_1, validation_rules_1, aurelia_pal_1, validator_2, standard_validator_2, validation_parser_2, validation_rules_2) {
define(["require", "exports", "./get-target-dom-element", "./property-info", "./property-accessor-parser", "./validate-binding-behavior", "./validate-event", "./validate-result", "./validate-trigger", "./validation-controller", "./validation-controller-factory", "./validation-errors-custom-attribute", "./validation-renderer-custom-attribute", "./validator", "./implementation/rules", "./implementation/standard-validator", "./implementation/validation-messages", "./implementation/validation-message-parser", "./implementation/validation-rules", "aurelia-pal", "./validator", "./implementation/standard-validator", "./implementation/validation-message-parser", "./property-accessor-parser", "./implementation/validation-rules"], function (require, exports, get_target_dom_element_1, property_info_1, property_accessor_parser_1, validate_binding_behavior_1, validate_event_1, validate_result_1, validate_trigger_1, validation_controller_1, validation_controller_factory_1, validation_errors_custom_attribute_1, validation_renderer_custom_attribute_1, validator_1, rules_1, standard_validator_1, validation_messages_1, validation_message_parser_1, validation_rules_1, aurelia_pal_1, validator_2, standard_validator_2, validation_message_parser_2, property_accessor_parser_2, validation_rules_2) {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(get_target_dom_element_1);
__export(property_info_1);
__export(property_accessor_parser_1);
__export(validate_binding_behavior_1);
__export(validate_event_1);
__export(validate_result_1);
__export(validate_trigger_1);
__export(validation_controller_1);
Expand All @@ -18,7 +20,7 @@ define(["require", "exports", "./get-target-dom-element", "./property-info", "./
__export(rules_1);
__export(standard_validator_1);
__export(validation_messages_1);
__export(validation_parser_1);
__export(validation_message_parser_1);
__export(validation_rules_1);
/**
* Aurelia Validation Configuration API
Expand Down Expand Up @@ -49,8 +51,9 @@ define(["require", "exports", "./get-target-dom-element", "./property-info", "./
function configure(frameworkConfig, callback) {
// the fluent rule definition API needs the parser to translate messages
// to interpolation expressions.
var parser = frameworkConfig.container.get(validation_parser_2.ValidationParser);
validation_rules_2.ValidationRules.initialize(parser);
var messageParser = frameworkConfig.container.get(validation_message_parser_2.ValidationMessageParser);
var propertyParser = frameworkConfig.container.get(property_accessor_parser_2.PropertyAccessorParser);
validation_rules_2.ValidationRules.initialize(messageParser, propertyParser);
// configure...
var config = new AureliaValidationConfiguration();
if (callback instanceof Function) {
Expand Down
33 changes: 33 additions & 0 deletions dist/amd/implementation/expression-visitor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ValueConverter, Conditional, AccessMember, AccessKeyed, CallMember, BindingBehavior, Binary } from 'aurelia-binding';
export declare type Chain = any;
export declare type Assign = any;
export declare type AccessThis = any;
export declare type AccessScope = any;
export declare type CallScope = any;
export declare type CallFunction = any;
export declare type PrefixNot = any;
export declare type LiteralPrimitive = any;
export declare type LiteralArray = any;
export declare type LiteralObject = any;
export declare type LiteralString = any;
export declare class ExpressionVisitor {
visitChain(chain: Chain): void;
visitBindingBehavior(behavior: BindingBehavior): void;
visitValueConverter(converter: ValueConverter): void;
visitAssign(assign: Assign): void;
visitConditional(conditional: Conditional): void;
visitAccessThis(access: AccessThis): void;
visitAccessScope(access: AccessScope): void;
visitAccessMember(access: AccessMember): void;
visitAccessKeyed(access: AccessKeyed): void;
visitCallScope(call: CallScope): void;
visitCallFunction(call: CallFunction): void;
visitCallMember(call: CallMember): void;
visitPrefix(prefix: PrefixNot): void;
visitBinary(binary: Binary): void;
visitLiteralPrimitive(literal: LiteralPrimitive): void;
visitLiteralArray(literal: LiteralArray): void;
visitLiteralObject(literal: LiteralObject): void;
visitLiteralString(literal: LiteralString): void;
private visitArgs(args);
}
79 changes: 79 additions & 0 deletions dist/amd/implementation/expression-visitor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable:no-empty
var ExpressionVisitor = (function () {
function ExpressionVisitor() {
}
ExpressionVisitor.prototype.visitChain = function (chain) {
this.visitArgs(chain.expressions);
};
ExpressionVisitor.prototype.visitBindingBehavior = function (behavior) {
behavior.expression.accept(this);
this.visitArgs(behavior.args);
};
ExpressionVisitor.prototype.visitValueConverter = function (converter) {
converter.expression.accept(this);
this.visitArgs(converter.args);
};
ExpressionVisitor.prototype.visitAssign = function (assign) {
assign.target.accept(this);
assign.value.accept(this);
};
ExpressionVisitor.prototype.visitConditional = function (conditional) {
conditional.condition.accept(this);
conditional.yes.accept(this);
conditional.no.accept(this);
};
ExpressionVisitor.prototype.visitAccessThis = function (access) {
access.ancestor = access.ancestor;
};
ExpressionVisitor.prototype.visitAccessScope = function (access) {
access.name = access.name;
};
ExpressionVisitor.prototype.visitAccessMember = function (access) {
access.object.accept(this);
};
ExpressionVisitor.prototype.visitAccessKeyed = function (access) {
access.object.accept(this);
access.key.accept(this);
};
ExpressionVisitor.prototype.visitCallScope = function (call) {
this.visitArgs(call.args);
};
ExpressionVisitor.prototype.visitCallFunction = function (call) {
call.func.accept(this);
this.visitArgs(call.args);
};
ExpressionVisitor.prototype.visitCallMember = function (call) {
call.object.accept(this);
this.visitArgs(call.args);
};
ExpressionVisitor.prototype.visitPrefix = function (prefix) {
prefix.expression.accept(this);
};
ExpressionVisitor.prototype.visitBinary = function (binary) {
binary.left.accept(this);
binary.right.accept(this);
};
ExpressionVisitor.prototype.visitLiteralPrimitive = function (literal) {
literal.value = literal.value;
};
ExpressionVisitor.prototype.visitLiteralArray = function (literal) {
this.visitArgs(literal.elements);
};
ExpressionVisitor.prototype.visitLiteralObject = function (literal) {
this.visitArgs(literal.values);
};
ExpressionVisitor.prototype.visitLiteralString = function (literal) {
literal.value = literal.value;
};
ExpressionVisitor.prototype.visitArgs = function (args) {
for (var i = 0; i < args.length; i++) {
args[i].accept(this);
}
};
return ExpressionVisitor;
}());
exports.ExpressionVisitor = ExpressionVisitor;
});
2 changes: 1 addition & 1 deletion dist/amd/implementation/rule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface RuleProperty {
export interface Rule<TObject, TValue> {
property: RuleProperty;
condition: (value: TValue, object?: TObject) => boolean | Promise<boolean>;
config: Object;
config: object;
when: ((object: TObject) => boolean) | null;
messageKey: string;
message: Expression | null;
Expand Down
8 changes: 4 additions & 4 deletions dist/amd/implementation/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ define(["require", "exports"], function (require, exports) {
Rules.get = function (target) {
return target[Rules.key] || null;
};
/**
* The name of the property that stores the rules.
*/
Rules.key = '__rules__';
return Rules;
}());
/**
* The name of the property that stores the rules.
*/
Rules.key = '__rules__';
exports.Rules = Rules;
});
2 changes: 1 addition & 1 deletion dist/amd/implementation/standard-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ define(["require", "exports", "aurelia-templating", "../validator", "../validate
}
return this.validateRuleSequence(object, propertyName, rules, 0, []);
};
StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources];
return StandardValidator;
}(validator_1.Validator));
StandardValidator.inject = [validation_messages_1.ValidationMessageProvider, aurelia_templating_1.ViewResources];
exports.StandardValidator = StandardValidator;
});
20 changes: 20 additions & 0 deletions dist/amd/implementation/validation-message-parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Expression, AccessScope } from 'aurelia-binding';
import { BindingLanguage } from 'aurelia-templating';
import { ExpressionVisitor } from './expression-visitor';
export declare class ValidationMessageParser {
private bindinqLanguage;
static inject: typeof BindingLanguage[];
private emptyStringExpression;
private nullExpression;
private undefinedExpression;
private cache;
constructor(bindinqLanguage: BindingLanguage);
parse(message: string): Expression;
private coalesce(part);
}
export declare class MessageExpressionValidator extends ExpressionVisitor {
private originalMessage;
static validate(expression: Expression, originalMessage: string): void;
constructor(originalMessage: string);
visitAccessScope(access: AccessScope): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
define(["require", "exports", "aurelia-binding", "aurelia-templating", "./util", "aurelia-logging"], function (require, exports, aurelia_binding_1, aurelia_templating_1, util_1, LogManager) {
define(["require", "exports", "aurelia-binding", "aurelia-templating", "aurelia-logging", "./expression-visitor"], function (require, exports, aurelia_binding_1, aurelia_templating_1, LogManager, expression_visitor_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ValidationParser = (function () {
function ValidationParser(parser, bindinqLanguage) {
this.parser = parser;
var ValidationMessageParser = (function () {
function ValidationMessageParser(bindinqLanguage) {
this.bindinqLanguage = bindinqLanguage;
this.emptyStringExpression = new aurelia_binding_1.LiteralString('');
this.nullExpression = new aurelia_binding_1.LiteralPrimitive(null);
this.undefinedExpression = new aurelia_binding_1.LiteralPrimitive(undefined);
this.cache = {};
}
ValidationParser.prototype.parseMessage = function (message) {
ValidationMessageParser.prototype.parse = function (message) {
if (this.cache[message] !== undefined) {
return this.cache[message];
}
Expand All @@ -36,43 +35,18 @@ define(["require", "exports", "aurelia-binding", "aurelia-templating", "./util",
this.cache[message] = expression;
return expression;
};
ValidationParser.prototype.parseProperty = function (property) {
if (util_1.isString(property)) {
return { name: property, displayName: null };
}
var accessor = this.getAccessorExpression(property.toString());
if (accessor instanceof aurelia_binding_1.AccessScope
|| accessor instanceof aurelia_binding_1.AccessMember && accessor.object instanceof aurelia_binding_1.AccessScope) {
return {
name: accessor.name,
displayName: null
};
}
throw new Error("Invalid subject: \"" + accessor + "\"");
};
ValidationParser.prototype.coalesce = function (part) {
ValidationMessageParser.prototype.coalesce = function (part) {
// part === null || part === undefined ? '' : part
return new aurelia_binding_1.Conditional(new aurelia_binding_1.Binary('||', new aurelia_binding_1.Binary('===', part, this.nullExpression), new aurelia_binding_1.Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new aurelia_binding_1.CallMember(part, 'toString', []));
};
ValidationParser.prototype.getAccessorExpression = function (fn) {
/* tslint:disable:max-line-length */
var classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?\s*(?:[$_\w\d.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/;
/* tslint:enable:max-line-length */
var arrow = /^\(?[$_\w\d]+\)?\s*=>\s*[$_\w\d]+\.([$_\w\d]+)$/;
var match = classic.exec(fn) || arrow.exec(fn);
if (match === null) {
throw new Error("Unable to parse accessor function:\n" + fn);
}
return this.parser.parse(match[1]);
};
return ValidationParser;
ValidationMessageParser.inject = [aurelia_templating_1.BindingLanguage];
return ValidationMessageParser;
}());
ValidationParser.inject = [aurelia_binding_1.Parser, aurelia_templating_1.BindingLanguage];
exports.ValidationParser = ValidationParser;
exports.ValidationMessageParser = ValidationMessageParser;
var MessageExpressionValidator = (function (_super) {
__extends(MessageExpressionValidator, _super);
function MessageExpressionValidator(originalMessage) {
var _this = _super.call(this, []) || this;
var _this = _super.call(this) || this;
_this.originalMessage = originalMessage;
return _this;
}
Expand All @@ -90,6 +64,6 @@ define(["require", "exports", "aurelia-binding", "aurelia-templating", "./util",
}
};
return MessageExpressionValidator;
}(aurelia_binding_1.Unparser));
}(expression_visitor_1.ExpressionVisitor));
exports.MessageExpressionValidator = MessageExpressionValidator;
});
8 changes: 4 additions & 4 deletions dist/amd/implementation/validation-messages.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Expression } from 'aurelia-binding';
import { ValidationParser } from './validation-parser';
import { ValidationMessageParser } from './validation-message-parser';
export interface ValidationMessages {
[key: string]: string;
}
Expand All @@ -12,8 +12,8 @@ export declare const validationMessages: ValidationMessages;
*/
export declare class ValidationMessageProvider {
private parser;
static inject: typeof ValidationParser[];
constructor(parser: ValidationParser);
static inject: typeof ValidationMessageParser[];
constructor(parser: ValidationMessageParser);
/**
* Returns a message binding expression that corresponds to the key.
* @param key The message key.
Expand All @@ -25,5 +25,5 @@ export declare class ValidationMessageProvider {
* Override this with your own custom logic.
* @param propertyName The property name.
*/
getDisplayName(propertyName: string, displayName?: string | null | Function): string;
getDisplayName(propertyName: string, displayName?: string | null | (() => string)): string;
}
6 changes: 3 additions & 3 deletions dist/amd/implementation/validation-messages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(["require", "exports", "./validation-parser"], function (require, exports, validation_parser_1) {
define(["require", "exports", "./validation-message-parser"], function (require, exports, validation_message_parser_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
Expand Down Expand Up @@ -37,7 +37,7 @@ define(["require", "exports", "./validation-parser"], function (require, exports
else {
message = exports.validationMessages['default'];
}
return this.parser.parseMessage(message);
return this.parser.parse(message);
};
/**
* Formulates a property display name using the property name and the configured
Expand All @@ -54,8 +54,8 @@ define(["require", "exports", "./validation-parser"], function (require, exports
// capitalize first letter.
return words.charAt(0).toUpperCase() + words.slice(1);
};
ValidationMessageProvider.inject = [validation_message_parser_1.ValidationMessageParser];
return ValidationMessageProvider;
}());
ValidationMessageProvider.inject = [validation_parser_1.ValidationParser];
exports.ValidationMessageProvider = ValidationMessageProvider;
});
24 changes: 0 additions & 24 deletions dist/amd/implementation/validation-parser.d.ts

This file was deleted.

Loading

0 comments on commit 62b0673

Please sign in to comment.