var ComponentMetadata = (function (_super) { __extends(ComponentMetadata, _super); function ComponentMetadata(_a) { var _b = _a === void 0 ? {} : _a, selector = _b.selector, inputs = _b.inputs, outputs = _b.outputs, properties = _b.properties, events = _b.events, host = _b.host, exportAs = _b.exportAs, moduleId = _b.moduleId, bindings = _b.bindings, viewBindings = _b.viewBindings, _c = _b.changeDetection, changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, queries = _b.queries; _super.call(this, { selector: selector, inputs: inputs, outputs: outputs, properties: properties, events: events, host: host, exportAs: exportAs, moduleId: moduleId, bindings: bindings, queries: queries }); this.changeDetection = changeDetection; this.viewBindings = viewBindings; } ComponentMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], ComponentMetadata); return ComponentMetadata; })(DirectiveMetadata);
var InjectableMetadata = (function () { function InjectableMetadata() { } InjectableMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], InjectableMetadata); return InjectableMetadata; })();
var SkipSelfMetadata = (function () { function SkipSelfMetadata() { } SkipSelfMetadata.prototype.toString = function () { return "@SkipSelf()"; }; SkipSelfMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], SkipSelfMetadata); return SkipSelfMetadata; })();
var HostBindingMetadata = (function () { function HostBindingMetadata(hostPropertyName) { this.hostPropertyName = hostPropertyName; } HostBindingMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [String]) ], HostBindingMetadata); return HostBindingMetadata; })();
var OutputMetadata = (function () { function OutputMetadata(bindingPropertyName) { this.bindingPropertyName = bindingPropertyName; } OutputMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [String]) ], OutputMetadata); return OutputMetadata; })();
var HostMetadata = (function () { function HostMetadata() { } HostMetadata.prototype.toString = function () { return "@Host()"; }; HostMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], HostMetadata); return HostMetadata; })();
var OptionalMetadata = (function () { function OptionalMetadata() { } OptionalMetadata.prototype.toString = function () { return "@Optional()"; }; OptionalMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], OptionalMetadata); return OptionalMetadata; })();
var NoopGetTestability = (function () { function NoopGetTestability() { } NoopGetTestability.prototype.addToWindow = function (registry) { }; NoopGetTestability = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], NoopGetTestability); return NoopGetTestability; })();
var HostListenerMetadata = (function () { function HostListenerMetadata(eventName, args) { this.eventName = eventName; this.args = args; } HostListenerMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [String, Array]) ], HostListenerMetadata); return HostListenerMetadata; })();
var InjectMetadata = (function () { function InjectMetadata(token) { this.token = token; } InjectMetadata.prototype.toString = function () { return "@Inject(" + lang_1.stringify(this.token) + ")"; }; InjectMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], InjectMetadata); return InjectMetadata; })();
var DefaultKeyValueDifferFactory = (function () { function DefaultKeyValueDifferFactory() { } DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || lang_1.isJsObject(obj); }; DefaultKeyValueDifferFactory.prototype.create = function (cdRef) { return new DefaultKeyValueDiffer(); }; DefaultKeyValueDifferFactory = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], DefaultKeyValueDifferFactory); return DefaultKeyValueDifferFactory; })();
var OpaqueToken = (function () { function OpaqueToken(_desc) { this._desc = _desc; } OpaqueToken.prototype.toString = function () { return "Token " + this._desc; }; OpaqueToken = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [String]) ], OpaqueToken); return OpaqueToken; })();
var Provider = (function () { function Provider(token, _a) { var useClass = _a.useClass, useValue = _a.useValue, useExisting = _a.useExisting, useFactory = _a.useFactory, deps = _a.deps, multi = _a.multi; this.token = token; this.useClass = useClass; this.useValue = useValue; this.useExisting = useExisting; this.useFactory = useFactory; this.dependencies = deps; this._multi = multi; } Object.defineProperty(Provider.prototype, "multi", { // TODO: Provide a full working example after alpha38 is released. /** * Creates multiple providers matching the same token (a multi-provider). * * Multi-providers are used for creating pluggable service, where the system comes * with some default providers, and the user can register additonal providers. * The combination of the default providers and the additional providers will be * used to drive the behavior of the system. * * ### Example * * ```typescript * var injector = Injector.resolveAndCreate([ * new Provider("Strings", { useValue: "String1", multi: true}), * new Provider("Strings", { useValue: "String2", multi: true}) * ]); * * expect(injector.get("Strings")).toEqual(["String1", "String2"]); * ``` * * Multi-providers and regular providers cannot be mixed. The following * will throw an exception: * * ```typescript * var injector = Injector.resolveAndCreate([ * new Provider("Strings", { useValue: "String1", multi: true }), * new Provider("Strings", { useValue: "String2"}) * ]); * ``` */ get: function () { return lang_1.normalizeBool(this._multi); }, enumerable: true, configurable: true }); Provider = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object, Object]) ], Provider); return Provider; })();
var Binding = (function (_super) { __extends(Binding, _super); function Binding(token, _a) { var toClass = _a.toClass, toValue = _a.toValue, toAlias = _a.toAlias, toFactory = _a.toFactory, deps = _a.deps, multi = _a.multi; _super.call(this, token, { useClass: toClass, useValue: toValue, useExisting: toAlias, useFactory: toFactory, deps: deps, multi: multi }); } Object.defineProperty(Binding.prototype, "toClass", { /** * @deprecated */ get: function () { return this.useClass; }, enumerable: true, configurable: true }); Object.defineProperty(Binding.prototype, "toAlias", { /** * @deprecated */ get: function () { return this.useExisting; }, enumerable: true, configurable: true }); Object.defineProperty(Binding.prototype, "toFactory", { /** * @deprecated */ get: function () { return this.useFactory; }, enumerable: true, configurable: true }); Object.defineProperty(Binding.prototype, "toValue", { /** * @deprecated */ get: function () { return this.useValue; }, enumerable: true, configurable: true }); Binding = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object, Object]) ], Binding); return Binding; })(Provider);
var InputMetadata = (function () { function InputMetadata( /** * Name used when instantiating a component in the temlate. */ bindingPropertyName) { this.bindingPropertyName = bindingPropertyName; } InputMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [String]) ], InputMetadata); return InputMetadata; })();
var DependencyMetadata = (function () { function DependencyMetadata() { } Object.defineProperty(DependencyMetadata.prototype, "token", { get: function () { return null; }, enumerable: true, configurable: true }); DependencyMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', []) ], DependencyMetadata); return DependencyMetadata; })();
var ViewMetadata = (function () { function ViewMetadata(_a) { var _b = _a === void 0 ? {} : _a, templateUrl = _b.templateUrl, template = _b.template, directives = _b.directives, pipes = _b.pipes, encapsulation = _b.encapsulation, styles = _b.styles, styleUrls = _b.styleUrls; this.templateUrl = templateUrl; this.template = template; this.styleUrls = styleUrls; this.styles = styles; this.directives = directives; this.pipes = pipes; this.encapsulation = encapsulation; } ViewMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], ViewMetadata); return ViewMetadata; })();
var PipeMetadata = (function (_super) { __extends(PipeMetadata, _super); function PipeMetadata(_a) { var name = _a.name, pure = _a.pure; _super.call(this); this.name = name; this._pure = pure; } Object.defineProperty(PipeMetadata.prototype, "pure", { get: function () { return lang_1.isPresent(this._pure) ? this._pure : true; }, enumerable: true, configurable: true }); PipeMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], PipeMetadata); return PipeMetadata; })(metadata_1.InjectableMetadata);
var LowerCasePipe = (function () { function LowerCasePipe() { } LowerCasePipe.prototype.transform = function (value, args) { if (args === void 0) { args = null; } if (lang_1.isBlank(value)) return value; if (!lang_1.isString(value)) { throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); } return lang_1.StringWrapper.toLowerCase(value); }; LowerCasePipe = __decorate([ lang_1.CONST(), metadata_1.Pipe({ name: 'lowercase' }), di_1.Injectable(), __metadata('design:paramtypes', []) ], LowerCasePipe); return LowerCasePipe; })();
var DirectiveMetadata = (function (_super) { __extends(DirectiveMetadata, _super); function DirectiveMetadata(_a) { var _b = _a === void 0 ? {} : _a, selector = _b.selector, inputs = _b.inputs, outputs = _b.outputs, properties = _b.properties, events = _b.events, host = _b.host, bindings = _b.bindings, exportAs = _b.exportAs, moduleId = _b.moduleId, queries = _b.queries; _super.call(this); this.selector = selector; this.inputs = inputs; this.outputs = outputs; this.host = host; // TODO: remove this once properties and events are removed. this.properties = properties; this.events = events; this.exportAs = exportAs; this.moduleId = moduleId; this.queries = queries; this.bindings = bindings; } DirectiveMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], DirectiveMetadata); return DirectiveMetadata; })(metadata_1.InjectableMetadata);
var KeyValueDiffers = (function () { function KeyValueDiffers(factories) { this.factories = factories; } KeyValueDiffers.create = function (factories, parent) { if (lang_1.isPresent(parent)) { var copied = collection_1.ListWrapper.clone(parent.factories); factories = factories.concat(copied); return new KeyValueDiffers(factories); } else { return new KeyValueDiffers(factories); } }; /** * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the * inherited {@link KeyValueDiffers} instance with the provided factories and return a new * {@link KeyValueDiffers} instance. * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {@link KeyValueDiffer} available. * * # Example * * ``` * @Component({ * viewProviders: [ * KeyValueDiffers.extend([new ImmutableMapDiffer()]) * ] * }) * ``` */ KeyValueDiffers.extend = function (factories) { return new di_1.Provider(KeyValueDiffers, { useFactory: function (parent) { if (lang_1.isBlank(parent)) { // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them. throw new exceptions_1.BaseException('Cannot extend KeyValueDiffers without a parent injector'); } return KeyValueDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[KeyValueDiffers, new di_1.SkipSelfMetadata(), new di_1.OptionalMetadata()]] }); }; KeyValueDiffers.prototype.find = function (kv) { var factory = collection_1.ListWrapper.find(this.factories, function (f) { return f.supports(kv); }); if (lang_1.isPresent(factory)) { return factory; } else { throw new exceptions_1.BaseException("Cannot find a differ supporting object '" + kv + "'"); } }; KeyValueDiffers = __decorate([ di_1.Injectable(), lang_1.CONST(), __metadata('design:paramtypes', [Array]) ], KeyValueDiffers); return KeyValueDiffers; })();
constructor(attributeName) { super(); this.attributeName = attributeName; } get token() { // Normally one would default a token to a type of an injected value but here // the type of a variable is "string" and we can't use primitive type as a return value // so we use instance of Attribute instead. This doesn't matter much in practice as arguments // with @Attribute annotation are injected by ElementInjector that doesn't take tokens into // account. return this; } toString() { return `@Attribute(${stringify(this.attributeName)})`; } }; AttributeMetadata = __decorate([ CONST(), __metadata('design:paramtypes', [String]) ], AttributeMetadata); /** * Declares an injectable parameter to be a live list of directives or variable * bindings from the content children of a directive. * * ### Example ([live demo](http://plnkr.co/edit/lY9m8HLy7z06vDoUaSN2?p=preview)) * * Assume that `<tabs>` component would like to get a list its children `<pane>` * components as shown in this example: * * ```html * <tabs> * <pane title="Overview">...</pane> * <pane *ng-for="#o of objects" [title]="o.title">{{o.text}}</pane>
* * In this example we transform the user text lowercase. * * ``` * @Component({ * selector: "username-cmp", * template: "Username: {{ user | lowercase }}" * }) * class Username { * user:string; * } * * ``` */ export let LowerCasePipe = class { transform(value, args = null) { if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(LowerCasePipe, value); } return StringWrapper.toLowerCase(value); } }; LowerCasePipe = __decorate([ CONST(), Pipe({ name: 'lowercase' }), Injectable(), __metadata('design:paramtypes', []) ], LowerCasePipe); //# sourceMappingURL=lowercase_pipe.js.map
var DirectiveMetadata = (function (_super) { __extends(DirectiveMetadata, _super); function DirectiveMetadata(_a) { var _b = _a === void 0 ? {} : _a, selector = _b.selector, inputs = _b.inputs, outputs = _b.outputs, properties = _b.properties, events = _b.events, host = _b.host, bindings = _b.bindings, providers = _b.providers, exportAs = _b.exportAs, moduleId = _b.moduleId, queries = _b.queries; _super.call(this); this.selector = selector; this._inputs = inputs; this._properties = properties; this._outputs = outputs; this._events = events; this.host = host; this.exportAs = exportAs; this.moduleId = moduleId; this.queries = queries; this._providers = providers; this._bindings = bindings; } Object.defineProperty(DirectiveMetadata.prototype, "inputs", { /** * Enumerates the set of data-bound input properties for a directive * * Angular automatically updates input properties during change detection. * * The `inputs` property defines a set of `directiveProperty` to `bindingProperty` * configuration: * * - `directiveProperty` specifies the component property where the value is written. * - `bindingProperty` specifies the DOM property where the value is read from. * * When `bindingProperty` is not provided, it is assumed to be equal to `directiveProperty`. * * ### Example ([live demo](http://plnkr.co/edit/ivhfXY?p=preview)) * * The following example creates a component with two data-bound properties. * * ```typescript * @Component({ * selector: 'bank-account', * inputs: ['bankName', 'id: account-id'], * template: ` * Bank Name: {{bankName}} * Account Id: {{id}} * ` * }) * class BankAccount { * bankName: string; * id: string; * * // this property is not bound, and won't be automatically updated by Angular * normalizedBankName: string; * } * * @Component({ * selector: 'app', * template: ` * <bank-account bank-name="RBC" account-id="4747"></bank-account> * `, * directives: [BankAccount] * }) * class App {} * * bootstrap(App); * ``` * */ get: function () { return lang_1.isPresent(this._properties) && this._properties.length > 0 ? this._properties : this._inputs; }, enumerable: true, configurable: true }); Object.defineProperty(DirectiveMetadata.prototype, "properties", { get: function () { return this.inputs; }, enumerable: true, configurable: true }); Object.defineProperty(DirectiveMetadata.prototype, "outputs", { /** * Enumerates the set of event-bound output properties. * * When an output property emits an event, an event handler attached to that event * the template is invoked. * * The `outputs` property defines a set of `directiveProperty` to `bindingProperty` * configuration: * * - `directiveProperty` specifies the component property that emits events. * - `bindingProperty` specifies the DOM property the event handler is attached to. * * ### Example ([live demo](http://plnkr.co/edit/d5CNq7?p=preview)) * * ```typescript * @Directive({ * selector: 'interval-dir', * outputs: ['everySecond', 'five5Secs: everyFiveSeconds'] * }) * class IntervalDir { * everySecond = new EventEmitter(); * five5Secs = new EventEmitter(); * * constructor() { * setInterval(() => this.everySecond.next("event"), 1000); * setInterval(() => this.five5Secs.next("event"), 5000); * } * } * * @Component({ * selector: 'app', * template: ` * <interval-dir (every-second)="everySecond()" (every-five-seconds)="everyFiveSeconds()"> * </interval-dir> * `, * directives: [IntervalDir] * }) * class App { * everySecond() { console.log('second'); } * everyFiveSeconds() { console.log('five seconds'); } * } * bootstrap(App); * ``` * */ get: function () { return lang_1.isPresent(this._events) && this._events.length > 0 ? this._events : this._outputs; }, enumerable: true, configurable: true }); Object.defineProperty(DirectiveMetadata.prototype, "events", { get: function () { return this.outputs; }, enumerable: true, configurable: true }); Object.defineProperty(DirectiveMetadata.prototype, "providers", { /** * Defines the set of injectable objects that are visible to a Directive and its light DOM * children. * * ## Simple Example * * Here is an example of a class that can be injected: * * ``` * class Greeter { * greet(name:string) { * return 'Hello ' + name + '!'; * } * } * * @Directive({ * selector: 'greet', * bindings: [ * Greeter * ] * }) * class HelloWorld { * greeter:Greeter; * * constructor(greeter:Greeter) { * this.greeter = greeter; * } * } * ``` */ get: function () { return lang_1.isPresent(this._bindings) && this._bindings.length > 0 ? this._bindings : this._providers; }, enumerable: true, configurable: true }); Object.defineProperty(DirectiveMetadata.prototype, "bindings", { /** @deprecated */ get: function () { return this.providers; }, enumerable: true, configurable: true }); DirectiveMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], DirectiveMetadata); return DirectiveMetadata; })(metadata_1.InjectableMetadata);
var ComponentMetadata = (function (_super) { __extends(ComponentMetadata, _super); function ComponentMetadata(_a) { var _b = _a === void 0 ? {} : _a, selector = _b.selector, inputs = _b.inputs, outputs = _b.outputs, properties = _b.properties, events = _b.events, host = _b.host, exportAs = _b.exportAs, moduleId = _b.moduleId, bindings = _b.bindings, providers = _b.providers, viewBindings = _b.viewBindings, viewProviders = _b.viewProviders, _c = _b.changeDetection, changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, queries = _b.queries, templateUrl = _b.templateUrl, template = _b.template, styleUrls = _b.styleUrls, styles = _b.styles, directives = _b.directives, pipes = _b.pipes, encapsulation = _b.encapsulation; _super.call(this, { selector: selector, inputs: inputs, outputs: outputs, properties: properties, events: events, host: host, exportAs: exportAs, moduleId: moduleId, bindings: bindings, providers: providers, queries: queries }); this.changeDetection = changeDetection; this._viewProviders = viewProviders; this._viewBindings = viewBindings; this.templateUrl = templateUrl; this.template = template; this.styleUrls = styleUrls; this.styles = styles; this.directives = directives; this.pipes = pipes; this.encapsulation = encapsulation; } Object.defineProperty(ComponentMetadata.prototype, "viewProviders", { /** * Defines the set of injectable objects that are visible to its view DOM children. * * ## Simple Example * * Here is an example of a class that can be injected: * * ``` * class Greeter { * greet(name:string) { * return 'Hello ' + name + '!'; * } * } * * @Directive({ * selector: 'needs-greeter' * }) * class NeedsGreeter { * greeter:Greeter; * * constructor(greeter:Greeter) { * this.greeter = greeter; * } * } * * @Component({ * selector: 'greet', * viewProviders: [ * Greeter * ], * template: `<needs-greeter></needs-greeter>`, * directives: [NeedsGreeter] * }) * class HelloWorld { * } * * ``` */ get: function () { return lang_1.isPresent(this._viewBindings) && this._viewBindings.length > 0 ? this._viewBindings : this._viewProviders; }, enumerable: true, configurable: true }); Object.defineProperty(ComponentMetadata.prototype, "viewBindings", { get: function () { return this.viewProviders; }, enumerable: true, configurable: true }); ComponentMetadata = __decorate([ lang_1.CONST(), __metadata('design:paramtypes', [Object]) ], ComponentMetadata); return ComponentMetadata; })(DirectiveMetadata);