vendor/assets/javascripts/unstable/angular2.js in angularjs-rails-1.4.0 vs vendor/assets/javascripts/unstable/angular2.js in angularjs-rails-1.4.2
- old
+ new
@@ -3,11 +3,11 @@
'use strict';
var core = require('../core');
var microtask = require('../microtask');
var browserPatch = require('../patch/browser');
-var es6Promise = require('../ext/es6-promise.js');
+var es6Promise = require('es6-promise');
if (global.Zone) {
console.warn('Zone already exported on window the object!');
}
@@ -18,11 +18,11 @@
global.Promise = es6Promise.Promise;
browserPatch.apply();
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../core":2,"../ext/es6-promise.js":3,"../microtask":4,"../patch/browser":5}],2:[function(require,module,exports){
+},{"../core":2,"../microtask":3,"../patch/browser":4,"es6-promise":15}],2:[function(require,module,exports){
(function (global){
'use strict';
function Zone(parentZone, data) {
var zone = (arguments.length) ? Object.create(parentZone) : this;
@@ -152,17 +152,867 @@
Zone: Zone
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./patch/promise":10}],3:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var es6Promise = require('es6-promise').Promise;
+
+// es6-promise asap should schedule microtasks via zone.scheduleMicrotask so that any
+// user defined hooks are triggered
+es6Promise._setAsap(function(fn, arg) {
+ global.zone.scheduleMicrotask(function() {
+ fn(arg);
+ });
+});
+
+// The default implementation of scheduleMicrotask use the original es6-promise implementation
+// to schedule a microtask
+function scheduleMicrotask(fn) {
+ es6Promise._asap(this.bind(fn));
+}
+
+function addMicrotaskSupport(zoneClass) {
+ zoneClass.prototype.scheduleMicrotask = scheduleMicrotask;
+ return zoneClass;
+}
+
+module.exports = {
+ addMicrotaskSupport: addMicrotaskSupport
+};
+
+// TODO(vicb): Create a benchmark for the different methods & the usage of the queue
+// see https://github.com/angular/zone.js/issues/97
+
+var hasNativePromise = typeof Promise !== "undefined" &&
+ Promise.toString().indexOf("[native code]") !== -1;
+
+var isFirefox = global.navigator &&
+ global.navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
+
+// TODO(vicb): remove '!isFirefox' when the bug gets fixed:
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013
+if (hasNativePromise && !isFirefox) {
+ // When available use a native Promise to schedule microtasks.
+ // When not available, es6-promise fallback will be used
+ var resolvedPromise = Promise.resolve();
+ es6Promise._setScheduler(function(fn) {
+ resolvedPromise.then(fn);
+ });
+}
+
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"es6-promise":15}],4:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var fnPatch = require('./functions');
+var promisePatch = require('./promise');
+var mutationObserverPatch = require('./mutation-observer');
+var definePropertyPatch = require('./define-property');
+var registerElementPatch = require('./register-element');
+var webSocketPatch = require('./websocket');
+var eventTargetPatch = require('./event-target');
+var propertyDescriptorPatch = require('./property-descriptor');
+var geolocationPatch = require('./geolocation');
+
+function apply() {
+ fnPatch.patchSetClearFunction(global, [
+ 'timeout',
+ 'interval',
+ 'immediate'
+ ]);
+
+ fnPatch.patchSetFunction(global, [
+ 'requestAnimationFrame',
+ 'mozRequestAnimationFrame',
+ 'webkitRequestAnimationFrame'
+ ]);
+
+ fnPatch.patchFunction(global, [
+ 'alert',
+ 'prompt'
+ ]);
+
+ eventTargetPatch.apply();
+
+ propertyDescriptorPatch.apply();
+
+ promisePatch.apply();
+
+ mutationObserverPatch.patchClass('MutationObserver');
+ mutationObserverPatch.patchClass('WebKitMutationObserver');
+
+ definePropertyPatch.apply();
+
+ registerElementPatch.apply();
+
+ geolocationPatch.apply();
+}
+
+module.exports = {
+ apply: apply
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){
+'use strict';
+
+// might need similar for object.freeze
+// i regret nothing
+
+var _defineProperty = Object.defineProperty;
+var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+var _create = Object.create;
+
+function apply() {
+ Object.defineProperty = function (obj, prop, desc) {
+ if (isUnconfigurable(obj, prop)) {
+ throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj);
+ }
+ if (prop !== 'prototype') {
+ desc = rewriteDescriptor(obj, prop, desc);
+ }
+ return _defineProperty(obj, prop, desc);
+ };
+
+ Object.defineProperties = function (obj, props) {
+ Object.keys(props).forEach(function (prop) {
+ Object.defineProperty(obj, prop, props[prop]);
+ });
+ return obj;
+ };
+
+ Object.create = function (obj, proto) {
+ if (typeof proto === 'object') {
+ Object.keys(proto).forEach(function (prop) {
+ proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);
+ });
+ }
+ return _create(obj, proto);
+ };
+
+ Object.getOwnPropertyDescriptor = function (obj, prop) {
+ var desc = _getOwnPropertyDescriptor(obj, prop);
+ if (isUnconfigurable(obj, prop)) {
+ desc.configurable = false;
+ }
+ return desc;
+ };
+};
+
+function _redefineProperty(obj, prop, desc) {
+ desc = rewriteDescriptor(obj, prop, desc);
+ return _defineProperty(obj, prop, desc);
+};
+
+function isUnconfigurable (obj, prop) {
+ return obj && obj.__unconfigurables && obj.__unconfigurables[prop];
+}
+
+function rewriteDescriptor (obj, prop, desc) {
+ desc.configurable = true;
+ if (!desc.configurable) {
+ if (!obj.__unconfigurables) {
+ _defineProperty(obj, '__unconfigurables', { writable: true, value: {} });
+ }
+ obj.__unconfigurables[prop] = true;
+ }
+ return desc;
+}
+
+module.exports = {
+ apply: apply,
+ _redefineProperty: _redefineProperty
+};
+
+
+
+},{}],6:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var utils = require('../utils');
+
+function apply() {
+ // patched properties depend on addEventListener, so this needs to come first
+ if (global.EventTarget) {
+ utils.patchEventTargetMethods(global.EventTarget.prototype);
+
+ // Note: EventTarget is not available in all browsers,
+ // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
+ } else {
+ var apis = [ 'ApplicationCache',
+ 'EventSource',
+ 'FileReader',
+ 'InputMethodContext',
+ 'MediaController',
+ 'MessagePort',
+ 'Node',
+ 'Performance',
+ 'SVGElementInstance',
+ 'SharedWorker',
+ 'TextTrack',
+ 'TextTrackCue',
+ 'TextTrackList',
+ 'WebKitNamedFlow',
+ 'Window',
+ 'Worker',
+ 'WorkerGlobalScope',
+ 'XMLHttpRequest',
+ 'XMLHttpRequestEventTarget',
+ 'XMLHttpRequestUpload'
+ ];
+
+ apis.forEach(function(thing) {
+ global[thing] && utils.patchEventTargetMethods(global[thing].prototype);
+ });
+ }
+}
+
+module.exports = {
+ apply: apply
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../utils":14}],7:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var utils = require('../utils');
+
+function patchSetClearFunction(obj, fnNames) {
+ fnNames.map(function (name) {
+ return name[0].toUpperCase() + name.substr(1);
+ }).forEach(function (name) {
+ var setName = 'set' + name;
+ var delegate = obj[setName];
+
+ if (delegate) {
+ var clearName = 'clear' + name;
+ var ids = {};
+
+ var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce;
+
+ global.zone[setName] = function (fn) {
+ var id, fnRef = fn;
+ arguments[0] = function () {
+ delete ids[id];
+ return fnRef.apply(this, arguments);
+ };
+ var args = bindArgs(arguments);
+ id = delegate.apply(obj, args);
+ ids[id] = true;
+ return id;
+ };
+
+ obj[setName] = function () {
+ return global.zone[setName].apply(this, arguments);
+ };
+
+ var clearDelegate = obj[clearName];
+
+ global.zone[clearName] = function (id) {
+ if (ids[id]) {
+ delete ids[id];
+ global.zone.dequeueTask();
+ }
+ return clearDelegate.apply(this, arguments);
+ };
+
+ obj[clearName] = function () {
+ return global.zone[clearName].apply(this, arguments);
+ };
+ }
+ });
+};
+
+function patchSetFunction(obj, fnNames) {
+ fnNames.forEach(function (name) {
+ var delegate = obj[name];
+
+ if (delegate) {
+ global.zone[name] = function (fn) {
+ var fnRef = fn;
+ arguments[0] = function () {
+ return fnRef.apply(this, arguments);
+ };
+ var args = utils.bindArgumentsOnce(arguments);
+ return delegate.apply(obj, args);
+ };
+
+ obj[name] = function () {
+ return zone[name].apply(this, arguments);
+ };
+ }
+ });
+};
+
+function patchFunction(obj, fnNames) {
+ fnNames.forEach(function (name) {
+ var delegate = obj[name];
+ global.zone[name] = function () {
+ return delegate.apply(obj, arguments);
+ };
+
+ obj[name] = function () {
+ return global.zone[name].apply(this, arguments);
+ };
+ });
+};
+
+
+module.exports = {
+ patchSetClearFunction: patchSetClearFunction,
+ patchSetFunction: patchSetFunction,
+ patchFunction: patchFunction
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../utils":14}],8:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var utils = require('../utils');
+
+function apply() {
+ if (global.navigator && global.navigator.geolocation) {
+ utils.patchPrototype(global.navigator.geolocation, [
+ 'getCurrentPosition',
+ 'watchPosition'
+ ]);
+ }
+}
+
+module.exports = {
+ apply: apply
+}
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../utils":14}],9:[function(require,module,exports){
+(function (global){
+'use strict';
+
+// wrap some native API on `window`
+function patchClass(className) {
+ var OriginalClass = global[className];
+ if (!OriginalClass) return;
+
+ global[className] = function (fn) {
+ this._o = new OriginalClass(global.zone.bind(fn, true));
+ // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks
+ this._creationZone = global.zone;
+ };
+
+ var instance = new OriginalClass(function () {});
+
+ global[className].prototype.disconnect = function () {
+ var result = this._o.disconnect.apply(this._o, arguments);
+ if (this._active) {
+ this._creationZone.dequeueTask();
+ this._active = false;
+ }
+ return result;
+ };
+
+ global[className].prototype.observe = function () {
+ if (!this._active) {
+ this._creationZone.enqueueTask();
+ this._active = true;
+ }
+ return this._o.observe.apply(this._o, arguments);
+ };
+
+ var prop;
+ for (prop in instance) {
+ (function (prop) {
+ if (typeof global[className].prototype !== undefined) {
+ return;
+ }
+ if (typeof instance[prop] === 'function') {
+ global[className].prototype[prop] = function () {
+ return this._o[prop].apply(this._o, arguments);
+ };
+ } else {
+ Object.defineProperty(global[className].prototype, prop, {
+ set: function (fn) {
+ if (typeof fn === 'function') {
+ this._o[prop] = global.zone.bind(fn);
+ } else {
+ this._o[prop] = fn;
+ }
+ },
+ get: function () {
+ return this._o[prop];
+ }
+ });
+ }
+ }(prop));
+ }
+};
+
+module.exports = {
+ patchClass: patchClass
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],10:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var utils = require('../utils');
+
+/*
+ * Patches a function that returns a Promise-like instance.
+ *
+ * This function must be used when either:
+ * - Native Promises are not available,
+ * - The function returns a Promise-like object.
+ *
+ * This is required because zones rely on a Promise monkey patch that could not be applied when
+ * Promise is not natively available or when the returned object is not an instance of Promise.
+ *
+ * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work
+ * with minimal overhead.
+ *
+ * ```
+ * var boundFunction = bindPromiseFn(FunctionReturningAPromise);
+ *
+ * boundFunction.then(successHandler, errorHandler);
+ * ```
+ */
+var bindPromiseFn;
+
+if (global.Promise) {
+ bindPromiseFn = function (delegate) {
+ return function() {
+ var delegatePromise = delegate.apply(this, arguments);
+
+ // if the delegate returned an instance of Promise, forward it.
+ if (delegatePromise instanceof Promise) {
+ return delegatePromise;
+ }
+
+ // Otherwise wrap the Promise-like in a global Promise
+ return new Promise(function(resolve, reject) {
+ delegatePromise.then(resolve, reject);
+ });
+ };
+ };
+} else {
+ bindPromiseFn = function (delegate) {
+ return function () {
+ return _patchThenable(delegate.apply(this, arguments));
+ };
+ };
+}
+
+
+function _patchPromiseFnsOnObject(objectPath, fnNames) {
+ var obj = global;
+
+ var exists = objectPath.every(function (segment) {
+ obj = obj[segment];
+ return obj;
+ });
+
+ if (!exists) {
+ return;
+ }
+
+ fnNames.forEach(function (name) {
+ var fn = obj[name];
+ if (fn) {
+ obj[name] = bindPromiseFn(fn);
+ }
+ });
+}
+
+function _patchThenable(thenable) {
+ var then = thenable.then;
+ thenable.then = function () {
+ var args = utils.bindArguments(arguments);
+ var nextThenable = then.apply(thenable, args);
+ return _patchThenable(nextThenable);
+ };
+
+ var ocatch = thenable.catch;
+ thenable.catch = function () {
+ var args = utils.bindArguments(arguments);
+ var nextThenable = ocatch.apply(thenable, args);
+ return _patchThenable(nextThenable);
+ };
+
+ return thenable;
+}
+
+
+function apply() {
+ // Patch .then() and .catch() on native Promises to execute callbacks in the zone where
+ // those functions are called.
+ if (global.Promise) {
+ utils.patchPrototype(Promise.prototype, [
+ 'then',
+ 'catch'
+ ]);
+
+ // Patch browser APIs that return a Promise
+ var patchFns = [
+ // fetch
+ [[], ['fetch']],
+ [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']]
+ ];
+
+ patchFns.forEach(function(objPathAndFns) {
+ _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]);
+ });
+ }
+}
+
+module.exports = {
+ apply: apply,
+ bindPromiseFn: bindPromiseFn
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../utils":14}],11:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var webSocketPatch = require('./websocket');
+var utils = require('../utils');
+
+var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' ');
+
+function apply() {
+ if (canPatchViaPropertyDescriptor()) {
+ // for browsers that we can patch the descriptor: Chrome & Firefox
+ var onEventNames = eventNames.map(function (property) {
+ return 'on' + property;
+ });
+ utils.patchProperties(HTMLElement.prototype, onEventNames);
+ utils.patchProperties(XMLHttpRequest.prototype);
+ if (typeof WebSocket !== 'undefined') {
+ utils.patchProperties(WebSocket.prototype);
+ }
+ } else {
+ // Safari
+ patchViaCapturingAllTheEvents();
+ utils.patchClass('XMLHttpRequest');
+ webSocketPatch.apply();
+ }
+}
+
+function canPatchViaPropertyDescriptor() {
+ if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') {
+ // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364
+ // IDL interface attributes are not configurable
+ var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick');
+ if (desc && !desc.configurable) return false;
+ }
+
+ Object.defineProperty(HTMLElement.prototype, 'onclick', {
+ get: function () {
+ return true;
+ }
+ });
+ var elt = document.createElement('div');
+ var result = !!elt.onclick;
+ Object.defineProperty(HTMLElement.prototype, 'onclick', {});
+ return result;
+};
+
+// Whenever any event fires, we check the event target and all parents
+// for `onwhatever` properties and replace them with zone-bound functions
+// - Chrome (for now)
+function patchViaCapturingAllTheEvents() {
+ eventNames.forEach(function (property) {
+ var onproperty = 'on' + property;
+ document.addEventListener(property, function (event) {
+ var elt = event.target, bound;
+ while (elt) {
+ if (elt[onproperty] && !elt[onproperty]._unbound) {
+ bound = global.zone.bind(elt[onproperty]);
+ bound._unbound = elt[onproperty];
+ elt[onproperty] = bound;
+ }
+ elt = elt.parentElement;
+ }
+ }, true);
+ });
+};
+
+module.exports = {
+ apply: apply
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var _redefineProperty = require('./define-property')._redefineProperty;
+
+function apply() {
+ if (!('registerElement' in global.document)) {
+ return;
+ }
+
+ var _registerElement = document.registerElement;
+ var callbacks = [
+ 'createdCallback',
+ 'attachedCallback',
+ 'detachedCallback',
+ 'attributeChangedCallback'
+ ];
+
+ document.registerElement = function (name, opts) {
+ if (opts && opts.prototype) {
+ callbacks.forEach(function (callback) {
+ if (opts.prototype.hasOwnProperty(callback)) {
+ var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);
+ if (descriptor.value) {
+ descriptor.value = global.zone.bind(descriptor.value);
+ _redefineProperty(opts.prototype, callback, descriptor);
+ } else {
+ opts.prototype[callback] = global.zone.bind(opts.prototype[callback]);
+ }
+ } else if (opts.prototype[callback]) {
+ opts.prototype[callback] = global.zone.bind(opts.prototype[callback]);
+ }
+ });
+ }
+
+ return _registerElement.apply(document, [name, opts]);
+ };
+}
+
+module.exports = {
+ apply: apply
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./define-property":5}],13:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var utils = require('../utils');
+
+// we have to patch the instance since the proto is non-configurable
+function apply() {
+ var WS = global.WebSocket;
+ utils.patchEventTargetMethods(WS.prototype);
+ global.WebSocket = function(a, b) {
+ var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);
+ var proxySocket;
+
+ // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
+ var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');
+ if (onmessageDesc && onmessageDesc.configurable === false) {
+ proxySocket = Object.create(socket);
+ ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) {
+ proxySocket[propName] = function() {
+ return socket[propName].apply(socket, arguments);
+ };
+ });
+ } else {
+ // we can patch the real socket
+ proxySocket = socket;
+ }
+
+ utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']);
+
+ return proxySocket;
+ };
+}
+
+module.exports = {
+ apply: apply
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../utils":14}],14:[function(require,module,exports){
+(function (global){
+'use strict';
+
+function bindArguments(args) {
+ for (var i = args.length - 1; i >= 0; i--) {
+ if (typeof args[i] === 'function') {
+ args[i] = global.zone.bind(args[i]);
+ }
+ }
+ return args;
+};
+
+function bindArgumentsOnce(args) {
+ for (var i = args.length - 1; i >= 0; i--) {
+ if (typeof args[i] === 'function') {
+ args[i] = global.zone.bindOnce(args[i]);
+ }
+ }
+ return args;
+};
+
+function patchPrototype(obj, fnNames) {
+ fnNames.forEach(function (name) {
+ var delegate = obj[name];
+ if (delegate) {
+ obj[name] = function () {
+ return delegate.apply(this, bindArguments(arguments));
+ };
+ }
+ });
+};
+
+function patchProperty(obj, prop) {
+ var desc = Object.getOwnPropertyDescriptor(obj, prop) || {
+ enumerable: true,
+ configurable: true
+ };
+
+ // A property descriptor cannot have getter/setter and be writable
+ // deleting the writable and value properties avoids this error:
+ //
+ // TypeError: property descriptors must not specify a value or be writable when a
+ // getter or setter has been specified
+ delete desc.writable;
+ delete desc.value;
+
+ // substr(2) cuz 'onclick' -> 'click', etc
+ var eventName = prop.substr(2);
+ var _prop = '_' + prop;
+
+ desc.set = function (fn) {
+ if (this[_prop]) {
+ this.removeEventListener(eventName, this[_prop]);
+ }
+
+ if (typeof fn === 'function') {
+ this[_prop] = fn;
+ this.addEventListener(eventName, fn, false);
+ } else {
+ this[_prop] = null;
+ }
+ };
+
+ desc.get = function () {
+ return this[_prop];
+ };
+
+ Object.defineProperty(obj, prop, desc);
+};
+
+function patchProperties(obj, properties) {
+
+ (properties || (function () {
+ var props = [];
+ for (var prop in obj) {
+ props.push(prop);
+ }
+ return props;
+ }()).
+ filter(function (propertyName) {
+ return propertyName.substr(0,2) === 'on';
+ })).
+ forEach(function (eventName) {
+ patchProperty(obj, eventName);
+ });
+};
+
+function patchEventTargetMethods(obj) {
+ var addDelegate = obj.addEventListener;
+ obj.addEventListener = function (eventName, fn) {
+ fn._bound = fn._bound || {};
+ arguments[1] = fn._bound[eventName] = zone.bind(fn);
+ return addDelegate.apply(this, arguments);
+ };
+
+ var removeDelegate = obj.removeEventListener;
+ obj.removeEventListener = function (eventName, fn) {
+ if(arguments[1]._bound && arguments[1]._bound[eventName]) {
+ var _bound = arguments[1]._bound;
+ arguments[1] = _bound[eventName];
+ delete _bound[eventName];
+ }
+ var result = removeDelegate.apply(this, arguments);
+ global.zone.dequeueTask(fn);
+ return result;
+ };
+};
+
+// wrap some native API on `window`
+function patchClass(className) {
+ var OriginalClass = global[className];
+ if (!OriginalClass) return;
+
+ global[className] = function () {
+ var a = bindArguments(arguments);
+ switch (a.length) {
+ case 0: this._o = new OriginalClass(); break;
+ case 1: this._o = new OriginalClass(a[0]); break;
+ case 2: this._o = new OriginalClass(a[0], a[1]); break;
+ case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break;
+ case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break;
+ default: throw new Error('what are you even doing?');
+ }
+ };
+
+ var instance = new OriginalClass();
+
+ var prop;
+ for (prop in instance) {
+ (function (prop) {
+ if (typeof instance[prop] === 'function') {
+ global[className].prototype[prop] = function () {
+ return this._o[prop].apply(this._o, arguments);
+ };
+ } else {
+ Object.defineProperty(global[className].prototype, prop, {
+ set: function (fn) {
+ if (typeof fn === 'function') {
+ this._o[prop] = global.zone.bind(fn);
+ } else {
+ this._o[prop] = fn;
+ }
+ },
+ get: function () {
+ return this._o[prop];
+ }
+ });
+ }
+ }(prop));
+ }
+
+ for (prop in OriginalClass) {
+ if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {
+ global[className][prop] = OriginalClass[prop];
+ }
+ }
+};
+
+module.exports = {
+ bindArguments: bindArguments,
+ bindArgumentsOnce: bindArgumentsOnce,
+ patchPrototype: patchPrototype,
+ patchProperty: patchProperty,
+ patchProperties: patchProperties,
+ patchEventTargetMethods: patchEventTargetMethods,
+ patchClass: patchClass
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],15:[function(require,module,exports){
(function (process,global){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
- * @version 2.1.1
+ * @version 2.3.0
*/
(function() {
"use strict";
function lib$es6$promise$utils$$objectOrFunction(x) {
@@ -188,27 +1038,36 @@
var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
var lib$es6$promise$asap$$len = 0;
var lib$es6$promise$asap$$toString = {}.toString;
var lib$es6$promise$asap$$vertxNext;
- function lib$es6$promise$asap$$asap(callback, arg) {
- window.zone.scheduleMicrotask(function() {
- callback(arg);
- });
- //queue[len] = callback;
- //queue[len + 1] = arg;
- //len += 2;
- //if (len === 2) {
- // // If len is 2, that means that we need to schedule an async flush.
- // // If additional callbacks are queued before the queue is flushed, they
- // // will be processed by this flush that we are scheduling.
- // scheduleFlush();
- //}
+ var lib$es6$promise$asap$$customSchedulerFn;
+
+ var lib$es6$promise$asap$$asap = function asap(callback, arg) {
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
+ lib$es6$promise$asap$$len += 2;
+ if (lib$es6$promise$asap$$len === 2) {
+ // If len is 2, that means that we need to schedule an async flush.
+ // If additional callbacks are queued before the queue is flushed, they
+ // will be processed by this flush that we are scheduling.
+ if (lib$es6$promise$asap$$customSchedulerFn) {
+ lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
+ } else {
+ lib$es6$promise$asap$$scheduleFlush();
+ }
+ }
}
- var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap;
+ function lib$es6$promise$asap$$setScheduler(scheduleFn) {
+ lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
+ }
+ function lib$es6$promise$asap$$setAsap(asapFn) {
+ lib$es6$promise$asap$$asap = asapFn;
+ }
+
var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
@@ -336,11 +1195,11 @@
return e;
}
}
function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
- lib$es6$promise$asap$$default(function(promise) {
+ lib$es6$promise$asap$$asap(function(promise) {
var sealed = false;
var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
if (sealed) { return; }
sealed = true;
if (thenable !== value) {
@@ -417,20 +1276,20 @@
promise._result = value;
promise._state = lib$es6$promise$$internal$$FULFILLED;
if (promise._subscribers.length !== 0) {
- lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise);
+ lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
}
}
function lib$es6$promise$$internal$$reject(promise, reason) {
if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
promise._state = lib$es6$promise$$internal$$REJECTED;
promise._result = reason;
- lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise);
+ lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
}
function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
@@ -440,11 +1299,11 @@
subscribers[length] = child;
subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
if (length === 0 && parent._state) {
- lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent);
+ lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
}
}
function lib$es6$promise$$internal$$publish(promise) {
var subscribers = promise._subscribers;
@@ -697,11 +1556,11 @@
var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
- registers callbacks to receive either a promise’s eventual value or the reason
+ registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
@@ -820,10 +1679,13 @@
lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
+ lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
+ lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
+ lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
lib$es6$promise$promise$$Promise.prototype = {
constructor: lib$es6$promise$promise$$Promise,
/**
@@ -1030,11 +1892,11 @@
var child = new this.constructor(lib$es6$promise$$internal$$noop);
var result = parent._result;
if (state) {
var callback = arguments[state - 1];
- lib$es6$promise$asap$$default(function(){
+ lib$es6$promise$asap$$asap(function(){
lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
});
} else {
lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
}
@@ -1115,829 +1977,976 @@
lib$es6$promise$polyfill$$default();
}).call(this);
}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],4:[function(require,module,exports){
-(function (global){
-'use strict';
-
-function scheduleMicrotask(fn) {
- asap(this.bind(fn));
-}
-
-function addMicrotaskSupport(zoneClass) {
- zoneClass.prototype.scheduleMicrotask = scheduleMicrotask;
- return zoneClass;
-}
-
-module.exports = {
- addMicrotaskSupport: addMicrotaskSupport
-};
-
-// TODO(vicb): There are plan to be able to use asap() from es6-promise
-// see https://github.com/jakearchibald/es6-promise/pull/113
-// for now adapt code from asap.js in es6-promise
-// Note: the node support has been dropped here
-
-// TODO(vicb): Create a benchmark for the different methods & the usage of the queue
-// see https://github.com/angular/zone.js/issues/97
-
-var len = 0;
-
-var hasNativePromise = typeof Promise ==! "undefined" &&
- Promise.toString().indexOf("[native code]") !== -1;
-
-var isFirefox = global.navigator &&
- global.navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
-
-function asap(callback) {
- queue[len] = callback;
- len += 1;
- if (len === 1) {
- scheduleFlush();
- }
-}
-
-var browserWindow = (typeof global.window !== 'undefined') ? global.window : undefined;
-var browserGlobal = browserWindow || {};
-var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
-
-// test for web worker but not in IE10
-var isWorker = typeof Uint8ClampedArray !== 'undefined' &&
- typeof importScripts !== 'undefined' &&
- typeof MessageChannel !== 'undefined';
-
-function useMutationObserver() {
- var iterations = 0;
- var observer = new BrowserMutationObserver(flush);
- var node = document.createTextNode('');
- observer.observe(node, { characterData: true });
-
- return function() {
- node.data = (iterations = ++iterations % 2);
- };
-}
-
-// web worker
-function useMessageChannel() {
- var channel = new MessageChannel();
- channel.port1.onmessage = flush;
- return function () {
- channel.port2.postMessage(0);
- };
-}
-
-function useSetTimeout() {
- return function() {
- setTimeout(flush, 1);
- };
-}
-
-function usePromise() {
- var resolvedPromise = Promise.resolve(void 0);
- return function() {
- resolvedPromise.then(flush);
- }
-}
-
-var queue = new Array(1000);
-
-function flush() {
- for (var i = 0; i < len; i++) {
- var callback = queue[i];
- callback();
- queue[i] = undefined;
- }
-
- len = 0;
-}
-
-var scheduleFlush;
-// Decide what async method to use to triggering processing of queued callbacks:
-if (hasNativePromise && !isFirefox) {
- // TODO(vicb): remove '!isFirefox' when the bug is fixed:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1162013
- scheduleFlush = usePromise();
-} else if (BrowserMutationObserver) {
- scheduleFlush = useMutationObserver();
-} else if (isWorker) {
- scheduleFlush = useMessageChannel();
-} else {
- scheduleFlush = useSetTimeout();
-}
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],5:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var fnPatch = require('./functions');
-var promisePatch = require('./promise');
-var mutationObserverPatch = require('./mutation-observer');
-var definePropertyPatch = require('./define-property');
-var registerElementPatch = require('./register-element');
-var webSocketPatch = require('./websocket');
-var eventTargetPatch = require('./event-target');
-var propertyDescriptorPatch = require('./property-descriptor');
-
-function apply() {
- fnPatch.patchSetClearFunction(global, [
- 'timeout',
- 'interval',
- 'immediate'
- ]);
-
- fnPatch.patchSetFunction(global, [
- 'requestAnimationFrame',
- 'mozRequestAnimationFrame',
- 'webkitRequestAnimationFrame'
- ]);
-
- fnPatch.patchFunction(global, [
- 'alert',
- 'prompt'
- ]);
-
- eventTargetPatch.apply();
-
- propertyDescriptorPatch.apply();
-
- promisePatch.apply();
-
- mutationObserverPatch.patchClass('MutationObserver');
- mutationObserverPatch.patchClass('WebKitMutationObserver');
-
- definePropertyPatch.apply();
-
- registerElementPatch.apply();
-}
-
-module.exports = {
- apply: apply
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./define-property":6,"./event-target":7,"./functions":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],6:[function(require,module,exports){
-'use strict';
-
-// might need similar for object.freeze
-// i regret nothing
-
-var _defineProperty = Object.defineProperty;
-var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
-var _create = Object.create;
-
-function apply() {
- Object.defineProperty = function (obj, prop, desc) {
- if (isUnconfigurable(obj, prop)) {
- throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj);
- }
- if (prop !== 'prototype') {
- desc = rewriteDescriptor(obj, prop, desc);
- }
- return _defineProperty(obj, prop, desc);
- };
-
- Object.defineProperties = function (obj, props) {
- Object.keys(props).forEach(function (prop) {
- Object.defineProperty(obj, prop, props[prop]);
- });
- return obj;
- };
-
- Object.create = function (obj, proto) {
- if (typeof proto === 'object') {
- Object.keys(proto).forEach(function (prop) {
- proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);
- });
- }
- return _create(obj, proto);
- };
-
- Object.getOwnPropertyDescriptor = function (obj, prop) {
- var desc = _getOwnPropertyDescriptor(obj, prop);
- if (isUnconfigurable(obj, prop)) {
- desc.configurable = false;
- }
- return desc;
- };
-};
-
-function _redefineProperty(obj, prop, desc) {
- desc = rewriteDescriptor(obj, prop, desc);
- return _defineProperty(obj, prop, desc);
-};
-
-function isUnconfigurable (obj, prop) {
- return obj && obj.__unconfigurables && obj.__unconfigurables[prop];
-}
-
-function rewriteDescriptor (obj, prop, desc) {
- desc.configurable = true;
- if (!desc.configurable) {
- if (!obj.__unconfigurables) {
- _defineProperty(obj, '__unconfigurables', { writable: true, value: {} });
- }
- obj.__unconfigurables[prop] = true;
- }
- return desc;
-}
-
-module.exports = {
- apply: apply,
- _redefineProperty: _redefineProperty
-};
-
-
-
-},{}],7:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var utils = require('../utils');
-
-function apply() {
- // patched properties depend on addEventListener, so this needs to come first
- if (global.EventTarget) {
- utils.patchEventTargetMethods(global.EventTarget.prototype);
-
- // Note: EventTarget is not available in all browsers,
- // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
- } else {
- var apis = [ 'ApplicationCache',
- 'EventSource',
- 'FileReader',
- 'InputMethodContext',
- 'MediaController',
- 'MessagePort',
- 'Node',
- 'Performance',
- 'SVGElementInstance',
- 'SharedWorker',
- 'TextTrack',
- 'TextTrackCue',
- 'TextTrackList',
- 'WebKitNamedFlow',
- 'Window',
- 'Worker',
- 'WorkerGlobalScope',
- 'XMLHttpRequestEventTarget',
- 'XMLHttpRequestUpload'
- ];
-
- apis.forEach(function(thing) {
- global[thing] && utils.patchEventTargetMethods(global[thing].prototype);
- });
- }
-}
-
-module.exports = {
- apply: apply
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../utils":14}],8:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var utils = require('../utils');
-
-function patchSetClearFunction(obj, fnNames) {
- fnNames.map(function (name) {
- return name[0].toUpperCase() + name.substr(1);
- }).forEach(function (name) {
- var setName = 'set' + name;
- var delegate = obj[setName];
-
- if (delegate) {
- var clearName = 'clear' + name;
- var ids = {};
-
- var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce;
-
- global.zone[setName] = function (fn) {
- var id, fnRef = fn;
- arguments[0] = function () {
- delete ids[id];
- return fnRef.apply(this, arguments);
- };
- var args = bindArgs(arguments);
- id = delegate.apply(obj, args);
- ids[id] = true;
- return id;
- };
-
- obj[setName] = function () {
- return global.zone[setName].apply(this, arguments);
- };
-
- var clearDelegate = obj[clearName];
-
- global.zone[clearName] = function (id) {
- if (ids[id]) {
- delete ids[id];
- global.zone.dequeueTask();
- }
- return clearDelegate.apply(this, arguments);
- };
-
- obj[clearName] = function () {
- return global.zone[clearName].apply(this, arguments);
- };
- }
- });
-};
-
-function patchSetFunction(obj, fnNames) {
- fnNames.forEach(function (name) {
- var delegate = obj[name];
-
- if (delegate) {
- global.zone[name] = function (fn) {
- var fnRef = fn;
- arguments[0] = function () {
- return fnRef.apply(this, arguments);
- };
- var args = utils.bindArgumentsOnce(arguments);
- return delegate.apply(obj, args);
- };
-
- obj[name] = function () {
- return zone[name].apply(this, arguments);
- };
- }
- });
-};
-
-function patchFunction(obj, fnNames) {
- fnNames.forEach(function (name) {
- var delegate = obj[name];
- global.zone[name] = function () {
- return delegate.apply(obj, arguments);
- };
-
- obj[name] = function () {
- return global.zone[name].apply(this, arguments);
- };
- });
-};
-
-
-module.exports = {
- patchSetClearFunction: patchSetClearFunction,
- patchSetFunction: patchSetFunction,
- patchFunction: patchFunction
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../utils":14}],9:[function(require,module,exports){
-(function (global){
-'use strict';
-
-// wrap some native API on `window`
-function patchClass(className) {
- var OriginalClass = global[className];
- if (!OriginalClass) return;
-
- global[className] = function (fn) {
- this._o = new OriginalClass(global.zone.bind(fn, true));
- // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks
- this._creationZone = global.zone;
- };
-
- var instance = new OriginalClass(function () {});
-
- global[className].prototype.disconnect = function () {
- var result = this._o.disconnect.apply(this._o, arguments);
- if (this._active) {
- this._creationZone.dequeueTask();
- this._active = false;
- }
- return result;
- };
-
- global[className].prototype.observe = function () {
- if (!this._active) {
- this._creationZone.enqueueTask();
- this._active = true;
- }
- return this._o.observe.apply(this._o, arguments);
- };
-
- var prop;
- for (prop in instance) {
- (function (prop) {
- if (typeof global[className].prototype !== undefined) {
- return;
- }
- if (typeof instance[prop] === 'function') {
- global[className].prototype[prop] = function () {
- return this._o[prop].apply(this._o, arguments);
- };
- } else {
- Object.defineProperty(global[className].prototype, prop, {
- set: function (fn) {
- if (typeof fn === 'function') {
- this._o[prop] = global.zone.bind(fn);
- } else {
- this._o[prop] = fn;
- }
- },
- get: function () {
- return this._o[prop];
- }
- });
- }
- }(prop));
- }
-};
-
-module.exports = {
- patchClass: patchClass
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],10:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var utils = require('../utils');
-
-/*
- * patch a fn that returns a promise
- */
-var bindPromiseFn = (function() {
- // if the browser natively supports Promises, we can just return a native promise
- if (global.Promise) {
- return function (delegate) {
- return function() {
- var delegatePromise = delegate.apply(this, arguments);
- if (delegatePromise instanceof Promise) {
- return delegatePromise;
- } else {
- return new Promise(function(resolve, reject) {
- delegatePromise.then(resolve, reject);
- });
- }
- };
- };
- } else {
- // if the browser does not have native promises, we have to patch each promise instance
- return function (delegate) {
- return function () {
- return patchThenable(delegate.apply(this, arguments));
- };
- };
- }
-
- function patchThenable(thenable) {
- var then = thenable.then;
- thenable.then = function () {
- var args = utils.bindArguments(arguments);
- var nextThenable = then.apply(thenable, args);
- return patchThenable(nextThenable);
- };
-
- var ocatch = thenable.catch;
- thenable.catch = function () {
- var args = utils.bindArguments(arguments);
- var nextThenable = ocatch.apply(thenable, args);
- return patchThenable(nextThenable);
- };
- return thenable;
- }
-}());
-
-function apply() {
- if (global.Promise) {
- utils.patchPrototype(Promise.prototype, [
- 'then',
- 'catch'
- ]);
- }
-}
-
-module.exports = {
- apply: apply,
- bindPromiseFn: bindPromiseFn
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../utils":14}],11:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var webSocketPatch = require('./websocket');
-var utils = require('../utils');
-
-var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' ');
-
-function apply() {
- if (canPatchViaPropertyDescriptor()) {
- // for browsers that we can patch the descriptor: Chrome & Firefox
- var onEventNames = eventNames.map(function (property) {
- return 'on' + property;
- });
- utils.patchProperties(HTMLElement.prototype, onEventNames);
- utils.patchProperties(XMLHttpRequest.prototype);
- utils.patchProperties(WebSocket.prototype);
- } else {
- // Safari
- patchViaCapturingAllTheEvents();
- utils.patchClass('XMLHttpRequest');
- webSocketPatch.apply();
- }
-}
-
-function canPatchViaPropertyDescriptor() {
- if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') {
- // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364
- // IDL interface attributes are not configurable
- var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick');
- if (desc && !desc.configurable) return false;
- }
-
- Object.defineProperty(HTMLElement.prototype, 'onclick', {
- get: function () {
- return true;
- }
- });
- var elt = document.createElement('div');
- var result = !!elt.onclick;
- Object.defineProperty(HTMLElement.prototype, 'onclick', {});
- return result;
-};
-
-// Whenever any event fires, we check the event target and all parents
-// for `onwhatever` properties and replace them with zone-bound functions
-// - Chrome (for now)
-function patchViaCapturingAllTheEvents() {
- eventNames.forEach(function (property) {
- var onproperty = 'on' + property;
- document.addEventListener(property, function (event) {
- var elt = event.target, bound;
- while (elt) {
- if (elt[onproperty] && !elt[onproperty]._unbound) {
- bound = global.zone.bind(elt[onproperty]);
- bound._unbound = elt[onproperty];
- elt[onproperty] = bound;
- }
- elt = elt.parentElement;
- }
- }, true);
- });
-};
-
-module.exports = {
- apply: apply
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var _redefineProperty = require('./define-property')._redefineProperty;
-
-function apply() {
- if (!('registerElement' in global.document)) {
- return;
- }
-
- var _registerElement = document.registerElement;
- var callbacks = [
- 'createdCallback',
- 'attachedCallback',
- 'detachedCallback',
- 'attributeChangedCallback'
- ];
-
- document.registerElement = function (name, opts) {
- callbacks.forEach(function (callback) {
- if (opts.prototype[callback]) {
- var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);
- if (descriptor.value) {
- descriptor.value = global.zone.bind(descriptor.value || opts.prototype[callback]);
- _redefineProperty(opts.prototype, callback, descriptor);
- }
- }
- });
- return _registerElement.apply(document, [name, opts]);
- };
-}
-
-module.exports = {
- apply: apply
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./define-property":6}],13:[function(require,module,exports){
-(function (global){
-'use strict';
-
-var utils = require('../utils.js');
-
-// we have to patch the instance since the proto is non-configurable
-function apply() {
- var WS = global.WebSocket;
- utils.patchEventTargetMethods(WS.prototype);
- global.WebSocket = function(a, b) {
- var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);
- var proxySocket;
-
- // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
- var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');
- if (onmessageDesc && onmessageDesc.configurable === false) {
- proxySocket = Object.create(socket);
- ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) {
- proxySocket[propName] = function() {
- return socket[propName].apply(socket, arguments);
- };
- });
- } else {
- // we can patch the real socket
- proxySocket = socket;
- }
-
- utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']);
-
- return proxySocket;
- };
-}
-
-module.exports = {
- apply: apply
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"../utils.js":14}],14:[function(require,module,exports){
-(function (global){
-'use strict';
-
-function bindArguments(args) {
- for (var i = args.length - 1; i >= 0; i--) {
- if (typeof args[i] === 'function') {
- args[i] = global.zone.bind(args[i]);
- }
- }
- return args;
-};
-
-function bindArgumentsOnce(args) {
- for (var i = args.length - 1; i >= 0; i--) {
- if (typeof args[i] === 'function') {
- args[i] = global.zone.bindOnce(args[i]);
- }
- }
- return args;
-};
-
-function patchPrototype(obj, fnNames) {
- fnNames.forEach(function (name) {
- var delegate = obj[name];
- if (delegate) {
- obj[name] = function () {
- return delegate.apply(this, bindArguments(arguments));
- };
- }
- });
-};
-
-function patchProperty(obj, prop) {
- var desc = Object.getOwnPropertyDescriptor(obj, prop) || {
- enumerable: true,
- configurable: true
- };
-
- // A property descriptor cannot have getter/setter and be writable
- // deleting the writable and value properties avoids this error:
- //
- // TypeError: property descriptors must not specify a value or be writable when a
- // getter or setter has been specified
- delete desc.writable;
- delete desc.value;
-
- // substr(2) cuz 'onclick' -> 'click', etc
- var eventName = prop.substr(2);
- var _prop = '_' + prop;
-
- desc.set = function (fn) {
- if (this[_prop]) {
- this.removeEventListener(eventName, this[_prop]);
- }
-
- if (typeof fn === 'function') {
- this[_prop] = fn;
- this.addEventListener(eventName, fn, false);
- } else {
- this[_prop] = null;
- }
- };
-
- desc.get = function () {
- return this[_prop];
- };
-
- Object.defineProperty(obj, prop, desc);
-};
-
-function patchProperties(obj, properties) {
-
- (properties || (function () {
- var props = [];
- for (var prop in obj) {
- props.push(prop);
- }
- return props;
- }()).
- filter(function (propertyName) {
- return propertyName.substr(0,2) === 'on';
- })).
- forEach(function (eventName) {
- patchProperty(obj, eventName);
- });
-};
-
-function patchEventTargetMethods(obj) {
- var addDelegate = obj.addEventListener;
- obj.addEventListener = function (eventName, fn) {
- fn._bound = fn._bound || {};
- arguments[1] = fn._bound[eventName] = zone.bind(fn);
- return addDelegate.apply(this, arguments);
- };
-
- var removeDelegate = obj.removeEventListener;
- obj.removeEventListener = function (eventName, fn) {
- if(arguments[1]._bound && arguments[1]._bound[eventName]) {
- var _bound = arguments[1]._bound;
- arguments[1] = _bound[eventName];
- delete _bound[eventName];
- }
- var result = removeDelegate.apply(this, arguments);
- global.zone.dequeueTask(fn);
- return result;
- };
-};
-
-// wrap some native API on `window`
-function patchClass(className) {
- var OriginalClass = global[className];
- if (!OriginalClass) return;
-
- global[className] = function () {
- var a = bindArguments(arguments);
- switch (a.length) {
- case 0: this._o = new OriginalClass(); break;
- case 1: this._o = new OriginalClass(a[0]); break;
- case 2: this._o = new OriginalClass(a[0], a[1]); break;
- case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break;
- case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break;
- default: throw new Error('what are you even doing?');
- }
- };
-
- var instance = new OriginalClass(className.substr(-16) === 'MutationObserver' ? function () {} : undefined);
-
- var prop;
- for (prop in instance) {
- (function (prop) {
- if (typeof instance[prop] === 'function') {
- global[className].prototype[prop] = function () {
- return this._o[prop].apply(this._o, arguments);
- };
- } else {
- Object.defineProperty(global[className].prototype, prop, {
- set: function (fn) {
- if (typeof fn === 'function') {
- this._o[prop] = global.zone.bind(fn);
- } else {
- this._o[prop] = fn;
- }
- },
- get: function () {
- return this._o[prop];
- }
- });
- }
- }(prop));
- };
-};
-
-module.exports = {
- bindArguments: bindArguments,
- bindArgumentsOnce: bindArgumentsOnce,
- patchPrototype: patchPrototype,
- patchProperty: patchProperty,
- patchProperties: patchProperties,
- patchEventTargetMethods: patchEventTargetMethods,
- patchClass: patchClass
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1]);
+/*! *****************************************************************************
+Copyright (C) Microsoft. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+***************************************************************************** */
+"use strict";
+var Reflect;
+(function (Reflect) {
+ // Load global or shim versions of Map, Set, and WeakMap
+ var functionPrototype = Object.getPrototypeOf(Function);
+ var _Map = typeof Map === "function" ? Map : CreateMapPolyfill();
+ var _Set = typeof Set === "function" ? Set : CreateSetPolyfill();
+ var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
+ // [[Metadata]] internal slot
+ var __Metadata__ = new _WeakMap();
+ /**
+ * Applies a set of decorators to a property of a target object.
+ * @param decorators An array of decorators.
+ * @param target The target object.
+ * @param targetKey (Optional) The property key to decorate.
+ * @param targetDescriptor (Optional) The property descriptor for the target key
+ * @remarks Decorators are applied in reverse order.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * C = Reflect.decorate(decoratorsArray, C);
+ *
+ * // property (on constructor)
+ * Reflect.decorate(decoratorsArray, C, "staticProperty");
+ *
+ * // property (on prototype)
+ * Reflect.decorate(decoratorsArray, C.prototype, "property");
+ *
+ * // method (on constructor)
+ * Object.defineProperty(C, "staticMethod",
+ * Reflect.decorate(decoratorsArray, C, "staticMethod",
+ * Object.getOwnPropertyDescriptor(C, "staticMethod")));
+ *
+ * // method (on prototype)
+ * Object.defineProperty(C.prototype, "method",
+ * Reflect.decorate(decoratorsArray, C.prototype, "method",
+ * Object.getOwnPropertyDescriptor(C.prototype, "method")));
+ *
+ */
+ function decorate(decorators, target, targetKey, targetDescriptor) {
+ if (!IsUndefined(targetDescriptor)) {
+ if (!IsArray(decorators)) {
+ throw new TypeError();
+ }
+ else if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (IsUndefined(targetKey)) {
+ throw new TypeError();
+ }
+ else if (!IsObject(targetDescriptor)) {
+ throw new TypeError();
+ }
+ targetKey = ToPropertyKey(targetKey);
+ return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor);
+ }
+ else if (!IsUndefined(targetKey)) {
+ if (!IsArray(decorators)) {
+ throw new TypeError();
+ }
+ else if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ targetKey = ToPropertyKey(targetKey);
+ return DecoratePropertyWithoutDescriptor(decorators, target, targetKey);
+ }
+ else {
+ if (!IsArray(decorators)) {
+ throw new TypeError();
+ }
+ else if (!IsConstructor(target)) {
+ throw new TypeError();
+ }
+ return DecorateConstructor(decorators, target);
+ }
+ }
+ Reflect.decorate = decorate;
+ /**
+ * A default metadata decorator factory that can be used on a class, class member, or parameter.
+ * @param metadataKey The key for the metadata entry.
+ * @param metadataValue The value for the metadata entry.
+ * @returns A decorator function.
+ * @remarks
+ * If `metadataKey` is already defined for the target and target key, the
+ * metadataValue for that key will be overwritten.
+ * @example
+ *
+ * // constructor
+ * @Reflect.metadata(key, value)
+ * class C {
+ * }
+ *
+ * // property (on constructor, TypeScript only)
+ * class C {
+ * @Reflect.metadata(key, value)
+ * static staticProperty;
+ * }
+ *
+ * // property (on prototype, TypeScript only)
+ * class C {
+ * @Reflect.metadata(key, value)
+ * property;
+ * }
+ *
+ * // method (on constructor)
+ * class C {
+ * @Reflect.metadata(key, value)
+ * static staticMethod() { }
+ * }
+ *
+ * // method (on prototype)
+ * class C {
+ * @Reflect.metadata(key, value)
+ * method() { }
+ * }
+ *
+ */
+ function metadata(metadataKey, metadataValue) {
+ function decorator(target, targetKey) {
+ if (!IsUndefined(targetKey)) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ targetKey = ToPropertyKey(targetKey);
+ OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
+ }
+ else {
+ if (!IsConstructor(target)) {
+ throw new TypeError();
+ }
+ OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined);
+ }
+ }
+ return decorator;
+ }
+ Reflect.metadata = metadata;
+ /**
+ * Define a unique metadata entry on the target.
+ * @param metadataKey A key used to store and retrieve metadata.
+ * @param metadataValue A value that contains attached metadata.
+ * @param target The target object on which to define metadata.
+ * @param targetKey (Optional) The property key for the target.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * Reflect.defineMetadata("custom:annotation", options, C);
+ *
+ * // property (on constructor)
+ * Reflect.defineMetadata("custom:annotation", options, C, "staticProperty");
+ *
+ * // property (on prototype)
+ * Reflect.defineMetadata("custom:annotation", options, C.prototype, "property");
+ *
+ * // method (on constructor)
+ * Reflect.defineMetadata("custom:annotation", options, C, "staticMethod");
+ *
+ * // method (on prototype)
+ * Reflect.defineMetadata("custom:annotation", options, C.prototype, "method");
+ *
+ * // decorator factory as metadata-producing annotation.
+ * function MyAnnotation(options): Decorator {
+ * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key);
+ * }
+ *
+ */
+ function defineMetadata(metadataKey, metadataValue, target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
+ }
+ Reflect.defineMetadata = defineMetadata;
+ /**
+ * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
+ * @param metadataKey A key used to store and retrieve metadata.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.hasMetadata("custom:annotation", C);
+ *
+ * // property (on constructor)
+ * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method");
+ *
+ */
+ function hasMetadata(metadataKey, target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryHasMetadata(metadataKey, target, targetKey);
+ }
+ Reflect.hasMetadata = hasMetadata;
+ /**
+ * Gets a value indicating whether the target object has the provided metadata key defined.
+ * @param metadataKey A key used to store and retrieve metadata.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.hasOwnMetadata("custom:annotation", C);
+ *
+ * // property (on constructor)
+ * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method");
+ *
+ */
+ function hasOwnMetadata(metadataKey, target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryHasOwnMetadata(metadataKey, target, targetKey);
+ }
+ Reflect.hasOwnMetadata = hasOwnMetadata;
+ /**
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
+ * @param metadataKey A key used to store and retrieve metadata.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.getMetadata("custom:annotation", C);
+ *
+ * // property (on constructor)
+ * result = Reflect.getMetadata("custom:annotation", C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.getMetadata("custom:annotation", C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.getMetadata("custom:annotation", C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.getMetadata("custom:annotation", C.prototype, "method");
+ *
+ */
+ function getMetadata(metadataKey, target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryGetMetadata(metadataKey, target, targetKey);
+ }
+ Reflect.getMetadata = getMetadata;
+ /**
+ * Gets the metadata value for the provided metadata key on the target object.
+ * @param metadataKey A key used to store and retrieve metadata.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.getOwnMetadata("custom:annotation", C);
+ *
+ * // property (on constructor)
+ * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method");
+ *
+ */
+ function getOwnMetadata(metadataKey, target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryGetOwnMetadata(metadataKey, target, targetKey);
+ }
+ Reflect.getOwnMetadata = getOwnMetadata;
+ /**
+ * Gets the metadata keys defined on the target object or its prototype chain.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns An array of unique metadata keys.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.getMetadataKeys(C);
+ *
+ * // property (on constructor)
+ * result = Reflect.getMetadataKeys(C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.getMetadataKeys(C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.getMetadataKeys(C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.getMetadataKeys(C.prototype, "method");
+ *
+ */
+ function getMetadataKeys(target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryMetadataKeys(target, targetKey);
+ }
+ Reflect.getMetadataKeys = getMetadataKeys;
+ /**
+ * Gets the unique metadata keys defined on the target object.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns An array of unique metadata keys.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.getOwnMetadataKeys(C);
+ *
+ * // property (on constructor)
+ * result = Reflect.getOwnMetadataKeys(C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.getOwnMetadataKeys(C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.getOwnMetadataKeys(C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.getOwnMetadataKeys(C.prototype, "method");
+ *
+ */
+ function getOwnMetadataKeys(target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ return OrdinaryOwnMetadataKeys(target, targetKey);
+ }
+ Reflect.getOwnMetadataKeys = getOwnMetadataKeys;
+ /**
+ * Deletes the metadata entry from the target object with the provided key.
+ * @param metadataKey A key used to store and retrieve metadata.
+ * @param target The target object on which the metadata is defined.
+ * @param targetKey (Optional) The property key for the target.
+ * @returns `true` if the metadata entry was found and deleted; otherwise, false.
+ * @example
+ *
+ * class C {
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
+ * // static staticProperty;
+ * // property;
+ *
+ * constructor(p) { }
+ * static staticMethod(p) { }
+ * method(p) { }
+ * }
+ *
+ * // constructor
+ * result = Reflect.deleteMetadata("custom:annotation", C);
+ *
+ * // property (on constructor)
+ * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty");
+ *
+ * // property (on prototype)
+ * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property");
+ *
+ * // method (on constructor)
+ * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod");
+ *
+ * // method (on prototype)
+ * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method");
+ *
+ */
+ function deleteMetadata(metadataKey, target, targetKey) {
+ if (!IsObject(target)) {
+ throw new TypeError();
+ }
+ else if (!IsUndefined(targetKey)) {
+ targetKey = ToPropertyKey(targetKey);
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p-
+ var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
+ if (IsUndefined(metadataMap)) {
+ return false;
+ }
+ if (!metadataMap.delete(metadataKey)) {
+ return false;
+ }
+ if (metadataMap.size > 0) {
+ return true;
+ }
+ var targetMetadata = __Metadata__.get(target);
+ targetMetadata.delete(targetKey);
+ if (targetMetadata.size > 0) {
+ return true;
+ }
+ __Metadata__.delete(target);
+ return true;
+ }
+ Reflect.deleteMetadata = deleteMetadata;
+ function DecorateConstructor(decorators, target) {
+ for (var i = decorators.length - 1; i >= 0; --i) {
+ var decorator = decorators[i];
+ var decorated = decorator(target);
+ if (!IsUndefined(decorated)) {
+ if (!IsConstructor(decorated)) {
+ throw new TypeError();
+ }
+ target = decorated;
+ }
+ }
+ return target;
+ }
+ function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) {
+ for (var i = decorators.length - 1; i >= 0; --i) {
+ var decorator = decorators[i];
+ var decorated = decorator(target, propertyKey, descriptor);
+ if (!IsUndefined(decorated)) {
+ if (!IsObject(decorated)) {
+ throw new TypeError();
+ }
+ descriptor = decorated;
+ }
+ }
+ return descriptor;
+ }
+ function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) {
+ for (var i = decorators.length - 1; i >= 0; --i) {
+ var decorator = decorators[i];
+ decorator(target, propertyKey);
+ }
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create-
+ function GetOrCreateMetadataMap(target, targetKey, create) {
+ var targetMetadata = __Metadata__.get(target);
+ if (!targetMetadata) {
+ if (!create) {
+ return undefined;
+ }
+ targetMetadata = new _Map();
+ __Metadata__.set(target, targetMetadata);
+ }
+ var keyMetadata = targetMetadata.get(targetKey);
+ if (!keyMetadata) {
+ if (!create) {
+ return undefined;
+ }
+ keyMetadata = new _Map();
+ targetMetadata.set(targetKey, keyMetadata);
+ }
+ return keyMetadata;
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p-
+ function OrdinaryHasMetadata(MetadataKey, O, P) {
+ var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
+ if (hasOwn) {
+ return true;
+ }
+ var parent = GetPrototypeOf(O);
+ if (parent !== null) {
+ return OrdinaryHasMetadata(MetadataKey, parent, P);
+ }
+ return false;
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p-
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
+ var metadataMap = GetOrCreateMetadataMap(O, P, false);
+ if (metadataMap === undefined) {
+ return false;
+ }
+ return Boolean(metadataMap.has(MetadataKey));
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p-
+ function OrdinaryGetMetadata(MetadataKey, O, P) {
+ var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
+ if (hasOwn) {
+ return OrdinaryGetOwnMetadata(MetadataKey, O, P);
+ }
+ var parent = GetPrototypeOf(O);
+ if (parent !== null) {
+ return OrdinaryGetMetadata(MetadataKey, parent, P);
+ }
+ return undefined;
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p-
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
+ var metadataMap = GetOrCreateMetadataMap(O, P, false);
+ if (metadataMap === undefined) {
+ return undefined;
+ }
+ return metadataMap.get(MetadataKey);
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p-
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
+ var metadataMap = GetOrCreateMetadataMap(O, P, true);
+ metadataMap.set(MetadataKey, MetadataValue);
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p-
+ function OrdinaryMetadataKeys(O, P) {
+ var ownKeys = OrdinaryOwnMetadataKeys(O, P);
+ var parent = GetPrototypeOf(O);
+ if (parent === null) {
+ return ownKeys;
+ }
+ var parentKeys = OrdinaryMetadataKeys(parent, P);
+ if (parentKeys.length <= 0) {
+ return ownKeys;
+ }
+ if (ownKeys.length <= 0) {
+ return parentKeys;
+ }
+ var set = new _Set();
+ var keys = [];
+ for (var _i = 0; _i < ownKeys.length; _i++) {
+ var key = ownKeys[_i];
+ var hasKey = set.has(key);
+ if (!hasKey) {
+ set.add(key);
+ keys.push(key);
+ }
+ }
+ for (var _a = 0; _a < parentKeys.length; _a++) {
+ var key = parentKeys[_a];
+ var hasKey = set.has(key);
+ if (!hasKey) {
+ set.add(key);
+ keys.push(key);
+ }
+ }
+ return keys;
+ }
+ // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p-
+ function OrdinaryOwnMetadataKeys(target, targetKey) {
+ var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
+ var keys = [];
+ if (metadataMap) {
+ metadataMap.forEach(function (_, key) { return keys.push(key); });
+ }
+ return keys;
+ }
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type
+ function IsUndefined(x) {
+ return x === undefined;
+ }
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray
+ function IsArray(x) {
+ return Array.isArray(x);
+ }
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type
+ function IsObject(x) {
+ return typeof x === "object" ? x !== null : typeof x === "function";
+ }
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
+ function IsConstructor(x) {
+ return typeof x === "function";
+ }
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type
+ function IsSymbol(x) {
+ return typeof x === "symbol";
+ }
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey
+ function ToPropertyKey(value) {
+ if (IsSymbol(value)) {
+ return value;
+ }
+ return String(value);
+ }
+ function GetPrototypeOf(O) {
+ var proto = Object.getPrototypeOf(O);
+ if (typeof O !== "function" || O === functionPrototype) {
+ return proto;
+ }
+ // TypeScript doesn't set __proto__ in ES5, as it's non-standard.
+ // Try to determine the superclass constructor. Compatible implementations
+ // must either set __proto__ on a subclass constructor to the superclass constructor,
+ // or ensure each class has a valid `constructor` property on its prototype that
+ // points back to the constructor.
+ // If this is not the same as Function.[[Prototype]], then this is definately inherited.
+ // This is the case when in ES6 or when using __proto__ in a compatible browser.
+ if (proto !== functionPrototype) {
+ return proto;
+ }
+ // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.
+ var prototype = O.prototype;
+ var prototypeProto = Object.getPrototypeOf(prototype);
+ if (prototypeProto == null || prototypeProto === Object.prototype) {
+ return proto;
+ }
+ // if the constructor was not a function, then we cannot determine the heritage.
+ var constructor = prototypeProto.constructor;
+ if (typeof constructor !== "function") {
+ return proto;
+ }
+ // if we have some kind of self-reference, then we cannot determine the heritage.
+ if (constructor === O) {
+ return proto;
+ }
+ // we have a pretty good guess at the heritage.
+ return constructor;
+ }
+ // naive Map shim
+ function CreateMapPolyfill() {
+ var cacheSentinel = {};
+ function Map() {
+ this._keys = [];
+ this._values = [];
+ this._cache = cacheSentinel;
+ }
+ Map.prototype = {
+ get size() {
+ return this._keys.length;
+ },
+ has: function (key) {
+ if (key === this._cache) {
+ return true;
+ }
+ if (this._find(key) >= 0) {
+ this._cache = key;
+ return true;
+ }
+ return false;
+ },
+ get: function (key) {
+ var index = this._find(key);
+ if (index >= 0) {
+ this._cache = key;
+ return this._values[index];
+ }
+ return undefined;
+ },
+ set: function (key, value) {
+ this.delete(key);
+ this._keys.push(key);
+ this._values.push(value);
+ this._cache = key;
+ return this;
+ },
+ delete: function (key) {
+ var index = this._find(key);
+ if (index >= 0) {
+ this._keys.splice(index, 1);
+ this._values.splice(index, 1);
+ this._cache = cacheSentinel;
+ return true;
+ }
+ return false;
+ },
+ clear: function () {
+ this._keys.length = 0;
+ this._values.length = 0;
+ this._cache = cacheSentinel;
+ },
+ forEach: function (callback, thisArg) {
+ var size = this.size;
+ for (var i = 0; i < size; ++i) {
+ var key = this._keys[i];
+ var value = this._values[i];
+ this._cache = key;
+ callback.call(this, value, key, this);
+ }
+ },
+ _find: function (key) {
+ var keys = this._keys;
+ var size = keys.length;
+ for (var i = 0; i < size; ++i) {
+ if (keys[i] === key) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ };
+ return Map;
+ }
+ // naive Set shim
+ function CreateSetPolyfill() {
+ var cacheSentinel = {};
+ function Set() {
+ this._map = new _Map();
+ }
+ Set.prototype = {
+ get size() {
+ return this._map.length;
+ },
+ has: function (value) {
+ return this._map.has(value);
+ },
+ add: function (value) {
+ this._map.set(value, value);
+ return this;
+ },
+ delete: function (value) {
+ return this._map.delete(value);
+ },
+ clear: function () {
+ this._map.clear();
+ },
+ forEach: function (callback, thisArg) {
+ this._map.forEach(callback, thisArg);
+ }
+ };
+ return Set;
+ }
+ // naive WeakMap shim
+ function CreateWeakMapPolyfill() {
+ var UUID_SIZE = 16;
+ var isNode = typeof global !== "undefined" &&
+ typeof module === "object" &&
+ typeof module.exports === "object" &&
+ typeof require === "function";
+ var nodeCrypto = isNode && require("crypto");
+ var hasOwn = Object.prototype.hasOwnProperty;
+ var keys = {};
+ var rootKey = CreateUniqueKey();
+ function WeakMap() {
+ this._key = CreateUniqueKey();
+ }
+ WeakMap.prototype = {
+ has: function (target) {
+ var table = GetOrCreateWeakMapTable(target, false);
+ if (table) {
+ return this._key in table;
+ }
+ return false;
+ },
+ get: function (target) {
+ var table = GetOrCreateWeakMapTable(target, false);
+ if (table) {
+ return table[this._key];
+ }
+ return undefined;
+ },
+ set: function (target, value) {
+ var table = GetOrCreateWeakMapTable(target, true);
+ table[this._key] = value;
+ return this;
+ },
+ delete: function (target) {
+ var table = GetOrCreateWeakMapTable(target, false);
+ if (table && this._key in table) {
+ return delete table[this._key];
+ }
+ return false;
+ },
+ clear: function () {
+ // NOTE: not a real clear, just makes the previous data unreachable
+ this._key = CreateUniqueKey();
+ }
+ };
+ function FillRandomBytes(buffer, size) {
+ for (var i = 0; i < size; ++i) {
+ buffer[i] = Math.random() * 255 | 0;
+ }
+ }
+ function GenRandomBytes(size) {
+ if (nodeCrypto) {
+ var data = nodeCrypto.randomBytes(size);
+ return data;
+ }
+ else if (typeof Uint8Array === "function") {
+ var data = new Uint8Array(size);
+ if (typeof crypto !== "undefined") {
+ crypto.getRandomValues(data);
+ }
+ else if (typeof msCrypto !== "undefined") {
+ msCrypto.getRandomValues(data);
+ }
+ else {
+ FillRandomBytes(data, size);
+ }
+ return data;
+ }
+ else {
+ var data = new Array(size);
+ FillRandomBytes(data, size);
+ return data;
+ }
+ }
+ function CreateUUID() {
+ var data = GenRandomBytes(UUID_SIZE);
+ // mark as random - RFC 4122 § 4.4
+ data[6] = data[6] & 0x4f | 0x40;
+ data[8] = data[8] & 0xbf | 0x80;
+ var result = "";
+ for (var offset = 0; offset < UUID_SIZE; ++offset) {
+ var byte = data[offset];
+ if (offset === 4 || offset === 6 || offset === 8) {
+ result += "-";
+ }
+ if (byte < 16) {
+ result += "0";
+ }
+ result += byte.toString(16).toLowerCase();
+ }
+ return result;
+ }
+ function CreateUniqueKey() {
+ var key;
+ do {
+ key = "@@WeakMap@@" + CreateUUID();
+ } while (hasOwn.call(keys, key));
+ keys[key] = true;
+ return key;
+ }
+ function GetOrCreateWeakMapTable(target, create) {
+ if (!hasOwn.call(target, rootKey)) {
+ if (!create) {
+ return undefined;
+ }
+ Object.defineProperty(target, rootKey, { value: Object.create(null) });
+ }
+ return target[rootKey];
+ }
+ return WeakMap;
+ }
+ // hook global Reflect
+ (function (__global) {
+ if (typeof __global.Reflect !== "undefined") {
+ if (__global.Reflect !== Reflect) {
+ for (var p in Reflect) {
+ __global.Reflect[p] = Reflect[p];
+ }
+ }
+ }
+ else {
+ __global.Reflect = Reflect;
+ }
+ })(typeof window !== "undefined" ? window :
+ typeof WorkerGlobalScope !== "undefined" ? self :
+ typeof global !== "undefined" ? global :
+ Function("return this;")());
+})(Reflect || (Reflect = {}));
+//# sourceMappingURLDisabled=Reflect.js.map
"format register";
System.register("rx", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
@@ -6007,12 +7016,10 @@
Type,
BaseException,
Math,
Date,
assertionsEnabled_,
- ABSTRACT,
- IMPLEMENTS,
StringWrapper,
StringJoiner,
NumberParseError,
NumberWrapper,
RegExp,
@@ -6030,10 +7037,20 @@
function CONST() {
return (function(target) {
return target;
});
}
+ function ABSTRACT() {
+ return (function(t) {
+ return t;
+ });
+ }
+ function IMPLEMENTS(_) {
+ return (function(t) {
+ return t;
+ });
+ }
function isPresent(obj) {
return obj !== undefined && obj !== null;
}
function isBlank(obj) {
return obj === undefined || obj === null;
@@ -6045,10 +7062,19 @@
return typeof obj === "function";
}
function isType(obj) {
return isFunction(obj);
}
+ function isStringMap(obj) {
+ return typeof obj === 'object' && obj !== null;
+ }
+ function isPromise(obj) {
+ return obj instanceof _global.Promise;
+ }
+ function isArray(obj) {
+ return Array.isArray(obj);
+ }
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (token === undefined || token === null) {
@@ -6066,10 +7092,13 @@
return value;
}
function normalizeBlank(obj) {
return isBlank(obj) ? null : obj;
}
+ function normalizeBool(obj) {
+ return isBlank(obj) ? false : obj;
+ }
function isJsObject(o) {
return o !== null && (typeof o === "function" || typeof o === "object");
}
function print(obj) {
if (obj instanceof Error) {
@@ -6079,19 +7108,25 @@
}
}
$__export("assertionsEnabled", assertionsEnabled);
$__export("CONST_EXPR", CONST_EXPR);
$__export("CONST", CONST);
+ $__export("ABSTRACT", ABSTRACT);
+ $__export("IMPLEMENTS", IMPLEMENTS);
$__export("isPresent", isPresent);
$__export("isBlank", isBlank);
$__export("isString", isString);
$__export("isFunction", isFunction);
$__export("isType", isType);
+ $__export("isStringMap", isStringMap);
+ $__export("isPromise", isPromise);
+ $__export("isArray", isArray);
$__export("stringify", stringify);
$__export("looseIdentical", looseIdentical);
$__export("getMapKey", getMapKey);
$__export("normalizeBlank", normalizeBlank);
+ $__export("normalizeBool", normalizeBool);
$__export("isJsObject", isJsObject);
$__export("print", print);
return {
setters: [],
execute: function() {
@@ -6101,11 +7136,11 @@
$__export("Type", Type);
BaseException = (function($__super) {
function BaseException(message) {
$traceurRuntime.superConstructor(BaseException).call(this, message);
this.message = message;
- this.stack = (new Error()).stack;
+ this.stack = (new Error(message)).stack;
}
return ($traceurRuntime.createClass)(BaseException, {toString: function() {
return this.message;
}}, {}, $__super);
}(Error));
@@ -6118,20 +7153,10 @@
_global.assert = function assert(condition) {
if (assertionsEnabled_) {
_global['assert'].call(condition);
}
};
- ABSTRACT = (function() {
- function ABSTRACT() {}
- return ($traceurRuntime.createClass)(ABSTRACT, {}, {});
- }());
- $__export("ABSTRACT", ABSTRACT);
- IMPLEMENTS = (function() {
- function IMPLEMENTS() {}
- return ($traceurRuntime.createClass)(IMPLEMENTS, {}, {});
- }());
- $__export("IMPLEMENTS", IMPLEMENTS);
StringWrapper = (function() {
function StringWrapper() {}
return ($traceurRuntime.createClass)(StringWrapper, {}, {
fromCharCode: function(code) {
return String.fromCharCode(code);
@@ -6264,10 +7289,13 @@
},
firstMatch: function(regExp, input) {
regExp.lastIndex = 0;
return regExp.exec(input);
},
+ test: function(regExp, input) {
+ return regExp.test(input);
+ },
matcher: function(regExp, input) {
regExp.lastIndex = 0;
return {
re: regExp,
input: input
@@ -6327,26 +7355,31 @@
System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/facade/collection";
var isJsObject,
global,
+ isPresent,
+ isArray,
List,
Map,
Set,
StringMap,
createMapFromPairs,
+ createMapFromMap,
+ _clearValues,
MapWrapper,
StringMapWrapper,
ListWrapper,
+ createSetFromList,
SetWrapper;
function isListLikeIterable(obj) {
if (!isJsObject(obj))
return false;
- return ListWrapper.isList(obj) || (!(obj instanceof Map) && Symbol.iterator in obj);
+ return isArray(obj) || (!(obj instanceof Map) && Symbol.iterator in obj);
}
function iterateListLike(obj, fn) {
- if (ListWrapper.isList(obj)) {
+ if (isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
fn(obj[i]);
}
} else {
var iterator = obj[Symbol.iterator]();
@@ -6354,16 +7387,48 @@
while (!((item = iterator.next()).done)) {
fn(item.value);
}
}
}
+ function iterableToList(ii) {
+ var res = [];
+ var $__4 = true;
+ var $__5 = false;
+ var $__6 = undefined;
+ try {
+ for (var $__2 = void 0,
+ $__1 = (ii)[$traceurRuntime.toProperty(Symbol.iterator)](); !($__4 = ($__2 = $__1.next()).done); $__4 = true) {
+ var i = $__2.value;
+ {
+ res.push(i);
+ }
+ }
+ } catch ($__7) {
+ $__5 = true;
+ $__6 = $__7;
+ } finally {
+ try {
+ if (!$__4 && $__1.return != null) {
+ $__1.return();
+ }
+ } finally {
+ if ($__5) {
+ throw $__6;
+ }
+ }
+ }
+ return res;
+ }
$__export("isListLikeIterable", isListLikeIterable);
$__export("iterateListLike", iterateListLike);
+ $__export("iterableToList", iterableToList);
return {
setters: [function($__m) {
isJsObject = $__m.isJsObject;
global = $__m.global;
+ isPresent = $__m.isPresent;
+ isArray = $__m.isArray;
}],
execute: function() {
List = global.Array;
$__export("List", List);
Map = global.Map;
@@ -6387,65 +7452,79 @@
map.set(pair[0], pair[1]);
}
return map;
};
})();
+ createMapFromMap = (function() {
+ try {
+ if (new Map(new Map())) {
+ return function createMapFromMap(m) {
+ return new Map(m);
+ };
+ }
+ } catch (e) {}
+ return function createMapAndPopulateFromMap(m) {
+ var map = new Map();
+ m.forEach((function(v, k) {
+ map.set(k, v);
+ }));
+ return map;
+ };
+ })();
+ _clearValues = (function() {
+ if ((new Map()).keys().next) {
+ return function _clearValues(m) {
+ var keyIterator = m.keys();
+ var k;
+ while (!((k = keyIterator.next()).done)) {
+ m.set(k.value, null);
+ }
+ };
+ } else {
+ return function _clearValuesWithForeEach(m) {
+ m.forEach((function(v, k) {
+ m.set(k, null);
+ }));
+ };
+ }
+ })();
MapWrapper = (function() {
function MapWrapper() {}
return ($traceurRuntime.createClass)(MapWrapper, {}, {
- create: function() {
- return new Map();
- },
clone: function(m) {
- return new Map(m);
+ return createMapFromMap(m);
},
createFromStringMap: function(stringMap) {
- var result = MapWrapper.create();
+ var result = new Map();
for (var prop in stringMap) {
- MapWrapper.set(result, prop, stringMap[prop]);
+ result.set(prop, stringMap[prop]);
}
return result;
},
createFromPairs: function(pairs) {
return createMapFromPairs(pairs);
},
- get: function(m, k) {
- return m.get(k);
- },
- set: function(m, k, v) {
- m.set(k, v);
- },
- contains: function(m, k) {
- return m.has(k);
- },
forEach: function(m, fn) {
m.forEach(fn);
},
size: function(m) {
return m.size;
},
delete: function(m, k) {
m.delete(k);
},
- clear: function(m) {
- m.clear();
- },
clearValues: function(m) {
- var keyIterator = m.keys();
- var k;
- while (!((k = keyIterator.next()).done)) {
- m.set(k.value, null);
- }
+ _clearValues(m);
},
iterable: function(m) {
return m;
},
keys: function(m) {
- return m.keys();
+ return Array.from(m.keys());
},
values: function(m) {
- return m.values();
+ return Array.from(m.values());
}
});
}());
$__export("MapWrapper", MapWrapper);
StringMapWrapper = (function() {
@@ -6515,16 +7594,16 @@
}());
$__export("StringMapWrapper", StringMapWrapper);
ListWrapper = (function() {
function ListWrapper() {}
return ($traceurRuntime.createClass)(ListWrapper, {}, {
- create: function() {
- return new List();
- },
createFixedSize: function(size) {
return new List(size);
},
+ createGrowableSize: function(size) {
+ return new List(size);
+ },
get: function(m, k) {
return m[k];
},
set: function(m, k, v) {
m[k] = v;
@@ -6538,13 +7617,10 @@
forEach: function(array, fn) {
for (var i = 0; i < array.length; i++) {
fn(array[i]);
}
},
- push: function(array, el) {
- array.push(el);
- },
first: function(array) {
if (!array)
return null;
return array[0];
},
@@ -6559,11 +7635,11 @@
return list[i];
}
return null;
},
indexOf: function(array, value) {
- var startIndex = arguments[2] !== (void 0) ? arguments[2] : -1;
+ var startIndex = arguments[2] !== (void 0) ? arguments[2] : 0;
return array.indexOf(value, startIndex);
},
reduce: function(list, fn, init) {
return list.reduce(fn, init);
},
@@ -6585,13 +7661,10 @@
return a.reverse();
},
concat: function(a, b) {
return a.concat(b);
},
- isList: function(list) {
- return Array.isArray(list);
- },
insert: function(list, index, value) {
list.splice(index, 0, value);
},
removeAt: function(list, index) {
var res = list[index];
@@ -6645,20 +7718,45 @@
},
splice: function(l, from, length) {
return l.splice(from, length);
},
sort: function(l, compareFn) {
- l.sort(compareFn);
+ if (isPresent(compareFn)) {
+ l.sort(compareFn);
+ } else {
+ l.sort();
+ }
+ },
+ toString: function(l) {
+ return l.toString();
}
});
}());
$__export("ListWrapper", ListWrapper);
+ createSetFromList = (function() {
+ var test = new Set([1, 2, 3]);
+ if (test.size === 3) {
+ return function createSetFromList(lst) {
+ return new Set(lst);
+ };
+ } else {
+ return function createSetAndPopulateFromList(lst) {
+ var res = new Set(lst);
+ if (res.size !== lst.length) {
+ for (var i = 0; i < lst.length; i++) {
+ res.add(lst[i]);
+ }
+ }
+ return res;
+ };
+ }
+ })();
SetWrapper = (function() {
function SetWrapper() {}
return ($traceurRuntime.createClass)(SetWrapper, {}, {
createFromList: function(lst) {
- return new Set(lst);
+ return createSetFromList(lst);
},
has: function(s, key) {
return s.has(key);
}
});
@@ -6672,19 +7770,21 @@
"use strict";
var __moduleName = "angular2/src/di/annotations_impl";
var __decorate,
__metadata,
CONST,
+ stringify,
Inject,
InjectPromise,
InjectLazy,
Optional,
DependencyAnnotation,
Injectable;
return {
setters: [function($__m) {
CONST = $__m.CONST;
+ stringify = $__m.stringify;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -6707,24 +7807,32 @@
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
Inject = (($traceurRuntime.createClass)(function(token) {
this.token = token;
- }, {}, {}));
+ }, {toString: function() {
+ return ("@Inject(" + stringify(this.token) + ")");
+ }}, {}));
$__export("Inject", Inject);
$__export("Inject", Inject = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Inject));
InjectPromise = (($traceurRuntime.createClass)(function(token) {
this.token = token;
- }, {}, {}));
+ }, {toString: function() {
+ return ("@InjectPromise(" + stringify(this.token) + ")");
+ }}, {}));
$__export("InjectPromise", InjectPromise);
$__export("InjectPromise", InjectPromise = __decorate([CONST(), __metadata('design:paramtypes', [Object])], InjectPromise));
InjectLazy = (($traceurRuntime.createClass)(function(token) {
this.token = token;
- }, {}, {}));
+ }, {toString: function() {
+ return ("@InjectLazy(" + stringify(this.token) + ")");
+ }}, {}));
$__export("InjectLazy", InjectLazy);
$__export("InjectLazy", InjectLazy = __decorate([CONST(), __metadata('design:paramtypes', [Object])], InjectLazy));
- Optional = (($traceurRuntime.createClass)(function() {}, {}, {}));
+ Optional = (($traceurRuntime.createClass)(function() {}, {toString: function() {
+ return "@Optional()";
+ }}, {}));
$__export("Optional", Optional);
$__export("Optional", Optional = __decorate([CONST(), __metadata('design:paramtypes', [])], Optional));
DependencyAnnotation = (($traceurRuntime.createClass)(function() {}, {get token() {
return null;
}}, {}));
@@ -6738,93 +7846,181 @@
});
System.register("angular2/src/util/decorators", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/util/decorators";
- var global;
+ var global,
+ isFunction,
+ stringify,
+ Reflect;
+ function extractAnnotation(annotation) {
+ if (isFunction(annotation) && annotation.hasOwnProperty('annotation')) {
+ annotation = annotation.annotation;
+ }
+ return annotation;
+ }
+ function applyParams(fnOrArray, key) {
+ if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) {
+ throw new Error(("Can not use native " + stringify(fnOrArray) + " as constructor"));
+ }
+ if (isFunction(fnOrArray)) {
+ return fnOrArray;
+ } else if (fnOrArray instanceof Array) {
+ var annotations = fnOrArray;
+ var fn = fnOrArray[fnOrArray.length - 1];
+ if (!isFunction(fn)) {
+ throw new Error(("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'"));
+ }
+ var annoLength = annotations.length - 1;
+ if (annoLength != fn.length) {
+ throw new Error(("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn)));
+ }
+ var paramsAnnotations = [];
+ for (var i = 0,
+ ii = annotations.length - 1; i < ii; i++) {
+ var paramAnnotations = [];
+ paramsAnnotations.push(paramAnnotations);
+ var annotation = annotations[i];
+ if (annotation instanceof Array) {
+ for (var j = 0; j < annotation.length; j++) {
+ paramAnnotations.push(extractAnnotation(annotation[j]));
+ }
+ } else if (isFunction(annotation)) {
+ paramAnnotations.push(extractAnnotation(annotation));
+ } else {
+ paramAnnotations.push(annotation);
+ }
+ }
+ Reflect.defineMetadata('parameters', paramsAnnotations, fn);
+ return fn;
+ } else {
+ throw new Error(("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'"));
+ }
+ }
+ function Class(clsDef) {
+ var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
+ var proto = constructor.prototype;
+ if (clsDef.hasOwnProperty('extends')) {
+ if (isFunction(clsDef.extends)) {
+ constructor.prototype = proto = Object.create(clsDef.extends.prototype);
+ } else {
+ throw new Error(("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends)));
+ }
+ }
+ for (var key in clsDef) {
+ if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) {
+ proto[key] = applyParams(clsDef[key], key);
+ }
+ }
+ if (this && this.annotations instanceof Array) {
+ Reflect.defineMetadata('annotations', this.annotations, constructor);
+ }
+ return constructor;
+ }
function makeDecorator(annotationCls) {
- return function() {
- for (var args = [],
- $__0 = 0; $__0 < arguments.length; $__0++)
- args[$__0] = arguments[$__0];
- var Reflect = global.Reflect;
- if (!(Reflect && Reflect.getMetadata)) {
- throw 'reflect-metadata shim is required when using class decorators';
+ var chainFn = arguments[1] !== (void 0) ? arguments[1] : null;
+ function DecoratorFactory(objOrType) {
+ var annotationInstance = new annotationCls(objOrType);
+ if (this instanceof annotationCls) {
+ return annotationInstance;
+ } else {
+ var chainAnnotation = isFunction(this) && this.annotations instanceof Array ? this.annotations : [];
+ chainAnnotation.push(annotationInstance);
+ var TypeDecorator = function TypeDecorator(cls) {
+ var annotations = Reflect.getMetadata('annotations', cls);
+ annotations = annotations || [];
+ annotations.push(annotationInstance);
+ Reflect.defineMetadata('annotations', annotations, cls);
+ return cls;
+ };
+ TypeDecorator.annotations = chainAnnotation;
+ TypeDecorator.Class = Class;
+ if (chainFn)
+ chainFn(TypeDecorator);
+ return TypeDecorator;
}
- var annotationInstance = Object.create(annotationCls.prototype);
- annotationCls.apply(annotationInstance, args);
- return function(cls) {
- var annotations = Reflect.getMetadata('annotations', cls);
- annotations = annotations || [];
- annotations.push(annotationInstance);
- Reflect.defineMetadata('annotations', annotations, cls);
- return cls;
- };
- };
+ }
+ DecoratorFactory.prototype = Object.create(annotationCls.prototype);
+ return DecoratorFactory;
}
function makeParamDecorator(annotationCls) {
- return function() {
+ function ParamDecoratorFactory() {
for (var args = [],
$__0 = 0; $__0 < arguments.length; $__0++)
args[$__0] = arguments[$__0];
- var Reflect = global.Reflect;
- if (!(Reflect && Reflect.getMetadata)) {
- throw 'reflect-metadata shim is required when using parameter decorators';
- }
var annotationInstance = Object.create(annotationCls.prototype);
annotationCls.apply(annotationInstance, args);
- return function(cls, unusedKey, index) {
+ if (this instanceof annotationCls) {
+ return annotationInstance;
+ } else {
+ ParamDecorator.annotation = annotationInstance;
+ return ParamDecorator;
+ }
+ function ParamDecorator(cls, unusedKey, index) {
var parameters = Reflect.getMetadata('parameters', cls);
parameters = parameters || [];
while (parameters.length <= index) {
parameters.push(null);
}
parameters[index] = parameters[index] || [];
var annotationsForParam = parameters[index];
annotationsForParam.push(annotationInstance);
Reflect.defineMetadata('parameters', parameters, cls);
return cls;
- };
- };
+ }
+ }
+ ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype);
+ return ParamDecoratorFactory;
}
+ $__export("Class", Class);
$__export("makeDecorator", makeDecorator);
$__export("makeParamDecorator", makeParamDecorator);
return {
setters: [function($__m) {
global = $__m.global;
+ isFunction = $__m.isFunction;
+ stringify = $__m.stringify;
}],
execute: function() {
+ Reflect = global.Reflect;
+ if (!(Reflect && Reflect.getMetadata)) {
+ throw 'reflect-metadata shim is required when using class decorators';
+ }
}
};
});
System.register("angular2/src/reflection/types", [], function($__export) {
"use strict";
var __moduleName = "angular2/src/reflection/types";
return {
setters: [],
execute: function() {
- $__export("SetterFn", Function);
$__export("GetterFn", Function);
+ $__export("SetterFn", Function);
$__export("MethodFn", Function);
}
};
});
System.register("angular2/src/reflection/reflection_capabilities", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/reflection/reflection_capabilities";
var isPresent,
+ isFunction,
global,
stringify,
+ BaseException,
ListWrapper,
ReflectionCapabilities;
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
+ isFunction = $__m.isFunction;
global = $__m.global;
stringify = $__m.stringify;
+ BaseException = $__m.BaseException;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
}],
execute: function() {
ReflectionCapabilities = (function() {
@@ -6833,56 +8029,96 @@
}
return ($traceurRuntime.createClass)(ReflectionCapabilities, {
factory: function(t) {
switch (t.length) {
case 0:
- return function() {
+ return (function() {
return new t();
- };
+ });
case 1:
- return function(a1) {
+ return (function(a1) {
return new t(a1);
- };
+ });
case 2:
- return function(a1, a2) {
+ return (function(a1, a2) {
return new t(a1, a2);
- };
+ });
case 3:
- return function(a1, a2, a3) {
+ return (function(a1, a2, a3) {
return new t(a1, a2, a3);
- };
+ });
case 4:
- return function(a1, a2, a3, a4) {
+ return (function(a1, a2, a3, a4) {
return new t(a1, a2, a3, a4);
- };
+ });
case 5:
- return function(a1, a2, a3, a4, a5) {
+ return (function(a1, a2, a3, a4, a5) {
return new t(a1, a2, a3, a4, a5);
- };
+ });
case 6:
- return function(a1, a2, a3, a4, a5, a6) {
+ return (function(a1, a2, a3, a4, a5, a6) {
return new t(a1, a2, a3, a4, a5, a6);
- };
+ });
case 7:
- return function(a1, a2, a3, a4, a5, a6, a7) {
+ return (function(a1, a2, a3, a4, a5, a6, a7) {
return new t(a1, a2, a3, a4, a5, a6, a7);
- };
+ });
case 8:
- return function(a1, a2, a3, a4, a5, a6, a7, a8) {
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8);
- };
+ });
case 9:
- return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9);
- };
+ });
case 10:
- return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
- };
+ });
+ case 11:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ });
+ case 12:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
+ });
+ case 13:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
+ });
+ case 14:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
+ });
+ case 15:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
+ });
+ case 16:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16);
+ });
+ case 17:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
+ });
+ case 18:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18);
+ });
+ case 19:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19);
+ });
+ case 20:
+ return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) {
+ return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+ });
}
;
- throw new Error(("Cannot create a factory for '" + stringify(t) + "' because its constructor has more than 10 arguments"));
+ throw new Error(("Cannot create a factory for '" + stringify(t) + "' because its constructor has more than 20 arguments"));
},
_zipTypesAndAnnotaions: function(paramTypes, paramAnnotations) {
var result;
if (typeof paramTypes === 'undefined') {
result = ListWrapper.createFixedSize(paramAnnotations.length);
@@ -6916,19 +8152,26 @@
}
return ListWrapper.createFixedSize(typeOfFunc.length);
},
annotations: function(typeOfFunc) {
if (isPresent(typeOfFunc.annotations)) {
- return typeOfFunc.annotations;
+ var annotations = typeOfFunc.annotations;
+ if (isFunction(annotations) && annotations.annotations) {
+ annotations = annotations.annotations;
+ }
+ return annotations;
}
if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) {
var annotations = this._reflect.getMetadata('annotations', typeOfFunc);
if (isPresent(annotations))
return annotations;
}
return [];
},
+ interfaces: function(type) {
+ throw new BaseException("JavaScript does not support interfaces");
+ },
getter: function(name) {
return new Function('o', 'return o.' + name + ';');
},
setter: function(name) {
return new Function('o', 'v', 'return o.' + name + ' = v;');
@@ -6964,32 +8207,32 @@
this.parent = parent;
this.current = current;
}
return ($traceurRuntime.createClass)(Locals, {
contains: function(name) {
- if (MapWrapper.contains(this.current, name)) {
+ if (this.current.has(name)) {
return true;
}
if (isPresent(this.parent)) {
return this.parent.contains(name);
}
return false;
},
get: function(name) {
- if (MapWrapper.contains(this.current, name)) {
- return MapWrapper.get(this.current, name);
+ if (this.current.has(name)) {
+ return this.current.get(name);
}
if (isPresent(this.parent)) {
return this.parent.get(name);
}
throw new BaseException(("Cannot find '" + name + "'"));
},
set: function(name, value) {
- if (MapWrapper.contains(this.current, name)) {
- MapWrapper.set(this.current, name, value);
+ if (this.current.has(name)) {
+ this.current.set(name, value);
} else {
- throw new BaseException('Setting of new keys post-construction is not supported.');
+ throw new BaseException(("Setting of new keys post-construction is not supported. Key: " + name + "."));
}
},
clearValues: function() {
MapWrapper.clearValues(this.current);
}
@@ -7003,11 +8246,12 @@
System.register("angular2/src/change_detection/exceptions", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/exceptions";
var BaseException,
ExpressionChangedAfterItHasBeenChecked,
- ChangeDetectionError;
+ ChangeDetectionError,
+ DehydratedException;
return {
setters: [function($__m) {
BaseException = $__m.BaseException;
}],
execute: function() {
@@ -7031,60 +8275,36 @@
return ($traceurRuntime.createClass)(ChangeDetectionError, {toString: function() {
return this.message;
}}, {}, $__super);
}(BaseException));
$__export("ChangeDetectionError", ChangeDetectionError);
+ DehydratedException = (function($__super) {
+ function DehydratedException() {
+ $traceurRuntime.superConstructor(DehydratedException).call(this, 'Attempt to detect changes on a dehydrated detector.');
+ }
+ return ($traceurRuntime.createClass)(DehydratedException, {}, {}, $__super);
+ }(BaseException));
+ $__export("DehydratedException", DehydratedException);
}
};
});
System.register("angular2/src/change_detection/interfaces", [], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/interfaces";
- var ProtoChangeDetector,
- ChangeDetection,
- ChangeDispatcher,
- ChangeDetector,
+ var ChangeDetection,
ChangeDetectorDefinition;
return {
setters: [],
execute: function() {
- ProtoChangeDetector = (function() {
- function ProtoChangeDetector() {}
- return ($traceurRuntime.createClass)(ProtoChangeDetector, {instantiate: function(dispatcher) {
- return null;
- }}, {});
- }());
- $__export("ProtoChangeDetector", ProtoChangeDetector);
ChangeDetection = (function() {
function ChangeDetection() {}
return ($traceurRuntime.createClass)(ChangeDetection, {createProtoChangeDetector: function(definition) {
return null;
}}, {});
}());
$__export("ChangeDetection", ChangeDetection);
- ChangeDispatcher = (function() {
- function ChangeDispatcher() {}
- return ($traceurRuntime.createClass)(ChangeDispatcher, {notifyOnBinding: function(bindingRecord, value) {}}, {});
- }());
- $__export("ChangeDispatcher", ChangeDispatcher);
- ChangeDetector = (function() {
- function ChangeDetector() {}
- return ($traceurRuntime.createClass)(ChangeDetector, {
- addChild: function(cd) {},
- addShadowDomChild: function(cd) {},
- removeChild: function(cd) {},
- removeShadowDomChild: function(cd) {},
- remove: function() {},
- hydrate: function(context, locals, directives) {},
- dehydrate: function() {},
- markPathToRootAsCheckOnce: function() {},
- detectChanges: function() {},
- checkNoChanges: function() {}
- }, {});
- }());
- $__export("ChangeDetector", ChangeDetector);
ChangeDetectorDefinition = (function() {
function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, directiveRecords) {
this.id = id;
this.strategy = strategy;
this.variableNames = variableNames;
@@ -7127,50 +8347,23 @@
});
System.register("angular2/src/change_detection/pipes/pipe", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/pipe";
- var __decorate,
- __metadata,
- BaseException,
- CONST,
+ var BaseException,
WrappedValue,
_wrappedValues,
_wrappedIndex,
- Pipe,
- PipeFactory;
+ BasePipe;
function _abstract() {
throw new BaseException('This method is abstract');
}
return {
setters: [function($__m) {
BaseException = $__m.BaseException;
- CONST = $__m.CONST;
}],
execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
WrappedValue = (function() {
function WrappedValue(wrapped) {
this.wrapped = wrapped;
}
return ($traceurRuntime.createClass)(WrappedValue, {}, {wrap: function(value) {
@@ -7180,35 +8373,23 @@
}});
}());
$__export("WrappedValue", WrappedValue);
_wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)];
_wrappedIndex = 0;
- Pipe = (function() {
- function Pipe() {}
- return ($traceurRuntime.createClass)(Pipe, {
+ BasePipe = (function() {
+ function BasePipe() {}
+ return ($traceurRuntime.createClass)(BasePipe, {
supports: function(obj) {
- return false;
+ return true;
},
onDestroy: function() {},
transform: function(value) {
- return null;
+ return _abstract();
}
}, {});
}());
- $__export("Pipe", Pipe);
- PipeFactory = (($traceurRuntime.createClass)(function() {}, {
- supports: function(obs) {
- _abstract();
- return false;
- },
- create: function(cdRef) {
- _abstract();
- return null;
- }
- }, {}));
- $__export("PipeFactory", PipeFactory);
- $__export("PipeFactory", PipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], PipeFactory));
+ $__export("BasePipe", BasePipe);
}
};
});
System.register("angular2/src/change_detection/change_detector_ref", ["angular2/src/change_detection/constants"], function($__export) {
@@ -7246,47 +8427,31 @@
});
System.register("angular2/src/change_detection/proto_record", [], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/proto_record";
- var RECORD_TYPE_SELF,
- RECORD_TYPE_CONST,
- RECORD_TYPE_PRIMITIVE_OP,
- RECORD_TYPE_PROPERTY,
- RECORD_TYPE_LOCAL,
- RECORD_TYPE_INVOKE_METHOD,
- RECORD_TYPE_INVOKE_CLOSURE,
- RECORD_TYPE_KEYED_ACCESS,
- RECORD_TYPE_PIPE,
- RECORD_TYPE_BINDING_PIPE,
- RECORD_TYPE_INTERPOLATE,
+ var RecordType,
ProtoRecord;
return {
setters: [],
execute: function() {
- RECORD_TYPE_SELF = 0;
- $__export("RECORD_TYPE_SELF", RECORD_TYPE_SELF);
- RECORD_TYPE_CONST = 1;
- $__export("RECORD_TYPE_CONST", RECORD_TYPE_CONST);
- RECORD_TYPE_PRIMITIVE_OP = 2;
- $__export("RECORD_TYPE_PRIMITIVE_OP", RECORD_TYPE_PRIMITIVE_OP);
- RECORD_TYPE_PROPERTY = 3;
- $__export("RECORD_TYPE_PROPERTY", RECORD_TYPE_PROPERTY);
- RECORD_TYPE_LOCAL = 4;
- $__export("RECORD_TYPE_LOCAL", RECORD_TYPE_LOCAL);
- RECORD_TYPE_INVOKE_METHOD = 5;
- $__export("RECORD_TYPE_INVOKE_METHOD", RECORD_TYPE_INVOKE_METHOD);
- RECORD_TYPE_INVOKE_CLOSURE = 6;
- $__export("RECORD_TYPE_INVOKE_CLOSURE", RECORD_TYPE_INVOKE_CLOSURE);
- RECORD_TYPE_KEYED_ACCESS = 7;
- $__export("RECORD_TYPE_KEYED_ACCESS", RECORD_TYPE_KEYED_ACCESS);
- RECORD_TYPE_PIPE = 8;
- $__export("RECORD_TYPE_PIPE", RECORD_TYPE_PIPE);
- RECORD_TYPE_BINDING_PIPE = 9;
- $__export("RECORD_TYPE_BINDING_PIPE", RECORD_TYPE_BINDING_PIPE);
- RECORD_TYPE_INTERPOLATE = 10;
- $__export("RECORD_TYPE_INTERPOLATE", RECORD_TYPE_INTERPOLATE);
+ $__export("RecordType", RecordType);
+ (function(RecordType) {
+ RecordType[RecordType["SELF"] = 0] = "SELF";
+ RecordType[RecordType["CONST"] = 1] = "CONST";
+ RecordType[RecordType["PRIMITIVE_OP"] = 2] = "PRIMITIVE_OP";
+ RecordType[RecordType["PROPERTY"] = 3] = "PROPERTY";
+ RecordType[RecordType["LOCAL"] = 4] = "LOCAL";
+ RecordType[RecordType["INVOKE_METHOD"] = 5] = "INVOKE_METHOD";
+ RecordType[RecordType["INVOKE_CLOSURE"] = 6] = "INVOKE_CLOSURE";
+ RecordType[RecordType["KEYED_ACCESS"] = 7] = "KEYED_ACCESS";
+ RecordType[RecordType["PIPE"] = 8] = "PIPE";
+ RecordType[RecordType["INTERPOLATE"] = 9] = "INTERPOLATE";
+ RecordType[RecordType["SAFE_PROPERTY"] = 10] = "SAFE_PROPERTY";
+ RecordType[RecordType["SAFE_INVOKE_METHOD"] = 11] = "SAFE_INVOKE_METHOD";
+ RecordType[RecordType["DIRECTIVE_LIFECYCLE"] = 12] = "DIRECTIVE_LIFECYCLE";
+ })(RecordType || ($__export("RecordType", RecordType = {})));
ProtoRecord = (function() {
function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, expressionAsString, lastInBinding, lastInDirective) {
this.mode = mode;
this.name = name;
this.funcOrValue = funcOrValue;
@@ -7298,430 +8463,41 @@
this.bindingRecord = bindingRecord;
this.expressionAsString = expressionAsString;
this.lastInBinding = lastInBinding;
this.lastInDirective = lastInDirective;
}
- return ($traceurRuntime.createClass)(ProtoRecord, {isPureFunction: function() {
- return this.mode === RECORD_TYPE_INTERPOLATE || this.mode === RECORD_TYPE_PRIMITIVE_OP;
- }}, {});
- }());
- $__export("ProtoRecord", ProtoRecord);
- }
- };
-});
-
-System.register("angular2/src/change_detection/change_detection_jit_generator", ["angular2/src/facade/lang", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/change_detection/change_detection_jit_generator";
- var BaseException,
- AbstractChangeDetector,
- ChangeDetectionUtil,
- RECORD_TYPE_SELF,
- RECORD_TYPE_PROPERTY,
- RECORD_TYPE_LOCAL,
- RECORD_TYPE_INVOKE_METHOD,
- RECORD_TYPE_CONST,
- RECORD_TYPE_INVOKE_CLOSURE,
- RECORD_TYPE_PRIMITIVE_OP,
- RECORD_TYPE_KEYED_ACCESS,
- RECORD_TYPE_PIPE,
- RECORD_TYPE_BINDING_PIPE,
- RECORD_TYPE_INTERPOLATE,
- ABSTRACT_CHANGE_DETECTOR,
- UTIL,
- DISPATCHER_ACCESSOR,
- PIPE_REGISTRY_ACCESSOR,
- PROTOS_ACCESSOR,
- DIRECTIVES_ACCESSOR,
- CONTEXT_ACCESSOR,
- IS_CHANGED_LOCAL,
- CHANGES_LOCAL,
- LOCALS_ACCESSOR,
- MODE_ACCESSOR,
- TEMP_LOCAL,
- CURRENT_PROTO,
- ChangeDetectorJITGenerator;
- function typeTemplate(type, cons, detectChanges, notifyOnAllChangesDone, setContext) {
- return ("\n" + cons + "\n" + detectChanges + "\n" + notifyOnAllChangesDone + "\n" + setContext + ";\n\nreturn function(dispatcher, pipeRegistry) {\n return new " + type + "(dispatcher, pipeRegistry, protos, directiveRecords);\n}\n");
- }
- function constructorTemplate(type, fieldsDefinitions) {
- return ("\nvar " + type + " = function " + type + "(dispatcher, pipeRegistry, protos, directiveRecords) {\n" + ABSTRACT_CHANGE_DETECTOR + ".call(this);\n" + DISPATCHER_ACCESSOR + " = dispatcher;\n" + PIPE_REGISTRY_ACCESSOR + " = pipeRegistry;\n" + PROTOS_ACCESSOR + " = protos;\n" + DIRECTIVES_ACCESSOR + " = directiveRecords;\n" + LOCALS_ACCESSOR + " = null;\n" + fieldsDefinitions + "\n}\n\n" + type + ".prototype = Object.create(" + ABSTRACT_CHANGE_DETECTOR + ".prototype);\n");
- }
- function pipeOnDestroyTemplate(pipeNames) {
- return pipeNames.map((function(p) {
- return (p + ".onDestroy()");
- })).join("\n");
- }
- function hydrateTemplate(type, mode, fieldDefinitions, pipeOnDestroy, directiveFieldNames, detectorFieldNames) {
- var directiveInit = "";
- for (var i = 0; i < directiveFieldNames.length; ++i) {
- directiveInit += (directiveFieldNames[i] + " = directives.getDirectiveFor(this.directiveRecords[" + i + "].directiveIndex);\n");
- }
- var detectorInit = "";
- for (var i = 0; i < detectorFieldNames.length; ++i) {
- detectorInit += (detectorFieldNames[i] + " = directives.getDetectorFor(this.directiveRecords[" + i + "].directiveIndex);\n");
- }
- return ("\n" + type + ".prototype.hydrate = function(context, locals, directives) {\n " + MODE_ACCESSOR + " = \"" + mode + "\";\n " + CONTEXT_ACCESSOR + " = context;\n " + LOCALS_ACCESSOR + " = locals;\n " + directiveInit + "\n " + detectorInit + "\n}\n" + type + ".prototype.dehydrate = function() {\n " + pipeOnDestroy + "\n " + fieldDefinitions + "\n " + LOCALS_ACCESSOR + " = null;\n}\n" + type + ".prototype.hydrated = function() {\n return " + CONTEXT_ACCESSOR + " !== " + UTIL + ".uninitialized();\n}\n");
- }
- function detectChangesTemplate(type, body) {
- return ("\n" + type + ".prototype.detectChangesInRecords = function(throwOnChange) {\n " + body + "\n}\n");
- }
- function callOnAllChangesDoneTemplate(type, body) {
- return ("\n" + type + ".prototype.callOnAllChangesDone = function() {\n " + body + "\n}\n");
- }
- function onAllChangesDoneTemplate(directive) {
- return (directive + ".onAllChangesDone();");
- }
- function detectChangesBodyTemplate(localDefinitions, changeDefinitions, records) {
- return ("\n" + localDefinitions + "\n" + changeDefinitions + "\nvar " + TEMP_LOCAL + ";\nvar " + IS_CHANGED_LOCAL + " = false;\nvar " + CURRENT_PROTO + ";\nvar " + CHANGES_LOCAL + " = null;\n\ncontext = " + CONTEXT_ACCESSOR + ";\n" + records + "\n");
- }
- function pipeCheckTemplate(protoIndex, context, bindingPropagationConfig, pipe, pipeType, oldValue, newValue, change, update, addToChanges, lastInDirective) {
- return ("\n" + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\nif (" + pipe + " === " + UTIL + ".uninitialized()) {\n " + pipe + " = " + PIPE_REGISTRY_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + bindingPropagationConfig + ");\n} else if (!" + pipe + ".supports(" + context + ")) {\n " + pipe + ".onDestroy();\n " + pipe + " = " + PIPE_REGISTRY_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + bindingPropagationConfig + ");\n}\n\n" + newValue + " = " + pipe + ".transform(" + context + ");\nif (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + UTIL + ".unwrapValue(" + newValue + ");\n " + change + " = true;\n " + update + "\n " + addToChanges + "\n " + oldValue + " = " + newValue + ";\n}\n" + lastInDirective + "\n");
- }
- function referenceCheckTemplate(protoIndex, assignment, oldValue, newValue, change, update, addToChanges, lastInDirective) {
- return ("\n" + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n" + assignment + "\nif (" + newValue + " !== " + oldValue + " || (" + newValue + " !== " + newValue + ") && (" + oldValue + " !== " + oldValue + ")) {\n " + change + " = true;\n " + update + "\n " + addToChanges + "\n " + oldValue + " = " + newValue + ";\n}\n" + lastInDirective + "\n");
- }
- function assignmentTemplate(field, value) {
- return (field + " = " + value + ";");
- }
- function localDefinitionsTemplate(names) {
- return names.map((function(n) {
- return ("var " + n + ";");
- })).join("\n");
- }
- function changeDefinitionsTemplate(names) {
- return names.map((function(n) {
- return ("var " + n + " = false;");
- })).join("\n");
- }
- function fieldDefinitionsTemplate(names) {
- return names.map((function(n) {
- return (n + " = " + UTIL + ".uninitialized();");
- })).join("\n");
- }
- function ifChangedGuardTemplate(changeNames, body) {
- var cond = changeNames.join(" || ");
- return ("\nif (" + cond + ") {\n " + body + "\n}\n");
- }
- function addToChangesTemplate(oldValue, newValue) {
- return (CHANGES_LOCAL + " = " + UTIL + ".addChange(" + CHANGES_LOCAL + ", " + CURRENT_PROTO + ".bindingRecord.propertyName, " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));");
- }
- function updateDirectiveTemplate(oldValue, newValue, directiveProperty) {
- return ("\nif(throwOnChange) " + UTIL + ".throwOnChange(" + CURRENT_PROTO + ", " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n" + directiveProperty + " = " + newValue + ";\n" + IS_CHANGED_LOCAL + " = true;\n ");
- }
- function updateElementTemplate(oldValue, newValue) {
- return ("\nif(throwOnChange) " + UTIL + ".throwOnChange(" + CURRENT_PROTO + ", " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n" + DISPATCHER_ACCESSOR + ".notifyOnBinding(" + CURRENT_PROTO + ".bindingRecord, " + newValue + ");\n ");
- }
- function notifyOnChangesTemplate(directive) {
- return ("\nif(" + CHANGES_LOCAL + ") {\n " + directive + ".onChange(" + CHANGES_LOCAL + ");\n " + CHANGES_LOCAL + " = null;\n}\n");
- }
- function notifyOnPushDetectorsTemplate(detector) {
- return ("\nif(" + IS_CHANGED_LOCAL + ") {\n " + detector + ".markAsCheckOnce();\n}\n");
- }
- function lastInDirectiveTemplate(notifyOnChanges, notifyOnPush) {
- return ("\n" + notifyOnChanges + "\n" + notifyOnPush + "\n" + IS_CHANGED_LOCAL + " = false;\n");
- }
- return {
- setters: [function($__m) {
- BaseException = $__m.BaseException;
- }, function($__m) {
- AbstractChangeDetector = $__m.AbstractChangeDetector;
- }, function($__m) {
- ChangeDetectionUtil = $__m.ChangeDetectionUtil;
- }, function($__m) {
- RECORD_TYPE_SELF = $__m.RECORD_TYPE_SELF;
- RECORD_TYPE_PROPERTY = $__m.RECORD_TYPE_PROPERTY;
- RECORD_TYPE_LOCAL = $__m.RECORD_TYPE_LOCAL;
- RECORD_TYPE_INVOKE_METHOD = $__m.RECORD_TYPE_INVOKE_METHOD;
- RECORD_TYPE_CONST = $__m.RECORD_TYPE_CONST;
- RECORD_TYPE_INVOKE_CLOSURE = $__m.RECORD_TYPE_INVOKE_CLOSURE;
- RECORD_TYPE_PRIMITIVE_OP = $__m.RECORD_TYPE_PRIMITIVE_OP;
- RECORD_TYPE_KEYED_ACCESS = $__m.RECORD_TYPE_KEYED_ACCESS;
- RECORD_TYPE_PIPE = $__m.RECORD_TYPE_PIPE;
- RECORD_TYPE_BINDING_PIPE = $__m.RECORD_TYPE_BINDING_PIPE;
- RECORD_TYPE_INTERPOLATE = $__m.RECORD_TYPE_INTERPOLATE;
- }],
- execute: function() {
- ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector";
- UTIL = "ChangeDetectionUtil";
- DISPATCHER_ACCESSOR = "this.dispatcher";
- PIPE_REGISTRY_ACCESSOR = "this.pipeRegistry";
- PROTOS_ACCESSOR = "this.protos";
- DIRECTIVES_ACCESSOR = "this.directiveRecords";
- CONTEXT_ACCESSOR = "this.context";
- IS_CHANGED_LOCAL = "isChanged";
- CHANGES_LOCAL = "changes";
- LOCALS_ACCESSOR = "this.locals";
- MODE_ACCESSOR = "this.mode";
- TEMP_LOCAL = "temp";
- CURRENT_PROTO = "currentProto";
- ChangeDetectorJITGenerator = (function() {
- function ChangeDetectorJITGenerator(typeName, changeDetectionStrategy, records, directiveRecords) {
- this.typeName = typeName;
- this.changeDetectionStrategy = changeDetectionStrategy;
- this.records = records;
- this.directiveRecords = directiveRecords;
- this.localNames = this.getLocalNames(records);
- this.changeNames = this.getChangeNames(this.localNames);
- this.fieldNames = this.getFieldNames(this.localNames);
- this.pipeNames = this.getPipeNames(this.localNames);
- }
- return ($traceurRuntime.createClass)(ChangeDetectorJITGenerator, {
- getLocalNames: function(records) {
- var index = 0;
- var names = records.map((function(r) {
- var sanitizedName = r.name.replace(new RegExp("\\W", "g"), '');
- return ("" + sanitizedName + index++);
- }));
- return ["context"].concat(names);
+ return ($traceurRuntime.createClass)(ProtoRecord, {
+ isPureFunction: function() {
+ return this.mode === RecordType.INTERPOLATE || this.mode === RecordType.PRIMITIVE_OP;
},
- getChangeNames: function(localNames) {
- return localNames.map((function(n) {
- return ("change_" + n);
- }));
+ isPipeRecord: function() {
+ return this.mode === RecordType.PIPE;
},
- getFieldNames: function(localNames) {
- return localNames.map((function(n) {
- return ("this." + n);
- }));
- },
- getPipeNames: function(localNames) {
- return localNames.map((function(n) {
- return ("this." + n + "_pipe");
- }));
- },
- generate: function() {
- var text = typeTemplate(this.typeName, this.genConstructor(), this.genDetectChanges(), this.genCallOnAllChangesDone(), this.genHydrate());
- return new Function('AbstractChangeDetector', 'ChangeDetectionUtil', 'protos', 'directiveRecords', text)(AbstractChangeDetector, ChangeDetectionUtil, this.records, this.directiveRecords);
- },
- genConstructor: function() {
- return constructorTemplate(this.typeName, this.genFieldDefinitions());
- },
- genHydrate: function() {
- var mode = ChangeDetectionUtil.changeDetectionMode(this.changeDetectionStrategy);
- return hydrateTemplate(this.typeName, mode, this.genFieldDefinitions(), pipeOnDestroyTemplate(this.getNonNullPipeNames()), this.getDirectiveFieldNames(), this.getDetectorFieldNames());
- },
- getDirectiveFieldNames: function() {
- var $__0 = this;
- return this.directiveRecords.map((function(d) {
- return $__0.getDirective(d.directiveIndex);
- }));
- },
- getDetectorFieldNames: function() {
- var $__0 = this;
- return this.directiveRecords.filter((function(r) {
- return r.isOnPushChangeDetection();
- })).map((function(d) {
- return $__0.getDetector(d.directiveIndex);
- }));
- },
- getDirective: function(d) {
- return ("this.directive_" + d.name);
- },
- getDetector: function(d) {
- return ("this.detector_" + d.name);
- },
- genFieldDefinitions: function() {
- var fields = [];
- fields = fields.concat(this.fieldNames);
- fields = fields.concat(this.getNonNullPipeNames());
- fields = fields.concat(this.getDirectiveFieldNames());
- fields = fields.concat(this.getDetectorFieldNames());
- return fieldDefinitionsTemplate(fields);
- },
- getNonNullPipeNames: function() {
- var $__0 = this;
- var pipes = [];
- this.records.forEach((function(r) {
- if (r.mode === RECORD_TYPE_PIPE || r.mode === RECORD_TYPE_BINDING_PIPE) {
- pipes.push($__0.pipeNames[r.selfIndex]);
- }
- }));
- return pipes;
- },
- genDetectChanges: function() {
- var body = this.genDetectChangesBody();
- return detectChangesTemplate(this.typeName, body);
- },
- genCallOnAllChangesDone: function() {
- var notifications = [];
- var dirs = this.directiveRecords;
- for (var i = dirs.length - 1; i >= 0; --i) {
- var dir = dirs[i];
- if (dir.callOnAllChangesDone) {
- var directive = ("this.directive_" + dir.directiveIndex.name);
- notifications.push(onAllChangesDoneTemplate(directive));
- }
- }
- return callOnAllChangesDoneTemplate(this.typeName, notifications.join(";\n"));
- },
- genDetectChangesBody: function() {
- var $__0 = this;
- var rec = this.records.map((function(r) {
- return $__0.genRecord(r);
- })).join("\n");
- return detectChangesBodyTemplate(this.genLocalDefinitions(), this.genChangeDefinitions(), rec);
- },
- genLocalDefinitions: function() {
- return localDefinitionsTemplate(this.localNames);
- },
- genChangeDefinitions: function() {
- return changeDefinitionsTemplate(this.changeNames);
- },
- genRecord: function(r) {
- if (r.mode === RECORD_TYPE_PIPE || r.mode === RECORD_TYPE_BINDING_PIPE) {
- return this.genPipeCheck(r);
- } else {
- return this.genReferenceCheck(r);
- }
- },
- genPipeCheck: function(r) {
- var context = this.localNames[r.contextIndex];
- var oldValue = this.fieldNames[r.selfIndex];
- var newValue = this.localNames[r.selfIndex];
- var change = this.changeNames[r.selfIndex];
- var pipe = this.pipeNames[r.selfIndex];
- var cdRef = r.mode === RECORD_TYPE_BINDING_PIPE ? "this.ref" : "null";
- var update = this.genUpdateDirectiveOrElement(r);
- var addToChanges = this.genAddToChanges(r);
- var lastInDirective = this.genLastInDirective(r);
- return pipeCheckTemplate(r.selfIndex - 1, context, cdRef, pipe, r.name, oldValue, newValue, change, update, addToChanges, lastInDirective);
- },
- genReferenceCheck: function(r) {
- var oldValue = this.fieldNames[r.selfIndex];
- var newValue = this.localNames[r.selfIndex];
- var change = this.changeNames[r.selfIndex];
- var assignment = this.genUpdateCurrentValue(r);
- var update = this.genUpdateDirectiveOrElement(r);
- var addToChanges = this.genAddToChanges(r);
- var lastInDirective = this.genLastInDirective(r);
- var check = referenceCheckTemplate(r.selfIndex - 1, assignment, oldValue, newValue, change, update, addToChanges, lastInDirective);
- if (r.isPureFunction()) {
- return this.ifChangedGuard(r, check);
- } else {
- return check;
- }
- },
- genUpdateCurrentValue: function(r) {
- var context = this.getContext(r);
- var newValue = this.localNames[r.selfIndex];
- var args = this.genArgs(r);
- switch (r.mode) {
- case RECORD_TYPE_SELF:
- return assignmentTemplate(newValue, context);
- case RECORD_TYPE_CONST:
- return (newValue + " = " + this.genLiteral(r.funcOrValue));
- case RECORD_TYPE_PROPERTY:
- return assignmentTemplate(newValue, (context + "." + r.name));
- case RECORD_TYPE_LOCAL:
- return assignmentTemplate(newValue, (LOCALS_ACCESSOR + ".get('" + r.name + "')"));
- case RECORD_TYPE_INVOKE_METHOD:
- return assignmentTemplate(newValue, (context + "." + r.name + "(" + args + ")"));
- case RECORD_TYPE_INVOKE_CLOSURE:
- return assignmentTemplate(newValue, (context + "(" + args + ")"));
- case RECORD_TYPE_PRIMITIVE_OP:
- return assignmentTemplate(newValue, (UTIL + "." + r.name + "(" + args + ")"));
- case RECORD_TYPE_INTERPOLATE:
- return assignmentTemplate(newValue, this.genInterpolation(r));
- case RECORD_TYPE_KEYED_ACCESS:
- var key = this.localNames[r.args[0]];
- return assignmentTemplate(newValue, (context + "[" + key + "]"));
- default:
- throw new BaseException(("Unknown operation " + r.mode));
- }
- },
- getContext: function(r) {
- if (r.contextIndex == -1) {
- return this.getDirective(r.directiveIndex);
- } else {
- return this.localNames[r.contextIndex];
- }
- },
- ifChangedGuard: function(r, body) {
- var $__0 = this;
- return ifChangedGuardTemplate(r.args.map((function(a) {
- return $__0.changeNames[a];
- })), body);
- },
- genInterpolation: function(r) {
- var res = "";
- for (var i = 0; i < r.args.length; ++i) {
- res += this.genLiteral(r.fixedArgs[i]);
- res += " + ";
- res += this.localNames[r.args[i]];
- res += " + ";
- }
- res += this.genLiteral(r.fixedArgs[r.args.length]);
- return res;
- },
- genLiteral: function(value) {
- return JSON.stringify(value);
- },
- genUpdateDirectiveOrElement: function(r) {
- if (!r.lastInBinding)
- return "";
- var newValue = this.localNames[r.selfIndex];
- var oldValue = this.fieldNames[r.selfIndex];
- var br = r.bindingRecord;
- if (br.isDirective()) {
- var directiveProperty = (this.getDirective(br.directiveRecord.directiveIndex) + "." + br.propertyName);
- return updateDirectiveTemplate(oldValue, newValue, directiveProperty);
- } else {
- return updateElementTemplate(oldValue, newValue);
- }
- },
- genAddToChanges: function(r) {
- var newValue = this.localNames[r.selfIndex];
- var oldValue = this.fieldNames[r.selfIndex];
- return r.bindingRecord.callOnChange() ? addToChangesTemplate(oldValue, newValue) : "";
- },
- genLastInDirective: function(r) {
- var onChanges = this.genNotifyOnChanges(r);
- var onPush = this.genNotifyOnPushDetectors(r);
- return lastInDirectiveTemplate(onChanges, onPush);
- },
- genNotifyOnChanges: function(r) {
- var br = r.bindingRecord;
- if (r.lastInDirective && br.callOnChange()) {
- return notifyOnChangesTemplate(this.getDirective(br.directiveRecord.directiveIndex));
- } else {
- return "";
- }
- },
- genNotifyOnPushDetectors: function(r) {
- var br = r.bindingRecord;
- if (r.lastInDirective && br.isOnPushChangeDetection()) {
- return notifyOnPushDetectorsTemplate(this.getDetector(br.directiveRecord.directiveIndex));
- } else {
- return "";
- }
- },
- genArgs: function(r) {
- var $__0 = this;
- return r.args.map((function(arg) {
- return $__0.localNames[arg];
- })).join(", ");
+ isLifeCycleRecord: function() {
+ return this.mode === RecordType.DIRECTIVE_LIFECYCLE;
}
}, {});
}());
- $__export("ChangeDetectorJITGenerator", ChangeDetectorJITGenerator);
+ $__export("ProtoRecord", ProtoRecord);
}
};
});
System.register("angular2/src/change_detection/directive_record", ["angular2/src/change_detection/constants", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/directive_record";
var ON_PUSH,
StringWrapper,
+ normalizeBool,
DirectiveIndex,
DirectiveRecord;
return {
setters: [function($__m) {
ON_PUSH = $__m.ON_PUSH;
}, function($__m) {
StringWrapper = $__m.StringWrapper;
+ normalizeBool = $__m.normalizeBool;
}],
execute: function() {
DirectiveIndex = (function() {
function DirectiveIndex(elementIndex, directiveIndex) {
this.elementIndex = elementIndex;
@@ -7731,14 +8507,23 @@
return (this.elementIndex + "_" + this.directiveIndex);
}}, {});
}());
$__export("DirectiveIndex", DirectiveIndex);
DirectiveRecord = (function() {
- function DirectiveRecord(directiveIndex, callOnAllChangesDone, callOnChange, changeDetection) {
+ function DirectiveRecord() {
+ var $__1 = arguments[0] !== (void 0) ? arguments[0] : {},
+ directiveIndex = $__1.directiveIndex,
+ callOnAllChangesDone = $__1.callOnAllChangesDone,
+ callOnChange = $__1.callOnChange,
+ callOnCheck = $__1.callOnCheck,
+ callOnInit = $__1.callOnInit,
+ changeDetection = $__1.changeDetection;
this.directiveIndex = directiveIndex;
- this.callOnAllChangesDone = callOnAllChangesDone;
- this.callOnChange = callOnChange;
+ this.callOnAllChangesDone = normalizeBool(callOnAllChangesDone);
+ this.callOnChange = normalizeBool(callOnChange);
+ this.callOnCheck = normalizeBool(callOnCheck);
+ this.callOnInit = normalizeBool(callOnInit);
this.changeDetection = changeDetection;
}
return ($traceurRuntime.createClass)(DirectiveRecord, {isOnPushChangeDetection: function() {
return StringWrapper.equals(this.changeDetection, ON_PUSH);
}}, {});
@@ -7751,60 +8536,60 @@
System.register("angular2/src/change_detection/coalesce", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/proto_record"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/coalesce";
var isPresent,
ListWrapper,
- MapWrapper,
- RECORD_TYPE_SELF,
+ Map,
+ RecordType,
ProtoRecord;
function coalesce(records) {
- var res = ListWrapper.create();
- var indexMap = MapWrapper.create();
+ var res = [];
+ var indexMap = new Map();
for (var i = 0; i < records.length; ++i) {
var r = records[i];
var record = _replaceIndices(r, res.length + 1, indexMap);
var matchingRecord = _findMatching(record, res);
if (isPresent(matchingRecord) && record.lastInBinding) {
- ListWrapper.push(res, _selfRecord(record, matchingRecord.selfIndex, res.length + 1));
- MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
+ res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1));
+ indexMap.set(r.selfIndex, matchingRecord.selfIndex);
} else if (isPresent(matchingRecord) && !record.lastInBinding) {
- MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
+ indexMap.set(r.selfIndex, matchingRecord.selfIndex);
} else {
- ListWrapper.push(res, record);
- MapWrapper.set(indexMap, r.selfIndex, record.selfIndex);
+ res.push(record);
+ indexMap.set(r.selfIndex, record.selfIndex);
}
}
return res;
}
function _selfRecord(r, contextIndex, selfIndex) {
- return new ProtoRecord(RECORD_TYPE_SELF, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective);
+ return new ProtoRecord(RecordType.SELF, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective);
}
function _findMatching(r, rs) {
return ListWrapper.find(rs, (function(rr) {
- return rr.mode === r.mode && rr.funcOrValue === r.funcOrValue && rr.contextIndex === r.contextIndex && ListWrapper.equals(rr.args, r.args);
+ return rr.mode !== RecordType.DIRECTIVE_LIFECYCLE && rr.mode === r.mode && rr.funcOrValue === r.funcOrValue && rr.contextIndex === r.contextIndex && ListWrapper.equals(rr.args, r.args);
}));
}
function _replaceIndices(r, selfIndex, indexMap) {
var args = ListWrapper.map(r.args, (function(a) {
return _map(indexMap, a);
}));
var contextIndex = _map(indexMap, r.contextIndex);
return new ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective);
}
function _map(indexMap, value) {
- var r = MapWrapper.get(indexMap, value);
+ var r = indexMap.get(value);
return isPresent(r) ? r : value;
}
$__export("coalesce", coalesce);
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
- MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
}, function($__m) {
- RECORD_TYPE_SELF = $__m.RECORD_TYPE_SELF;
+ RecordType = $__m.RecordType;
ProtoRecord = $__m.ProtoRecord;
}],
execute: function() {
}
};
@@ -7813,29 +8598,39 @@
System.register("angular2/src/change_detection/binding_record", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/binding_record";
var isPresent,
DIRECTIVE,
- ELEMENT,
+ DIRECTIVE_LIFECYCLE,
+ ELEMENT_PROPERTY,
+ ELEMENT_ATTRIBUTE,
+ ELEMENT_CLASS,
+ ELEMENT_STYLE,
TEXT_NODE,
BindingRecord;
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
}],
execute: function() {
DIRECTIVE = "directive";
- ELEMENT = "element";
+ DIRECTIVE_LIFECYCLE = "directiveLifecycle";
+ ELEMENT_PROPERTY = "elementProperty";
+ ELEMENT_ATTRIBUTE = "elementAttribute";
+ ELEMENT_CLASS = "elementClass";
+ ELEMENT_STYLE = "elementStyle";
TEXT_NODE = "textNode";
BindingRecord = (function() {
- function BindingRecord(mode, implicitReceiver, ast, elementIndex, propertyName, setter, directiveRecord) {
+ function BindingRecord(mode, implicitReceiver, ast, elementIndex, propertyName, propertyUnit, setter, lifecycleEvent, directiveRecord) {
this.mode = mode;
this.implicitReceiver = implicitReceiver;
this.ast = ast;
this.elementIndex = elementIndex;
this.propertyName = propertyName;
+ this.propertyUnit = propertyUnit;
this.setter = setter;
+ this.lifecycleEvent = lifecycleEvent;
this.directiveRecord = directiveRecord;
}
return ($traceurRuntime.createClass)(BindingRecord, {
callOnChange: function() {
return isPresent(this.directiveRecord) && this.directiveRecord.callOnChange;
@@ -7844,28 +8639,67 @@
return isPresent(this.directiveRecord) && this.directiveRecord.isOnPushChangeDetection();
},
isDirective: function() {
return this.mode === DIRECTIVE;
},
- isElement: function() {
- return this.mode === ELEMENT;
+ isDirectiveLifecycle: function() {
+ return this.mode === DIRECTIVE_LIFECYCLE;
},
+ isElementProperty: function() {
+ return this.mode === ELEMENT_PROPERTY;
+ },
+ isElementAttribute: function() {
+ return this.mode === ELEMENT_ATTRIBUTE;
+ },
+ isElementClass: function() {
+ return this.mode === ELEMENT_CLASS;
+ },
+ isElementStyle: function() {
+ return this.mode === ELEMENT_STYLE;
+ },
isTextNode: function() {
return this.mode === TEXT_NODE;
}
}, {
createForDirective: function(ast, propertyName, setter, directiveRecord) {
- return new BindingRecord(DIRECTIVE, 0, ast, 0, propertyName, setter, directiveRecord);
+ return new BindingRecord(DIRECTIVE, 0, ast, 0, propertyName, null, setter, null, directiveRecord);
},
- createForElement: function(ast, elementIndex, propertyName) {
- return new BindingRecord(ELEMENT, 0, ast, elementIndex, propertyName, null, null);
+ createDirectiveOnCheck: function(directiveRecord) {
+ return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onCheck", directiveRecord);
},
+ createDirectiveOnInit: function(directiveRecord) {
+ return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onInit", directiveRecord);
+ },
+ createDirectiveOnChange: function(directiveRecord) {
+ return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onChange", directiveRecord);
+ },
+ createForElementProperty: function(ast, elementIndex, propertyName) {
+ return new BindingRecord(ELEMENT_PROPERTY, 0, ast, elementIndex, propertyName, null, null, null, null);
+ },
+ createForElementAttribute: function(ast, elementIndex, attributeName) {
+ return new BindingRecord(ELEMENT_ATTRIBUTE, 0, ast, elementIndex, attributeName, null, null, null, null);
+ },
+ createForElementClass: function(ast, elementIndex, className) {
+ return new BindingRecord(ELEMENT_CLASS, 0, ast, elementIndex, className, null, null, null, null);
+ },
+ createForElementStyle: function(ast, elementIndex, styleName, unit) {
+ return new BindingRecord(ELEMENT_STYLE, 0, ast, elementIndex, styleName, unit, null, null, null);
+ },
createForHostProperty: function(directiveIndex, ast, propertyName) {
- return new BindingRecord(ELEMENT, directiveIndex, ast, directiveIndex.elementIndex, propertyName, null, null);
+ return new BindingRecord(ELEMENT_PROPERTY, directiveIndex, ast, directiveIndex.elementIndex, propertyName, null, null, null, null);
},
+ createForHostAttribute: function(directiveIndex, ast, attributeName) {
+ return new BindingRecord(ELEMENT_ATTRIBUTE, directiveIndex, ast, directiveIndex.elementIndex, attributeName, null, null, null, null);
+ },
+ createForHostClass: function(directiveIndex, ast, className) {
+ return new BindingRecord(ELEMENT_CLASS, directiveIndex, ast, directiveIndex.elementIndex, className, null, null, null, null);
+ },
+ createForHostStyle: function(directiveIndex, ast, styleName, unit) {
+ return new BindingRecord(ELEMENT_STYLE, directiveIndex, ast, directiveIndex.elementIndex, styleName, unit, null, null, null);
+ },
createForTextNode: function(ast, elementIndex) {
- return new BindingRecord(TEXT_NODE, 0, ast, elementIndex, null, null, null);
+ return new BindingRecord(TEXT_NODE, 0, ast, elementIndex, null, null, null, null, null);
}
});
}());
$__export("BindingRecord", BindingRecord);
}
@@ -7877,18 +8711,20 @@
var __moduleName = "angular2/src/change_detection/pipes/pipe_registry";
var __decorate,
__metadata,
ListWrapper,
isBlank,
+ isPresent,
BaseException,
Injectable,
PipeRegistry;
return {
setters: [function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
isBlank = $__m.isBlank;
+ isPresent = $__m.isPresent;
BaseException = $__m.BaseException;
}, function($__m) {
Injectable = $__m.Injectable;
}],
execute: function() {
@@ -7914,23 +8750,37 @@
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
PipeRegistry = (($traceurRuntime.createClass)(function(config) {
this.config = config;
- }, {get: function(type, obj, cdRef) {
- var listOfConfigs = this.config[type];
- if (isBlank(listOfConfigs)) {
+ }, {
+ get: function(type, obj, cdRef, existingPipe) {
+ if (isPresent(existingPipe) && existingPipe.supports(obj))
+ return existingPipe;
+ if (isPresent(existingPipe))
+ existingPipe.onDestroy();
+ var factories = this._getListOfFactories(type, obj);
+ var factory = this._getMatchingFactory(factories, type, obj);
+ return factory.create(cdRef);
+ },
+ _getListOfFactories: function(type, obj) {
+ var listOfFactories = this.config[type];
+ if (isBlank(listOfFactories)) {
throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'"));
}
- var matchingConfig = ListWrapper.find(listOfConfigs, (function(pipeConfig) {
- return pipeConfig.supports(obj);
+ return listOfFactories;
+ },
+ _getMatchingFactory: function(listOfFactories, type, obj) {
+ var matchingFactory = ListWrapper.find(listOfFactories, (function(pipeFactory) {
+ return pipeFactory.supports(obj);
}));
- if (isBlank(matchingConfig)) {
+ if (isBlank(matchingFactory)) {
throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'"));
}
- return matchingConfig.create(cdRef);
- }}, {}));
+ return matchingFactory;
+ }
+ }, {}));
$__export("PipeRegistry", PipeRegistry);
$__export("PipeRegistry", PipeRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [Object])], PipeRegistry));
}
};
});
@@ -7940,23 +8790,21 @@
var __moduleName = "angular2/src/change_detection/pipes/null_pipe";
var __decorate,
__metadata,
isBlank,
CONST,
- Pipe,
+ BasePipe,
WrappedValue,
- PipeFactory,
NullPipeFactory,
NullPipe;
return {
setters: [function($__m) {
isBlank = $__m.isBlank;
CONST = $__m.CONST;
}, function($__m) {
- Pipe = $__m.Pipe;
+ BasePipe = $__m.BasePipe;
WrappedValue = $__m.WrappedValue;
- PipeFactory = $__m.PipeFactory;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -7977,28 +8825,27 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- NullPipeFactory = (function($__super) {
- function $__0() {
- $traceurRuntime.superConstructor($__0).call(this);
+ NullPipeFactory = (($traceurRuntime.createClass)(function() {}, {
+ supports: function(obj) {
+ return NullPipe.supportsObj(obj);
+ },
+ create: function(cdRef) {
+ return new NullPipe();
}
- return ($traceurRuntime.createClass)($__0, {
- supports: function(obj) {
- return NullPipe.supportsObj(obj);
- },
- create: function(cdRef) {
- return new NullPipe();
- }
- }, {}, $__super);
- }(PipeFactory));
+ }, {}));
$__export("NullPipeFactory", NullPipeFactory);
$__export("NullPipeFactory", NullPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], NullPipeFactory));
NullPipe = (function($__super) {
function NullPipe() {
- $traceurRuntime.superConstructor(NullPipe).call(this);
+ var $__3;
+ for (var args = [],
+ $__2 = 0; $__2 < arguments.length; $__2++)
+ args[$__2] = arguments[$__2];
+ ($__3 = $traceurRuntime.superConstructor(NullPipe)).call.apply($__3, $traceurRuntime.spread([this], args));
this.called = false;
}
return ($traceurRuntime.createClass)(NullPipe, {
supports: function(obj) {
return NullPipe.supportsObj(obj);
@@ -8012,34 +8859,395 @@
}
}
}, {supportsObj: function(obj) {
return isBlank(obj);
}}, $__super);
- }(Pipe));
+ }(BasePipe));
$__export("NullPipe", NullPipe);
}
};
});
+System.register("angular2/src/change_detection/change_detection_jit_generator", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/change_detection/change_detection_jit_generator";
+ var BaseException,
+ ListWrapper,
+ AbstractChangeDetector,
+ ChangeDetectionUtil,
+ RecordType,
+ ABSTRACT_CHANGE_DETECTOR,
+ UTIL,
+ DISPATCHER_ACCESSOR,
+ PIPE_REGISTRY_ACCESSOR,
+ PROTOS_ACCESSOR,
+ DIRECTIVES_ACCESSOR,
+ CONTEXT_ACCESSOR,
+ IS_CHANGED_LOCAL,
+ CHANGES_LOCAL,
+ LOCALS_ACCESSOR,
+ MODE_ACCESSOR,
+ CURRENT_PROTO,
+ ALREADY_CHECKED_ACCESSOR,
+ ChangeDetectorJITGenerator;
+ function _sanitizeName(s) {
+ return s.replace(new RegExp("\\W", "g"), '');
+ }
+ return {
+ setters: [function($__m) {
+ BaseException = $__m.BaseException;
+ }, function($__m) {
+ ListWrapper = $__m.ListWrapper;
+ }, function($__m) {
+ AbstractChangeDetector = $__m.AbstractChangeDetector;
+ }, function($__m) {
+ ChangeDetectionUtil = $__m.ChangeDetectionUtil;
+ }, function($__m) {
+ RecordType = $__m.RecordType;
+ }],
+ execute: function() {
+ ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector";
+ UTIL = "ChangeDetectionUtil";
+ DISPATCHER_ACCESSOR = "this.dispatcher";
+ PIPE_REGISTRY_ACCESSOR = "this.pipeRegistry";
+ PROTOS_ACCESSOR = "this.protos";
+ DIRECTIVES_ACCESSOR = "this.directiveRecords";
+ CONTEXT_ACCESSOR = "this.context";
+ IS_CHANGED_LOCAL = "isChanged";
+ CHANGES_LOCAL = "changes";
+ LOCALS_ACCESSOR = "this.locals";
+ MODE_ACCESSOR = "this.mode";
+ CURRENT_PROTO = "currentProto";
+ ALREADY_CHECKED_ACCESSOR = "this.alreadyChecked";
+ ChangeDetectorJITGenerator = (function() {
+ function ChangeDetectorJITGenerator(id, changeDetectionStrategy, records, directiveRecords) {
+ this.id = id;
+ this.changeDetectionStrategy = changeDetectionStrategy;
+ this.records = records;
+ this.directiveRecords = directiveRecords;
+ this._localNames = this._getLocalNames(records);
+ this._changeNames = this._getChangeNames(this._localNames);
+ this._fieldNames = this._getFieldNames(this._localNames);
+ this._pipeNames = this._getPipeNames(this._localNames);
+ }
+ return ($traceurRuntime.createClass)(ChangeDetectorJITGenerator, {
+ _getLocalNames: function(records) {
+ var index = 0;
+ var names = records.map((function(r) {
+ return _sanitizeName(("" + r.name + index++));
+ }));
+ return ["context"].concat(names);
+ },
+ _getChangeNames: function(_localNames) {
+ return _localNames.map((function(n) {
+ return ("change_" + n);
+ }));
+ },
+ _getFieldNames: function(_localNames) {
+ return _localNames.map((function(n) {
+ return ("this." + n);
+ }));
+ },
+ _getPipeNames: function(_localNames) {
+ return _localNames.map((function(n) {
+ return ("this." + n + "_pipe");
+ }));
+ },
+ generate: function() {
+ var $__0 = this;
+ var typeName = _sanitizeName(("ChangeDetector_" + this.id));
+ var classDefinition = ("\n var " + typeName + " = function " + typeName + "(dispatcher, pipeRegistry, protos, directiveRecords) {\n " + ABSTRACT_CHANGE_DETECTOR + ".call(this, " + JSON.stringify(this.id) + ");\n " + DISPATCHER_ACCESSOR + " = dispatcher;\n " + PIPE_REGISTRY_ACCESSOR + " = pipeRegistry;\n " + PROTOS_ACCESSOR + " = protos;\n " + DIRECTIVES_ACCESSOR + " = directiveRecords;\n " + LOCALS_ACCESSOR + " = null;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n " + this._genFieldDefinitions() + "\n }\n\n " + typeName + ".prototype = Object.create(" + ABSTRACT_CHANGE_DETECTOR + ".prototype);\n\n " + typeName + ".prototype.detectChangesInRecords = function(throwOnChange) {\n if (!this.hydrated()) {\n " + UTIL + ".throwDehydrated();\n }\n " + this._genLocalDefinitions() + "\n " + this._genChangeDefinitions() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CURRENT_PROTO + ";\n var " + CHANGES_LOCAL + " = null;\n\n context = " + CONTEXT_ACCESSOR + ";\n\n " + this.records.map((function(r) {
+ return $__0._genRecord(r);
+ })).join("\n") + "\n\n " + ALREADY_CHECKED_ACCESSOR + " = true;\n }\n\n " + typeName + ".prototype.callOnAllChangesDone = function() {\n " + this._genCallOnAllChangesDoneBody() + "\n }\n\n " + typeName + ".prototype.hydrate = function(context, locals, directives) {\n " + MODE_ACCESSOR + " = \"" + ChangeDetectionUtil.changeDetectionMode(this.changeDetectionStrategy) + "\";\n " + CONTEXT_ACCESSOR + " = context;\n " + LOCALS_ACCESSOR + " = locals;\n " + this._genHydrateDirectives() + "\n " + this._genHydrateDetectors() + "\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n }\n\n " + typeName + ".prototype.dehydrate = function() {\n " + this._genPipeOnDestroy() + "\n " + this._genFieldDefinitions() + "\n " + LOCALS_ACCESSOR + " = null;\n }\n\n " + typeName + ".prototype.hydrated = function() {\n return " + CONTEXT_ACCESSOR + " !== null;\n }\n\n return function(dispatcher, pipeRegistry) {\n return new " + typeName + "(dispatcher, pipeRegistry, protos, directiveRecords);\n }\n ");
+ return new Function('AbstractChangeDetector', 'ChangeDetectionUtil', 'protos', 'directiveRecords', classDefinition)(AbstractChangeDetector, ChangeDetectionUtil, this.records, this.directiveRecords);
+ },
+ _genGetDirectiveFieldNames: function() {
+ var $__0 = this;
+ return this.directiveRecords.map((function(d) {
+ return $__0._genGetDirective(d.directiveIndex);
+ }));
+ },
+ _genGetDetectorFieldNames: function() {
+ var $__0 = this;
+ return this.directiveRecords.filter((function(r) {
+ return r.isOnPushChangeDetection();
+ })).map((function(d) {
+ return $__0._genGetDetector(d.directiveIndex);
+ }));
+ },
+ _genGetDirective: function(d) {
+ return ("this.directive_" + d.name);
+ },
+ _genGetDetector: function(d) {
+ return ("this.detector_" + d.name);
+ },
+ _getNonNullPipeNames: function() {
+ var $__0 = this;
+ var pipes = [];
+ this.records.forEach((function(r) {
+ if (r.isPipeRecord()) {
+ pipes.push($__0._pipeNames[r.selfIndex]);
+ }
+ }));
+ return pipes;
+ },
+ _genFieldDefinitions: function() {
+ var fields = [];
+ fields = fields.concat(this._fieldNames);
+ fields = fields.concat(this._getNonNullPipeNames());
+ fields = fields.concat(this._genGetDirectiveFieldNames());
+ fields = fields.concat(this._genGetDetectorFieldNames());
+ return fields.map((function(n) {
+ return n == CONTEXT_ACCESSOR ? (n + " = null;") : (n + " = " + UTIL + ".uninitialized();");
+ })).join("\n");
+ },
+ _genHydrateDirectives: function() {
+ var directiveFieldNames = this._genGetDirectiveFieldNames();
+ var lines = ListWrapper.createFixedSize(directiveFieldNames.length);
+ for (var i = 0,
+ iLen = directiveFieldNames.length; i < iLen; ++i) {
+ lines[i] = (directiveFieldNames[i] + " = directives.getDirectiveFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);");
+ }
+ return lines.join('\n');
+ },
+ _genHydrateDetectors: function() {
+ var detectorFieldNames = this._genGetDetectorFieldNames();
+ var lines = ListWrapper.createFixedSize(detectorFieldNames.length);
+ for (var i = 0,
+ iLen = detectorFieldNames.length; i < iLen; ++i) {
+ lines[i] = (detectorFieldNames[i] + " =\n directives.getDetectorFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);");
+ }
+ return lines.join('\n');
+ },
+ _genPipeOnDestroy: function() {
+ return this._getNonNullPipeNames().map((function(p) {
+ return (p + ".onDestroy();");
+ })).join("\n");
+ },
+ _genCallOnAllChangesDoneBody: function() {
+ var notifications = [];
+ var dirs = this.directiveRecords;
+ for (var i = dirs.length - 1; i >= 0; --i) {
+ var dir = dirs[i];
+ if (dir.callOnAllChangesDone) {
+ notifications.push((this._genGetDirective(dir.directiveIndex) + ".onAllChangesDone();"));
+ }
+ }
+ var directiveNotifications = notifications.join("\n");
+ return ("\n this.dispatcher.notifyOnAllChangesDone();\n " + directiveNotifications + "\n ");
+ },
+ _genLocalDefinitions: function() {
+ return this._localNames.map((function(n) {
+ return ("var " + n + ";");
+ })).join("\n");
+ },
+ _genChangeDefinitions: function() {
+ return this._changeNames.map((function(n) {
+ return ("var " + n + " = false;");
+ })).join("\n");
+ },
+ _genRecord: function(r) {
+ var rec;
+ if (r.isLifeCycleRecord()) {
+ rec = this._genDirectiveLifecycle(r);
+ } else if (r.isPipeRecord()) {
+ rec = this._genPipeCheck(r);
+ } else {
+ rec = this._genReferenceCheck(r);
+ }
+ return ("" + rec + this._maybeGenLastInDirective(r));
+ },
+ _genDirectiveLifecycle: function(r) {
+ if (r.name === "onCheck") {
+ return this._genOnCheck(r);
+ } else if (r.name === "onInit") {
+ return this._genOnInit(r);
+ } else if (r.name === "onChange") {
+ return this._genOnChange(r);
+ } else {
+ throw new BaseException(("Unknown lifecycle event '" + r.name + "'"));
+ }
+ },
+ _genPipeCheck: function(r) {
+ var context = this._localNames[r.contextIndex];
+ var oldValue = this._fieldNames[r.selfIndex];
+ var newValue = this._localNames[r.selfIndex];
+ var change = this._changeNames[r.selfIndex];
+ var pipe = this._pipeNames[r.selfIndex];
+ var cdRef = "this.ref";
+ var protoIndex = r.selfIndex - 1;
+ var pipeType = r.name;
+ return ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n if (" + pipe + " === " + UTIL + ".uninitialized()) {\n " + pipe + " = " + PIPE_REGISTRY_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n } else if (!" + pipe + ".supports(" + context + ")) {\n " + pipe + ".onDestroy();\n " + pipe + " = " + PIPE_REGISTRY_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n }\n\n " + newValue + " = " + pipe + ".transform(" + context + ");\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + UTIL + ".unwrapValue(" + newValue + ");\n " + change + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n ");
+ },
+ _genReferenceCheck: function(r) {
+ var $__0 = this;
+ var oldValue = this._fieldNames[r.selfIndex];
+ var newValue = this._localNames[r.selfIndex];
+ var protoIndex = r.selfIndex - 1;
+ var check = ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n " + this._genUpdateCurrentValue(r) + "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._changeNames[r.selfIndex] + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n ");
+ if (r.isPureFunction()) {
+ var condition = r.args.map((function(a) {
+ return $__0._changeNames[a];
+ })).join(" || ");
+ return ("if (" + condition + ") { " + check + " } else { " + newValue + " = " + oldValue + "; }");
+ } else {
+ return check;
+ }
+ },
+ _genUpdateCurrentValue: function(r) {
+ var $__0 = this;
+ var context = (r.contextIndex == -1) ? this._genGetDirective(r.directiveIndex) : this._localNames[r.contextIndex];
+ var newValue = this._localNames[r.selfIndex];
+ var argString = r.args.map((function(arg) {
+ return $__0._localNames[arg];
+ })).join(", ");
+ var rhs;
+ switch (r.mode) {
+ case RecordType.SELF:
+ rhs = context;
+ break;
+ case RecordType.CONST:
+ rhs = JSON.stringify(r.funcOrValue);
+ break;
+ case RecordType.PROPERTY:
+ rhs = (context + "." + r.name);
+ break;
+ case RecordType.SAFE_PROPERTY:
+ rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name);
+ break;
+ case RecordType.LOCAL:
+ rhs = (LOCALS_ACCESSOR + ".get('" + r.name + "')");
+ break;
+ case RecordType.INVOKE_METHOD:
+ rhs = (context + "." + r.name + "(" + argString + ")");
+ break;
+ case RecordType.SAFE_INVOKE_METHOD:
+ rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name + "(" + argString + ")");
+ break;
+ case RecordType.INVOKE_CLOSURE:
+ rhs = (context + "(" + argString + ")");
+ break;
+ case RecordType.PRIMITIVE_OP:
+ rhs = (UTIL + "." + r.name + "(" + argString + ")");
+ break;
+ case RecordType.INTERPOLATE:
+ rhs = this._genInterpolation(r);
+ break;
+ case RecordType.KEYED_ACCESS:
+ rhs = (context + "[" + this._localNames[r.args[0]] + "]");
+ break;
+ default:
+ throw new BaseException(("Unknown operation " + r.mode));
+ }
+ return (newValue + " = " + rhs);
+ },
+ _genInterpolation: function(r) {
+ var res = "";
+ for (var i = 0; i < r.args.length; ++i) {
+ res += JSON.stringify(r.fixedArgs[i]);
+ res += " + ";
+ res += this._localNames[r.args[i]];
+ res += " + ";
+ }
+ res += JSON.stringify(r.fixedArgs[r.args.length]);
+ return res;
+ },
+ _genUpdateDirectiveOrElement: function(r) {
+ if (!r.lastInBinding)
+ return "";
+ var newValue = this._localNames[r.selfIndex];
+ var oldValue = this._fieldNames[r.selfIndex];
+ var br = r.bindingRecord;
+ if (br.isDirective()) {
+ var directiveProperty = (this._genGetDirective(br.directiveRecord.directiveIndex) + "." + br.propertyName);
+ return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + IS_CHANGED_LOCAL + " = true;\n ");
+ } else {
+ return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + DISPATCHER_ACCESSOR + ".notifyOnBinding(" + CURRENT_PROTO + ".bindingRecord, " + newValue + ");\n ");
+ }
+ },
+ _genThrowOnChangeCheck: function(oldValue, newValue) {
+ return ("\n if(throwOnChange) {\n " + UTIL + ".throwOnChange(" + CURRENT_PROTO + ", " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n }\n ");
+ },
+ _genAddToChanges: function(r) {
+ var newValue = this._localNames[r.selfIndex];
+ var oldValue = this._fieldNames[r.selfIndex];
+ if (!r.bindingRecord.callOnChange())
+ return "";
+ return ("\n " + CHANGES_LOCAL + " = " + UTIL + ".addChange(\n " + CHANGES_LOCAL + ", " + CURRENT_PROTO + ".bindingRecord.propertyName,\n " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n ");
+ },
+ _maybeGenLastInDirective: function(r) {
+ if (!r.lastInDirective)
+ return "";
+ return ("\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n ");
+ },
+ _genOnCheck: function(r) {
+ var br = r.bindingRecord;
+ return ("if (!throwOnChange) " + this._genGetDirective(br.directiveRecord.directiveIndex) + ".onCheck();");
+ },
+ _genOnInit: function(r) {
+ var br = r.bindingRecord;
+ return ("if (!throwOnChange && !" + ALREADY_CHECKED_ACCESSOR + ") " + this._genGetDirective(br.directiveRecord.directiveIndex) + ".onInit();");
+ },
+ _genOnChange: function(r) {
+ var br = r.bindingRecord;
+ return ("if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._genGetDirective(br.directiveRecord.directiveIndex) + ".onChange(" + CHANGES_LOCAL + ");");
+ },
+ _genNotifyOnPushDetectors: function(r) {
+ var br = r.bindingRecord;
+ if (!r.lastInDirective || !br.isOnPushChangeDetection())
+ return "";
+ var retVal = ("\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._genGetDetector(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n ");
+ return retVal;
+ }
+ }, {});
+ }());
+ $__export("ChangeDetectorJITGenerator", ChangeDetectorJITGenerator);
+ }
+ };
+});
+
+System.register("angular2/src/change_detection/pregen_proto_change_detector", ["angular2/src/facade/lang"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/change_detection/pregen_proto_change_detector";
+ var BaseException,
+ PregenProtoChangeDetector;
+ return {
+ setters: [function($__m) {
+ BaseException = $__m.BaseException;
+ }],
+ execute: function() {
+ $__export("PregenProtoChangeDetectorFactory", Function);
+ PregenProtoChangeDetector = (function() {
+ function PregenProtoChangeDetector() {}
+ return ($traceurRuntime.createClass)(PregenProtoChangeDetector, {instantiate: function(dispatcher) {
+ throw new BaseException('Pregen change detection not supported in Js');
+ }}, {isSupported: function() {
+ return false;
+ }});
+ }());
+ $__export("PregenProtoChangeDetector", PregenProtoChangeDetector);
+ }
+ };
+});
+
System.register("angular2/src/change_detection/pipes/iterable_changes", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/iterable_changes";
var __decorate,
__metadata,
CONST,
isListLikeIterable,
iterateListLike,
- ListWrapper,
MapWrapper,
isBlank,
isPresent,
stringify,
getMapKey,
looseIdentical,
+ isArray,
WrappedValue,
- Pipe,
- PipeFactory,
+ BasePipe,
IterableChangesFactory,
IterableChanges,
CollectionChangeRecord,
_DuplicateItemRecordList,
_DuplicateMap;
@@ -8049,19 +9257,18 @@
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
stringify = $__m.stringify;
getMapKey = $__m.getMapKey;
looseIdentical = $__m.looseIdentical;
+ isArray = $__m.isArray;
}, function($__m) {
isListLikeIterable = $__m.isListLikeIterable;
iterateListLike = $__m.iterateListLike;
- ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
}, function($__m) {
WrappedValue = $__m.WrappedValue;
- Pipe = $__m.Pipe;
- PipeFactory = $__m.PipeFactory;
+ BasePipe = $__m.BasePipe;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -8082,23 +9289,18 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- IterableChangesFactory = (function($__super) {
- function $__1() {
- $traceurRuntime.superConstructor($__1).call(this);
+ IterableChangesFactory = (($traceurRuntime.createClass)(function() {}, {
+ supports: function(obj) {
+ return IterableChanges.supportsObj(obj);
+ },
+ create: function(cdRef) {
+ return new IterableChanges();
}
- return ($traceurRuntime.createClass)($__1, {
- supports: function(obj) {
- return IterableChanges.supportsObj(obj);
- },
- create: function(cdRef) {
- return new IterableChanges();
- }
- }, {}, $__super);
- }(PipeFactory));
+ }, {}));
$__export("IterableChangesFactory", IterableChangesFactory);
$__export("IterableChangesFactory", IterableChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], IterableChangesFactory));
IterableChanges = (function($__super) {
function IterableChanges() {
$traceurRuntime.superConstructor(IterableChanges).call(this);
@@ -8158,21 +9360,21 @@
},
transform: function(collection) {
if (this.check(collection)) {
return WrappedValue.wrap(this);
} else {
- return this;
+ return null;
}
},
check: function(collection) {
var $__0 = this;
this._reset();
var record = this._itHead;
var mayBeDirty = false;
var index;
var item;
- if (ListWrapper.isList(collection)) {
+ if (isArray(collection)) {
var list = collection;
this._length = collection.length;
for (index = 0; index < this._length; index++) {
item = list[index];
if (record === null || !looseIdentical(record.item, item)) {
@@ -8382,40 +9584,40 @@
},
toString: function() {
var record;
var list = [];
for (record = this._itHead; record !== null; record = record._next) {
- ListWrapper.push(list, record);
+ list.push(record);
}
var previous = [];
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
- ListWrapper.push(previous, record);
+ previous.push(record);
}
var additions = [];
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- ListWrapper.push(additions, record);
+ additions.push(record);
}
var moves = [];
for (record = this._movesHead; record !== null; record = record._nextMoved) {
- ListWrapper.push(moves, record);
+ moves.push(record);
}
var removals = [];
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
- ListWrapper.push(removals, record);
+ removals.push(record);
}
return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n";
}
}, {supportsObj: function(obj) {
return isListLikeIterable(obj);
}}, $__super);
- }(Pipe));
+ }(BasePipe));
$__export("IterableChanges", IterableChanges);
CollectionChangeRecord = (function() {
function CollectionChangeRecord(item) {
+ this.item = item;
this.currentIndex = null;
this.previousIndex = null;
- this.item = item;
this._nextPrevious = null;
this._prev = null;
this._next = null;
this._prevDup = null;
this._nextDup = null;
@@ -8473,41 +9675,41 @@
}
}, {});
}());
_DuplicateMap = (function() {
function _DuplicateMap() {
- this.map = MapWrapper.create();
+ this.map = new Map();
}
return ($traceurRuntime.createClass)(_DuplicateMap, {
put: function(record) {
var key = getMapKey(record.item);
- var duplicates = MapWrapper.get(this.map, key);
+ var duplicates = this.map.get(key);
if (!isPresent(duplicates)) {
duplicates = new _DuplicateItemRecordList();
- MapWrapper.set(this.map, key, duplicates);
+ this.map.set(key, duplicates);
}
duplicates.add(record);
},
get: function(value) {
var afterIndex = arguments[1] !== (void 0) ? arguments[1] : null;
var key = getMapKey(value);
- var recordList = MapWrapper.get(this.map, key);
+ var recordList = this.map.get(key);
return isBlank(recordList) ? null : recordList.get(value, afterIndex);
},
remove: function(record) {
var key = getMapKey(record.item);
- var recordList = MapWrapper.get(this.map, key);
+ var recordList = this.map.get(key);
if (recordList.remove(record)) {
MapWrapper.delete(this.map, key);
}
return record;
},
get isEmpty() {
return MapWrapper.size(this.map) === 0;
},
clear: function() {
- MapWrapper.clear(this.map);
+ this.map.clear();
},
toString: function() {
return '_DuplicateMap(' + stringify(this.map) + ')';
}
}, {});
@@ -8519,37 +9721,33 @@
System.register("angular2/src/change_detection/pipes/keyvalue_changes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/keyvalue_changes";
var __decorate,
__metadata,
- ListWrapper,
MapWrapper,
StringMapWrapper,
stringify,
looseIdentical,
isJsObject,
CONST,
WrappedValue,
- Pipe,
- PipeFactory,
+ BasePipe,
KeyValueChangesFactory,
KeyValueChanges,
KVChangeRecord;
return {
setters: [function($__m) {
- ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
StringMapWrapper = $__m.StringMapWrapper;
}, function($__m) {
stringify = $__m.stringify;
looseIdentical = $__m.looseIdentical;
isJsObject = $__m.isJsObject;
CONST = $__m.CONST;
}, function($__m) {
WrappedValue = $__m.WrappedValue;
- Pipe = $__m.Pipe;
- PipeFactory = $__m.PipeFactory;
+ BasePipe = $__m.BasePipe;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -8570,29 +9768,28 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- KeyValueChangesFactory = (function($__super) {
- function $__1() {
- $traceurRuntime.superConstructor($__1).call(this);
+ KeyValueChangesFactory = (($traceurRuntime.createClass)(function() {}, {
+ supports: function(obj) {
+ return KeyValueChanges.supportsObj(obj);
+ },
+ create: function(cdRef) {
+ return new KeyValueChanges();
}
- return ($traceurRuntime.createClass)($__1, {
- supports: function(obj) {
- return KeyValueChanges.supportsObj(obj);
- },
- create: function(cdRef) {
- return new KeyValueChanges();
- }
- }, {}, $__super);
- }(PipeFactory));
+ }, {}));
$__export("KeyValueChangesFactory", KeyValueChangesFactory);
$__export("KeyValueChangesFactory", KeyValueChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], KeyValueChangesFactory));
KeyValueChanges = (function($__super) {
function KeyValueChanges() {
- $traceurRuntime.superConstructor(KeyValueChanges).call(this);
- this._records = MapWrapper.create();
+ var $__4;
+ for (var args = [],
+ $__3 = 0; $__3 < arguments.length; $__3++)
+ args[$__3] = arguments[$__3];
+ ($__4 = $traceurRuntime.superConstructor(KeyValueChanges)).call.apply($__4, $traceurRuntime.spread([this], args));
+ this._records = new Map();
this._mapHead = null;
this._previousMapHead = null;
this._changesHead = null;
this._changesTail = null;
this._additionsHead = null;
@@ -8606,11 +9803,11 @@
},
transform: function(map) {
if (this.check(map)) {
return WrappedValue.wrap(this);
} else {
- return this;
+ return null;
}
},
get isDirty() {
return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null;
},
@@ -8666,15 +9863,15 @@
if (oldSeqRecord !== null) {
oldSeqRecord._next = null;
$__0._removeFromSeq(lastOldSeqRecord, oldSeqRecord);
$__0._addToRemovals(oldSeqRecord);
}
- if (MapWrapper.contains(records, key)) {
- newSeqRecord = MapWrapper.get(records, key);
+ if (records.has(key)) {
+ newSeqRecord = records.get(key);
} else {
newSeqRecord = new KVChangeRecord(key);
- MapWrapper.set(records, key, newSeqRecord);
+ records.set(key, newSeqRecord);
newSeqRecord.currentValue = value;
$__0._addToAdditions(newSeqRecord);
}
}
if (seqChanged) {
@@ -8786,23 +9983,23 @@
var changes = [];
var additions = [];
var removals = [];
var record;
for (record = this._mapHead; record !== null; record = record._next) {
- ListWrapper.push(items, stringify(record));
+ items.push(stringify(record));
}
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
- ListWrapper.push(previous, stringify(record));
+ previous.push(stringify(record));
}
for (record = this._changesHead; record !== null; record = record._nextChanged) {
- ListWrapper.push(changes, stringify(record));
+ changes.push(stringify(record));
}
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- ListWrapper.push(additions, stringify(record));
+ additions.push(stringify(record));
}
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
- ListWrapper.push(removals, stringify(record));
+ removals.push(stringify(record));
}
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n";
},
_forEach: function(obj, fn) {
if (obj instanceof Map) {
@@ -8812,11 +10009,11 @@
}
}
}, {supportsObj: function(obj) {
return obj instanceof Map || isJsObject(obj);
}}, $__super);
- }(Pipe));
+ }(BasePipe));
$__export("KeyValueChanges", KeyValueChanges);
KVChangeRecord = (function() {
function KVChangeRecord(key) {
this.key = key;
this.previousValue = null;
@@ -8835,41 +10032,37 @@
$__export("KVChangeRecord", KVChangeRecord);
}
};
});
-System.register("angular2/src/change_detection/pipes/promise_pipe", ["angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) {
+System.register("angular2/src/change_detection/pipes/promise_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/promise_pipe";
- var PromiseWrapper,
- isBlank,
+ var isBlank,
isPresent,
- Pipe,
+ isPromise,
WrappedValue,
PromisePipe,
PromisePipeFactory;
return {
setters: [function($__m) {
- PromiseWrapper = $__m.PromiseWrapper;
- }, function($__m) {
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
+ isPromise = $__m.isPromise;
}, function($__m) {
- Pipe = $__m.Pipe;
WrappedValue = $__m.WrappedValue;
}],
execute: function() {
- PromisePipe = (function($__super) {
- function PromisePipe(ref) {
- $traceurRuntime.superConstructor(PromisePipe).call(this);
- this._ref = ref;
+ PromisePipe = (function() {
+ function PromisePipe(_ref) {
+ this._ref = _ref;
this._latestValue = null;
this._latestReturnedValue = null;
}
return ($traceurRuntime.createClass)(PromisePipe, {
supports: function(promise) {
- return PromiseWrapper.isPromise(promise);
+ return isPromise(promise);
},
onDestroy: function() {
if (isPresent(this._sourcePromise)) {
this._latestValue = null;
this._latestReturnedValue = null;
@@ -8900,18 +10093,18 @@
},
_updateLatestValue: function(value) {
this._latestValue = value;
this._ref.requestCheck();
}
- }, {}, $__super);
- }(Pipe));
+ }, {});
+ }());
$__export("PromisePipe", PromisePipe);
PromisePipeFactory = (function() {
function PromisePipeFactory() {}
return ($traceurRuntime.createClass)(PromisePipeFactory, {
supports: function(promise) {
- return PromiseWrapper.isPromise(promise);
+ return isPromise(promise);
},
create: function(cdRef) {
return new PromisePipe(cdRef);
}
}, {});
@@ -8919,29 +10112,25 @@
$__export("PromisePipeFactory", PromisePipeFactory);
}
};
});
-System.register("angular2/src/change_detection/pipes/uppercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) {
+System.register("angular2/src/change_detection/pipes/uppercase_pipe", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/uppercase_pipe";
var isString,
StringWrapper,
- Pipe,
UpperCasePipe,
UpperCaseFactory;
return {
setters: [function($__m) {
isString = $__m.isString;
StringWrapper = $__m.StringWrapper;
- }, function($__m) {
- Pipe = $__m.Pipe;
}],
execute: function() {
- UpperCasePipe = (function($__super) {
+ UpperCasePipe = (function() {
function UpperCasePipe() {
- $traceurRuntime.superConstructor(UpperCasePipe).call(this);
this._latestValue = null;
}
return ($traceurRuntime.createClass)(UpperCasePipe, {
supports: function(str) {
return isString(str);
@@ -8955,12 +10144,12 @@
return StringWrapper.toUpperCase(value);
} else {
return this._latestValue;
}
}
- }, {}, $__super);
- }(Pipe));
+ }, {});
+ }());
$__export("UpperCasePipe", UpperCasePipe);
UpperCaseFactory = (function() {
function UpperCaseFactory() {}
return ($traceurRuntime.createClass)(UpperCaseFactory, {
supports: function(str) {
@@ -8974,29 +10163,25 @@
$__export("UpperCaseFactory", UpperCaseFactory);
}
};
});
-System.register("angular2/src/change_detection/pipes/lowercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) {
+System.register("angular2/src/change_detection/pipes/lowercase_pipe", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/lowercase_pipe";
var isString,
StringWrapper,
- Pipe,
LowerCasePipe,
LowerCaseFactory;
return {
setters: [function($__m) {
isString = $__m.isString;
StringWrapper = $__m.StringWrapper;
- }, function($__m) {
- Pipe = $__m.Pipe;
}],
execute: function() {
- LowerCasePipe = (function($__super) {
+ LowerCasePipe = (function() {
function LowerCasePipe() {
- $traceurRuntime.superConstructor(LowerCasePipe).call(this);
this._latestValue = null;
}
return ($traceurRuntime.createClass)(LowerCasePipe, {
supports: function(str) {
return isString(str);
@@ -9010,12 +10195,12 @@
return StringWrapper.toLowerCase(value);
} else {
return this._latestValue;
}
}
- }, {}, $__super);
- }(Pipe));
+ }, {});
+ }());
$__export("LowerCasePipe", LowerCasePipe);
LowerCaseFactory = (function() {
function LowerCaseFactory() {}
return ($traceurRuntime.createClass)(LowerCaseFactory, {
supports: function(str) {
@@ -9032,262 +10217,64 @@
});
System.register("angular2/src/change_detection/pipes/json_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/pipes/json_pipe";
- var __decorate,
- __metadata,
- isPresent,
- CONST,
- Json,
- Pipe,
- PipeFactory,
- JsonPipe,
- JsonPipeFactory;
+ var Json,
+ BasePipe,
+ JsonPipe;
return {
setters: [function($__m) {
- isPresent = $__m.isPresent;
- CONST = $__m.CONST;
Json = $__m.Json;
}, function($__m) {
- Pipe = $__m.Pipe;
- PipeFactory = $__m.PipeFactory;
+ BasePipe = $__m.BasePipe;
}],
execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
JsonPipe = (function($__super) {
function JsonPipe() {
- $traceurRuntime.superConstructor(JsonPipe).call(this);
- this._latestRef = null;
- this._latestValue = null;
+ $traceurRuntime.superConstructor(JsonPipe).apply(this, arguments);
}
return ($traceurRuntime.createClass)(JsonPipe, {
- onDestroy: function() {
- if (isPresent(this._latestValue)) {
- this._latestRef = null;
- this._latestValue = null;
- }
- },
- supports: function(obj) {
- return true;
- },
transform: function(value) {
- if (value === this._latestRef) {
- return this._latestValue;
- } else {
- return this._prettyPrint(value);
- }
+ return Json.stringify(value);
},
- _prettyPrint: function(value) {
- this._latestRef = value;
- this._latestValue = Json.stringify(value);
- return this._latestValue;
- }
- }, {}, $__super);
- }(Pipe));
- $__export("JsonPipe", JsonPipe);
- JsonPipeFactory = (function($__super) {
- function $__0() {
- $traceurRuntime.superConstructor($__0).call(this);
- }
- return ($traceurRuntime.createClass)($__0, {
- supports: function(obj) {
- return true;
- },
create: function(cdRef) {
- return new JsonPipe();
+ return this;
}
}, {}, $__super);
- }(PipeFactory));
- $__export("JsonPipeFactory", JsonPipeFactory);
- $__export("JsonPipeFactory", JsonPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], JsonPipeFactory));
+ }(BasePipe));
+ $__export("JsonPipe", JsonPipe);
}
};
});
-System.register("angular2/src/core/annotations_impl/visibility", ["angular2/src/facade/lang", "angular2/src/di/annotations_impl"], function($__export) {
+System.register("angular2/src/di/forward_ref", ["angular2/src/facade/lang"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/core/annotations_impl/visibility";
- var __decorate,
- __metadata,
- CONST,
- DependencyAnnotation,
- Visibility,
- Self,
- self,
- Parent,
- Ancestor,
- Unbounded;
- return {
- setters: [function($__m) {
- CONST = $__m.CONST;
- }, function($__m) {
- DependencyAnnotation = $__m.DependencyAnnotation;
- }],
- execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
- Visibility = (function($__super) {
- function $__0(depth, crossComponentBoundaries) {
- $traceurRuntime.superConstructor($__0).call(this);
- this.depth = depth;
- this.crossComponentBoundaries = crossComponentBoundaries;
- }
- return ($traceurRuntime.createClass)($__0, {shouldIncludeSelf: function() {
- return this.depth === 0;
- }}, {}, $__super);
- }(DependencyAnnotation));
- $__export("Visibility", Visibility);
- $__export("Visibility", Visibility = __decorate([CONST(), __metadata('design:paramtypes', [Number, Boolean])], Visibility));
- Self = (function($__super) {
- function $__0() {
- $traceurRuntime.superConstructor($__0).call(this, 0, false);
- }
- return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
- }(Visibility));
- $__export("Self", Self);
- $__export("Self", Self = __decorate([CONST(), __metadata('design:paramtypes', [])], Self));
- self = new Self();
- $__export("self", self);
- Parent = (function($__super) {
- function $__0() {
- $traceurRuntime.superConstructor($__0).call(this, 1, false);
- }
- return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
- }(Visibility));
- $__export("Parent", Parent);
- $__export("Parent", Parent = __decorate([CONST(), __metadata('design:paramtypes', [])], Parent));
- Ancestor = (function($__super) {
- function $__0() {
- $traceurRuntime.superConstructor($__0).call(this, 999999, false);
- }
- return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
- }(Visibility));
- $__export("Ancestor", Ancestor);
- $__export("Ancestor", Ancestor = __decorate([CONST(), __metadata('design:paramtypes', [])], Ancestor));
- Unbounded = (function($__super) {
- function $__0() {
- $traceurRuntime.superConstructor($__0).call(this, 999999, true);
- }
- return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
- }(Visibility));
- $__export("Unbounded", Unbounded);
- $__export("Unbounded", Unbounded = __decorate([CONST(), __metadata('design:paramtypes', [])], Unbounded));
- }
- };
-});
-
-System.register("angular2/src/core/annotations_impl/view", ["angular2/src/facade/lang"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/core/annotations_impl/view";
- var __decorate,
- __metadata,
- CONST,
- View;
- return {
- setters: [function($__m) {
- CONST = $__m.CONST;
- }],
- execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
- View = (($traceurRuntime.createClass)(function() {
- var $__2 = arguments[0] !== (void 0) ? arguments[0] : {},
- templateUrl = $__2.templateUrl,
- template = $__2.template,
- directives = $__2.directives,
- renderer = $__2.renderer;
- this.templateUrl = templateUrl;
- this.template = template;
- this.directives = directives;
- this.renderer = renderer;
- }, {}, {}));
- $__export("View", View);
- $__export("View", View = __decorate([CONST(), __metadata('design:paramtypes', [Object])], View));
- }
- };
-});
-
-System.register("angular2/src/di/forward_ref", [], function($__export) {
- "use strict";
var __moduleName = "angular2/src/di/forward_ref";
+ var stringify,
+ isFunction;
function forwardRef(forwardRefFn) {
forwardRefFn.__forward_ref__ = forwardRef;
+ forwardRefFn.toString = function() {
+ return stringify(this());
+ };
return forwardRefFn;
}
function resolveForwardRef(type) {
- if (typeof type == 'function' && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) {
+ if (isFunction(type) && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) {
return type();
} else {
return type;
}
}
$__export("forwardRef", forwardRef);
$__export("resolveForwardRef", resolveForwardRef);
return {
- setters: [],
+ setters: [function($__m) {
+ stringify = $__m.stringify;
+ isFunction = $__m.isFunction;
+ }],
execute: function() {
}
};
});
@@ -9313,10 +10300,11 @@
"use strict";
var __moduleName = "angular2/src/di/exceptions";
var ListWrapper,
stringify,
BaseException,
+ isBlank,
AbstractBindingError,
NoBindingError,
AsyncBindingError,
CyclicDependencyError,
InstantiationError,
@@ -9324,14 +10312,14 @@
NoAnnotationError;
function findFirstClosedCycle(keys) {
var res = [];
for (var i = 0; i < keys.length; ++i) {
if (ListWrapper.contains(res, keys[i])) {
- ListWrapper.push(res, keys[i]);
+ res.push(keys[i]);
return res;
} else {
- ListWrapper.push(res, keys[i]);
+ res.push(keys[i]);
}
}
return res;
}
function constructResolvingPath(keys) {
@@ -9349,10 +10337,11 @@
setters: [function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
stringify = $__m.stringify;
BaseException = $__m.BaseException;
+ isBlank = $__m.isBlank;
}],
execute: function() {
AbstractBindingError = (function($__super) {
function AbstractBindingError(key, constructResolvingMessage) {
$traceurRuntime.superConstructor(AbstractBindingError).call(this);
@@ -9360,11 +10349,11 @@
this.constructResolvingMessage = constructResolvingMessage;
this.message = this.constructResolvingMessage(this.keys);
}
return ($traceurRuntime.createClass)(AbstractBindingError, {
addKey: function(key) {
- ListWrapper.push(this.keys, key);
+ this.keys.push(key);
this.message = this.constructResolvingMessage(this.keys);
},
toString: function() {
return this.message;
}
@@ -9421,43 +10410,244 @@
return this.message;
}}, {}, $__super);
}(BaseException));
$__export("InvalidBindingError", InvalidBindingError);
NoAnnotationError = (function($__super) {
- function NoAnnotationError(typeOrFunc) {
+ function NoAnnotationError(typeOrFunc, params) {
$traceurRuntime.superConstructor(NoAnnotationError).call(this);
- this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + ". " + 'Make sure they all have valid type or annotations.';
+ var signature = [];
+ for (var i = 0,
+ ii = params.length; i < ii; i++) {
+ var parameter = params[i];
+ if (isBlank(parameter) || parameter.length == 0) {
+ signature.push('?');
+ } else {
+ signature.push(ListWrapper.map(parameter, stringify).join(' '));
+ }
+ }
+ this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" + signature.join(', ') + "). " + 'Make sure they all have valid type or annotations.';
}
return ($traceurRuntime.createClass)(NoAnnotationError, {toString: function() {
return this.message;
}}, {}, $__super);
}(BaseException));
$__export("NoAnnotationError", NoAnnotationError);
}
};
});
-System.register("angular2/src/di/opaque_token", [], function($__export) {
+System.register("angular2/src/di/opaque_token", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/di/opaque_token";
- var OpaqueToken;
+ var __decorate,
+ __metadata,
+ CONST,
+ OpaqueToken;
return {
- setters: [],
+ setters: [function($__m) {
+ CONST = $__m.CONST;
+ }],
execute: function() {
- OpaqueToken = (function() {
- function OpaqueToken(desc) {
- this._desc = ("Token(" + desc + ")");
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
}
- return ($traceurRuntime.createClass)(OpaqueToken, {toString: function() {
- return this._desc;
- }}, {});
- }());
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ OpaqueToken = (($traceurRuntime.createClass)(function(desc) {
+ this._desc = 'Token(' + desc + ')';
+ }, {toString: function() {
+ return this._desc;
+ }}, {}));
$__export("OpaqueToken", OpaqueToken);
+ $__export("OpaqueToken", OpaqueToken = __decorate([CONST(), __metadata('design:paramtypes', [String])], OpaqueToken));
}
};
});
+System.register("angular2/src/core/annotations_impl/visibility", ["angular2/src/facade/lang", "angular2/src/di/annotations_impl"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/core/annotations_impl/visibility";
+ var __decorate,
+ __metadata,
+ CONST,
+ isBlank,
+ DependencyAnnotation,
+ Visibility,
+ Self,
+ self,
+ Parent,
+ Ancestor,
+ Unbounded;
+ return {
+ setters: [function($__m) {
+ CONST = $__m.CONST;
+ isBlank = $__m.isBlank;
+ }, function($__m) {
+ DependencyAnnotation = $__m.DependencyAnnotation;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ Visibility = (function($__super) {
+ function $__0(depth, crossComponentBoundaries, _includeSelf) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this.depth = depth;
+ this.crossComponentBoundaries = crossComponentBoundaries;
+ this._includeSelf = _includeSelf;
+ }
+ return ($traceurRuntime.createClass)($__0, {
+ get includeSelf() {
+ return isBlank(this._includeSelf) ? false : this._includeSelf;
+ },
+ toString: function() {
+ return ("@Visibility(depth: " + this.depth + ", crossComponentBoundaries: " + this.crossComponentBoundaries + ", includeSelf: " + this.includeSelf + "})");
+ }
+ }, {}, $__super);
+ }(DependencyAnnotation));
+ $__export("Visibility", Visibility);
+ $__export("Visibility", Visibility = __decorate([CONST(), __metadata('design:paramtypes', [Number, Boolean, Boolean])], Visibility));
+ Self = (function($__super) {
+ function $__0() {
+ $traceurRuntime.superConstructor($__0).call(this, 0, false, true);
+ }
+ return ($traceurRuntime.createClass)($__0, {toString: function() {
+ return "@Self()";
+ }}, {}, $__super);
+ }(Visibility));
+ $__export("Self", Self);
+ $__export("Self", Self = __decorate([CONST(), __metadata('design:paramtypes', [])], Self));
+ self = new Self();
+ $__export("self", self);
+ Parent = (function($__super) {
+ function $__0() {
+ var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self;
+ $traceurRuntime.superConstructor($__0).call(this, 1, false, self);
+ }
+ return ($traceurRuntime.createClass)($__0, {toString: function() {
+ return ("@Parent(self: " + this.includeSelf + "})");
+ }}, {}, $__super);
+ }(Visibility));
+ $__export("Parent", Parent);
+ $__export("Parent", Parent = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Parent));
+ Ancestor = (function($__super) {
+ function $__0() {
+ var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self;
+ $traceurRuntime.superConstructor($__0).call(this, 999999, false, self);
+ }
+ return ($traceurRuntime.createClass)($__0, {toString: function() {
+ return ("@Ancestor(self: " + this.includeSelf + "})");
+ }}, {}, $__super);
+ }(Visibility));
+ $__export("Ancestor", Ancestor);
+ $__export("Ancestor", Ancestor = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Ancestor));
+ Unbounded = (function($__super) {
+ function $__0() {
+ var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self;
+ $traceurRuntime.superConstructor($__0).call(this, 999999, true, self);
+ }
+ return ($traceurRuntime.createClass)($__0, {toString: function() {
+ return ("@Unbounded(self: " + this.includeSelf + "})");
+ }}, {}, $__super);
+ }(Visibility));
+ $__export("Unbounded", Unbounded);
+ $__export("Unbounded", Unbounded = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Unbounded));
+ }
+ };
+});
+
+System.register("angular2/src/core/annotations_impl/view", ["angular2/src/facade/lang"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/core/annotations_impl/view";
+ var __decorate,
+ __metadata,
+ CONST,
+ View;
+ return {
+ setters: [function($__m) {
+ CONST = $__m.CONST;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ View = (($traceurRuntime.createClass)(function() {
+ var $__2 = arguments[0] !== (void 0) ? arguments[0] : {},
+ templateUrl = $__2.templateUrl,
+ template = $__2.template,
+ directives = $__2.directives,
+ renderer = $__2.renderer,
+ styles = $__2.styles,
+ styleUrls = $__2.styleUrls;
+ this.templateUrl = templateUrl;
+ this.template = template;
+ this.styleUrls = styleUrls;
+ this.styles = styles;
+ this.directives = directives;
+ this.renderer = renderer;
+ }, {}, {}));
+ $__export("View", View);
+ $__export("View", View = __decorate([CONST(), __metadata('design:paramtypes', [Object])], View));
+ }
+ };
+});
+
System.register("angular2/src/dom/dom_adapter", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/dom/dom_adapter";
var BaseException,
isBlank,
@@ -9480,10 +10670,22 @@
execute: function() {
$__export("DOM", DOM);
DomAdapter = (function() {
function DomAdapter() {}
return ($traceurRuntime.createClass)(DomAdapter, {
+ hasProperty: function(element, name) {
+ throw _abstract();
+ },
+ setProperty: function(el, name, value) {
+ throw _abstract();
+ },
+ getProperty: function(el, name) {
+ throw _abstract();
+ },
+ invoke: function(el, methodName, args) {
+ throw _abstract();
+ },
logError: function(error) {
throw _abstract();
},
get attrToPropMap() {
throw _abstract();
@@ -9513,10 +10715,13 @@
throw _abstract();
},
createEvent: function(eventType) {
throw _abstract();
},
+ preventDefault: function(evt) {
+ throw _abstract();
+ },
getInnerHTML: function(el) {
throw _abstract();
},
getOuterHTML: function(el) {
throw _abstract();
@@ -9625,13 +10830,10 @@
throw _abstract();
},
clone: function(node) {
throw _abstract();
},
- hasProperty: function(element, name) {
- throw _abstract();
- },
getElementsByClassName: function(element, name) {
throw _abstract();
},
getElementsByTagName: function(element, name) {
throw _abstract();
@@ -9756,10 +10958,22 @@
getLocation: function() {
throw _abstract();
},
getBaseHref: function() {
throw _abstract();
+ },
+ getUserAgent: function() {
+ throw _abstract();
+ },
+ setData: function(element, name, value) {
+ throw _abstract();
+ },
+ getData: function(element, name) {
+ throw _abstract();
+ },
+ setGlobalVar: function(name, value) {
+ throw _abstract();
}
}, {});
}());
$__export("DomAdapter", DomAdapter);
}
@@ -9796,11 +11010,11 @@
el.href = href == null ? baseUrl : baseUrl + '/../' + href;
},
cssToRules: function(css) {
var style = this.createStyleElement(css);
this.appendChild(this.defaultDoc().head, style);
- var rules = ListWrapper.create();
+ var rules = [];
if (isPresent(style.sheet)) {
try {
var rawRules = style.sheet.cssRules;
rules = ListWrapper.createFixedSize(rawRules.length);
for (var i = 0; i < rawRules.length; i++) {
@@ -9822,35 +11036,32 @@
$__export("GenericBrowserDomAdapter", GenericBrowserDomAdapter);
}
};
});
-System.register("angular2/src/core/annotations_impl/annotations", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/di/annotations_impl", "angular2/change_detection"], function($__export) {
+System.register("angular2/src/core/annotations_impl/annotations", ["angular2/src/facade/lang", "angular2/src/di/annotations_impl", "angular2/change_detection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/annotations_impl/annotations";
var __decorate,
__metadata,
CONST,
- isPresent,
CONST_EXPR,
- ListWrapper,
Injectable,
DEFAULT,
Directive,
Component,
LifecycleEvent,
onDestroy,
onChange,
+ onCheck,
+ onInit,
onAllChangesDone;
return {
setters: [function($__m) {
CONST = $__m.CONST;
- isPresent = $__m.isPresent;
CONST_EXPR = $__m.CONST_EXPR;
}, function($__m) {
- ListWrapper = $__m.ListWrapper;
- }, function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
DEFAULT = $__m.DEFAULT;
}],
execute: function() {
@@ -9881,32 +11092,26 @@
var $__3;
var $__2 = arguments[0] !== (void 0) ? arguments[0] : {},
selector = $__2.selector,
properties = $__2.properties,
events = $__2.events,
- hostListeners = $__2.hostListeners,
- hostProperties = $__2.hostProperties,
- hostAttributes = $__2.hostAttributes,
- hostActions = $__2.hostActions,
+ host = $__2.host,
lifecycle = $__2.lifecycle,
hostInjector = $__2.hostInjector,
+ exportAs = $__2.exportAs,
compileChildren = ($__3 = $__2.compileChildren) === void 0 ? true : $__3;
$traceurRuntime.superConstructor($__0).call(this);
this.selector = selector;
this.properties = properties;
this.events = events;
- this.hostListeners = hostListeners;
- this.hostProperties = hostProperties;
- this.hostAttributes = hostAttributes;
- this.hostActions = hostActions;
+ this.host = host;
+ this.exportAs = exportAs;
this.lifecycle = lifecycle;
this.compileChildren = compileChildren;
this.hostInjector = hostInjector;
}
- return ($traceurRuntime.createClass)($__0, {hasLifecycleHook: function(hook) {
- return isPresent(this.lifecycle) ? ListWrapper.contains(this.lifecycle, hook) : false;
- }}, {}, $__super);
+ return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
}(Injectable));
$__export("Directive", Directive);
$__export("Directive", Directive = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Directive));
Component = (function($__super) {
function $__0() {
@@ -9914,28 +11119,24 @@
$__4;
var $__2 = arguments[0] !== (void 0) ? arguments[0] : {},
selector = $__2.selector,
properties = $__2.properties,
events = $__2.events,
- hostListeners = $__2.hostListeners,
- hostProperties = $__2.hostProperties,
- hostAttributes = $__2.hostAttributes,
- hostActions = $__2.hostActions,
+ host = $__2.host,
+ exportAs = $__2.exportAs,
appInjector = $__2.appInjector,
lifecycle = $__2.lifecycle,
hostInjector = $__2.hostInjector,
viewInjector = $__2.viewInjector,
changeDetection = ($__3 = $__2.changeDetection) === void 0 ? DEFAULT : $__3,
compileChildren = ($__4 = $__2.compileChildren) === void 0 ? true : $__4;
$traceurRuntime.superConstructor($__0).call(this, {
selector: selector,
properties: properties,
events: events,
- hostListeners: hostListeners,
- hostProperties: hostProperties,
- hostAttributes: hostAttributes,
- hostActions: hostActions,
+ host: host,
+ exportAs: exportAs,
hostInjector: hostInjector,
lifecycle: lifecycle,
compileChildren: compileChildren
});
this.changeDetection = changeDetection;
@@ -9953,10 +11154,14 @@
$__export("LifecycleEvent", LifecycleEvent = __decorate([CONST(), __metadata('design:paramtypes', [String])], LifecycleEvent));
onDestroy = CONST_EXPR(new LifecycleEvent("onDestroy"));
$__export("onDestroy", onDestroy);
onChange = CONST_EXPR(new LifecycleEvent("onChange"));
$__export("onChange", onChange);
+ onCheck = CONST_EXPR(new LifecycleEvent("onCheck"));
+ $__export("onCheck", onCheck);
+ onInit = CONST_EXPR(new LifecycleEvent("onInit"));
+ $__export("onInit", onInit);
onAllChangesDone = CONST_EXPR(new LifecycleEvent("onAllChangesDone"));
$__export("onAllChangesDone", onAllChangesDone);
}
};
});
@@ -9979,12 +11184,12 @@
setters: [function($__m) {
isPresent = $__m.isPresent;
}],
execute: function() {
ViewRef = (function() {
- function ViewRef(view) {
- this._view = view;
+ function ViewRef(_view) {
+ this._view = _view;
}
return ($traceurRuntime.createClass)(ViewRef, {
get render() {
return this._view.render;
},
@@ -9993,34 +11198,43 @@
}
}, {});
}());
$__export("ViewRef", ViewRef);
ProtoViewRef = (function() {
- function ProtoViewRef(protoView) {
- this._protoView = protoView;
+ function ProtoViewRef(_protoView) {
+ this._protoView = _protoView;
}
return ($traceurRuntime.createClass)(ProtoViewRef, {}, {});
}());
$__export("ProtoViewRef", ProtoViewRef);
}
};
});
-System.register("angular2/src/core/annotations_impl/di", ["angular2/src/facade/lang", "angular2/src/di/annotations_impl"], function($__export) {
+System.register("angular2/src/core/annotations_impl/di", ["angular2/src/facade/lang", "angular2/src/di/annotations_impl", "angular2/di"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/annotations_impl/di";
var __decorate,
__metadata,
CONST,
+ stringify,
+ StringWrapper,
+ isString,
DependencyAnnotation,
+ resolveForwardRef,
Attribute,
Query;
return {
setters: [function($__m) {
CONST = $__m.CONST;
+ stringify = $__m.stringify;
+ StringWrapper = $__m.StringWrapper;
+ isString = $__m.isString;
}, function($__m) {
DependencyAnnotation = $__m.DependencyAnnotation;
+ }, function($__m) {
+ resolveForwardRef = $__m.resolveForwardRef;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -10046,56 +11260,109 @@
Attribute = (function($__super) {
function $__0(attributeName) {
$traceurRuntime.superConstructor($__0).call(this);
this.attributeName = attributeName;
}
- return ($traceurRuntime.createClass)($__0, {get token() {
+ return ($traceurRuntime.createClass)($__0, {
+ get token() {
return this;
- }}, {}, $__super);
+ },
+ toString: function() {
+ return ("@Attribute(" + stringify(this.attributeName) + ")");
+ }
+ }, {}, $__super);
}(DependencyAnnotation));
$__export("Attribute", Attribute);
$__export("Attribute", Attribute = __decorate([CONST(), __metadata('design:paramtypes', [String])], Attribute));
Query = (function($__super) {
- function $__0(directive) {
+ function $__0(_selector) {
+ var $__3;
+ var $__2 = arguments[1] !== (void 0) ? arguments[1] : {},
+ descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3;
$traceurRuntime.superConstructor($__0).call(this);
- this.directive = directive;
+ this._selector = _selector;
+ this.descendants = descendants;
}
- return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
+ return ($traceurRuntime.createClass)($__0, {
+ get selector() {
+ return resolveForwardRef(this._selector);
+ },
+ get isVarBindingQuery() {
+ return isString(this.selector);
+ },
+ get varBindings() {
+ return StringWrapper.split(this.selector, new RegExp(","));
+ },
+ toString: function() {
+ return ("@Query(" + stringify(this.selector) + ")");
+ }
+ }, {}, $__super);
}(DependencyAnnotation));
$__export("Query", Query);
- $__export("Query", Query = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Query));
+ $__export("Query", Query = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Query));
}
};
});
-System.register("angular2/src/render/api", ["angular2/src/facade/lang"], function($__export) {
+System.register("angular2/src/render/api", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/api";
var isPresent,
+ isBlank,
+ RegExpWrapper,
+ Map,
+ MapWrapper,
EventBinding,
+ PropertyBindingType,
+ ElementPropertyBinding,
ElementBinder,
DirectiveBinder,
+ ViewType,
ProtoViewDto,
+ hostRegExp,
DirectiveMetadata,
RenderProtoViewRef,
RenderViewRef,
ViewDefinition,
RenderCompiler,
Renderer;
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
+ isBlank = $__m.isBlank;
+ RegExpWrapper = $__m.RegExpWrapper;
+ }, function($__m) {
+ Map = $__m.Map;
+ MapWrapper = $__m.MapWrapper;
}],
execute: function() {
EventBinding = (function() {
function EventBinding(fullName, source) {
this.fullName = fullName;
this.source = source;
}
return ($traceurRuntime.createClass)(EventBinding, {}, {});
}());
$__export("EventBinding", EventBinding);
+ $__export("PropertyBindingType", PropertyBindingType);
+ (function(PropertyBindingType) {
+ PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY";
+ PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE";
+ PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS";
+ PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE";
+ })(PropertyBindingType || ($__export("PropertyBindingType", PropertyBindingType = {})));
+ ElementPropertyBinding = (function() {
+ function ElementPropertyBinding(type, astWithSource, property) {
+ var unit = arguments[3] !== (void 0) ? arguments[3] : null;
+ this.type = type;
+ this.astWithSource = astWithSource;
+ this.property = property;
+ this.unit = unit;
+ }
+ return ($traceurRuntime.createClass)(ElementPropertyBinding, {}, {});
+ }());
+ $__export("ElementPropertyBinding", ElementPropertyBinding);
ElementBinder = (function() {
function ElementBinder() {
var $__1 = arguments[0] !== (void 0) ? arguments[0] : {},
index = $__1.index,
parentIndex = $__1.parentIndex,
@@ -10134,10 +11401,16 @@
this.hostPropertyBindings = hostPropertyBindings;
}
return ($traceurRuntime.createClass)(DirectiveBinder, {}, {});
}());
$__export("DirectiveBinder", DirectiveBinder);
+ $__export("ViewType", ViewType);
+ (function(ViewType) {
+ ViewType[ViewType["HOST"] = 0] = "HOST";
+ ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT";
+ ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED";
+ })(ViewType || ($__export("ViewType", ViewType = {})));
ProtoViewDto = (function() {
function ProtoViewDto($__1) {
var $__2 = $__1,
render = $__2.render,
elementBinders = $__2.elementBinders,
@@ -10146,23 +11419,14 @@
this.render = render;
this.elementBinders = elementBinders;
this.variableBindings = variableBindings;
this.type = type;
}
- return ($traceurRuntime.createClass)(ProtoViewDto, {}, {
- get HOST_VIEW_TYPE() {
- return 0;
- },
- get COMPONENT_VIEW_TYPE() {
- return 1;
- },
- get EMBEDDED_VIEW_TYPE() {
- return 2;
- }
- });
+ return ($traceurRuntime.createClass)(ProtoViewDto, {}, {});
}());
$__export("ProtoViewDto", ProtoViewDto);
+ hostRegExp = RegExpWrapper.create('^(?:(?:\\[([^\\]]+)\\])|(?:\\(([^\\)]+)\\))|(?:@(.+)))$');
DirectiveMetadata = (function() {
function DirectiveMetadata($__1) {
var $__2 = $__1,
id = $__2.id,
selector = $__2.selector,
@@ -10175,34 +11439,96 @@
properties = $__2.properties,
readAttributes = $__2.readAttributes,
type = $__2.type,
callOnDestroy = $__2.callOnDestroy,
callOnChange = $__2.callOnChange,
+ callOnCheck = $__2.callOnCheck,
+ callOnInit = $__2.callOnInit,
callOnAllChangesDone = $__2.callOnAllChangesDone,
- changeDetection = $__2.changeDetection;
+ changeDetection = $__2.changeDetection,
+ exportAs = $__2.exportAs;
this.id = id;
this.selector = selector;
this.compileChildren = isPresent(compileChildren) ? compileChildren : true;
this.events = events;
this.hostListeners = hostListeners;
- this.hostProperties = hostProperties;
this.hostAttributes = hostAttributes;
+ this.hostProperties = hostProperties;
this.hostActions = hostActions;
this.properties = properties;
this.readAttributes = readAttributes;
this.type = type;
this.callOnDestroy = callOnDestroy;
this.callOnChange = callOnChange;
+ this.callOnCheck = callOnCheck;
+ this.callOnInit = callOnInit;
this.callOnAllChangesDone = callOnAllChangesDone;
this.changeDetection = changeDetection;
+ this.exportAs = exportAs;
}
return ($traceurRuntime.createClass)(DirectiveMetadata, {}, {
get DIRECTIVE_TYPE() {
return 0;
},
get COMPONENT_TYPE() {
return 1;
+ },
+ create: function($__1) {
+ var $__2 = $__1,
+ id = $__2.id,
+ selector = $__2.selector,
+ compileChildren = $__2.compileChildren,
+ events = $__2.events,
+ host = $__2.host,
+ properties = $__2.properties,
+ readAttributes = $__2.readAttributes,
+ type = $__2.type,
+ callOnDestroy = $__2.callOnDestroy,
+ callOnChange = $__2.callOnChange,
+ callOnCheck = $__2.callOnCheck,
+ callOnInit = $__2.callOnInit,
+ callOnAllChangesDone = $__2.callOnAllChangesDone,
+ changeDetection = $__2.changeDetection,
+ exportAs = $__2.exportAs;
+ var hostListeners = new Map();
+ var hostProperties = new Map();
+ var hostAttributes = new Map();
+ var hostActions = new Map();
+ if (isPresent(host)) {
+ MapWrapper.forEach(host, (function(value, key) {
+ var matches = RegExpWrapper.firstMatch(hostRegExp, key);
+ if (isBlank(matches)) {
+ hostAttributes.set(key, value);
+ } else if (isPresent(matches[1])) {
+ hostProperties.set(matches[1], value);
+ } else if (isPresent(matches[2])) {
+ hostListeners.set(matches[2], value);
+ } else if (isPresent(matches[3])) {
+ hostActions.set(matches[3], value);
+ }
+ }));
+ }
+ return new DirectiveMetadata({
+ id: id,
+ selector: selector,
+ compileChildren: compileChildren,
+ events: events,
+ hostListeners: hostListeners,
+ hostProperties: hostProperties,
+ hostAttributes: hostAttributes,
+ hostActions: hostActions,
+ properties: properties,
+ readAttributes: readAttributes,
+ type: type,
+ callOnDestroy: callOnDestroy,
+ callOnChange: callOnChange,
+ callOnCheck: callOnCheck,
+ callOnInit: callOnInit,
+ callOnAllChangesDone: callOnAllChangesDone,
+ changeDetection: changeDetection,
+ exportAs: exportAs
+ });
}
});
}());
$__export("DirectiveMetadata", DirectiveMetadata);
RenderProtoViewRef = (function() {
@@ -10217,16 +11543,20 @@
$__export("RenderViewRef", RenderViewRef);
ViewDefinition = (function() {
function ViewDefinition($__1) {
var $__2 = $__1,
componentId = $__2.componentId,
- absUrl = $__2.absUrl,
+ templateAbsUrl = $__2.templateAbsUrl,
template = $__2.template,
+ styleAbsUrls = $__2.styleAbsUrls,
+ styles = $__2.styles,
directives = $__2.directives;
this.componentId = componentId;
- this.absUrl = absUrl;
+ this.templateAbsUrl = templateAbsUrl;
this.template = template;
+ this.styleAbsUrls = styleAbsUrls;
+ this.styles = styles;
this.directives = directives;
}
return ($traceurRuntime.createClass)(ViewDefinition, {}, {});
}());
$__export("ViewDefinition", ViewDefinition);
@@ -10234,11 +11564,11 @@
function RenderCompiler() {}
return ($traceurRuntime.createClass)(RenderCompiler, {
compileHost: function(directiveMetadata) {
return null;
},
- compile: function(template) {
+ compile: function(view) {
return null;
}
}, {});
}());
$__export("RenderCompiler", RenderCompiler);
@@ -10246,23 +11576,28 @@
function Renderer() {}
return ($traceurRuntime.createClass)(Renderer, {
createRootHostView: function(hostProtoViewRef, hostElementSelector) {
return null;
},
- detachFreeHostView: function(parentHostViewRef, hostViewRef) {},
createView: function(protoViewRef) {
return null;
},
destroyView: function(viewRef) {},
- attachComponentView: function(hostViewRef, elementIndex, componentViewRef) {},
- detachComponentView: function(hostViewRef, boundElementIndex, componentViewRef) {},
- attachViewInContainer: function(parentViewRef, boundElementIndex, atIndex, viewRef) {},
- detachViewInContainer: function(parentViewRef, boundElementIndex, atIndex, viewRef) {},
+ attachComponentView: function(location, componentViewRef) {},
+ detachComponentView: function(location, componentViewRef) {},
+ attachViewInContainer: function(location, atIndex, viewRef) {},
+ detachViewInContainer: function(location, atIndex, viewRef) {},
hydrateView: function(viewRef) {},
dehydrateView: function(viewRef) {},
- setElementProperty: function(viewRef, elementIndex, propertyName, propertyValue) {},
- callAction: function(viewRef, elementIndex, actionExpression, actionArgs) {},
+ getNativeElementSync: function(location) {
+ return null;
+ },
+ setElementProperty: function(location, propertyName, propertyValue) {},
+ setElementAttribute: function(location, attributeName, attributeValue) {},
+ setElementClass: function(location, className, isAdd) {},
+ setElementStyle: function(location, styleName, styleValue) {},
+ invokeElementMethod: function(location, methodName, args) {},
setText: function(viewRef, textNodeIndex, text) {},
setEventDispatcher: function(viewRef, dispatcher) {}
}, {});
}());
$__export("Renderer", Renderer);
@@ -10289,55 +11624,91 @@
this.index = index;
this.parent = parent;
this.distanceToParent = distanceToParent;
this.protoElementInjector = protoElementInjector;
this.componentDirective = componentDirective;
+ this.nestedProtoView = null;
+ this.hostListeners = null;
if (isBlank(index)) {
throw new BaseException('null index not allowed.');
}
- this.hostListeners = null;
- this.nestedProtoView = null;
}
return ($traceurRuntime.createClass)(ElementBinder, {
hasStaticComponent: function() {
return isPresent(this.componentDirective) && isPresent(this.nestedProtoView);
},
- hasDynamicComponent: function() {
- return isPresent(this.componentDirective) && isBlank(this.nestedProtoView);
- },
hasEmbeddedProtoView: function() {
return !isPresent(this.componentDirective) && isPresent(this.nestedProtoView);
}
}, {});
}());
$__export("ElementBinder", ElementBinder);
}
};
});
+System.register("angular2/src/core/compiler/element_ref", ["angular2/src/facade/lang"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/core/compiler/element_ref";
+ var BaseException,
+ ElementRef;
+ return {
+ setters: [function($__m) {
+ BaseException = $__m.BaseException;
+ }],
+ execute: function() {
+ ElementRef = (function() {
+ function ElementRef(parentView, boundElementIndex, _renderer) {
+ this.parentView = parentView;
+ this.boundElementIndex = boundElementIndex;
+ this._renderer = _renderer;
+ }
+ return ($traceurRuntime.createClass)(ElementRef, {
+ get renderView() {
+ return this.parentView.render;
+ },
+ set renderView(viewRef) {
+ throw new BaseException('Abstract setter');
+ },
+ get nativeElement() {
+ return this._renderer.getNativeElementSync(this);
+ }
+ }, {});
+ }());
+ $__export("ElementRef", ElementRef);
+ }
+ };
+});
+
System.register("angular2/src/core/compiler/view_pool", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/view_pool";
var __decorate,
__metadata,
__param,
Inject,
+ Injectable,
+ OpaqueToken,
ListWrapper,
- MapWrapper,
+ Map,
isPresent,
isBlank,
+ CONST_EXPR,
APP_VIEW_POOL_CAPACITY,
AppViewPool;
return {
setters: [function($__m) {
Inject = $__m.Inject;
+ Injectable = $__m.Injectable;
+ OpaqueToken = $__m.OpaqueToken;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
- MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
+ CONST_EXPR = $__m.CONST_EXPR;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -10363,59 +11734,100 @@
__param = (this && this.__param) || function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
- APP_VIEW_POOL_CAPACITY = 'AppViewPool.viewPoolCapacity';
+ APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.viewPoolCapacity'));
$__export("APP_VIEW_POOL_CAPACITY", APP_VIEW_POOL_CAPACITY);
- AppViewPool = (function() {
- function AppViewPool(poolCapacityPerProtoView) {
- this._poolCapacityPerProtoView = poolCapacityPerProtoView;
- this._pooledViewsPerProtoView = MapWrapper.create();
- }
- return ($traceurRuntime.createClass)(AppViewPool, {
- getView: function(protoView) {
- var pooledViews = MapWrapper.get(this._pooledViewsPerProtoView, protoView);
- if (isPresent(pooledViews) && pooledViews.length > 0) {
- return ListWrapper.removeLast(pooledViews);
- }
- return null;
- },
- returnView: function(view) {
- var protoView = view.proto;
- var pooledViews = MapWrapper.get(this._pooledViewsPerProtoView, protoView);
- if (isBlank(pooledViews)) {
- pooledViews = [];
- MapWrapper.set(this._pooledViewsPerProtoView, protoView, pooledViews);
- }
- if (pooledViews.length < this._poolCapacityPerProtoView) {
- ListWrapper.push(pooledViews, view);
- }
+ AppViewPool = (($traceurRuntime.createClass)(function(poolCapacityPerProtoView) {
+ this._pooledViewsPerProtoView = new Map();
+ this._poolCapacityPerProtoView = poolCapacityPerProtoView;
+ }, {
+ getView: function(protoView) {
+ var pooledViews = this._pooledViewsPerProtoView.get(protoView);
+ if (isPresent(pooledViews) && pooledViews.length > 0) {
+ return ListWrapper.removeLast(pooledViews);
}
- }, {});
- }());
+ return null;
+ },
+ returnView: function(view) {
+ var protoView = view.proto;
+ var pooledViews = this._pooledViewsPerProtoView.get(protoView);
+ if (isBlank(pooledViews)) {
+ pooledViews = [];
+ this._pooledViewsPerProtoView.set(protoView, pooledViews);
+ }
+ var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView;
+ if (haveRemainingCapacity) {
+ pooledViews.push(view);
+ }
+ return haveRemainingCapacity;
+ }
+ }, {}));
$__export("AppViewPool", AppViewPool);
- $__export("AppViewPool", AppViewPool = __decorate([__param(0, Inject(APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool));
+ $__export("AppViewPool", AppViewPool = __decorate([Injectable(), __param(0, Inject(APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool));
}
};
});
+System.register("angular2/src/core/compiler/view_listener", ["angular2/di"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/core/compiler/view_listener";
+ var __decorate,
+ __metadata,
+ Injectable,
+ AppViewListener;
+ return {
+ setters: [function($__m) {
+ Injectable = $__m.Injectable;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ AppViewListener = (($traceurRuntime.createClass)(function() {}, {
+ viewCreated: function(view) {},
+ viewDestroyed: function(view) {}
+ }, {}));
+ $__export("AppViewListener", AppViewListener);
+ $__export("AppViewListener", AppViewListener = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewListener));
+ }
+ };
+});
+
System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/view_container_ref";
var ListWrapper,
isPresent,
- ViewRef,
internalView,
ViewContainerRef;
return {
setters: [function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
isPresent = $__m.isPresent;
}, function($__m) {
- ViewRef = $__m.ViewRef;
internalView = $__m.internalView;
}],
execute: function() {
ViewContainerRef = (function() {
function ViewContainerRef(viewManager, element) {
@@ -10431,11 +11843,11 @@
for (var i = this.length - 1; i >= 0; i--) {
this.remove(i);
}
},
get: function(index) {
- return new ViewRef(this._getViews()[index]);
+ return this._getViews()[index].ref;
},
get length() {
return this._getViews().length;
},
create: function() {
@@ -10473,105 +11885,31 @@
$__export("ViewContainerRef", ViewContainerRef);
}
};
});
-System.register("angular2/src/render/dom/view/view", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/change_detection", "angular2/src/facade/lang", "angular2/src/render/api"], function($__export) {
+System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/facade/lang"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/render/dom/view/view";
- var DOM,
- ListWrapper,
- MapWrapper,
- Locals,
- isPresent,
- RenderViewRef,
- DomViewRef,
- NG_BINDING_CLASS,
- DomView;
- function resolveInternalDomView(viewRef) {
- return viewRef._view;
+ var __moduleName = "angular2/src/core/compiler/directive_lifecycle_reflector";
+ var Type,
+ isPresent;
+ function hasLifecycleHook(e, type, annotation) {
+ if (isPresent(annotation.lifecycle)) {
+ return annotation.lifecycle.indexOf(e) !== -1;
+ } else {
+ if (!(type instanceof Type))
+ return false;
+ return e.name in type.prototype;
+ }
}
- $__export("resolveInternalDomView", resolveInternalDomView);
+ $__export("hasLifecycleHook", hasLifecycleHook);
return {
setters: [function($__m) {
- DOM = $__m.DOM;
- }, function($__m) {
- ListWrapper = $__m.ListWrapper;
- MapWrapper = $__m.MapWrapper;
- }, function($__m) {
- Locals = $__m.Locals;
- }, function($__m) {
+ Type = $__m.Type;
isPresent = $__m.isPresent;
- }, function($__m) {
- RenderViewRef = $__m.RenderViewRef;
}],
execute: function() {
- DomViewRef = (function($__super) {
- function DomViewRef(view) {
- $traceurRuntime.superConstructor(DomViewRef).call(this);
- this._view = view;
- }
- return ($traceurRuntime.createClass)(DomViewRef, {}, {}, $__super);
- }(RenderViewRef));
- $__export("DomViewRef", DomViewRef);
- NG_BINDING_CLASS = 'ng-binding';
- DomView = (function() {
- function DomView(proto, rootNodes, boundTextNodes, boundElements, contentTags) {
- this.proto = proto;
- this.rootNodes = rootNodes;
- this.boundTextNodes = boundTextNodes;
- this.boundElements = boundElements;
- this.contentTags = contentTags;
- this.viewContainers = ListWrapper.createFixedSize(boundElements.length);
- this.lightDoms = ListWrapper.createFixedSize(boundElements.length);
- this.hostLightDom = null;
- this.hydrated = false;
- this.eventHandlerRemovers = [];
- this.eventDispatcher = null;
- this.shadowRoot = null;
- }
- return ($traceurRuntime.createClass)(DomView, {
- getDirectParentLightDom: function(boundElementIndex) {
- var binder = this.proto.elementBinders[boundElementIndex];
- var destLightDom = null;
- if (binder.parentIndex !== -1 && binder.distanceToParent === 1) {
- destLightDom = this.lightDoms[binder.parentIndex];
- }
- return destLightDom;
- },
- setElementProperty: function(elementIndex, propertyName, value) {
- var setter = MapWrapper.get(this.proto.elementBinders[elementIndex].propertySetters, propertyName);
- setter(this.boundElements[elementIndex], value);
- },
- callAction: function(elementIndex, actionExpression, actionArgs) {
- var binder = this.proto.elementBinders[elementIndex];
- var hostAction = MapWrapper.get(binder.hostActions, actionExpression);
- hostAction.eval(this.boundElements[elementIndex], this._localsWithAction(actionArgs));
- },
- _localsWithAction: function(action) {
- var map = MapWrapper.create();
- MapWrapper.set(map, '$action', action);
- return new Locals(null, map);
- },
- setText: function(textIndex, value) {
- DOM.setText(this.boundTextNodes[textIndex], value);
- },
- dispatchEvent: function(elementIndex, eventName, event) {
- var allowDefaultBehavior = true;
- if (isPresent(this.eventDispatcher)) {
- var evalLocals = MapWrapper.create();
- MapWrapper.set(evalLocals, '$event', event);
- allowDefaultBehavior = this.eventDispatcher.dispatchEvent(elementIndex, eventName, evalLocals);
- if (!allowDefaultBehavior) {
- event.preventDefault();
- }
- }
- return allowDefaultBehavior;
- }
- }, {});
- }());
- $__export("DomView", DomView);
}
};
});
System.register("angular2/src/core/compiler/base_query_list", ["angular2/src/facade/collection"], function($__export) {
@@ -10606,11 +11944,11 @@
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__1, "add", {
value: function(obj) {
- ListWrapper.push(this._results, obj);
+ this._results.push(obj);
this._dirty = true;
},
configurable: true,
enumerable: true,
writable: true
@@ -10626,11 +11964,11 @@
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__1, "onChange", {
value: function(callback) {
- ListWrapper.push(this._callbacks, callback);
+ this._callbacks.push(callback);
},
configurable: true,
enumerable: true,
writable: true
}), Object.defineProperty($__1, "removeCallback", {
@@ -10638,37 +11976,59 @@
ListWrapper.remove(this._callbacks, callback);
},
configurable: true,
enumerable: true,
writable: true
+ }), Object.defineProperty($__1, "length", {
+ get: function() {
+ return this._results.length;
+ },
+ configurable: true,
+ enumerable: true
+ }), Object.defineProperty($__1, "first", {
+ get: function() {
+ return ListWrapper.first(this._results);
+ },
+ configurable: true,
+ enumerable: true
+ }), Object.defineProperty($__1, "last", {
+ get: function() {
+ return ListWrapper.last(this._results);
+ },
+ configurable: true,
+ enumerable: true
}), $__1), {});
}());
$__export("BaseQueryList", BaseQueryList);
}
};
});
-System.register("angular2/src/core/compiler/template_resolver", ["angular2/di", "angular2/src/core/annotations_impl/view", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection"], function($__export) {
+System.register("angular2/src/core/compiler/view_resolver", ["angular2/di", "angular2/src/core/annotations_impl/view", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/core/compiler/template_resolver";
+ var __moduleName = "angular2/src/core/compiler/view_resolver";
var __decorate,
__metadata,
Injectable,
View,
+ stringify,
isBlank,
- MapWrapper,
+ BaseException,
+ Map,
reflector,
- TemplateResolver;
+ ViewResolver;
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
View = $__m.View;
}, function($__m) {
+ stringify = $__m.stringify;
isBlank = $__m.isBlank;
+ BaseException = $__m.BaseException;
}, function($__m) {
- MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
}, function($__m) {
reflector = $__m.reflector;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
@@ -10691,18 +12051,18 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- TemplateResolver = (($traceurRuntime.createClass)(function() {
- this._cache = MapWrapper.create();
+ ViewResolver = (($traceurRuntime.createClass)(function() {
+ this._cache = new Map();
}, {
resolve: function(component) {
- var view = MapWrapper.get(this._cache, component);
+ var view = this._cache.get(component);
if (isBlank(view)) {
view = this._resolve(component);
- MapWrapper.set(this._cache, component, view);
+ this._cache.set(component, view);
}
return view;
},
_resolve: function(component) {
var annotations = reflector.annotations(component);
@@ -10710,15 +12070,15 @@
var annotation = annotations[i];
if (annotation instanceof View) {
return annotation;
}
}
- return null;
+ throw new BaseException(("No View annotation found on component " + stringify(component)));
}
}, {}));
- $__export("TemplateResolver", TemplateResolver);
- $__export("TemplateResolver", TemplateResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], TemplateResolver));
+ $__export("ViewResolver", ViewResolver);
+ $__export("ViewResolver", ViewResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], ViewResolver));
}
};
});
System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
@@ -10726,20 +12086,20 @@
var __moduleName = "angular2/src/core/compiler/component_url_mapper";
var __decorate,
__metadata,
Injectable,
isPresent,
- MapWrapper,
+ Map,
ComponentUrlMapper,
RuntimeComponentUrlMapper;
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
isPresent = $__m.isPresent;
}, function($__m) {
- MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -10768,18 +12128,18 @@
$__export("ComponentUrlMapper", ComponentUrlMapper);
$__export("ComponentUrlMapper", ComponentUrlMapper = __decorate([Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper));
RuntimeComponentUrlMapper = (function($__super) {
function RuntimeComponentUrlMapper() {
$traceurRuntime.superConstructor(RuntimeComponentUrlMapper).call(this);
- this._componentUrls = MapWrapper.create();
+ this._componentUrls = new Map();
}
return ($traceurRuntime.createClass)(RuntimeComponentUrlMapper, {
setComponentUrl: function(component, url) {
- MapWrapper.set(this._componentUrls, component, url);
+ this._componentUrls.set(component, url);
},
getUrl: function(component) {
- var url = MapWrapper.get(this._componentUrls, component);
+ var url = this._componentUrls.get(component);
if (isPresent(url))
return url;
return $traceurRuntime.superGet(this, RuntimeComponentUrlMapper.prototype, "getUrl").call(this, component);
}
}, {}, $__super);
@@ -10797,10 +12157,11 @@
Injectable,
ListWrapper,
MapWrapper,
isPresent,
isBlank,
+ BaseException,
reflector,
ChangeDetection,
DirectiveIndex,
BindingRecord,
DirectiveRecord,
@@ -10813,22 +12174,21 @@
ProtoViewFactory,
RenderProtoViewWithIndex,
ParentProtoElementInjectorWithDistance;
function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata) {
var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView);
- var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex);
- var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex, nestedPvVariableBindings);
+ var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex);
return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata);
}
function _collectNestedProtoViews(renderProtoView) {
var parentIndex = arguments[1] !== (void 0) ? arguments[1] : null;
var boundElementIndex = arguments[2] !== (void 0) ? arguments[2] : null;
var result = arguments[3] !== (void 0) ? arguments[3] : null;
if (isBlank(result)) {
result = [];
}
- ListWrapper.push(result, new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex));
+ result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex));
var currentIndex = result.length - 1;
var childBoundElementIndex = 0;
ListWrapper.forEach(renderProtoView.elementBinders, (function(elementBinder) {
if (isPresent(elementBinder.nestedProtoView)) {
_collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result);
@@ -10843,14 +12203,14 @@
var bindingRecordsCreator = new BindingRecordsCreator();
var bindingRecords = bindingRecordsCreator.getBindingRecords(elementBinders, allRenderDirectiveMetadata);
var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata);
var strategyName = DEFAULT;
var typeString;
- if (pvWithIndex.renderProtoView.type === renderApi.ProtoViewDto.COMPONENT_VIEW_TYPE) {
+ if (pvWithIndex.renderProtoView.type === renderApi.ViewType.COMPONENT) {
strategyName = hostComponentMetadata.changeDetection;
typeString = 'comp';
- } else if (pvWithIndex.renderProtoView.type === renderApi.ProtoViewDto.HOST_VIEW_TYPE) {
+ } else if (pvWithIndex.renderProtoView.type === renderApi.ViewType.HOST) {
typeString = 'host';
} else {
typeString = 'embedded';
}
var id = (hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index);
@@ -10858,47 +12218,57 @@
return new ChangeDetectorDefinition(id, strategyName, variableNames, bindingRecords, directiveRecords);
}));
}
function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives) {
var elementBinders = renderProtoView.elementBinders;
- var protoView = new AppProtoView(renderProtoView.render, protoChangeDetector, variableBindings);
+ var protoView = new AppProtoView(renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders));
_createElementBinders(protoView, elementBinders, allDirectives);
_bindDirectiveEvents(protoView, elementBinders);
return protoView;
}
function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) {
return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) {
return _createVariableBindings(pvWithIndex.renderProtoView);
}));
}
function _createVariableBindings(renderProtoView) {
- var variableBindings = MapWrapper.create();
+ var variableBindings = new Map();
MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) {
- MapWrapper.set(variableBindings, varName, mappedName);
+ variableBindings.set(varName, mappedName);
}));
- ListWrapper.forEach(renderProtoView.elementBinders, (function(binder) {
- MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) {
- MapWrapper.set(variableBindings, varName, mappedName);
- }));
- }));
return variableBindings;
}
- function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex, nestedPvVariableBindings) {
+ function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) {
var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length);
ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) {
var parentVariableNames = isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null;
- nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, nestedPvVariableBindings[pvWithIndex.index]);
+ nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView);
}));
return nestedPvVariableNames;
}
- function _createVariableNames(parentVariableNames, variableBindings) {
- var variableNames = isPresent(parentVariableNames) ? ListWrapper.clone(parentVariableNames) : [];
- MapWrapper.forEach(variableBindings, (function(local, v) {
- ListWrapper.push(variableNames, local);
+ function _createVariableNames(parentVariableNames, renderProtoView) {
+ var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames);
+ MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) {
+ res.push(mappedName);
}));
- return variableNames;
+ ListWrapper.forEach(renderProtoView.elementBinders, (function(binder) {
+ MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) {
+ res.push(mappedName);
+ }));
+ }));
+ return res;
}
+ function createVariableLocations(elementBinders) {
+ var variableLocations = new Map();
+ for (var i = 0; i < elementBinders.length; i++) {
+ var binder = elementBinders[i];
+ MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) {
+ variableLocations.set(mappedName, i);
+ }));
+ }
+ return variableLocations;
+ }
function _createElementBinders(protoView, elementBinders, allDirectiveBindings) {
for (var i = 0; i < elementBinders.length; i++) {
var renderElementBinder = elementBinders[i];
var dirs = elementBinders[i].directives;
var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders);
@@ -10910,11 +12280,11 @@
if (directiveBindings[0].metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) {
componentDirectiveBinding = directiveBindings[0];
}
}
var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings);
- _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding);
+ _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings);
}
}
function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) {
var distance = 0;
do {
@@ -10932,54 +12302,84 @@
}
function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) {
var protoElementInjector = null;
var hasVariables = MapWrapper.size(renderElementBinder.variableBindings) > 0;
if (directiveBindings.length > 0 || hasVariables) {
- protoElementInjector = ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, isPresent(componentDirectiveBinding), parentPeiWithDistance.distance);
+ var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings);
+ protoElementInjector = ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings);
protoElementInjector.attributes = renderElementBinder.readAttributes;
- if (hasVariables) {
- protoElementInjector.exportComponent = isPresent(componentDirectiveBinding);
- protoElementInjector.exportElement = isBlank(componentDirectiveBinding);
- var exportImplicitName = MapWrapper.get(renderElementBinder.variableBindings, '\$implicit');
- if (isPresent(exportImplicitName)) {
- protoElementInjector.exportImplicitName = exportImplicitName;
- }
- }
}
return protoElementInjector;
}
- function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding) {
+ function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) {
var parent = null;
if (renderElementBinder.parentIndex !== -1) {
parent = protoView.elementBinders[renderElementBinder.parentIndex];
}
var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding);
protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1);
MapWrapper.forEach(renderElementBinder.variableBindings, (function(mappedName, varName) {
- MapWrapper.set(protoView.protoLocals, mappedName, null);
+ protoView.protoLocals.set(mappedName, null);
}));
return elBinder;
}
+ function createDirectiveVariableBindings(renderElementBinder, directiveBindings) {
+ var directiveVariableBindings = new Map();
+ MapWrapper.forEach(renderElementBinder.variableBindings, (function(templateName, exportAs) {
+ var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs);
+ directiveVariableBindings.set(templateName, dirIndex);
+ }));
+ return directiveVariableBindings;
+ }
+ function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) {
+ var matchedDirectiveIndex = null;
+ var matchedDirective;
+ for (var i = 0; i < directiveBindings.length; ++i) {
+ var directive = directiveBindings[i];
+ if (_directiveExportAs(directive) == exportAs) {
+ if (isPresent(matchedDirective)) {
+ throw new BaseException(("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"));
+ }
+ matchedDirectiveIndex = i;
+ matchedDirective = directive;
+ }
+ }
+ if (isBlank(matchedDirective) && exportAs !== "$implicit") {
+ throw new BaseException(("Cannot find directive with exportAs = '" + exportAs + "'"));
+ }
+ return matchedDirectiveIndex;
+ }
+ function _directiveExportAs(directive) {
+ var directiveExportAs = directive.metadata.exportAs;
+ if (isBlank(directiveExportAs) && directive.metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) {
+ return "$implicit";
+ } else {
+ return directiveExportAs;
+ }
+ }
function _bindDirectiveEvents(protoView, elementBinders) {
for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; ++boundElementIndex) {
var dirs = elementBinders[boundElementIndex].directives;
for (var i = 0; i < dirs.length; i++) {
var directiveBinder = dirs[i];
protoView.bindEvent(directiveBinder.eventBindings, boundElementIndex, i);
}
}
}
$__export("getChangeDetectorDefinitions", getChangeDetectorDefinitions);
+ $__export("createVariableLocations", createVariableLocations);
+ $__export("createDirectiveVariableBindings", createDirectiveVariableBindings);
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
+ BaseException = $__m.BaseException;
}, function($__m) {
reflector = $__m.reflector;
}, function($__m) {
ChangeDetection = $__m.ChangeDetection;
DirectiveIndex = $__m.DirectiveIndex;
@@ -11017,11 +12417,11 @@
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
BindingRecordsCreator = (function() {
function BindingRecordsCreator() {
- this._directiveRecordsMap = MapWrapper.create();
+ this._directiveRecordsMap = new Map();
this._textNodeIndex = 0;
}
return ($traceurRuntime.createClass)(BindingRecordsCreator, {
getBindingRecords: function(elementBinders, allDirectiveMetadatas) {
var bindings = [];
@@ -11036,64 +12436,97 @@
getDirectiveRecords: function(elementBinders, allDirectiveMetadatas) {
var directiveRecords = [];
for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) {
var dirs = elementBinders[elementIndex].directives;
for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) {
- ListWrapper.push(directiveRecords, this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex]));
+ directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex]));
}
}
return directiveRecords;
},
_createTextNodeRecords: function(bindings, renderElementBinder) {
var $__0 = this;
if (isBlank(renderElementBinder.textBindings))
return ;
ListWrapper.forEach(renderElementBinder.textBindings, (function(b) {
- ListWrapper.push(bindings, BindingRecord.createForTextNode(b, $__0._textNodeIndex++));
+ bindings.push(BindingRecord.createForTextNode(b, $__0._textNodeIndex++));
}));
},
_createElementPropertyRecords: function(bindings, boundElementIndex, renderElementBinder) {
- MapWrapper.forEach(renderElementBinder.propertyBindings, (function(astWithSource, propertyName) {
- ListWrapper.push(bindings, BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName));
+ ListWrapper.forEach(renderElementBinder.propertyBindings, (function(binding) {
+ if (binding.type === renderApi.PropertyBindingType.PROPERTY) {
+ bindings.push(BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property));
+ } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) {
+ bindings.push(BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property));
+ } else if (binding.type === renderApi.PropertyBindingType.CLASS) {
+ bindings.push(BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property));
+ } else if (binding.type === renderApi.PropertyBindingType.STYLE) {
+ bindings.push(BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit));
+ }
}));
},
_createDirectiveRecords: function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) {
- var $__0 = this;
for (var i = 0; i < directiveBinders.length; i++) {
var directiveBinder = directiveBinders[i];
var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex];
+ var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata);
MapWrapper.forEach(directiveBinder.propertyBindings, (function(astWithSource, propertyName) {
var setter = reflector.setter(propertyName);
- var directiveRecord = $__0._getDirectiveRecord(boundElementIndex, i, directiveMetadata);
- ListWrapper.push(bindings, BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord));
+ bindings.push(BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord));
}));
- MapWrapper.forEach(directiveBinder.hostPropertyBindings, (function(astWithSource, propertyName) {
+ if (directiveRecord.callOnChange) {
+ bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord));
+ }
+ if (directiveRecord.callOnInit) {
+ bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord));
+ }
+ if (directiveRecord.callOnCheck) {
+ bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord));
+ }
+ }
+ for (var i = 0; i < directiveBinders.length; i++) {
+ var directiveBinder = directiveBinders[i];
+ ListWrapper.forEach(directiveBinder.hostPropertyBindings, (function(binding) {
var dirIndex = new DirectiveIndex(boundElementIndex, i);
- ListWrapper.push(bindings, BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName));
+ if (binding.type === renderApi.PropertyBindingType.PROPERTY) {
+ bindings.push(BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property));
+ } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) {
+ bindings.push(BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property));
+ } else if (binding.type === renderApi.PropertyBindingType.CLASS) {
+ bindings.push(BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property));
+ } else if (binding.type === renderApi.PropertyBindingType.STYLE) {
+ bindings.push(BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit));
+ }
}));
}
},
_getDirectiveRecord: function(boundElementIndex, directiveIndex, directiveMetadata) {
var id = boundElementIndex * 100 + directiveIndex;
- if (!MapWrapper.contains(this._directiveRecordsMap, id)) {
- var changeDetection = directiveMetadata.changeDetection;
- MapWrapper.set(this._directiveRecordsMap, id, new DirectiveRecord(new DirectiveIndex(boundElementIndex, directiveIndex), directiveMetadata.callOnAllChangesDone, directiveMetadata.callOnChange, changeDetection));
+ if (!this._directiveRecordsMap.has(id)) {
+ this._directiveRecordsMap.set(id, new DirectiveRecord({
+ directiveIndex: new DirectiveIndex(boundElementIndex, directiveIndex),
+ callOnAllChangesDone: directiveMetadata.callOnAllChangesDone,
+ callOnChange: directiveMetadata.callOnChange,
+ callOnCheck: directiveMetadata.callOnCheck,
+ callOnInit: directiveMetadata.callOnInit,
+ changeDetection: directiveMetadata.changeDetection
+ }));
}
- return MapWrapper.get(this._directiveRecordsMap, id);
+ return this._directiveRecordsMap.get(id);
}
}, {});
}());
- ProtoViewFactory = (($traceurRuntime.createClass)(function(changeDetection) {
- this._changeDetection = changeDetection;
+ ProtoViewFactory = (($traceurRuntime.createClass)(function(_changeDetection) {
+ this._changeDetection = _changeDetection;
}, {createAppProtoViews: function(hostComponentBinding, rootRenderProtoView, allDirectives) {
var $__0 = this;
var allRenderDirectiveMetadata = ListWrapper.map(allDirectives, (function(directiveBinding) {
return directiveBinding.metadata;
}));
var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView);
var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex);
- var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex, nestedPvVariableBindings);
+ var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex);
var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata);
var protoChangeDetectors = ListWrapper.map(changeDetectorDefs, (function(changeDetectorDef) {
return $__0._changeDetection.createProtoChangeDetector(changeDetectorDef);
}));
var appProtoViews = ListWrapper.createFixedSize(nestedPvsWithIndex.length);
@@ -11127,33 +12560,125 @@
}());
}
};
});
-System.register("angular2/src/services/url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) {
+System.register("angular2/src/services/url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/services/url_resolver";
var __decorate,
__metadata,
Injectable,
isPresent,
isBlank,
RegExpWrapper,
- BaseException,
- DOM,
+ ListWrapper,
UrlResolver,
- _schemeRe;
+ _splitRe,
+ _ComponentIndex;
+ function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
+ var out = [];
+ if (isPresent(opt_scheme)) {
+ out.push(opt_scheme + ':');
+ }
+ if (isPresent(opt_domain)) {
+ out.push('//');
+ if (isPresent(opt_userInfo)) {
+ out.push(opt_userInfo + '@');
+ }
+ out.push(opt_domain);
+ if (isPresent(opt_port)) {
+ out.push(':' + opt_port);
+ }
+ }
+ if (isPresent(opt_path)) {
+ out.push(opt_path);
+ }
+ if (isPresent(opt_queryData)) {
+ out.push('?' + opt_queryData);
+ }
+ if (isPresent(opt_fragment)) {
+ out.push('#' + opt_fragment);
+ }
+ return out.join('');
+ }
+ function _split(uri) {
+ return RegExpWrapper.firstMatch(_splitRe, uri);
+ }
+ function _removeDotSegments(path) {
+ if (path == '/')
+ return '/';
+ var leadingSlash = path[0] == '/' ? '/' : '';
+ var trailingSlash = path[path.length - 1] === '/' ? '/' : '';
+ var segments = path.split('/');
+ var out = [];
+ var up = 0;
+ for (var pos = 0; pos < segments.length; pos++) {
+ var segment = segments[pos];
+ switch (segment) {
+ case '':
+ case '.':
+ break;
+ case '..':
+ if (out.length > 0) {
+ ListWrapper.removeAt(out, out.length - 1);
+ } else {
+ up++;
+ }
+ break;
+ default:
+ out.push(segment);
+ }
+ }
+ if (leadingSlash == '') {
+ while (up-- > 0) {
+ ListWrapper.insert(out, 0, '..');
+ }
+ if (out.length === 0)
+ out.push('.');
+ }
+ return leadingSlash + out.join('/') + trailingSlash;
+ }
+ function _joinAndCanonicalizePath(parts) {
+ var path = parts[_ComponentIndex.PATH];
+ path = isBlank(path) ? '' : _removeDotSegments(path);
+ parts[_ComponentIndex.PATH] = path;
+ return _buildFromEncodedParts(parts[_ComponentIndex.SCHEME], parts[_ComponentIndex.USER_INFO], parts[_ComponentIndex.DOMAIN], parts[_ComponentIndex.PORT], path, parts[_ComponentIndex.QUERY_DATA], parts[_ComponentIndex.FRAGMENT]);
+ }
+ function _resolveUrl(base, url) {
+ var parts = _split(url);
+ var baseParts = _split(base);
+ if (isPresent(parts[_ComponentIndex.SCHEME])) {
+ return _joinAndCanonicalizePath(parts);
+ } else {
+ parts[_ComponentIndex.SCHEME] = baseParts[_ComponentIndex.SCHEME];
+ }
+ for (var i = _ComponentIndex.SCHEME; i <= _ComponentIndex.PORT; i++) {
+ if (isBlank(parts[i])) {
+ parts[i] = baseParts[i];
+ }
+ }
+ if (parts[_ComponentIndex.PATH][0] == '/') {
+ return _joinAndCanonicalizePath(parts);
+ }
+ var path = baseParts[_ComponentIndex.PATH];
+ if (isBlank(path))
+ path = '/';
+ var index = path.lastIndexOf('/');
+ path = path.substring(0, index + 1) + parts[_ComponentIndex.PATH];
+ parts[_ComponentIndex.PATH] = path;
+ return _joinAndCanonicalizePath(parts);
+ }
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
RegExpWrapper = $__m.RegExpWrapper;
- BaseException = $__m.BaseException;
}, function($__m) {
- DOM = $__m.DOM;
+ ListWrapper = $__m.ListWrapper;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -11174,38 +12699,83 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- UrlResolver = (($traceurRuntime.createClass)(function() {
- if (isBlank(UrlResolver.a)) {
- UrlResolver.a = DOM.createElement('a');
- }
- }, {resolve: function(baseUrl, url) {
- if (isBlank(baseUrl)) {
- DOM.resolveAndSetHref(UrlResolver.a, url, null);
- return DOM.getHref(UrlResolver.a);
- }
- if (isBlank(url) || url == '')
- return baseUrl;
- if (url[0] == '/') {
- throw new BaseException(("Could not resolve the url " + url + " from " + baseUrl));
- }
- var m = RegExpWrapper.firstMatch(_schemeRe, url);
- if (isPresent(m[1])) {
- return url;
- }
- DOM.resolveAndSetHref(UrlResolver.a, baseUrl, url);
- return DOM.getHref(UrlResolver.a);
+ UrlResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(baseUrl, url) {
+ return _resolveUrl(baseUrl, url);
}}, {}));
$__export("UrlResolver", UrlResolver);
$__export("UrlResolver", UrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], UrlResolver));
- _schemeRe = RegExpWrapper.create('^([^:/?#]+:)?');
+ _splitRe = RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$');
+ (function(_ComponentIndex) {
+ _ComponentIndex[_ComponentIndex["SCHEME"] = 1] = "SCHEME";
+ _ComponentIndex[_ComponentIndex["USER_INFO"] = 2] = "USER_INFO";
+ _ComponentIndex[_ComponentIndex["DOMAIN"] = 3] = "DOMAIN";
+ _ComponentIndex[_ComponentIndex["PORT"] = 4] = "PORT";
+ _ComponentIndex[_ComponentIndex["PATH"] = 5] = "PATH";
+ _ComponentIndex[_ComponentIndex["QUERY_DATA"] = 6] = "QUERY_DATA";
+ _ComponentIndex[_ComponentIndex["FRAGMENT"] = 7] = "FRAGMENT";
+ })(_ComponentIndex || (_ComponentIndex = {}));
}
};
});
+System.register("angular2/src/services/app_root_url", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/services/app_root_url";
+ var __decorate,
+ __metadata,
+ Injectable,
+ isBlank,
+ DOM,
+ AppRootUrl;
+ return {
+ setters: [function($__m) {
+ Injectable = $__m.Injectable;
+ }, function($__m) {
+ isBlank = $__m.isBlank;
+ }, function($__m) {
+ DOM = $__m.DOM;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ AppRootUrl = (($traceurRuntime.createClass)(function() {}, {get value() {
+ if (isBlank(this._value)) {
+ var a = DOM.createElement('a');
+ DOM.resolveAndSetHref(a, './', null);
+ this._value = DOM.getHref(a);
+ }
+ return this._value;
+ }}, {}));
+ $__export("AppRootUrl", AppRootUrl);
+ $__export("AppRootUrl", AppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppRootUrl));
+ }
+ };
+});
+
System.register("angular2/src/core/exception_handler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/exception_handler";
var __decorate,
__metadata,
@@ -11260,13 +12830,13 @@
$__export("ExceptionHandler", ExceptionHandler = __decorate([Injectable(), __metadata('design:paramtypes', [])], ExceptionHandler));
}
};
});
-System.register("angular2/src/services/xhr", [], function($__export) {
+System.register("angular2/src/render/xhr", [], function($__export) {
"use strict";
- var __moduleName = "angular2/src/services/xhr";
+ var __moduleName = "angular2/src/render/xhr";
var XHR;
return {
setters: [],
execute: function() {
XHR = (function() {
@@ -11278,10 +12848,83 @@
$__export("XHR", XHR);
}
};
});
+System.register("angular2/src/render/dom/compiler/style_url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/services/url_resolver"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/render/dom/compiler/style_url_resolver";
+ var __decorate,
+ __metadata,
+ Injectable,
+ RegExpWrapper,
+ StringWrapper,
+ UrlResolver,
+ StyleUrlResolver,
+ _cssUrlRe,
+ _cssImportRe,
+ _quoteRe;
+ return {
+ setters: [function($__m) {
+ Injectable = $__m.Injectable;
+ }, function($__m) {
+ RegExpWrapper = $__m.RegExpWrapper;
+ StringWrapper = $__m.StringWrapper;
+ }, function($__m) {
+ UrlResolver = $__m.UrlResolver;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ StyleUrlResolver = (($traceurRuntime.createClass)(function(_resolver) {
+ this._resolver = _resolver;
+ }, {
+ resolveUrls: function(cssText, baseUrl) {
+ cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl);
+ cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl);
+ return cssText;
+ },
+ _replaceUrls: function(cssText, re, baseUrl) {
+ var $__0 = this;
+ return StringWrapper.replaceAllMapped(cssText, re, (function(m) {
+ var pre = m[1];
+ var url = StringWrapper.replaceAll(m[2], _quoteRe, '');
+ var post = m[3];
+ var resolvedUrl = $__0._resolver.resolve(baseUrl, url);
+ return pre + "'" + resolvedUrl + "'" + post;
+ }));
+ }
+ }, {}));
+ $__export("StyleUrlResolver", StyleUrlResolver);
+ $__export("StyleUrlResolver", StyleUrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [UrlResolver])], StyleUrlResolver));
+ _cssUrlRe = RegExpWrapper.create('(url\\()([^)]*)(\\))');
+ _cssImportRe = RegExpWrapper.create('(@import[\\s]+(?!url\\())[\'"]([^\'"]*)[\'"](.*;)');
+ _quoteRe = RegExpWrapper.create('[\'"]');
+ }
+ };
+});
+
System.register("angular2/src/core/zone/ng_zone", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/zone/ng_zone";
var StringMapWrapper,
normalizeBlank,
@@ -11298,10 +12941,11 @@
}],
execute: function() {
NgZone = (function() {
function NgZone($__1) {
var enableLongStackTrace = $__1.enableLongStackTrace;
+ this._inVmTurnDone = false;
this._onTurnStart = null;
this._onTurnDone = null;
this._onErrorHandler = null;
this._pendingMicrotasks = 0;
this._hasExecutedCodeInInnerZone = false;
@@ -11363,15 +13007,17 @@
}
}
return parentRun.apply(this, arguments);
} finally {
ngZone._nestedRun--;
- if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0) {
+ if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) {
if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) {
try {
+ this._inVmTurnDone = true;
parentRun.call(ngZone._innerZone, ngZone._onTurnDone);
} finally {
+ this._inVmTurnDone = false;
ngZone._hasExecutedCodeInInnerZone = false;
}
}
}
}
@@ -11412,29 +13058,28 @@
$__export("NgZone", NgZone);
}
};
});
-System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/di", "angular2/change_detection", "angular2/src/core/exception_handler", "angular2/src/facade/lang"], function($__export) {
+System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/di", "angular2/src/core/exception_handler", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/life_cycle/life_cycle";
var __decorate,
__metadata,
Injectable,
- ChangeDetector,
ExceptionHandler,
isPresent,
+ BaseException,
LifeCycle;
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
- ChangeDetector = $__m.ChangeDetector;
- }, function($__m) {
ExceptionHandler = $__m.ExceptionHandler;
}, function($__m) {
isPresent = $__m.isPresent;
+ BaseException = $__m.BaseException;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -11458,10 +13103,11 @@
return Reflect.metadata(k, v);
};
LifeCycle = (($traceurRuntime.createClass)(function(exceptionHandler) {
var changeDetector = arguments[1] !== (void 0) ? arguments[1] : null;
var enforceNoNewChanges = arguments[2] !== (void 0) ? arguments[2] : false;
+ this._runningTick = false;
this._errorHandler = (function(exception, stackTrace) {
exceptionHandler.call(exception, stackTrace);
throw exception;
});
this._changeDetector = changeDetector;
@@ -11479,18 +13125,26 @@
return $__0.tick();
})
});
},
tick: function() {
- this._changeDetector.detectChanges();
- if (this._enforceNoNewChanges) {
- this._changeDetector.checkNoChanges();
+ if (this._runningTick) {
+ throw new BaseException("LifeCycle.tick is called recursively");
}
+ try {
+ this._runningTick = true;
+ this._changeDetector.detectChanges();
+ if (this._enforceNoNewChanges) {
+ this._changeDetector.checkNoChanges();
+ }
+ } finally {
+ this._runningTick = false;
+ }
}
}, {}));
$__export("LifeCycle", LifeCycle);
- $__export("LifeCycle", LifeCycle = __decorate([Injectable(), __metadata('design:paramtypes', [ExceptionHandler, ChangeDetector, Boolean])], LifeCycle));
+ $__export("LifeCycle", LifeCycle = __decorate([Injectable(), __metadata('design:paramtypes', [ExceptionHandler, Object, Boolean])], LifeCycle));
}
};
});
System.register("angular2/src/render/dom/shadow_dom/shadow_dom_strategy", [], function($__export) {
@@ -11510,13 +13164,11 @@
return null;
},
constructLightDom: function(lightDomView, el) {
return null;
},
- processStyleElement: function(hostComponentId, templateUrl, styleElement) {
- return null;
- },
+ processStyleElement: function(hostComponentId, templateUrl, styleElement) {},
processElement: function(hostComponentId, elementComponentId, element) {}
}, {});
}());
$__export("ShadowDomStrategy", ShadowDomStrategy);
}
@@ -11568,22 +13220,22 @@
function DestinationLightDom() {}
return ($traceurRuntime.createClass)(DestinationLightDom, {}, {});
}());
$__export("DestinationLightDom", DestinationLightDom);
_Root = (function() {
- function _Root(node, boundElementIndex) {
+ function _Root(node, boundElement) {
this.node = node;
- this.boundElementIndex = boundElementIndex;
+ this.boundElement = boundElement;
}
return ($traceurRuntime.createClass)(_Root, {}, {});
}());
LightDom = (function() {
function LightDom(lightDomView, element) {
+ this.shadowDomView = null;
+ this._roots = null;
this.lightDomView = lightDomView;
this.nodes = DOM.childNodesAsList(element);
- this._roots = null;
- this.shadowDomView = null;
}
return ($traceurRuntime.createClass)(LightDom, {
attachShadowDomView: function(shadowDomView) {
this.shadowDomView = shadowDomView;
},
@@ -11600,20 +13252,21 @@
return [];
}
},
_collectAllContentTags: function(view, acc) {
var $__0 = this;
- var contentTags = view.contentTags;
- var vcs = view.viewContainers;
- for (var i = 0; i < vcs.length; i++) {
- var vc = vcs[i];
- var contentTag = contentTags[i];
- if (isPresent(contentTag)) {
- ListWrapper.push(acc, contentTag);
+ if (view.proto.transitiveContentTagCount === 0) {
+ return acc;
+ }
+ var els = view.boundElements;
+ for (var i = 0; i < els.length; i++) {
+ var el = els[i];
+ if (isPresent(el.contentTag)) {
+ acc.push(el.contentTag);
}
- if (isPresent(vc)) {
- ListWrapper.forEach(vc.contentTagContainers(), (function(view) {
+ if (isPresent(el.viewContainer)) {
+ ListWrapper.forEach(el.viewContainer.contentTagContainers(), (function(view) {
$__0._collectAllContentTags(view, acc);
}));
}
}
return acc;
@@ -11621,40 +13274,40 @@
expandedDomNodes: function() {
var res = [];
var roots = this._findRoots();
for (var i = 0; i < roots.length; ++i) {
var root = roots[i];
- if (isPresent(root.boundElementIndex)) {
- var vc = this.lightDomView.viewContainers[root.boundElementIndex];
- var content = this.lightDomView.contentTags[root.boundElementIndex];
+ if (isPresent(root.boundElement)) {
+ var vc = root.boundElement.viewContainer;
+ var content = root.boundElement.contentTag;
if (isPresent(vc)) {
res = ListWrapper.concat(res, vc.nodes());
} else if (isPresent(content)) {
res = ListWrapper.concat(res, content.nodes());
} else {
- ListWrapper.push(res, root.node);
+ res.push(root.node);
}
} else {
- ListWrapper.push(res, root.node);
+ res.push(root.node);
}
}
return res;
},
_findRoots: function() {
if (isPresent(this._roots))
return this._roots;
var boundElements = this.lightDomView.boundElements;
this._roots = ListWrapper.map(this.nodes, (function(n) {
- var boundElementIndex = null;
+ var boundElement = null;
for (var i = 0; i < boundElements.length; i++) {
var boundEl = boundElements[i];
- if (isPresent(boundEl) && boundEl === n) {
- boundElementIndex = i;
+ if (isPresent(boundEl) && boundEl.element === n) {
+ boundElement = boundEl;
break;
}
}
- return new _Root(n, boundElementIndex);
+ return new _Root(n, boundElement);
}));
return this._roots;
}
}, {});
}());
@@ -11783,11 +13436,11 @@
for (var i = 0; i < parts.length; i++) {
var p = parts[i];
if (isBlank(p))
break;
p = p.trim();
- ListWrapper.push(r, partReplacer(_polyfillHostNoCombinator, p, m[3]));
+ r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
}
return r.join(',');
} else {
return _polyfillHostNoCombinator + m[3];
}
@@ -11852,11 +13505,11 @@
var p = parts[i];
p = p.trim();
if (this._selectorNeedsScoping(p, scopeSelector)) {
p = strict && !StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector);
}
- ListWrapper.push(r, p);
+ r.push(p);
}
return r.join(', ');
},
_selectorNeedsScoping: function(selector, scopeSelector) {
var re = this._makeScopeMatcher(scopeSelector);
@@ -11939,13 +13592,13 @@
_colonHostContextRe = RegExpWrapper.create(':host-context', 'im');
}
};
});
-System.register("angular2/src/services/xhr_impl", ["angular2/di", "angular2/src/facade/async", "angular2/src/services/xhr"], function($__export) {
+System.register("angular2/src/render/xhr_impl", ["angular2/di", "angular2/src/facade/async", "angular2/src/render/xhr"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/services/xhr_impl";
+ var __moduleName = "angular2/src/render/xhr_impl";
var __decorate,
__metadata,
Injectable,
PromiseWrapper,
XHR,
@@ -11989,13 +13642,17 @@
var completer = PromiseWrapper.completer();
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'text';
xhr.onload = function() {
- var status = xhr.status;
+ var response = ('response' in xhr) ? xhr.response : xhr.responseText;
+ var status = xhr.status === 1223 ? 204 : xhr.status;
+ if (status === 0) {
+ status = response ? 200 : 0;
+ }
if (200 <= status && status <= 300) {
- completer.resolve(xhr.responseText);
+ completer.resolve(response);
} else {
completer.reject(("Failed to load " + url), null);
}
};
xhr.onerror = function() {
@@ -12029,15 +13686,15 @@
DOM = $__m.DOM;
}],
execute: function() {
BUBBLE_SYMBOL = '^';
EventManager = (function() {
- function EventManager(plugins, zone) {
- this._zone = zone;
- this._plugins = plugins;
- for (var i = 0; i < plugins.length; i++) {
- plugins[i].manager = this;
+ function EventManager(_plugins, _zone) {
+ this._plugins = _plugins;
+ this._zone = _zone;
+ for (var i = 0; i < _plugins.length; i++) {
+ _plugins[i].manager = this;
}
}
return ($traceurRuntime.createClass)(EventManager, {
addEventListener: function(element, eventName, handler) {
var withoutBubbleSymbol = this._removeBubbleSymbol(eventName);
@@ -12186,17 +13843,16 @@
DOM.on(element, StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler);
}));
}
}, {
parseEventName: function(eventName) {
- eventName = eventName.toLowerCase();
- var parts = eventName.split('.');
+ var parts = eventName.toLowerCase().split('.');
var domEventName = ListWrapper.removeAt(parts, 0);
if ((parts.length === 0) || !(StringWrapper.equals(domEventName, 'keydown') || StringWrapper.equals(domEventName, 'keyup'))) {
return null;
}
- var key = ListWrapper.removeLast(parts);
+ var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts));
var fullKey = '';
ListWrapper.forEach(modifierKeys, (function(modifierName) {
if (ListWrapper.contains(parts, modifierName)) {
ListWrapper.remove(parts, modifierName);
fullKey += modifierName + '.';
@@ -12232,16 +13888,24 @@
return fullKey;
},
eventCallback: function(element, shouldSupportBubble, fullKey, handler, zone) {
return (function(event) {
var correctElement = shouldSupportBubble || event.target === element;
- if (correctElement && KeyEventsPlugin.getEventFullKey(event) === fullKey) {
+ if (correctElement && StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
zone.run((function() {
return handler(event);
}));
}
});
+ },
+ _normalizeKey: function(keyName) {
+ switch (keyName) {
+ case 'esc':
+ return 'escape';
+ default:
+ return keyName;
+ }
}
}, $__super);
}(EventManagerPlugin));
$__export("KeyEventsPlugin", KeyEventsPlugin);
}
@@ -12305,256 +13969,27 @@
$__export("HammerGesturesPluginCommon", HammerGesturesPluginCommon);
}
};
});
-System.register("angular2/src/render/dom/shadow_dom/style_url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/services/url_resolver"], function($__export) {
+System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/di", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/render/dom/shadow_dom/style_url_resolver";
- var __decorate,
- __metadata,
- Injectable,
- RegExpWrapper,
- StringWrapper,
- UrlResolver,
- StyleUrlResolver,
- _cssUrlRe,
- _cssImportRe,
- _quoteRe;
- return {
- setters: [function($__m) {
- Injectable = $__m.Injectable;
- }, function($__m) {
- RegExpWrapper = $__m.RegExpWrapper;
- StringWrapper = $__m.StringWrapper;
- }, function($__m) {
- UrlResolver = $__m.UrlResolver;
- }],
- execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
- StyleUrlResolver = (($traceurRuntime.createClass)(function(resolver) {
- this._resolver = resolver;
- }, {
- resolveUrls: function(cssText, baseUrl) {
- cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl);
- cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl);
- return cssText;
- },
- _replaceUrls: function(cssText, re, baseUrl) {
- var $__0 = this;
- return StringWrapper.replaceAllMapped(cssText, re, (function(m) {
- var pre = m[1];
- var url = StringWrapper.replaceAll(m[2], _quoteRe, '');
- var post = m[3];
- var resolvedUrl = $__0._resolver.resolve(baseUrl, url);
- return pre + "'" + resolvedUrl + "'" + post;
- }));
- }
- }, {}));
- $__export("StyleUrlResolver", StyleUrlResolver);
- $__export("StyleUrlResolver", StyleUrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [UrlResolver])], StyleUrlResolver));
- _cssUrlRe = RegExpWrapper.create('(url\\()([^)]*)(\\))');
- _cssImportRe = RegExpWrapper.create('(@import[\\s]+(?!url\\())[\'"]([^\'"]*)[\'"](.*;)');
- _quoteRe = RegExpWrapper.create('[\'"]');
- }
- };
-});
-
-System.register("angular2/src/render/dom/shadow_dom/style_inliner", ["angular2/di", "angular2/src/services/xhr", "angular2/src/facade/collection", "angular2/src/services/url_resolver", "angular2/src/render/dom/shadow_dom/style_url_resolver", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/render/dom/shadow_dom/style_inliner";
- var __decorate,
- __metadata,
- Injectable,
- XHR,
- ListWrapper,
- UrlResolver,
- StyleUrlResolver,
- isBlank,
- isPresent,
- RegExpWrapper,
- StringWrapper,
- PromiseWrapper,
- StyleInliner,
- _importRe,
- _urlRe,
- _mediaQueryRe;
- function _extractUrl(importRule) {
- var match = RegExpWrapper.firstMatch(_urlRe, importRule);
- if (isBlank(match))
- return null;
- return isPresent(match[1]) ? match[1] : match[2];
- }
- function _extractMediaQuery(importRule) {
- var match = RegExpWrapper.firstMatch(_mediaQueryRe, importRule);
- if (isBlank(match))
- return null;
- var mediaQuery = match[1].trim();
- return (mediaQuery.length > 0) ? mediaQuery : null;
- }
- function _wrapInMediaRule(css, query) {
- return (isBlank(query)) ? css : ("@media " + query + " {\n" + css + "\n}");
- }
- return {
- setters: [function($__m) {
- Injectable = $__m.Injectable;
- }, function($__m) {
- XHR = $__m.XHR;
- }, function($__m) {
- ListWrapper = $__m.ListWrapper;
- }, function($__m) {
- UrlResolver = $__m.UrlResolver;
- }, function($__m) {
- StyleUrlResolver = $__m.StyleUrlResolver;
- }, function($__m) {
- isBlank = $__m.isBlank;
- isPresent = $__m.isPresent;
- RegExpWrapper = $__m.RegExpWrapper;
- StringWrapper = $__m.StringWrapper;
- }, function($__m) {
- PromiseWrapper = $__m.PromiseWrapper;
- }],
- execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
- StyleInliner = (($traceurRuntime.createClass)(function(xhr, styleUrlResolver, urlResolver) {
- this._xhr = xhr;
- this._urlResolver = urlResolver;
- this._styleUrlResolver = styleUrlResolver;
- }, {
- inlineImports: function(cssText, baseUrl) {
- return this._inlineImports(cssText, baseUrl, []);
- },
- _inlineImports: function(cssText, baseUrl, inlinedUrls) {
- var $__0 = this;
- var partIndex = 0;
- var parts = StringWrapper.split(cssText, _importRe);
- if (parts.length === 1) {
- return cssText;
- }
- var promises = [];
- while (partIndex < parts.length - 1) {
- var prefix = parts[partIndex];
- var rule = parts[partIndex + 1];
- var url = _extractUrl(rule);
- if (isPresent(url)) {
- url = this._urlResolver.resolve(baseUrl, url);
- }
- var mediaQuery = _extractMediaQuery(rule);
- var promise = void 0;
- if (isBlank(url)) {
- promise = PromiseWrapper.resolve(("/* Invalid import rule: \"@import " + rule + ";\" */"));
- } else if (ListWrapper.contains(inlinedUrls, url)) {
- promise = PromiseWrapper.resolve(prefix);
- } else {
- ListWrapper.push(inlinedUrls, url);
- promise = PromiseWrapper.then(this._xhr.get(url), (function(rawCss) {
- var inlinedCss = $__0._inlineImports(rawCss, url, inlinedUrls);
- if (PromiseWrapper.isPromise(inlinedCss)) {
- return inlinedCss.then((function(css) {
- return prefix + $__0._transformImportedCss(css, mediaQuery, url) + '\n';
- }));
- } else {
- return prefix + $__0._transformImportedCss(inlinedCss, mediaQuery, url) + '\n';
- }
- }), (function(error) {
- return ("/* failed to import " + url + " */\n");
- }));
- }
- ListWrapper.push(promises, promise);
- partIndex += 2;
- }
- return PromiseWrapper.all(promises).then(function(cssParts) {
- var cssText = cssParts.join('');
- if (partIndex < parts.length) {
- cssText += parts[partIndex];
- }
- return cssText;
- });
- },
- _transformImportedCss: function(css, mediaQuery, url) {
- css = this._styleUrlResolver.resolveUrls(css, url);
- return _wrapInMediaRule(css, mediaQuery);
- }
- }, {}));
- $__export("StyleInliner", StyleInliner);
- $__export("StyleInliner", StyleInliner = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleUrlResolver, UrlResolver])], StyleInliner));
- _importRe = RegExpWrapper.create('@import\\s+([^;]+);');
- _urlRe = RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]');
- _mediaQueryRe = RegExpWrapper.create('[\'"][^\'"]+[\'"]\\s*\\)?\\s*(.*)');
- }
- };
-});
-
-System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/di", "angular2/src/core/compiler/compiler", "angular2/src/facade/lang", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/element_ref"], function($__export) {
- "use strict";
var __moduleName = "angular2/src/core/compiler/dynamic_component_loader";
var __decorate,
__metadata,
- Binding,
- bind,
Injectable,
Compiler,
- BaseException,
AppViewManager,
- ElementRef,
ComponentRef,
DynamicComponentLoader;
return {
setters: [function($__m) {
- Binding = $__m.Binding;
- bind = $__m.bind;
Injectable = $__m.Injectable;
}, function($__m) {
Compiler = $__m.Compiler;
}, function($__m) {
- BaseException = $__m.BaseException;
- }, function($__m) {
AppViewManager = $__m.AppViewManager;
- }, function($__m) {
- ElementRef = $__m.ElementRef;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -12586,78 +14021,46 @@
return ($traceurRuntime.createClass)(ComponentRef, {get hostView() {
return this.location.parentView;
}}, {});
}());
$__export("ComponentRef", ComponentRef);
- DynamicComponentLoader = (($traceurRuntime.createClass)(function(compiler, viewManager) {
- this._compiler = compiler;
- this._viewManager = viewManager;
+ DynamicComponentLoader = (($traceurRuntime.createClass)(function(_compiler, _viewManager) {
+ this._compiler = _compiler;
+ this._viewManager = _viewManager;
}, {
- loadIntoExistingLocation: function(typeOrBinding, location) {
- var injector = arguments[2] !== (void 0) ? arguments[2] : null;
- var $__0 = this;
- var binding = this._getBinding(typeOrBinding);
- return this._compiler.compile(binding.token).then((function(componentProtoViewRef) {
- $__0._viewManager.createDynamicComponentView(location, componentProtoViewRef, binding, injector);
- var component = $__0._viewManager.getComponent(location);
- var dispose = (function() {
- throw new BaseException("Not implemented");
- });
- return new ComponentRef(location, component, dispose);
- }));
- },
loadAsRoot: function(typeOrBinding) {
var overrideSelector = arguments[1] !== (void 0) ? arguments[1] : null;
var injector = arguments[2] !== (void 0) ? arguments[2] : null;
var $__0 = this;
- return this._compiler.compileInHost(this._getBinding(typeOrBinding)).then((function(hostProtoViewRef) {
+ return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) {
var hostViewRef = $__0._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector);
- var newLocation = new ElementRef(hostViewRef, 0);
+ var newLocation = $__0._viewManager.getHostElement(hostViewRef);
var component = $__0._viewManager.getComponent(newLocation);
var dispose = (function() {
$__0._viewManager.destroyRootHostView(hostViewRef);
});
return new ComponentRef(newLocation, component, dispose);
}));
},
- loadIntoNewLocation: function(typeOrBinding, parentComponentLocation) {
- var injector = arguments[2] !== (void 0) ? arguments[2] : null;
- var $__0 = this;
- return this._compiler.compileInHost(this._getBinding(typeOrBinding)).then((function(hostProtoViewRef) {
- var hostViewRef = $__0._viewManager.createFreeHostView(parentComponentLocation, hostProtoViewRef, injector);
- var newLocation = new ElementRef(hostViewRef, 0);
- var component = $__0._viewManager.getComponent(newLocation);
- var dispose = (function() {
- $__0._viewManager.destroyFreeHostView(parentComponentLocation, hostViewRef);
- });
- return new ComponentRef(newLocation, component, dispose);
- }));
+ loadIntoLocation: function(typeOrBinding, hostLocation, anchorName) {
+ var injector = arguments[3] !== (void 0) ? arguments[3] : null;
+ return this.loadNextToLocation(typeOrBinding, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), injector);
},
- loadNextToExistingLocation: function(typeOrBinding, location) {
+ loadNextToLocation: function(typeOrBinding, location) {
var injector = arguments[2] !== (void 0) ? arguments[2] : null;
var $__0 = this;
- var binding = this._getBinding(typeOrBinding);
- return this._compiler.compileInHost(binding).then((function(hostProtoViewRef) {
+ return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) {
var viewContainer = $__0._viewManager.getViewContainer(location);
var hostViewRef = viewContainer.create(hostProtoViewRef, viewContainer.length, null, injector);
- var newLocation = new ElementRef(hostViewRef, 0);
+ var newLocation = $__0._viewManager.getHostElement(hostViewRef);
var component = $__0._viewManager.getComponent(newLocation);
var dispose = (function() {
var index = viewContainer.indexOf(hostViewRef);
viewContainer.remove(index);
});
return new ComponentRef(newLocation, component, dispose);
}));
- },
- _getBinding: function(typeOrBinding) {
- var binding;
- if (typeOrBinding instanceof Binding) {
- binding = typeOrBinding;
- } else {
- binding = bind(typeOrBinding).toClass(typeOrBinding);
- }
- return binding;
}
}, {}));
$__export("DynamicComponentLoader", DynamicComponentLoader);
$__export("DynamicComponentLoader", DynamicComponentLoader = __decorate([Injectable(), __metadata('design:paramtypes', [Compiler, AppViewManager])], DynamicComponentLoader));
}
@@ -12750,22 +14153,22 @@
}, {}, $__super);
}(ContentStrategy));
IntermediateContent = (function($__super) {
function IntermediateContent(destinationLightDom) {
$traceurRuntime.superConstructor(IntermediateContent).call(this);
- this.nodes = [];
this.destinationLightDom = destinationLightDom;
+ this.nodes = [];
}
return ($traceurRuntime.createClass)(IntermediateContent, {insert: function(nodes) {
this.nodes = nodes;
this.destinationLightDom.redistribute();
}}, {}, $__super);
}(ContentStrategy));
Content = (function() {
- function Content(contentStartEl, selector) {
- this.select = selector;
- this.contentStartElement = contentStartEl;
+ function Content(contentStartElement, select) {
+ this.contentStartElement = contentStartElement;
+ this.select = select;
this._strategy = null;
}
return ($traceurRuntime.createClass)(Content, {
init: function(destinationLightDom) {
this._strategy = isPresent(destinationLightDom) ? new IntermediateContent(destinationLightDom) : new RenderedContent(this.contentStartElement);
@@ -12821,10 +14224,144 @@
DASH_CASE_REGEXP = RegExpWrapper.create('-([a-z])');
}
};
});
+System.register("angular2/src/render/dom/view/view", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/render/dom/view/view";
+ var DOM,
+ Map,
+ isPresent,
+ stringify,
+ RenderViewRef,
+ camelCaseToDashCase,
+ DomViewRef,
+ DomView;
+ function resolveInternalDomView(viewRef) {
+ return viewRef._view;
+ }
+ $__export("resolveInternalDomView", resolveInternalDomView);
+ return {
+ setters: [function($__m) {
+ DOM = $__m.DOM;
+ }, function($__m) {
+ Map = $__m.Map;
+ }, function($__m) {
+ isPresent = $__m.isPresent;
+ stringify = $__m.stringify;
+ }, function($__m) {
+ RenderViewRef = $__m.RenderViewRef;
+ }, function($__m) {
+ camelCaseToDashCase = $__m.camelCaseToDashCase;
+ }],
+ execute: function() {
+ DomViewRef = (function($__super) {
+ function DomViewRef(_view) {
+ $traceurRuntime.superConstructor(DomViewRef).call(this);
+ this._view = _view;
+ }
+ return ($traceurRuntime.createClass)(DomViewRef, {}, {}, $__super);
+ }(RenderViewRef));
+ $__export("DomViewRef", DomViewRef);
+ DomView = (function() {
+ function DomView(proto, rootNodes, boundTextNodes, boundElements) {
+ this.proto = proto;
+ this.rootNodes = rootNodes;
+ this.boundTextNodes = boundTextNodes;
+ this.boundElements = boundElements;
+ this.hostLightDom = null;
+ this.shadowRoot = null;
+ this.hydrated = false;
+ this.eventDispatcher = null;
+ this.eventHandlerRemovers = [];
+ }
+ return ($traceurRuntime.createClass)(DomView, {
+ getDirectParentElement: function(boundElementIndex) {
+ var binder = this.proto.elementBinders[boundElementIndex];
+ var parent = null;
+ if (binder.parentIndex !== -1 && binder.distanceToParent === 1) {
+ parent = this.boundElements[binder.parentIndex];
+ }
+ return parent;
+ },
+ setElementProperty: function(elementIndex, propertyName, value) {
+ DOM.setProperty(this.boundElements[elementIndex].element, propertyName, value);
+ },
+ setElementAttribute: function(elementIndex, attributeName, value) {
+ var element = this.boundElements[elementIndex].element;
+ var dashCasedAttributeName = camelCaseToDashCase(attributeName);
+ if (isPresent(value)) {
+ DOM.setAttribute(element, dashCasedAttributeName, stringify(value));
+ } else {
+ DOM.removeAttribute(element, dashCasedAttributeName);
+ }
+ },
+ setElementClass: function(elementIndex, className, isAdd) {
+ var element = this.boundElements[elementIndex].element;
+ var dashCasedClassName = camelCaseToDashCase(className);
+ if (isAdd) {
+ DOM.addClass(element, dashCasedClassName);
+ } else {
+ DOM.removeClass(element, dashCasedClassName);
+ }
+ },
+ setElementStyle: function(elementIndex, styleName, value) {
+ var element = this.boundElements[elementIndex].element;
+ var dashCasedStyleName = camelCaseToDashCase(styleName);
+ if (isPresent(value)) {
+ DOM.setStyle(element, dashCasedStyleName, stringify(value));
+ } else {
+ DOM.removeStyle(element, dashCasedStyleName);
+ }
+ },
+ invokeElementMethod: function(elementIndex, methodName, args) {
+ var element = this.boundElements[elementIndex].element;
+ DOM.invoke(element, methodName, args);
+ },
+ setText: function(textIndex, value) {
+ DOM.setText(this.boundTextNodes[textIndex], value);
+ },
+ dispatchEvent: function(elementIndex, eventName, event) {
+ var allowDefaultBehavior = true;
+ if (isPresent(this.eventDispatcher)) {
+ var evalLocals = new Map();
+ evalLocals.set('$event', event);
+ allowDefaultBehavior = this.eventDispatcher.dispatchEvent(elementIndex, eventName, evalLocals);
+ if (!allowDefaultBehavior) {
+ event.preventDefault();
+ }
+ }
+ return allowDefaultBehavior;
+ }
+ }, {});
+ }());
+ $__export("DomView", DomView);
+ }
+ };
+});
+
+System.register("angular2/src/render/dom/view/element", [], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/render/dom/view/element";
+ var DomElement;
+ return {
+ setters: [],
+ execute: function() {
+ DomElement = (function() {
+ function DomElement(proto, element, contentTag) {
+ this.proto = proto;
+ this.element = element;
+ this.contentTag = contentTag;
+ }
+ return ($traceurRuntime.createClass)(DomElement, {}, {});
+ }());
+ $__export("DomElement", DomElement);
+ }
+ };
+});
+
System.register("angular2/src/render/dom/view/view_container", ["angular2/src/facade/collection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/view/view_container";
var ListWrapper,
DomViewContainer;
@@ -12856,12 +14393,11 @@
});
System.register("angular2/src/render/dom/compiler/compile_element", ["angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/compiler/compile_element";
- var ListWrapper,
- MapWrapper,
+ var MapWrapper,
DOM,
isBlank,
isPresent,
StringJoiner,
assertionsEnabled,
@@ -12869,12 +14405,12 @@
function getElementDescription(domElement) {
var buf = new StringJoiner();
var atts = DOM.attributeMap(domElement);
buf.add("<");
buf.add(DOM.tagName(domElement).toLowerCase());
- addDescriptionAttribute(buf, "id", MapWrapper.get(atts, "id"));
- addDescriptionAttribute(buf, "class", MapWrapper.get(atts, "class"));
+ addDescriptionAttribute(buf, "id", atts.get("id"));
+ addDescriptionAttribute(buf, "class", atts.get("class"));
MapWrapper.forEach(atts, (function(attValue, attName) {
if (attName !== "id" && attName !== "class") {
addDescriptionAttribute(buf, attName, attValue);
}
}));
@@ -12890,11 +14426,10 @@
}
}
}
return {
setters: [function($__m) {
- ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
}, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
isBlank = $__m.isBlank;
@@ -12909,12 +14444,12 @@
this.element = element;
this._attrs = null;
this._classList = null;
this.isViewRoot = false;
this.inheritedProtoView = null;
- this.inheritedElementBinder = null;
this.distanceToInheritedBinder = 0;
+ this.inheritedElementBinder = null;
this.compileChildren = true;
var tplDesc = assertionsEnabled() ? getElementDescription(element) : null;
if (compilationUnit !== '') {
this.elementDescription = compilationUnit;
if (isPresent(tplDesc))
@@ -12950,14 +14485,14 @@
refreshClassList: function() {
this._classList = null;
},
classList: function() {
if (isBlank(this._classList)) {
- this._classList = ListWrapper.create();
+ this._classList = [];
var elClassList = DOM.classList(this.element);
for (var i = 0; i < elClassList.length; i++) {
- ListWrapper.push(this._classList, elClassList[i]);
+ this._classList.push(elClassList[i]);
}
}
return this._classList;
}
}, {});
@@ -12965,26 +14500,23 @@
$__export("CompileElement", CompileElement);
}
};
});
-System.register("angular2/src/render/dom/compiler/compile_control", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
+System.register("angular2/src/render/dom/compiler/compile_control", ["angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/compiler/compile_control";
var isBlank,
- ListWrapper,
CompileControl;
return {
setters: [function($__m) {
isBlank = $__m.isBlank;
- }, function($__m) {
- ListWrapper = $__m.ListWrapper;
}],
execute: function() {
CompileControl = (function() {
- function CompileControl(steps) {
- this._steps = steps;
+ function CompileControl(_steps) {
+ this._steps = _steps;
this._currentStepIndex = 0;
this._parent = null;
this._results = null;
this._additionalChildren = null;
}
@@ -13000,11 +14532,11 @@
this._currentStepIndex = i;
step.process(parent, current, this);
parent = this._parent;
}
if (!this._ignoreCurrentElement) {
- ListWrapper.push(results, current);
+ results.push(current);
}
this._currentStepIndex = previousStepIndex;
this._parent = previousParent;
var localAdditionalChildren = this._additionalChildren;
this._additionalChildren = null;
@@ -13014,13 +14546,13 @@
this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement);
this._parent = newElement;
},
addChild: function(element) {
if (isBlank(this._additionalChildren)) {
- this._additionalChildren = ListWrapper.create();
+ this._additionalChildren = [];
}
- ListWrapper.push(this._additionalChildren, element);
+ this._additionalChildren.push(element);
},
ignoreCurrentElement: function() {
this._ignoreCurrentElement = true;
}
}, {});
@@ -13047,25 +14579,23 @@
nestedProtoView = $__1.nestedProtoView,
componentId = $__1.componentId,
eventLocals = $__1.eventLocals,
localEvents = $__1.localEvents,
globalEvents = $__1.globalEvents,
- hostActions = $__1.hostActions,
parentIndex = $__1.parentIndex,
distanceToParent = $__1.distanceToParent,
- propertySetters = $__1.propertySetters;
+ elementIsEmpty = $__1.elementIsEmpty;
this.textNodeIndices = textNodeIndices;
this.contentTagSelector = contentTagSelector;
this.nestedProtoView = nestedProtoView;
this.componentId = componentId;
this.eventLocals = eventLocals;
this.localEvents = localEvents;
this.globalEvents = globalEvents;
- this.hostActions = hostActions;
this.parentIndex = parentIndex;
this.distanceToParent = distanceToParent;
- this.propertySetters = propertySetters;
+ this.elementIsEmpty = elementIsEmpty;
}
return ($traceurRuntime.createClass)(ElementBinder, {}, {});
}());
$__export("ElementBinder", ElementBinder);
Event = (function() {
@@ -13088,164 +14618,10 @@
$__export("HostAction", HostAction);
}
};
});
-System.register("angular2/src/render/dom/view/property_setter_factory", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/util", "angular2/src/reflection/reflection"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/render/dom/view/property_setter_factory";
- var StringWrapper,
- BaseException,
- isPresent,
- isBlank,
- isString,
- stringify,
- ListWrapper,
- StringMapWrapper,
- DOM,
- camelCaseToDashCase,
- reflector,
- STYLE_SEPARATOR,
- propertySettersCache,
- innerHTMLSetterCache,
- ATTRIBUTE_PREFIX,
- attributeSettersCache,
- CLASS_PREFIX,
- classSettersCache,
- STYLE_PREFIX,
- styleSettersCache;
- function setterFactory(property) {
- var setterFn,
- styleParts,
- styleSuffix;
- if (StringWrapper.startsWith(property, ATTRIBUTE_PREFIX)) {
- setterFn = attributeSetterFactory(StringWrapper.substring(property, ATTRIBUTE_PREFIX.length));
- } else if (StringWrapper.startsWith(property, CLASS_PREFIX)) {
- setterFn = classSetterFactory(StringWrapper.substring(property, CLASS_PREFIX.length));
- } else if (StringWrapper.startsWith(property, STYLE_PREFIX)) {
- styleParts = property.split(STYLE_SEPARATOR);
- styleSuffix = styleParts.length > 2 ? ListWrapper.get(styleParts, 2) : '';
- setterFn = styleSetterFactory(ListWrapper.get(styleParts, 1), styleSuffix);
- } else if (StringWrapper.equals(property, 'innerHtml')) {
- if (isBlank(innerHTMLSetterCache)) {
- innerHTMLSetterCache = (function(el, value) {
- return DOM.setInnerHTML(el, value);
- });
- }
- setterFn = innerHTMLSetterCache;
- } else {
- property = resolvePropertyName(property);
- setterFn = StringMapWrapper.get(propertySettersCache, property);
- if (isBlank(setterFn)) {
- var propertySetterFn = reflector.setter(property);
- setterFn = function(receiver, value) {
- if (DOM.hasProperty(receiver, property)) {
- return propertySetterFn(receiver, value);
- }
- };
- StringMapWrapper.set(propertySettersCache, property, setterFn);
- }
- }
- return setterFn;
- }
- function _isValidAttributeValue(attrName, value) {
- if (attrName == "role") {
- return isString(value);
- } else {
- return isPresent(value);
- }
- }
- function attributeSetterFactory(attrName) {
- var setterFn = StringMapWrapper.get(attributeSettersCache, attrName);
- var dashCasedAttributeName;
- if (isBlank(setterFn)) {
- dashCasedAttributeName = camelCaseToDashCase(attrName);
- setterFn = function(element, value) {
- if (_isValidAttributeValue(dashCasedAttributeName, value)) {
- DOM.setAttribute(element, dashCasedAttributeName, stringify(value));
- } else {
- if (isPresent(value)) {
- throw new BaseException("Invalid " + dashCasedAttributeName + " attribute, only string values are allowed, got '" + stringify(value) + "'");
- }
- DOM.removeAttribute(element, dashCasedAttributeName);
- }
- };
- StringMapWrapper.set(attributeSettersCache, attrName, setterFn);
- }
- return setterFn;
- }
- function classSetterFactory(className) {
- var setterFn = StringMapWrapper.get(classSettersCache, className);
- var dashCasedClassName;
- if (isBlank(setterFn)) {
- dashCasedClassName = camelCaseToDashCase(className);
- setterFn = function(element, value) {
- if (value) {
- DOM.addClass(element, dashCasedClassName);
- } else {
- DOM.removeClass(element, dashCasedClassName);
- }
- };
- StringMapWrapper.set(classSettersCache, className, setterFn);
- }
- return setterFn;
- }
- function styleSetterFactory(styleName, styleSuffix) {
- var cacheKey = styleName + styleSuffix;
- var setterFn = StringMapWrapper.get(styleSettersCache, cacheKey);
- var dashCasedStyleName;
- if (isBlank(setterFn)) {
- dashCasedStyleName = camelCaseToDashCase(styleName);
- setterFn = function(element, value) {
- var valAsStr;
- if (isPresent(value)) {
- valAsStr = stringify(value);
- DOM.setStyle(element, dashCasedStyleName, valAsStr + styleSuffix);
- } else {
- DOM.removeStyle(element, dashCasedStyleName);
- }
- };
- StringMapWrapper.set(styleSettersCache, cacheKey, setterFn);
- }
- return setterFn;
- }
- function resolvePropertyName(attrName) {
- var mappedPropName = StringMapWrapper.get(DOM.attrToPropMap, attrName);
- return isPresent(mappedPropName) ? mappedPropName : attrName;
- }
- $__export("setterFactory", setterFactory);
- return {
- setters: [function($__m) {
- StringWrapper = $__m.StringWrapper;
- BaseException = $__m.BaseException;
- isPresent = $__m.isPresent;
- isBlank = $__m.isBlank;
- isString = $__m.isString;
- stringify = $__m.stringify;
- }, function($__m) {
- ListWrapper = $__m.ListWrapper;
- StringMapWrapper = $__m.StringMapWrapper;
- }, function($__m) {
- DOM = $__m.DOM;
- }, function($__m) {
- camelCaseToDashCase = $__m.camelCaseToDashCase;
- }, function($__m) {
- reflector = $__m.reflector;
- }],
- execute: function() {
- STYLE_SEPARATOR = '.';
- propertySettersCache = StringMapWrapper.create();
- ATTRIBUTE_PREFIX = 'attr.';
- attributeSettersCache = StringMapWrapper.create();
- CLASS_PREFIX = 'class.';
- classSettersCache = StringMapWrapper.create();
- STYLE_PREFIX = 'style.';
- styleSettersCache = StringMapWrapper.create();
- }
- };
-});
-
System.register("angular2/src/render/dom/compiler/property_binding_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/util"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/compiler/property_binding_parser";
var isPresent,
RegExpWrapper,
@@ -13263,18 +14639,18 @@
dashCaseToCamelCase = $__m.dashCaseToCamelCase;
}],
execute: function() {
BIND_NAME_REGEXP = RegExpWrapper.create('^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\\[\\(([^\\)]+)\\)\\]|\\[([^\\]]+)\\]|\\(([^\\)]+)\\))$');
PropertyBindingParser = (function() {
- function PropertyBindingParser(parser) {
- this._parser = parser;
+ function PropertyBindingParser(_parser) {
+ this._parser = _parser;
}
return ($traceurRuntime.createClass)(PropertyBindingParser, {
process: function(parent, current, control) {
var $__0 = this;
var attrs = current.attrs();
- var newAttrs = MapWrapper.create();
+ var newAttrs = new Map();
MapWrapper.forEach(attrs, (function(attrValue, attrName) {
var bindParts = RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName);
if (isPresent(bindParts)) {
if (isPresent(bindParts[1])) {
$__0._bindProperty(bindParts[5], attrValue, current, newAttrs);
@@ -13301,25 +14677,24 @@
$__0._bindPropertyAst(attrName, expr, current, newAttrs);
}
}
}));
MapWrapper.forEach(newAttrs, (function(attrValue, attrName) {
- MapWrapper.set(attrs, attrName, attrValue);
+ attrs.set(attrName, attrValue);
}));
},
_bindVariable: function(identifier, value, current, newAttrs) {
current.bindElement().bindVariable(dashCaseToCamelCase(identifier), value);
- MapWrapper.set(newAttrs, identifier, value);
+ newAttrs.set(identifier, value);
},
_bindProperty: function(name, expression, current, newAttrs) {
this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs);
},
_bindPropertyAst: function(name, ast, current, newAttrs) {
var binder = current.bindElement();
- var camelCaseName = dashCaseToCamelCase(name);
- binder.bindProperty(camelCaseName, ast);
- MapWrapper.set(newAttrs, name, ast.source);
+ binder.bindProperty(dashCaseToCamelCase(name), ast);
+ newAttrs.set(name, ast.source);
},
_bindAssignmentEvent: function(name, expression, current, newAttrs) {
this._bindEvent(name, (expression + "=$event"), current, newAttrs);
},
_bindEvent: function(name, expression, current, newAttrs) {
@@ -13344,12 +14719,12 @@
}, function($__m) {
DOM = $__m.DOM;
}],
execute: function() {
TextInterpolationParser = (function() {
- function TextInterpolationParser(parser) {
- this._parser = parser;
+ function TextInterpolationParser(_parser) {
+ this._parser = _parser;
}
return ($traceurRuntime.createClass)(TextInterpolationParser, {process: function(parent, current, control) {
if (!current.compileChildren) {
return ;
}
@@ -13360,11 +14735,11 @@
if (DOM.isTextNode(node)) {
var text = DOM.nodeValue(node);
var expr = this._parser.parseInterpolation(text, current.elementDescription);
if (isPresent(expr)) {
DOM.setText(node, ' ');
- current.bindElement().bindText(i, expr);
+ current.bindElement().bindText(node, expr);
}
}
}
}}, {});
}());
@@ -13374,12 +14749,12 @@
});
System.register("angular2/src/render/dom/compiler/selector", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/compiler/selector";
- var ListWrapper,
- MapWrapper,
+ var Map,
+ ListWrapper,
isPresent,
isBlank,
RegExpWrapper,
RegExpMatcherWrapper,
StringWrapper,
@@ -13390,53 +14765,53 @@
SelectorMatcher,
SelectorListContext,
SelectorContext;
return {
setters: [function($__m) {
+ Map = $__m.Map;
ListWrapper = $__m.ListWrapper;
- MapWrapper = $__m.MapWrapper;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
RegExpWrapper = $__m.RegExpWrapper;
RegExpMatcherWrapper = $__m.RegExpMatcherWrapper;
StringWrapper = $__m.StringWrapper;
BaseException = $__m.BaseException;
}],
execute: function() {
_EMPTY_ATTR_VALUE = '';
- _SELECTOR_REGEXP = RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(?:\\))|' + '(\\s*,\\s*)');
+ _SELECTOR_REGEXP = RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)');
CssSelector = (function() {
function CssSelector() {
this.element = null;
- this.classNames = ListWrapper.create();
- this.attrs = ListWrapper.create();
- this.notSelector = null;
+ this.classNames = [];
+ this.attrs = [];
+ this.notSelectors = [];
}
return ($traceurRuntime.createClass)(CssSelector, {
isElementSelector: function() {
- return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) && ListWrapper.isEmpty(this.attrs) && isBlank(this.notSelector);
+ return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) && ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0;
},
setElement: function() {
var element = arguments[0] !== (void 0) ? arguments[0] : null;
if (isPresent(element)) {
element = element.toLowerCase();
}
this.element = element;
},
addAttribute: function(name) {
var value = arguments[1] !== (void 0) ? arguments[1] : _EMPTY_ATTR_VALUE;
- ListWrapper.push(this.attrs, name.toLowerCase());
+ this.attrs.push(name.toLowerCase());
if (isPresent(value)) {
value = value.toLowerCase();
} else {
value = _EMPTY_ATTR_VALUE;
}
- ListWrapper.push(this.attrs, value);
+ this.attrs.push(value);
},
addClassName: function(name) {
- ListWrapper.push(this.classNames, name.toLowerCase());
+ this.classNames.push(name.toLowerCase());
},
toString: function() {
var res = '';
if (isPresent(this.element)) {
res += this.element;
@@ -13455,34 +14830,36 @@
res += '=' + attrValue;
}
res += ']';
}
}
- if (isPresent(this.notSelector)) {
- res += ":not(" + this.notSelector.toString() + ")";
- }
+ ListWrapper.forEach(this.notSelectors, (function(notSelector) {
+ res += ":not(" + notSelector.toString() + ")";
+ }));
return res;
}
}, {parse: function(selector) {
- var results = ListWrapper.create();
+ var results = [];
var _addResult = (function(res, cssSel) {
- if (isPresent(cssSel.notSelector) && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
+ if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
cssSel.element = "*";
}
- ListWrapper.push(res, cssSel);
+ res.push(cssSel);
});
var cssSelector = new CssSelector();
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
var match;
var current = cssSelector;
+ var inNot = false;
while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
if (isPresent(match[1])) {
- if (isPresent(cssSelector.notSelector)) {
+ if (inNot) {
throw new BaseException('Nesting :not is not allowed in a selector');
}
- current.notSelector = new CssSelector();
- current = current.notSelector;
+ inNot = true;
+ current = new CssSelector();
+ cssSelector.notSelectors.push(current);
}
if (isPresent(match[2])) {
current.setElement(match[2]);
}
if (isPresent(match[3])) {
@@ -13490,10 +14867,17 @@
}
if (isPresent(match[4])) {
current.addAttribute(match[4], match[5]);
}
if (isPresent(match[6])) {
+ inNot = false;
+ current = cssSelector;
+ }
+ if (isPresent(match[7])) {
+ if (inNot) {
+ throw new BaseException('Multiple selectors in :not are not supported');
+ }
_addResult(results, cssSelector);
cssSelector = current = new CssSelector();
}
}
_addResult(results, cssSelector);
@@ -13501,24 +14885,24 @@
}});
}());
$__export("CssSelector", CssSelector);
SelectorMatcher = (function() {
function SelectorMatcher() {
- this._elementMap = MapWrapper.create();
- this._elementPartialMap = MapWrapper.create();
- this._classMap = MapWrapper.create();
- this._classPartialMap = MapWrapper.create();
- this._attrValueMap = MapWrapper.create();
- this._attrValuePartialMap = MapWrapper.create();
- this._listContexts = ListWrapper.create();
+ this._elementMap = new Map();
+ this._elementPartialMap = new Map();
+ this._classMap = new Map();
+ this._classPartialMap = new Map();
+ this._attrValueMap = new Map();
+ this._attrValuePartialMap = new Map();
+ this._listContexts = [];
}
return ($traceurRuntime.createClass)(SelectorMatcher, {
addSelectables: function(cssSelectors, callbackCtxt) {
var listContext = null;
if (cssSelectors.length > 1) {
listContext = new SelectorListContext(cssSelectors);
- ListWrapper.push(this._listContexts, listContext);
+ this._listContexts.push(listContext);
}
for (var i = 0; i < cssSelectors.length; i++) {
this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
}
},
@@ -13552,41 +14936,41 @@
var isTerminal = index === attrs.length - 2;
var attrName = attrs[index++];
var attrValue = attrs[index++];
if (isTerminal) {
var terminalMap = matcher._attrValueMap;
- var terminalValuesMap = MapWrapper.get(terminalMap, attrName);
+ var terminalValuesMap = terminalMap.get(attrName);
if (isBlank(terminalValuesMap)) {
- terminalValuesMap = MapWrapper.create();
- MapWrapper.set(terminalMap, attrName, terminalValuesMap);
+ terminalValuesMap = new Map();
+ terminalMap.set(attrName, terminalValuesMap);
}
this._addTerminal(terminalValuesMap, attrValue, selectable);
} else {
var parttialMap = matcher._attrValuePartialMap;
- var partialValuesMap = MapWrapper.get(parttialMap, attrName);
+ var partialValuesMap = parttialMap.get(attrName);
if (isBlank(partialValuesMap)) {
- partialValuesMap = MapWrapper.create();
- MapWrapper.set(parttialMap, attrName, partialValuesMap);
+ partialValuesMap = new Map();
+ parttialMap.set(attrName, partialValuesMap);
}
matcher = this._addPartial(partialValuesMap, attrValue);
}
}
}
},
_addTerminal: function(map, name, selectable) {
- var terminalList = MapWrapper.get(map, name);
+ var terminalList = map.get(name);
if (isBlank(terminalList)) {
- terminalList = ListWrapper.create();
- MapWrapper.set(map, name, terminalList);
+ terminalList = [];
+ map.set(name, terminalList);
}
- ListWrapper.push(terminalList, selectable);
+ terminalList.push(selectable);
},
_addPartial: function(map, name) {
- var matcher = MapWrapper.get(map, name);
+ var matcher = map.get(name);
if (isBlank(matcher)) {
matcher = new SelectorMatcher();
- MapWrapper.set(map, name, matcher);
+ map.set(name, matcher);
}
return matcher;
},
match: function(cssSelector, matchedCallback) {
var result = false;
@@ -13607,27 +14991,30 @@
}
if (isPresent(attrs)) {
for (var index = 0; index < attrs.length; ) {
var attrName = attrs[index++];
var attrValue = attrs[index++];
- var terminalValuesMap = MapWrapper.get(this._attrValueMap, attrName);
+ var terminalValuesMap = this._attrValueMap.get(attrName);
if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) {
result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result;
}
result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result;
- var partialValuesMap = MapWrapper.get(this._attrValuePartialMap, attrName);
+ var partialValuesMap = this._attrValuePartialMap.get(attrName);
+ if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) {
+ result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result;
+ }
result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result;
}
}
return result;
},
_matchTerminal: function(map, name, cssSelector, matchedCallback) {
if (isBlank(map) || isBlank(name)) {
return false;
}
- var selectables = MapWrapper.get(map, name);
- var starSelectables = MapWrapper.get(map, "*");
+ var selectables = map.get(name);
+ var starSelectables = map.get("*");
if (isPresent(starSelectables)) {
selectables = ListWrapper.concat(selectables, starSelectables);
}
if (isBlank(selectables)) {
return false;
@@ -13642,19 +15029,19 @@
},
_matchPartial: function(map, name, cssSelector, matchedCallback) {
if (isBlank(map) || isBlank(name)) {
return false;
}
- var nestedSelector = MapWrapper.get(map, name);
+ var nestedSelector = map.get(name);
if (isBlank(nestedSelector)) {
return false;
}
return nestedSelector.match(cssSelector, matchedCallback);
}
- }, {createNotMatcher: function(notSelector) {
+ }, {createNotMatcher: function(notSelectors) {
var notMatcher = new SelectorMatcher();
- notMatcher._addSelectable(notSelector, null, null);
+ notMatcher.addSelectables(notSelectors, null);
return notMatcher;
}});
}());
$__export("SelectorMatcher", SelectorMatcher);
SelectorListContext = (function() {
@@ -13665,18 +15052,18 @@
return ($traceurRuntime.createClass)(SelectorListContext, {}, {});
}());
SelectorContext = (function() {
function SelectorContext(selector, cbContext, listContext) {
this.selector = selector;
- this.notSelector = selector.notSelector;
this.cbContext = cbContext;
this.listContext = listContext;
+ this.notSelectors = selector.notSelectors;
}
return ($traceurRuntime.createClass)(SelectorContext, {finalize: function(cssSelector, callback) {
var result = true;
- if (isPresent(this.notSelector) && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) {
- var notMatcher = SelectorMatcher.createNotMatcher(this.notSelector);
+ if (this.notSelectors.length > 0 && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) {
+ var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
result = !notMatcher.match(cssSelector, null);
}
if (result && isPresent(callback) && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) {
if (isPresent(this.listContext)) {
this.listContext.alreadyMatched = true;
@@ -13715,17 +15102,17 @@
}, function($__m) {
dashCaseToCamelCase = $__m.dashCaseToCamelCase;
}],
execute: function() {
ViewSplitter = (function() {
- function ViewSplitter(parser) {
- this._parser = parser;
+ function ViewSplitter(_parser) {
+ this._parser = _parser;
}
return ($traceurRuntime.createClass)(ViewSplitter, {
process: function(parent, current, control) {
var attrs = current.attrs();
- var templateBindings = MapWrapper.get(attrs, 'template');
+ var templateBindings = attrs.get('template');
var hasTemplateBinding = isPresent(templateBindings);
MapWrapper.forEach(attrs, (function(attrValue, attrName) {
if (StringWrapper.startsWith(attrName, '*')) {
var key = StringWrapper.substring(attrName, 1);
if (hasTemplateBinding) {
@@ -13779,14 +15166,14 @@
var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription);
for (var i = 0; i < bindings.length; i++) {
var binding = bindings[i];
if (binding.keyIsVar) {
compileElement.bindElement().bindVariable(dashCaseToCamelCase(binding.key), binding.name);
- MapWrapper.set(compileElement.attrs(), binding.key, binding.name);
+ compileElement.attrs().set(binding.key, binding.name);
} else if (isPresent(binding.expression)) {
compileElement.bindElement().bindProperty(dashCaseToCamelCase(binding.key), binding.expression);
- MapWrapper.set(compileElement.attrs(), binding.key, binding.expression.source);
+ compileElement.attrs().set(binding.key, binding.expression.source);
} else {
DOM.setAttribute(compileElement.element, binding.key, '');
}
}
}
@@ -13795,64 +15182,52 @@
$__export("ViewSplitter", ViewSplitter);
}
};
});
-System.register("angular2/src/render/dom/shadow_dom/shadow_dom_compile_step", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/dom/dom_adapter"], function($__export) {
+System.register("angular2/src/render/dom/shadow_dom/shadow_dom_compile_step", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/shadow_dom/shadow_dom_compile_step";
var isPresent,
assertionsEnabled,
- MapWrapper,
- ListWrapper,
- PromiseWrapper,
DOM,
ShadowDomCompileStep;
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
assertionsEnabled = $__m.assertionsEnabled;
}, function($__m) {
- MapWrapper = $__m.MapWrapper;
- ListWrapper = $__m.ListWrapper;
- }, function($__m) {
- PromiseWrapper = $__m.PromiseWrapper;
- }, function($__m) {
DOM = $__m.DOM;
}],
execute: function() {
ShadowDomCompileStep = (function() {
- function ShadowDomCompileStep(shadowDomStrategy, template, subTaskPromises) {
- this._shadowDomStrategy = shadowDomStrategy;
- this._template = template;
- this._subTaskPromises = subTaskPromises;
+ function ShadowDomCompileStep(_shadowDomStrategy, _view) {
+ this._shadowDomStrategy = _shadowDomStrategy;
+ this._view = _view;
}
return ($traceurRuntime.createClass)(ShadowDomCompileStep, {
process: function(parent, current, control) {
var tagName = DOM.tagName(current.element).toUpperCase();
if (tagName == 'STYLE') {
this._processStyleElement(current, control);
} else if (tagName == 'CONTENT') {
this._processContentElement(current);
} else {
var componentId = current.isBound() ? current.inheritedElementBinder.componentId : null;
- this._shadowDomStrategy.processElement(this._template.componentId, componentId, current.element);
+ this._shadowDomStrategy.processElement(this._view.componentId, componentId, current.element);
}
},
_processStyleElement: function(current, control) {
- var stylePromise = this._shadowDomStrategy.processStyleElement(this._template.componentId, this._template.absUrl, current.element);
- if (isPresent(stylePromise) && PromiseWrapper.isPromise(stylePromise)) {
- ListWrapper.push(this._subTaskPromises, stylePromise);
- }
+ this._shadowDomStrategy.processStyleElement(this._view.componentId, this._view.templateAbsUrl, current.element);
control.ignoreCurrentElement();
},
_processContentElement: function(current) {
if (this._shadowDomStrategy.hasNativeContentElement()) {
return ;
}
var attrs = current.attrs();
- var selector = MapWrapper.get(attrs, 'select');
+ var selector = attrs.get('select');
selector = isPresent(selector) ? selector : '';
var contentStart = DOM.createScriptTag('type', 'ng/contentStart');
if (assertionsEnabled()) {
DOM.setAttribute(contentStart, 'select', selector);
}
@@ -13899,125 +15274,36 @@
}],
execute: function() {}
};
});
-System.register("angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy", ["angular2/src/dom/dom_adapter", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy"], function($__export) {
+System.register("angular2/src/core/compiler/interfaces", ["angular2/src/facade/lang"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy";
- var DOM,
- ShadowDomStrategy,
- NativeShadowDomStrategy;
+ var __moduleName = "angular2/src/core/compiler/interfaces";
+ var global,
+ __ignore_me;
return {
setters: [function($__m) {
- DOM = $__m.DOM;
- }, function($__m) {
- ShadowDomStrategy = $__m.ShadowDomStrategy;
+ global = $__m.global;
}],
execute: function() {
- NativeShadowDomStrategy = (function($__super) {
- function NativeShadowDomStrategy(styleUrlResolver) {
- $traceurRuntime.superConstructor(NativeShadowDomStrategy).call(this);
- this.styleUrlResolver = styleUrlResolver;
- }
- return ($traceurRuntime.createClass)(NativeShadowDomStrategy, {
- prepareShadowRoot: function(el) {
- return DOM.createShadowRoot(el);
- },
- processStyleElement: function(hostComponentId, templateUrl, styleEl) {
- var cssText = DOM.getText(styleEl);
- cssText = this.styleUrlResolver.resolveUrls(cssText, templateUrl);
- DOM.setText(styleEl, cssText);
- return null;
- }
- }, {}, $__super);
- }(ShadowDomStrategy));
- $__export("NativeShadowDomStrategy", NativeShadowDomStrategy);
+ __ignore_me = global;
}
};
});
-System.register("angular2/src/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/util"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy";
- var isPresent,
- PromiseWrapper,
- DOM,
- EmulatedUnscopedShadowDomStrategy,
- getContentAttribute,
- getHostAttribute,
- getComponentId,
- shimCssForComponent,
- insertStyleElement,
- EmulatedScopedShadowDomStrategy;
- return {
- setters: [function($__m) {
- isPresent = $__m.isPresent;
- }, function($__m) {
- PromiseWrapper = $__m.PromiseWrapper;
- }, function($__m) {
- DOM = $__m.DOM;
- }, function($__m) {
- EmulatedUnscopedShadowDomStrategy = $__m.EmulatedUnscopedShadowDomStrategy;
- }, function($__m) {
- getContentAttribute = $__m.getContentAttribute;
- getHostAttribute = $__m.getHostAttribute;
- getComponentId = $__m.getComponentId;
- shimCssForComponent = $__m.shimCssForComponent;
- insertStyleElement = $__m.insertStyleElement;
- }],
- execute: function() {
- EmulatedScopedShadowDomStrategy = (function($__super) {
- function EmulatedScopedShadowDomStrategy(styleInliner, styleUrlResolver, styleHost) {
- $traceurRuntime.superConstructor(EmulatedScopedShadowDomStrategy).call(this, styleUrlResolver, styleHost);
- this.styleInliner = styleInliner;
- }
- return ($traceurRuntime.createClass)(EmulatedScopedShadowDomStrategy, {
- processStyleElement: function(hostComponentId, templateUrl, styleEl) {
- var cssText = DOM.getText(styleEl);
- cssText = this.styleUrlResolver.resolveUrls(cssText, templateUrl);
- var inlinedCss = this.styleInliner.inlineImports(cssText, templateUrl);
- if (PromiseWrapper.isPromise(inlinedCss)) {
- DOM.setText(styleEl, '');
- return inlinedCss.then((function(css) {
- css = shimCssForComponent(css, hostComponentId);
- DOM.setText(styleEl, css);
- }));
- } else {
- var css = shimCssForComponent(inlinedCss, hostComponentId);
- DOM.setText(styleEl, css);
- DOM.remove(styleEl);
- insertStyleElement(this.styleHost, styleEl);
- return null;
- }
- },
- processElement: function(hostComponentId, elementComponentId, element) {
- if (isPresent(hostComponentId)) {
- var contentAttribute = getContentAttribute(getComponentId(hostComponentId));
- DOM.setAttribute(element, contentAttribute, '');
- }
- if (isPresent(elementComponentId)) {
- var hostAttribute = getHostAttribute(getComponentId(elementComponentId));
- DOM.setAttribute(element, hostAttribute, '');
- }
- }
- }, {}, $__super);
- }(EmulatedUnscopedShadowDomStrategy));
- $__export("EmulatedScopedShadowDomStrategy", EmulatedScopedShadowDomStrategy);
- }
- };
-});
-
System.register("angular2/src/core/annotations/annotations", ["angular2/src/core/annotations_impl/annotations"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/annotations/annotations";
return {
setters: [function($__m) {
$__export("ComponentAnnotation", $__m.Component);
$__export("DirectiveAnnotation", $__m.Directive);
$__export("onDestroy", $__m.onDestroy);
$__export("onChange", $__m.onChange);
+ $__export("onCheck", $__m.onCheck);
+ $__export("onInit", $__m.onInit);
$__export("onAllChangesDone", $__m.onAllChangesDone);
}],
execute: function() {}
};
});
@@ -14062,15 +15348,19 @@
}, function($__m) {
makeDecorator = $__m.makeDecorator;
makeParamDecorator = $__m.makeParamDecorator;
}],
execute: function() {
- Component = makeDecorator(ComponentAnnotation);
+ Component = makeDecorator(ComponentAnnotation, (function(fn) {
+ return fn.View = View;
+ }));
$__export("Component", Component);
Directive = makeDecorator(DirectiveAnnotation);
$__export("Directive", Directive);
- View = makeDecorator(ViewAnnotation);
+ View = makeDecorator(ViewAnnotation, (function(fn) {
+ return fn.View = View;
+ }));
$__export("View", View);
Self = makeParamDecorator(SelfAnnotation);
$__export("Self", Self);
Parent = makeParamDecorator(ParentAnnotation);
$__export("Parent", Parent);
@@ -14084,34 +15374,35 @@
$__export("Query", Query);
}
};
});
-System.register("angular2/src/directives/ng_for", ["angular2/annotations", "angular2/core", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
+System.register("angular2/src/directives/ng_for", ["angular2/annotations", "angular2/angular2", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/directives/ng_for";
var __decorate,
__metadata,
Directive,
ViewContainerRef,
ProtoViewRef,
+ PipeRegistry,
+ onCheck,
isPresent,
isBlank,
- ListWrapper,
NgFor,
RecordViewTuple;
return {
setters: [function($__m) {
Directive = $__m.Directive;
}, function($__m) {
ViewContainerRef = $__m.ViewContainerRef;
ProtoViewRef = $__m.ProtoViewRef;
+ PipeRegistry = $__m.PipeRegistry;
+ onCheck = $__m.onCheck;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
- }, function($__m) {
- ListWrapper = $__m.ListWrapper;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -14132,36 +15423,46 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- NgFor = (($traceurRuntime.createClass)(function(viewContainer, protoViewRef) {
+ NgFor = (($traceurRuntime.createClass)(function(viewContainer, protoViewRef, pipes) {
this.viewContainer = viewContainer;
this.protoViewRef = protoViewRef;
+ this.pipes = pipes;
}, {
- set iterableChanges(changes) {
+ set ngForOf(value) {
+ this._ngForOf = value;
+ this._pipe = this.pipes.get("iterableDiff", value, null, this._pipe);
+ },
+ onCheck: function() {
+ var diff = this._pipe.transform(this._ngForOf);
+ if (isPresent(diff))
+ this._applyChanges(diff.wrapped);
+ },
+ _applyChanges: function(changes) {
if (isBlank(changes)) {
this.viewContainer.clear();
return ;
}
var recordViewTuples = [];
changes.forEachRemovedItem((function(removedRecord) {
- return ListWrapper.push(recordViewTuples, new RecordViewTuple(removedRecord, null));
+ return recordViewTuples.push(new RecordViewTuple(removedRecord, null));
}));
changes.forEachMovedItem((function(movedRecord) {
- return ListWrapper.push(recordViewTuples, new RecordViewTuple(movedRecord, null));
+ return recordViewTuples.push(new RecordViewTuple(movedRecord, null));
}));
var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer);
changes.forEachAddedItem((function(addedRecord) {
- return ListWrapper.push(insertTuples, new RecordViewTuple(addedRecord, null));
+ return insertTuples.push(new RecordViewTuple(addedRecord, null));
}));
NgFor.bulkInsert(insertTuples, this.viewContainer, this.protoViewRef);
for (var i = 0; i < insertTuples.length; i++) {
- this.perViewChange(insertTuples[i].view, insertTuples[i].record);
+ this._perViewChange(insertTuples[i].view, insertTuples[i].record);
}
},
- perViewChange: function(view, record) {
+ _perViewChange: function(view, record) {
view.setLocal('\$implicit', record.item);
view.setLocal('index', record.currentIndex);
}
}, {
bulkRemove: function(tuples, viewContainer) {
@@ -14171,11 +15472,11 @@
var movedTuples = [];
for (var i = tuples.length - 1; i >= 0; i--) {
var tuple = tuples[i];
if (isPresent(tuple.record.currentIndex)) {
tuple.view = viewContainer.detach(tuple.record.previousIndex);
- ListWrapper.push(movedTuples, tuple);
+ movedTuples.push(tuple);
} else {
viewContainer.remove(tuple.record.previousIndex);
}
}
return movedTuples;
@@ -14196,12 +15497,13 @@
}
}));
$__export("NgFor", NgFor);
$__export("NgFor", NgFor = __decorate([Directive({
selector: '[ng-for][ng-for-of]',
- properties: {'iterableChanges': 'ngForOf | iterableDiff'}
- }), __metadata('design:paramtypes', [ViewContainerRef, ProtoViewRef])], NgFor));
+ properties: ['ngForOf'],
+ lifecycle: [onCheck]
+ }), __metadata('design:paramtypes', [ViewContainerRef, ProtoViewRef, PipeRegistry])], NgFor));
RecordViewTuple = (function() {
function RecordViewTuple(record, view) {
this.record = record;
this.view = view;
}
@@ -14267,11 +15569,11 @@
}
}}, {}));
$__export("NgIf", NgIf);
$__export("NgIf", NgIf = __decorate([Directive({
selector: '[ng-if]',
- properties: {'ngIf': 'ngIf'}
+ properties: ['ngIf']
}), __metadata('design:paramtypes', [ViewContainerRef, ProtoViewRef])], NgIf));
}
};
});
@@ -14332,10 +15634,11 @@
isPresent,
isBlank,
normalizeBlank,
ListWrapper,
MapWrapper,
+ Map,
SwitchView,
NgSwitch,
NgSwitchWhen,
NgSwitchDefault,
_whenDefault;
@@ -14351,10 +15654,11 @@
isBlank = $__m.isBlank;
normalizeBlank = $__m.normalizeBlank;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -14396,21 +15700,21 @@
}
}, {});
}());
$__export("SwitchView", SwitchView);
NgSwitch = (($traceurRuntime.createClass)(function() {
- this._valueViews = MapWrapper.create();
- this._activeViews = ListWrapper.create();
+ this._valueViews = new Map();
+ this._activeViews = [];
this._useDefault = false;
}, {
set ngSwitch(value) {
this._emptyAllActiveViews();
this._useDefault = false;
- var views = MapWrapper.get(this._valueViews, value);
+ var views = this._valueViews.get(value);
if (isBlank(views)) {
this._useDefault = true;
- views = normalizeBlank(MapWrapper.get(this._valueViews, _whenDefault));
+ views = normalizeBlank(this._valueViews.get(_whenDefault));
}
this._activateViews(views);
this._switchValue = value;
},
_onWhenValueChanged: function(oldWhen, newWhen, view) {
@@ -14423,55 +15727,55 @@
if (this._useDefault) {
this._useDefault = false;
this._emptyAllActiveViews();
}
view.create();
- ListWrapper.push(this._activeViews, view);
+ this._activeViews.push(view);
}
if (this._activeViews.length === 0 && !this._useDefault) {
this._useDefault = true;
- this._activateViews(MapWrapper.get(this._valueViews, _whenDefault));
+ this._activateViews(this._valueViews.get(_whenDefault));
}
},
_emptyAllActiveViews: function() {
var activeContainers = this._activeViews;
for (var i = 0; i < activeContainers.length; i++) {
activeContainers[i].destroy();
}
- this._activeViews = ListWrapper.create();
+ this._activeViews = [];
},
_activateViews: function(views) {
if (isPresent(views)) {
for (var i = 0; i < views.length; i++) {
views[i].create();
}
this._activeViews = views;
}
},
_registerView: function(value, view) {
- var views = MapWrapper.get(this._valueViews, value);
+ var views = this._valueViews.get(value);
if (isBlank(views)) {
- views = ListWrapper.create();
- MapWrapper.set(this._valueViews, value, views);
+ views = [];
+ this._valueViews.set(value, views);
}
- ListWrapper.push(views, view);
+ views.push(view);
},
_deregisterView: function(value, view) {
if (value == _whenDefault)
return ;
- var views = MapWrapper.get(this._valueViews, value);
+ var views = this._valueViews.get(value);
if (views.length == 1) {
MapWrapper.delete(this._valueViews, value);
} else {
ListWrapper.remove(views, view);
}
}
}, {}));
$__export("NgSwitch", NgSwitch);
$__export("NgSwitch", NgSwitch = __decorate([Directive({
selector: '[ng-switch]',
- properties: {'ngSwitch': 'ngSwitch'}
+ properties: ['ngSwitch']
}), __metadata('design:paramtypes', [])], NgSwitch));
NgSwitchWhen = (($traceurRuntime.createClass)(function(viewContainer, protoViewRef, sswitch) {
this._value = _whenDefault;
this._switch = sswitch;
this._view = new SwitchView(viewContainer, protoViewRef);
@@ -14485,11 +15789,11 @@
}
}, {}));
$__export("NgSwitchWhen", NgSwitchWhen);
$__export("NgSwitchWhen", NgSwitchWhen = __decorate([Directive({
selector: '[ng-switch-when]',
- properties: {'ngSwitchWhen': 'ngSwitchWhen'}
+ properties: ['ngSwitchWhen']
}), __param(2, Parent()), __metadata('design:paramtypes', [ViewContainerRef, ProtoViewRef, NgSwitch])], NgSwitchWhen));
NgSwitchDefault = (($traceurRuntime.createClass)(function(viewContainer, protoViewRef, sswitch) {
sswitch._registerView(_whenDefault, new SwitchView(viewContainer, protoViewRef));
}, {}, {}));
$__export("NgSwitchDefault", NgSwitchDefault);
@@ -14497,29 +15801,46 @@
_whenDefault = new Object();
}
};
});
-System.register("angular2/src/directives/class", ["angular2/annotations", "angular2/core", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) {
+System.register("angular2/src/directives/class", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipe_registry", "angular2/src/render/api", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/directives/class";
var __decorate,
__metadata,
Directive,
+ onCheck,
ElementRef,
+ PipeRegistry,
+ Renderer,
+ IterableChanges,
isPresent,
- DOM,
+ isString,
+ ListWrapper,
+ StringMapWrapper,
+ isListLikeIterable,
CSSClass;
return {
setters: [function($__m) {
Directive = $__m.Directive;
+ onCheck = $__m.onCheck;
}, function($__m) {
ElementRef = $__m.ElementRef;
}, function($__m) {
+ PipeRegistry = $__m.PipeRegistry;
+ }, function($__m) {
+ Renderer = $__m.Renderer;
+ }, function($__m) {
+ IterableChanges = $__m.IterableChanges;
+ }, function($__m) {
isPresent = $__m.isPresent;
+ isString = $__m.isString;
}, function($__m) {
- DOM = $__m.DOM;
+ ListWrapper = $__m.ListWrapper;
+ StringMapWrapper = $__m.StringMapWrapper;
+ isListLikeIterable = $__m.isListLikeIterable;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -14540,42 +15861,81 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- CSSClass = (($traceurRuntime.createClass)(function(ngEl) {
- this._domEl = ngEl.domElement;
+ CSSClass = (($traceurRuntime.createClass)(function(_pipeRegistry, _ngEl, _renderer) {
+ this._pipeRegistry = _pipeRegistry;
+ this._ngEl = _ngEl;
+ this._renderer = _renderer;
}, {
- _toggleClass: function(className, enabled) {
- if (enabled) {
- DOM.addClass(this._domEl, className);
- } else {
- DOM.removeClass(this._domEl, className);
+ set rawClass(v) {
+ this._cleanupClasses(this._rawClass);
+ if (isString(v)) {
+ v = v.split(' ');
}
+ this._rawClass = v;
+ this._pipe = this._pipeRegistry.get(isListLikeIterable(v) ? 'iterableDiff' : 'keyValDiff', v);
},
- set iterableChanges(changes) {
+ onCheck: function() {
+ var diff = this._pipe.transform(this._rawClass);
+ if (isPresent(diff) && isPresent(diff.wrapped)) {
+ if (diff.wrapped instanceof IterableChanges) {
+ this._applyArrayChanges(diff.wrapped);
+ } else {
+ this._applyObjectChanges(diff.wrapped);
+ }
+ }
+ },
+ _cleanupClasses: function(rawClassVal) {
var $__0 = this;
- if (isPresent(changes)) {
- changes.forEachAddedItem((function(record) {
- $__0._toggleClass(record.key, record.currentValue);
- }));
- changes.forEachChangedItem((function(record) {
- $__0._toggleClass(record.key, record.currentValue);
- }));
- changes.forEachRemovedItem((function(record) {
- if (record.previousValue) {
- DOM.removeClass($__0._domEl, record.key);
- }
- }));
+ if (isPresent(rawClassVal)) {
+ if (isListLikeIterable(rawClassVal)) {
+ ListWrapper.forEach(rawClassVal, (function(className) {
+ $__0._toggleClass(className, false);
+ }));
+ } else {
+ StringMapWrapper.forEach(rawClassVal, (function(expVal, className) {
+ if (expVal)
+ $__0._toggleClass(className, false);
+ }));
+ }
}
+ },
+ _applyObjectChanges: function(diff) {
+ var $__0 = this;
+ diff.forEachAddedItem((function(record) {
+ $__0._toggleClass(record.key, record.currentValue);
+ }));
+ diff.forEachChangedItem((function(record) {
+ $__0._toggleClass(record.key, record.currentValue);
+ }));
+ diff.forEachRemovedItem((function(record) {
+ if (record.previousValue) {
+ $__0._toggleClass(record.key, false);
+ }
+ }));
+ },
+ _applyArrayChanges: function(diff) {
+ var $__0 = this;
+ diff.forEachAddedItem((function(record) {
+ $__0._toggleClass(record.item, true);
+ }));
+ diff.forEachRemovedItem((function(record) {
+ $__0._toggleClass(record.item, false);
+ }));
+ },
+ _toggleClass: function(className, enabled) {
+ this._renderer.setElementClass(this._ngEl, className, enabled);
}
}, {}));
$__export("CSSClass", CSSClass);
$__export("CSSClass", CSSClass = __decorate([Directive({
selector: '[class]',
- properties: {'iterableChanges': 'class | keyValDiff'}
- }), __metadata('design:paramtypes', [ElementRef])], CSSClass));
+ lifecycle: [onCheck],
+ properties: ['rawClass: class']
+ }), __metadata('design:paramtypes', [PipeRegistry, ElementRef, Renderer])], CSSClass));
}
};
});
System.register("angular2/src/forms/validators", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
@@ -14634,78 +15994,383 @@
_mergeErrors: function(control, res) {
StringMapWrapper.forEach(control.errors, (function(value, error) {
if (!StringMapWrapper.contains(res, error)) {
res[error] = [];
}
- ListWrapper.push(res[error], control);
+ var current = res[error];
+ current.push(control);
}));
}
});
}());
$__export("Validators", Validators);
}
};
});
-System.register("angular2/src/forms/directives", ["angular2/src/core/annotations/decorators", "angular2/src/di/decorators", "angular2/src/core/compiler/element_ref", "angular2/src/render/api", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/forms/model", "angular2/src/forms/validators"], function($__export) {
+System.register("angular2/src/forms/directives/control_container", [], function($__export) {
"use strict";
- var __moduleName = "angular2/src/forms/directives";
+ var __moduleName = "angular2/src/forms/directives/control_container";
+ var ControlContainer;
+ return {
+ setters: [],
+ execute: function() {
+ ControlContainer = (function() {
+ function ControlContainer() {}
+ return ($traceurRuntime.createClass)(ControlContainer, {
+ get formDirective() {
+ return null;
+ },
+ get path() {
+ return null;
+ }
+ }, {});
+ }());
+ $__export("ControlContainer", ControlContainer);
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/ng_control", [], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_control";
+ var NgControl;
+ return {
+ setters: [],
+ execute: function() {
+ NgControl = (function() {
+ function NgControl() {
+ this.name = null;
+ this.valueAccessor = null;
+ }
+ return ($traceurRuntime.createClass)(NgControl, {
+ get validator() {
+ return null;
+ },
+ get path() {
+ return null;
+ },
+ get control() {
+ return null;
+ },
+ viewToModelUpdate: function(newValue) {}
+ }, {});
+ }());
+ $__export("NgControl", NgControl);
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/validators", ["angular2/di", "angular2/src/facade/lang", "angular2/angular2", "angular2/src/forms/validators"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/validators";
var __decorate,
__metadata,
- __param,
- Directive,
- Ancestor,
- Optional,
- ElementRef,
- Renderer,
- isPresent,
+ forwardRef,
+ Binding,
CONST_EXPR,
- isBlank,
- BaseException,
- ListWrapper,
- isControl,
+ Directive,
Validators,
- ControlGroupDirective,
- ControlDirective,
- DefaultValueAccessor,
- SelectControlValueAccessor,
- CheckboxControlValueAccessor,
- formDirectives;
- function _lookupControl(groupDirective, controlOrName) {
- if (isControl(controlOrName)) {
- return controlOrName;
+ NgValidator,
+ requiredValidatorBinding,
+ NgRequiredValidator;
+ return {
+ setters: [function($__m) {
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
+ }, function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ Directive = $__m.Directive;
+ }, function($__m) {
+ Validators = $__m.Validators;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ NgValidator = (function() {
+ function NgValidator() {}
+ return ($traceurRuntime.createClass)(NgValidator, {get validator() {
+ throw "Is not implemented";
+ }}, {});
+ }());
+ $__export("NgValidator", NgValidator);
+ requiredValidatorBinding = CONST_EXPR(new Binding(NgValidator, {toAlias: forwardRef((function() {
+ return NgRequiredValidator;
+ }))}));
+ NgRequiredValidator = (function($__super) {
+ function $__0() {
+ $traceurRuntime.superConstructor($__0).apply(this, arguments);
+ }
+ return ($traceurRuntime.createClass)($__0, {get validator() {
+ return Validators.required;
+ }}, {}, $__super);
+ }(NgValidator));
+ $__export("NgRequiredValidator", NgRequiredValidator);
+ $__export("NgRequiredValidator", NgRequiredValidator = __decorate([Directive({
+ selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]',
+ hostInjector: [requiredValidatorBinding]
+ }), __metadata('design:paramtypes', [])], NgRequiredValidator));
}
- if (isBlank(groupDirective)) {
- throw new BaseException(("No control group found for \"" + controlOrName + "\""));
- }
- var control = groupDirective.findControl(controlOrName);
- if (isBlank(control)) {
- throw new BaseException(("Cannot find control \"" + controlOrName + "\""));
- }
- return control;
+ };
+});
+
+System.register("angular2/src/forms/directives/shared", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/validators"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/shared";
+ var ListWrapper,
+ iterableToList,
+ isBlank,
+ BaseException,
+ Validators;
+ function controlPath(name, parent) {
+ var p = ListWrapper.clone(parent.path);
+ p.push(name);
+ return p;
}
+ function setUpControl(c, dir) {
+ if (isBlank(c))
+ _throwError(dir, "Cannot find control");
+ if (isBlank(dir.valueAccessor))
+ _throwError(dir, "No value accessor for");
+ c.validator = Validators.compose([c.validator, dir.validator]);
+ dir.valueAccessor.writeValue(c.value);
+ dir.valueAccessor.registerOnChange((function(newValue) {
+ dir.viewToModelUpdate(newValue);
+ c.updateValue(newValue);
+ c.markAsDirty();
+ }));
+ c.registerOnChange((function(newValue) {
+ return dir.valueAccessor.writeValue(newValue);
+ }));
+ dir.valueAccessor.registerOnTouched((function() {
+ return c.markAsTouched();
+ }));
+ }
+ function composeNgValidator(ngValidators) {
+ if (isBlank(ngValidators))
+ return Validators.nullValidator;
+ return Validators.compose(iterableToList(ngValidators).map((function(v) {
+ return v.validator;
+ })));
+ }
+ function _throwError(dir, message) {
+ var path = ListWrapper.join(dir.path, " -> ");
+ throw new BaseException((message + " '" + path + "'"));
+ }
+ function setProperty(renderer, elementRef, propName, propValue) {
+ renderer.setElementProperty(elementRef, propName, propValue);
+ }
+ $__export("controlPath", controlPath);
+ $__export("setUpControl", setUpControl);
+ $__export("composeNgValidator", composeNgValidator);
+ $__export("setProperty", setProperty);
return {
setters: [function($__m) {
+ ListWrapper = $__m.ListWrapper;
+ iterableToList = $__m.iterableToList;
+ }, function($__m) {
+ isBlank = $__m.isBlank;
+ BaseException = $__m.BaseException;
+ }, function($__m) {
+ Validators = $__m.Validators;
+ }],
+ execute: function() {
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/ng_form_control", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/angular2", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_form_control";
+ var __decorate,
+ __metadata,
+ __param,
+ CONST_EXPR,
+ StringMapWrapper,
+ EventEmitter,
+ ObservableWrapper,
+ Directive,
+ onChange,
+ Query,
+ QueryList,
+ forwardRef,
+ Binding,
+ NgControl,
+ NgValidator,
+ setUpControl,
+ composeNgValidator,
+ formControlBinding,
+ NgFormControl;
+ return {
+ setters: [function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ StringMapWrapper = $__m.StringMapWrapper;
+ }, function($__m) {
+ EventEmitter = $__m.EventEmitter;
+ ObservableWrapper = $__m.ObservableWrapper;
+ }, function($__m) {
Directive = $__m.Directive;
- Ancestor = $__m.Ancestor;
+ onChange = $__m.onChange;
+ Query = $__m.Query;
+ QueryList = $__m.QueryList;
}, function($__m) {
- Optional = $__m.Optional;
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
}, function($__m) {
- ElementRef = $__m.ElementRef;
+ NgControl = $__m.NgControl;
}, function($__m) {
- Renderer = $__m.Renderer;
+ NgValidator = $__m.NgValidator;
}, function($__m) {
- isPresent = $__m.isPresent;
+ setUpControl = $__m.setUpControl;
+ composeNgValidator = $__m.composeNgValidator;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ __param = (this && this.__param) || function(paramIndex, decorator) {
+ return function(target, key) {
+ decorator(target, key, paramIndex);
+ };
+ };
+ formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() {
+ return NgFormControl;
+ }))}));
+ NgFormControl = (function($__super) {
+ function $__0(ngValidators) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this.update = new EventEmitter();
+ this._added = false;
+ this.ngValidators = ngValidators;
+ }
+ return ($traceurRuntime.createClass)($__0, {
+ onChange: function(c) {
+ if (!this._added) {
+ setUpControl(this.form, this);
+ this.form.updateValidity();
+ this._added = true;
+ }
+ if (StringMapWrapper.contains(c, "model")) {
+ this.form.updateValue(this.model);
+ }
+ },
+ get path() {
+ return [];
+ },
+ get control() {
+ return this.form;
+ },
+ get validator() {
+ return composeNgValidator(this.ngValidators);
+ },
+ viewToModelUpdate: function(newValue) {
+ ObservableWrapper.callNext(this.update, newValue);
+ }
+ }, {}, $__super);
+ }(NgControl));
+ $__export("NgFormControl", NgFormControl);
+ $__export("NgFormControl", NgFormControl = __decorate([Directive({
+ selector: '[ng-form-control]',
+ hostInjector: [formControlBinding],
+ properties: ['form: ngFormControl', 'model: ngModel'],
+ events: ['update: ngModel'],
+ lifecycle: [onChange],
+ exportAs: 'form'
+ }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgFormControl));
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/ng_model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/angular2", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/model", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_model";
+ var __decorate,
+ __metadata,
+ __param,
+ CONST_EXPR,
+ EventEmitter,
+ ObservableWrapper,
+ StringMapWrapper,
+ Directive,
+ onChange,
+ QueryList,
+ Query,
+ forwardRef,
+ Binding,
+ NgControl,
+ Control,
+ NgValidator,
+ setUpControl,
+ composeNgValidator,
+ formControlBinding,
+ NgModel;
+ return {
+ setters: [function($__m) {
CONST_EXPR = $__m.CONST_EXPR;
- isBlank = $__m.isBlank;
- BaseException = $__m.BaseException;
}, function($__m) {
- ListWrapper = $__m.ListWrapper;
+ EventEmitter = $__m.EventEmitter;
+ ObservableWrapper = $__m.ObservableWrapper;
}, function($__m) {
- isControl = $__m.isControl;
+ StringMapWrapper = $__m.StringMapWrapper;
}, function($__m) {
- Validators = $__m.Validators;
+ Directive = $__m.Directive;
+ onChange = $__m.onChange;
+ QueryList = $__m.QueryList;
+ Query = $__m.Query;
+ }, function($__m) {
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
+ }, function($__m) {
+ NgControl = $__m.NgControl;
+ }, function($__m) {
+ Control = $__m.Control;
+ }, function($__m) {
+ NgValidator = $__m.NgValidator;
+ }, function($__m) {
+ setUpControl = $__m.setUpControl;
+ composeNgValidator = $__m.composeNgValidator;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -14731,147 +16396,689 @@
__param = (this && this.__param) || function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
- ControlGroupDirective = (($traceurRuntime.createClass)(function(groupDirective) {
- this._groupDirective = groupDirective;
- this._directives = ListWrapper.create();
+ formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() {
+ return NgModel;
+ }))}));
+ NgModel = (function($__super) {
+ function $__0(ngValidators) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this._control = new Control("");
+ this._added = false;
+ this.update = new EventEmitter();
+ this.ngValidators = ngValidators;
+ }
+ return ($traceurRuntime.createClass)($__0, {
+ onChange: function(c) {
+ if (!this._added) {
+ setUpControl(this._control, this);
+ this._control.updateValidity();
+ this._added = true;
+ }
+ if (StringMapWrapper.contains(c, "model")) {
+ this._control.updateValue(this.model);
+ }
+ },
+ get control() {
+ return this._control;
+ },
+ get path() {
+ return [];
+ },
+ get validator() {
+ return composeNgValidator(this.ngValidators);
+ },
+ viewToModelUpdate: function(newValue) {
+ ObservableWrapper.callNext(this.update, newValue);
+ }
+ }, {}, $__super);
+ }(NgControl));
+ $__export("NgModel", NgModel);
+ $__export("NgModel", NgModel = __decorate([Directive({
+ selector: '[ng-model]:not([ng-control]):not([ng-form-control])',
+ hostInjector: [formControlBinding],
+ properties: ['model: ngModel'],
+ events: ['update: ngModel'],
+ lifecycle: [onChange],
+ exportAs: 'form'
+ }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgModel));
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/ng_control_group", ["angular2/angular2", "angular2/di", "angular2/src/facade/lang", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_control_group";
+ var __decorate,
+ __metadata,
+ __param,
+ Directive,
+ Ancestor,
+ onDestroy,
+ onInit,
+ forwardRef,
+ Binding,
+ CONST_EXPR,
+ ControlContainer,
+ controlPath,
+ controlGroupBinding,
+ NgControlGroup;
+ return {
+ setters: [function($__m) {
+ Directive = $__m.Directive;
+ Ancestor = $__m.Ancestor;
+ onDestroy = $__m.onDestroy;
+ onInit = $__m.onInit;
+ }, function($__m) {
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
+ }, function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ ControlContainer = $__m.ControlContainer;
+ }, function($__m) {
+ controlPath = $__m.controlPath;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ __param = (this && this.__param) || function(paramIndex, decorator) {
+ return function(target, key) {
+ decorator(target, key, paramIndex);
+ };
+ };
+ controlGroupBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() {
+ return NgControlGroup;
+ }))}));
+ NgControlGroup = (function($__super) {
+ function $__0(_parent) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this._parent = _parent;
+ }
+ return ($traceurRuntime.createClass)($__0, {
+ onInit: function() {
+ this.formDirective.addControlGroup(this);
+ },
+ onDestroy: function() {
+ this.formDirective.removeControlGroup(this);
+ },
+ get path() {
+ return controlPath(this.name, this._parent);
+ },
+ get formDirective() {
+ return this._parent.formDirective;
+ }
+ }, {}, $__super);
+ }(ControlContainer));
+ $__export("NgControlGroup", NgControlGroup);
+ $__export("NgControlGroup", NgControlGroup = __decorate([Directive({
+ selector: '[ng-control-group]',
+ hostInjector: [controlGroupBinding],
+ properties: ['name: ng-control-group'],
+ lifecycle: [onInit, onDestroy],
+ exportAs: 'form'
+ }), __param(0, Ancestor()), __metadata('design:paramtypes', [ControlContainer])], NgControlGroup));
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/ng_form_model", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/angular2", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_form_model";
+ var __decorate,
+ __metadata,
+ CONST_EXPR,
+ ListWrapper,
+ ObservableWrapper,
+ EventEmitter,
+ Directive,
+ onChange,
+ forwardRef,
+ Binding,
+ ControlContainer,
+ setUpControl,
+ formDirectiveBinding,
+ NgFormModel;
+ return {
+ setters: [function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ ListWrapper = $__m.ListWrapper;
+ }, function($__m) {
+ ObservableWrapper = $__m.ObservableWrapper;
+ EventEmitter = $__m.EventEmitter;
+ }, function($__m) {
+ Directive = $__m.Directive;
+ onChange = $__m.onChange;
+ }, function($__m) {
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
+ }, function($__m) {
+ ControlContainer = $__m.ControlContainer;
+ }, function($__m) {
+ setUpControl = $__m.setUpControl;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() {
+ return NgFormModel;
+ }))}));
+ NgFormModel = (function($__super) {
+ function $__1() {
+ var $__4;
+ for (var args = [],
+ $__3 = 0; $__3 < arguments.length; $__3++)
+ args[$__3] = arguments[$__3];
+ ($__4 = $traceurRuntime.superConstructor($__1)).call.apply($__4, $traceurRuntime.spread([this], args));
+ this.form = null;
+ this.directives = [];
+ this.ngSubmit = new EventEmitter();
+ }
+ return ($traceurRuntime.createClass)($__1, {
+ onChange: function(_) {
+ this._updateDomValue();
+ },
+ get formDirective() {
+ return this;
+ },
+ get path() {
+ return [];
+ },
+ addControl: function(dir) {
+ var c = this.form.find(dir.path);
+ setUpControl(c, dir);
+ c.updateValidity();
+ this.directives.push(dir);
+ },
+ getControl: function(dir) {
+ return this.form.find(dir.path);
+ },
+ removeControl: function(dir) {
+ ListWrapper.remove(this.directives, dir);
+ },
+ addControlGroup: function(dir) {},
+ removeControlGroup: function(dir) {},
+ updateModel: function(dir, value) {
+ var c = this.form.find(dir.path);
+ c.updateValue(value);
+ },
+ onSubmit: function() {
+ ObservableWrapper.callNext(this.ngSubmit, null);
+ return false;
+ },
+ _updateDomValue: function() {
+ var $__0 = this;
+ ListWrapper.forEach(this.directives, (function(dir) {
+ var c = $__0.form.find(dir.path);
+ dir.valueAccessor.writeValue(c.value);
+ }));
+ }
+ }, {}, $__super);
+ }(ControlContainer));
+ $__export("NgFormModel", NgFormModel);
+ $__export("NgFormModel", NgFormModel = __decorate([Directive({
+ selector: '[ng-form-model]',
+ hostInjector: [formDirectiveBinding],
+ properties: ['form: ng-form-model'],
+ lifecycle: [onChange],
+ host: {'(submit)': 'onSubmit()'},
+ events: ['ngSubmit'],
+ exportAs: 'form'
+ }), __metadata('design:paramtypes', [])], NgFormModel));
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/ng_form", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/annotations/decorators", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/model", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_form";
+ var __decorate,
+ __metadata,
+ PromiseWrapper,
+ ObservableWrapper,
+ EventEmitter,
+ ListWrapper,
+ isPresent,
+ CONST_EXPR,
+ Directive,
+ forwardRef,
+ Binding,
+ ControlContainer,
+ ControlGroup,
+ Control,
+ setUpControl,
+ formDirectiveBinding,
+ NgForm;
+ return {
+ setters: [function($__m) {
+ PromiseWrapper = $__m.PromiseWrapper;
+ ObservableWrapper = $__m.ObservableWrapper;
+ EventEmitter = $__m.EventEmitter;
+ }, function($__m) {
+ ListWrapper = $__m.ListWrapper;
+ }, function($__m) {
+ isPresent = $__m.isPresent;
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ Directive = $__m.Directive;
+ }, function($__m) {
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
+ }, function($__m) {
+ ControlContainer = $__m.ControlContainer;
+ }, function($__m) {
+ ControlGroup = $__m.ControlGroup;
+ Control = $__m.Control;
+ }, function($__m) {
+ setUpControl = $__m.setUpControl;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() {
+ return NgForm;
+ }))}));
+ NgForm = (function($__super) {
+ function $__1() {
+ $traceurRuntime.superConstructor($__1).call(this);
+ this.ngSubmit = new EventEmitter();
+ this.form = new ControlGroup({});
+ }
+ return ($traceurRuntime.createClass)($__1, {
+ get formDirective() {
+ return this;
+ },
+ get path() {
+ return [];
+ },
+ get controls() {
+ return this.form.controls;
+ },
+ get value() {
+ return this.form.value;
+ },
+ get errors() {
+ return this.form.errors;
+ },
+ addControl: function(dir) {
+ var $__0 = this;
+ this._later((function(_) {
+ var container = $__0._findContainer(dir.path);
+ var c = new Control("");
+ setUpControl(c, dir);
+ container.addControl(dir.name, c);
+ c.updateValidity();
+ }));
+ },
+ getControl: function(dir) {
+ return this.form.find(dir.path);
+ },
+ removeControl: function(dir) {
+ var $__0 = this;
+ this._later((function(_) {
+ var container = $__0._findContainer(dir.path);
+ if (isPresent(container)) {
+ container.removeControl(dir.name);
+ container.updateValidity();
+ }
+ }));
+ },
+ addControlGroup: function(dir) {
+ var $__0 = this;
+ this._later((function(_) {
+ var container = $__0._findContainer(dir.path);
+ var c = new ControlGroup({});
+ container.addControl(dir.name, c);
+ c.updateValidity();
+ }));
+ },
+ removeControlGroup: function(dir) {
+ var $__0 = this;
+ this._later((function(_) {
+ var container = $__0._findContainer(dir.path);
+ if (isPresent(container)) {
+ container.removeControl(dir.name);
+ container.updateValidity();
+ }
+ }));
+ },
+ updateModel: function(dir, value) {
+ var $__0 = this;
+ this._later((function(_) {
+ var c = $__0.form.find(dir.path);
+ c.updateValue(value);
+ }));
+ },
+ onSubmit: function() {
+ ObservableWrapper.callNext(this.ngSubmit, null);
+ return false;
+ },
+ _findContainer: function(path) {
+ ListWrapper.removeLast(path);
+ return ListWrapper.isEmpty(path) ? this.form : this.form.find(path);
+ },
+ _later: function(fn) {
+ var c = PromiseWrapper.completer();
+ PromiseWrapper.then(c.promise, fn, (function(_) {}));
+ c.resolve(null);
+ }
+ }, {}, $__super);
+ }(ControlContainer));
+ $__export("NgForm", NgForm);
+ $__export("NgForm", NgForm = __decorate([Directive({
+ selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]',
+ hostInjector: [formDirectiveBinding],
+ host: {'(submit)': 'onSubmit()'},
+ events: ['ngSubmit'],
+ exportAs: 'form'
+ }), __metadata('design:paramtypes', [])], NgForm));
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/default_value_accessor", ["angular2/angular2", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/default_value_accessor";
+ var __decorate,
+ __metadata,
+ Directive,
+ Renderer,
+ ElementRef,
+ NgControl,
+ isBlank,
+ isPresent,
+ setProperty,
+ DefaultValueAccessor;
+ return {
+ setters: [function($__m) {
+ Directive = $__m.Directive;
+ Renderer = $__m.Renderer;
+ ElementRef = $__m.ElementRef;
+ }, function($__m) {
+ NgControl = $__m.NgControl;
+ }, function($__m) {
+ isBlank = $__m.isBlank;
+ isPresent = $__m.isPresent;
+ }, function($__m) {
+ setProperty = $__m.setProperty;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ DefaultValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) {
+ this.cd = cd;
+ this.renderer = renderer;
+ this.elementRef = elementRef;
+ this.value = null;
+ this.onChange = (function(_) {});
+ this.onTouched = (function() {});
+ cd.valueAccessor = this;
}, {
- set controlOrName(controlOrName) {
- this._controlOrName = controlOrName;
- this._updateDomValue();
+ writeValue: function(value) {
+ this.value = isBlank(value) ? '' : value;
+ setProperty(this.renderer, this.elementRef, 'value', this.value);
},
- _updateDomValue: function() {
- ListWrapper.forEach(this._directives, (function(cd) {
- return cd._updateDomValue();
- }));
+ get ngClassUntouched() {
+ return isPresent(this.cd.control) ? this.cd.control.untouched : false;
},
- addDirective: function(c) {
- ListWrapper.push(this._directives, c);
+ get ngClassTouched() {
+ return isPresent(this.cd.control) ? this.cd.control.touched : false;
},
- findControl: function(name) {
- return this._getControlGroup().controls[name];
+ get ngClassPristine() {
+ return isPresent(this.cd.control) ? this.cd.control.pristine : false;
},
- _getControlGroup: function() {
- return _lookupControl(this._groupDirective, this._controlOrName);
- }
- }, {}));
- $__export("ControlGroupDirective", ControlGroupDirective);
- $__export("ControlGroupDirective", ControlGroupDirective = __decorate([Directive({
- selector: '[control-group]',
- properties: {'controlOrName': 'control-group'}
- }), __param(0, Optional()), __param(0, Ancestor()), __metadata('design:paramtypes', [ControlGroupDirective])], ControlGroupDirective));
- ControlDirective = (($traceurRuntime.createClass)(function(groupDirective) {
- this._groupDirective = groupDirective;
- this._controlOrName = null;
- this.validator = Validators.nullValidator;
- }, {
- set controlOrName(controlOrName) {
- this._controlOrName = controlOrName;
- if (isPresent(this._groupDirective)) {
- this._groupDirective.addDirective(this);
- }
- var c = this._control();
- c.validator = Validators.compose([c.validator, this.validator]);
- if (isBlank(this.valueAccessor)) {
- throw new BaseException(("Cannot find value accessor for control \"" + controlOrName + "\""));
- }
- this._updateDomValue();
- this._setUpUpdateControlValue();
+ get ngClassDirty() {
+ return isPresent(this.cd.control) ? this.cd.control.dirty : false;
},
- _updateDomValue: function() {
- this.valueAccessor.writeValue(this._control().value);
+ get ngClassValid() {
+ return isPresent(this.cd.control) ? this.cd.control.valid : false;
},
- _setUpUpdateControlValue: function() {
- var $__0 = this;
- this.valueAccessor.onChange = (function(newValue) {
- return $__0._control().updateValue(newValue);
- });
+ get ngClassInvalid() {
+ return isPresent(this.cd.control) ? !this.cd.control.valid : false;
},
- _control: function() {
- return _lookupControl(this._groupDirective, this._controlOrName);
+ registerOnChange: function(fn) {
+ this.onChange = fn;
+ },
+ registerOnTouched: function(fn) {
+ this.onTouched = fn;
}
}, {}));
- $__export("ControlDirective", ControlDirective);
- $__export("ControlDirective", ControlDirective = __decorate([Directive({
- selector: '[control]',
- properties: {'controlOrName': 'control'}
- }), __param(0, Optional()), __param(0, Ancestor()), __metadata('design:paramtypes', [ControlGroupDirective])], ControlDirective));
- DefaultValueAccessor = (($traceurRuntime.createClass)(function(cd, _elementRef, _renderer) {
- this._elementRef = _elementRef;
- this._renderer = _renderer;
- this.value = null;
- this.onChange = (function(_) {});
- cd.valueAccessor = this;
- }, {writeValue: function(value) {
- this._renderer.setElementProperty(this._elementRef.parentView.render, this._elementRef.boundElementIndex, 'value', value);
- }}, {}));
$__export("DefaultValueAccessor", DefaultValueAccessor);
$__export("DefaultValueAccessor", DefaultValueAccessor = __decorate([Directive({
- selector: 'input:not([type=checkbox])[control],textarea[control]',
- hostListeners: {
- 'change': 'onChange($event.target.value)',
- 'input': 'onChange($event.target.value)'
- },
- hostProperties: {'value': 'value'}
- }), __metadata('design:paramtypes', [ControlDirective, ElementRef, Renderer])], DefaultValueAccessor));
- SelectControlValueAccessor = (($traceurRuntime.createClass)(function(cd, _elementRef, _renderer) {
- this._elementRef = _elementRef;
- this._renderer = _renderer;
- this.value = null;
+ selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]',
+ host: {
+ '(change)': 'onChange($event.target.value)',
+ '(input)': 'onChange($event.target.value)',
+ '(blur)': 'onTouched()',
+ '[value]': 'value',
+ '[class.ng-untouched]': 'ngClassUntouched',
+ '[class.ng-touched]': 'ngClassTouched',
+ '[class.ng-pristine]': 'ngClassPristine',
+ '[class.ng-dirty]': 'ngClassDirty',
+ '[class.ng-valid]': 'ngClassValid',
+ '[class.ng-invalid]': 'ngClassInvalid'
+ }
+ }), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], DefaultValueAccessor));
+ }
+ };
+});
+
+System.register("angular2/src/forms/directives/checkbox_value_accessor", ["angular2/angular2", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/checkbox_value_accessor";
+ var __decorate,
+ __metadata,
+ Directive,
+ Renderer,
+ ElementRef,
+ NgControl,
+ isPresent,
+ setProperty,
+ CheckboxControlValueAccessor;
+ return {
+ setters: [function($__m) {
+ Directive = $__m.Directive;
+ Renderer = $__m.Renderer;
+ ElementRef = $__m.ElementRef;
+ }, function($__m) {
+ NgControl = $__m.NgControl;
+ }, function($__m) {
+ isPresent = $__m.isPresent;
+ }, function($__m) {
+ setProperty = $__m.setProperty;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ CheckboxControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) {
+ this.cd = cd;
+ this.renderer = renderer;
+ this.elementRef = elementRef;
this.onChange = (function(_) {});
- this.value = '';
+ this.onTouched = (function() {});
cd.valueAccessor = this;
- }, {writeValue: function(value) {
- this._renderer.setElementProperty(this._elementRef.parentView.render, this._elementRef.boundElementIndex, 'value', value);
- }}, {}));
- $__export("SelectControlValueAccessor", SelectControlValueAccessor);
- $__export("SelectControlValueAccessor", SelectControlValueAccessor = __decorate([Directive({
- selector: 'select[control]',
- hostListeners: {
- 'change': 'onChange($event.target.value)',
- 'input': 'onChange($event.target.value)'
+ }, {
+ writeValue: function(value) {
+ this.checked = value;
+ setProperty(this.renderer, this.elementRef, "checked", value);
},
- hostProperties: {'value': 'value'}
- }), __metadata('design:paramtypes', [ControlDirective, ElementRef, Renderer])], SelectControlValueAccessor));
- CheckboxControlValueAccessor = (($traceurRuntime.createClass)(function(cd, _elementRef, _renderer) {
- this._elementRef = _elementRef;
- this._renderer = _renderer;
- this.onChange = (function(_) {});
- cd.valueAccessor = this;
- }, {writeValue: function(value) {
- this._renderer.setElementProperty(this._elementRef.parentView.render, this._elementRef.boundElementIndex, 'checked', value);
- }}, {}));
+ get ngClassUntouched() {
+ return isPresent(this.cd.control) ? this.cd.control.untouched : false;
+ },
+ get ngClassTouched() {
+ return isPresent(this.cd.control) ? this.cd.control.touched : false;
+ },
+ get ngClassPristine() {
+ return isPresent(this.cd.control) ? this.cd.control.pristine : false;
+ },
+ get ngClassDirty() {
+ return isPresent(this.cd.control) ? this.cd.control.dirty : false;
+ },
+ get ngClassValid() {
+ return isPresent(this.cd.control) ? this.cd.control.valid : false;
+ },
+ get ngClassInvalid() {
+ return isPresent(this.cd.control) ? !this.cd.control.valid : false;
+ },
+ registerOnChange: function(fn) {
+ this.onChange = fn;
+ },
+ registerOnTouched: function(fn) {
+ this.onTouched = fn;
+ }
+ }, {}));
$__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor);
$__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor = __decorate([Directive({
- selector: 'input[type=checkbox][control]',
- hostListeners: {'change': 'onChange($event.target.checked)'},
- hostProperties: {'checked': 'checked'}
- }), __metadata('design:paramtypes', [ControlDirective, ElementRef, Renderer])], CheckboxControlValueAccessor));
- formDirectives = CONST_EXPR([ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor, SelectControlValueAccessor]);
- $__export("formDirectives", formDirectives);
+ selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]',
+ host: {
+ '(change)': 'onChange($event.target.checked)',
+ '(blur)': 'onTouched()',
+ '[checked]': 'checked',
+ '[class.ng-untouched]': 'ngClassUntouched',
+ '[class.ng-touched]': 'ngClassTouched',
+ '[class.ng-pristine]': 'ngClassPristine',
+ '[class.ng-dirty]': 'ngClassDirty',
+ '[class.ng-valid]': 'ngClassValid',
+ '[class.ng-invalid]': 'ngClassInvalid'
+ }
+ }), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], CheckboxControlValueAccessor));
}
};
});
-System.register("angular2/src/forms/validator_directives", ["angular2/src/core/annotations/decorators", "angular2/src/forms/validators", "angular2/src/forms/directives"], function($__export) {
+System.register("angular2/src/forms/directives/select_control_value_accessor", ["angular2/angular2", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/forms/validator_directives";
+ var __moduleName = "angular2/src/forms/directives/select_control_value_accessor";
var __decorate,
__metadata,
+ __param,
Directive,
- Validators,
- ControlDirective,
- RequiredValidatorDirective;
+ Query,
+ QueryList,
+ Renderer,
+ ElementRef,
+ NgControl,
+ isPresent,
+ setProperty,
+ NgSelectOption,
+ SelectControlValueAccessor;
return {
setters: [function($__m) {
Directive = $__m.Directive;
+ Query = $__m.Query;
+ QueryList = $__m.QueryList;
+ Renderer = $__m.Renderer;
+ ElementRef = $__m.ElementRef;
}, function($__m) {
- Validators = $__m.Validators;
+ NgControl = $__m.NgControl;
}, function($__m) {
- ControlDirective = $__m.ControlDirective;
+ isPresent = $__m.isPresent;
+ }, function($__m) {
+ setProperty = $__m.setProperty;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -14892,33 +17099,160 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- RequiredValidatorDirective = (($traceurRuntime.createClass)(function(c) {
- c.validator = Validators.compose([c.validator, Validators.required]);
- }, {}, {}));
- $__export("RequiredValidatorDirective", RequiredValidatorDirective);
- $__export("RequiredValidatorDirective", RequiredValidatorDirective = __decorate([Directive({selector: '[required]'}), __metadata('design:paramtypes', [ControlDirective])], RequiredValidatorDirective));
+ __param = (this && this.__param) || function(paramIndex, decorator) {
+ return function(target, key) {
+ decorator(target, key, paramIndex);
+ };
+ };
+ NgSelectOption = (($traceurRuntime.createClass)(function() {}, {}, {}));
+ $__export("NgSelectOption", NgSelectOption);
+ $__export("NgSelectOption", NgSelectOption = __decorate([Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption));
+ SelectControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef, query) {
+ this.cd = cd;
+ this.renderer = renderer;
+ this.elementRef = elementRef;
+ this.value = '';
+ this.onChange = (function(_) {});
+ this.onTouched = (function() {});
+ cd.valueAccessor = this;
+ this._updateValueWhenListOfOptionsChanges(query);
+ }, {
+ writeValue: function(value) {
+ this.value = value;
+ setProperty(this.renderer, this.elementRef, "value", value);
+ },
+ get ngClassUntouched() {
+ return isPresent(this.cd.control) ? this.cd.control.untouched : false;
+ },
+ get ngClassTouched() {
+ return isPresent(this.cd.control) ? this.cd.control.touched : false;
+ },
+ get ngClassPristine() {
+ return isPresent(this.cd.control) ? this.cd.control.pristine : false;
+ },
+ get ngClassDirty() {
+ return isPresent(this.cd.control) ? this.cd.control.dirty : false;
+ },
+ get ngClassValid() {
+ return isPresent(this.cd.control) ? this.cd.control.valid : false;
+ },
+ get ngClassInvalid() {
+ return isPresent(this.cd.control) ? !this.cd.control.valid : false;
+ },
+ registerOnChange: function(fn) {
+ this.onChange = fn;
+ },
+ registerOnTouched: function(fn) {
+ this.onTouched = fn;
+ },
+ _updateValueWhenListOfOptionsChanges: function(query) {
+ var $__0 = this;
+ query.onChange((function() {
+ return $__0.writeValue($__0.value);
+ }));
+ }
+ }, {}));
+ $__export("SelectControlValueAccessor", SelectControlValueAccessor);
+ $__export("SelectControlValueAccessor", SelectControlValueAccessor = __decorate([Directive({
+ selector: 'select[ng-control],select[ng-form-control],select[ng-model]',
+ host: {
+ '(change)': 'onChange($event.target.value)',
+ '(input)': 'onChange($event.target.value)',
+ '(blur)': 'onTouched()',
+ '[value]': 'value',
+ '[class.ng-untouched]': 'ngClassUntouched',
+ '[class.ng-touched]': 'ngClassTouched',
+ '[class.ng-pristine]': 'ngClassPristine',
+ '[class.ng-dirty]': 'ngClassDirty',
+ '[class.ng-valid]': 'ngClassValid',
+ '[class.ng-invalid]': 'ngClassInvalid'
+ }
+ }), __param(3, Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef, QueryList])], SelectControlValueAccessor));
}
};
});
+System.register("angular2/src/forms/directives", ["angular2/src/facade/lang", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/ng_control"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives";
+ var CONST_EXPR,
+ NgControlName,
+ NgFormControl,
+ NgModel,
+ NgControlGroup,
+ NgFormModel,
+ NgForm,
+ DefaultValueAccessor,
+ CheckboxControlValueAccessor,
+ SelectControlValueAccessor,
+ NgSelectOption,
+ NgRequiredValidator,
+ formDirectives;
+ return {
+ setters: [function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ NgControlName = $__m.NgControlName;
+ $__export("NgControlName", $__m.NgControlName);
+ }, function($__m) {
+ NgFormControl = $__m.NgFormControl;
+ $__export("NgFormControl", $__m.NgFormControl);
+ }, function($__m) {
+ NgModel = $__m.NgModel;
+ $__export("NgModel", $__m.NgModel);
+ }, function($__m) {
+ NgControlGroup = $__m.NgControlGroup;
+ $__export("NgControlGroup", $__m.NgControlGroup);
+ }, function($__m) {
+ NgFormModel = $__m.NgFormModel;
+ $__export("NgFormModel", $__m.NgFormModel);
+ }, function($__m) {
+ NgForm = $__m.NgForm;
+ $__export("NgForm", $__m.NgForm);
+ }, function($__m) {
+ DefaultValueAccessor = $__m.DefaultValueAccessor;
+ $__export("DefaultValueAccessor", $__m.DefaultValueAccessor);
+ }, function($__m) {
+ CheckboxControlValueAccessor = $__m.CheckboxControlValueAccessor;
+ $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor);
+ }, function($__m) {
+ SelectControlValueAccessor = $__m.SelectControlValueAccessor;
+ NgSelectOption = $__m.NgSelectOption;
+ $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor);
+ }, function($__m) {
+ NgRequiredValidator = $__m.NgRequiredValidator;
+ $__export("NgValidator", $__m.NgValidator);
+ $__export("NgRequiredValidator", $__m.NgRequiredValidator);
+ }, function($__m) {
+ $__export("NgControl", $__m.NgControl);
+ }],
+ execute: function() {
+ formDirectives = CONST_EXPR([NgControlName, NgControlGroup, NgFormControl, NgModel, NgFormModel, NgForm, NgSelectOption, DefaultValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, NgRequiredValidator]);
+ $__export("formDirectives", formDirectives);
+ }
+ };
+});
+
System.register("angular2/src/forms/form_builder", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/model"], function($__export) {
"use strict";
var __moduleName = "angular2/src/forms/form_builder";
var StringMapWrapper,
ListWrapper,
isPresent,
+ isArray,
modelModule,
FormBuilder;
return {
setters: [function($__m) {
StringMapWrapper = $__m.StringMapWrapper;
ListWrapper = $__m.ListWrapper;
}, function($__m) {
isPresent = $__m.isPresent;
+ isArray = $__m.isArray;
}, function($__m) {
modelModule = $__m;
}],
execute: function() {
FormBuilder = (function() {
@@ -14964,11 +17298,11 @@
return controls;
},
_createControl: function(controlConfig) {
if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) {
return controlConfig;
- } else if (ListWrapper.isList(controlConfig)) {
+ } else if (isArray(controlConfig)) {
var value = ListWrapper.get(controlConfig, 0);
var validator = controlConfig.length > 1 ? controlConfig[1] : null;
return this.control(value, validator);
} else {
return this.control(controlConfig);
@@ -14979,38 +17313,557 @@
$__export("FormBuilder", FormBuilder);
}
};
});
+System.register("angular2/src/http/enums", [], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/enums";
+ var RequestModesOpts,
+ RequestCacheOpts,
+ RequestCredentialsOpts,
+ RequestMethods,
+ ReadyStates,
+ ResponseTypes;
+ return {
+ setters: [],
+ execute: function() {
+ $__export("RequestModesOpts", RequestModesOpts);
+ (function(RequestModesOpts) {
+ RequestModesOpts[RequestModesOpts["Cors"] = 0] = "Cors";
+ RequestModesOpts[RequestModesOpts["NoCors"] = 1] = "NoCors";
+ RequestModesOpts[RequestModesOpts["SameOrigin"] = 2] = "SameOrigin";
+ })(RequestModesOpts || ($__export("RequestModesOpts", RequestModesOpts = {})));
+ $__export("RequestCacheOpts", RequestCacheOpts);
+ (function(RequestCacheOpts) {
+ RequestCacheOpts[RequestCacheOpts["Default"] = 0] = "Default";
+ RequestCacheOpts[RequestCacheOpts["NoStore"] = 1] = "NoStore";
+ RequestCacheOpts[RequestCacheOpts["Reload"] = 2] = "Reload";
+ RequestCacheOpts[RequestCacheOpts["NoCache"] = 3] = "NoCache";
+ RequestCacheOpts[RequestCacheOpts["ForceCache"] = 4] = "ForceCache";
+ RequestCacheOpts[RequestCacheOpts["OnlyIfCached"] = 5] = "OnlyIfCached";
+ })(RequestCacheOpts || ($__export("RequestCacheOpts", RequestCacheOpts = {})));
+ $__export("RequestCredentialsOpts", RequestCredentialsOpts);
+ (function(RequestCredentialsOpts) {
+ RequestCredentialsOpts[RequestCredentialsOpts["Omit"] = 0] = "Omit";
+ RequestCredentialsOpts[RequestCredentialsOpts["SameOrigin"] = 1] = "SameOrigin";
+ RequestCredentialsOpts[RequestCredentialsOpts["Include"] = 2] = "Include";
+ })(RequestCredentialsOpts || ($__export("RequestCredentialsOpts", RequestCredentialsOpts = {})));
+ $__export("RequestMethods", RequestMethods);
+ (function(RequestMethods) {
+ RequestMethods[RequestMethods["GET"] = 0] = "GET";
+ RequestMethods[RequestMethods["POST"] = 1] = "POST";
+ RequestMethods[RequestMethods["PUT"] = 2] = "PUT";
+ RequestMethods[RequestMethods["DELETE"] = 3] = "DELETE";
+ RequestMethods[RequestMethods["OPTIONS"] = 4] = "OPTIONS";
+ RequestMethods[RequestMethods["HEAD"] = 5] = "HEAD";
+ RequestMethods[RequestMethods["PATCH"] = 6] = "PATCH";
+ })(RequestMethods || ($__export("RequestMethods", RequestMethods = {})));
+ $__export("ReadyStates", ReadyStates);
+ (function(ReadyStates) {
+ ReadyStates[ReadyStates["UNSENT"] = 0] = "UNSENT";
+ ReadyStates[ReadyStates["OPEN"] = 1] = "OPEN";
+ ReadyStates[ReadyStates["HEADERS_RECEIVED"] = 2] = "HEADERS_RECEIVED";
+ ReadyStates[ReadyStates["LOADING"] = 3] = "LOADING";
+ ReadyStates[ReadyStates["DONE"] = 4] = "DONE";
+ ReadyStates[ReadyStates["CANCELLED"] = 5] = "CANCELLED";
+ })(ReadyStates || ($__export("ReadyStates", ReadyStates = {})));
+ $__export("ResponseTypes", ResponseTypes);
+ (function(ResponseTypes) {
+ ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic";
+ ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors";
+ ResponseTypes[ResponseTypes["Default"] = 2] = "Default";
+ ResponseTypes[ResponseTypes["Error"] = 3] = "Error";
+ ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque";
+ })(ResponseTypes || ($__export("ResponseTypes", ResponseTypes = {})));
+ }
+ };
+});
+
+System.register("angular2/src/http/headers", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/headers";
+ var isPresent,
+ isBlank,
+ isJsObject,
+ BaseException,
+ isListLikeIterable,
+ Map,
+ MapWrapper,
+ ListWrapper,
+ Headers;
+ return {
+ setters: [function($__m) {
+ isPresent = $__m.isPresent;
+ isBlank = $__m.isBlank;
+ isJsObject = $__m.isJsObject;
+ BaseException = $__m.BaseException;
+ }, function($__m) {
+ isListLikeIterable = $__m.isListLikeIterable;
+ Map = $__m.Map;
+ MapWrapper = $__m.MapWrapper;
+ ListWrapper = $__m.ListWrapper;
+ }],
+ execute: function() {
+ Headers = (function() {
+ function Headers(headers) {
+ var $__0 = this;
+ if (isBlank(headers)) {
+ this._headersMap = new Map();
+ return ;
+ }
+ if (isPresent(headers._headersMap)) {
+ this._headersMap = headers._headersMap;
+ } else if (isJsObject(headers)) {
+ this._headersMap = MapWrapper.createFromStringMap(headers);
+ MapWrapper.forEach(this._headersMap, (function(v, k) {
+ if (!isListLikeIterable(v)) {
+ var list = [];
+ list.push(v);
+ $__0._headersMap.set(k, list);
+ }
+ }));
+ }
+ }
+ return ($traceurRuntime.createClass)(Headers, {
+ append: function(name, value) {
+ var list = this._headersMap.get(name) || [];
+ list.push(value);
+ this._headersMap.set(name, list);
+ },
+ delete: function(name) {
+ MapWrapper.delete(this._headersMap, name);
+ },
+ forEach: function(fn) {
+ return MapWrapper.forEach(this._headersMap, fn);
+ },
+ get: function(header) {
+ return ListWrapper.first(this._headersMap.get(header));
+ },
+ has: function(header) {
+ return this._headersMap.has(header);
+ },
+ keys: function() {
+ return MapWrapper.keys(this._headersMap);
+ },
+ set: function(header, value) {
+ var list = [];
+ if (!isListLikeIterable(value)) {
+ list.push(value);
+ } else {
+ list.push(ListWrapper.toString(value));
+ }
+ this._headersMap.set(header, list);
+ },
+ values: function() {
+ return MapWrapper.values(this._headersMap);
+ },
+ getAll: function(header) {
+ return this._headersMap.get(header) || [];
+ },
+ entries: function() {
+ throw new BaseException('"entries" method is not implemented on Headers class');
+ }
+ }, {});
+ }());
+ $__export("Headers", Headers);
+ }
+ };
+});
+
+System.register("angular2/src/http/base_response_options", ["angular2/src/http/headers", "angular2/src/http/enums"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/base_response_options";
+ var Headers,
+ ResponseTypes,
+ BaseResponseOptions,
+ baseResponseOptions;
+ return {
+ setters: [function($__m) {
+ Headers = $__m.Headers;
+ }, function($__m) {
+ ResponseTypes = $__m.ResponseTypes;
+ }],
+ execute: function() {
+ BaseResponseOptions = (function() {
+ function BaseResponseOptions() {
+ var $__2,
+ $__3,
+ $__4,
+ $__5,
+ $__6;
+ var $__1 = arguments[0] !== (void 0) ? arguments[0] : {},
+ status = ($__2 = $__1.status) === void 0 ? 200 : $__2,
+ statusText = ($__3 = $__1.statusText) === void 0 ? 'Ok' : $__3,
+ type = ($__4 = $__1.type) === void 0 ? ResponseTypes.Default : $__4,
+ headers = ($__5 = $__1.headers) === void 0 ? new Headers() : $__5,
+ url = ($__6 = $__1.url) === void 0 ? '' : $__6;
+ this.status = status;
+ this.statusText = statusText;
+ this.type = type;
+ this.headers = headers;
+ this.url = url;
+ }
+ return ($traceurRuntime.createClass)(BaseResponseOptions, {}, {});
+ }());
+ $__export("BaseResponseOptions", BaseResponseOptions);
+ ;
+ baseResponseOptions = Object.freeze(new BaseResponseOptions());
+ $__export("baseResponseOptions", baseResponseOptions);
+ }
+ };
+});
+
+System.register("angular2/src/http/backends/browser_xhr", ["angular2/di"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/backends/browser_xhr";
+ var __decorate,
+ __metadata,
+ Injectable,
+ BrowserXHR;
+ return {
+ setters: [function($__m) {
+ Injectable = $__m.Injectable;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ BrowserXHR = (($traceurRuntime.createClass)(function() {
+ return (new window.XMLHttpRequest());
+ }, {}, {}));
+ $__export("BrowserXHR", BrowserXHR);
+ $__export("BrowserXHR", BrowserXHR = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserXHR));
+ }
+ };
+});
+
+System.register("angular2/src/http/base_request_options", ["angular2/src/http/enums", "angular2/di", "angular2/src/facade/collection"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/base_request_options";
+ var __decorate,
+ __metadata,
+ RequestModesOpts,
+ RequestMethods,
+ Injectable,
+ StringMapWrapper,
+ RequestOptions,
+ BaseRequestOptions;
+ return {
+ setters: [function($__m) {
+ RequestModesOpts = $__m.RequestModesOpts;
+ RequestMethods = $__m.RequestMethods;
+ }, function($__m) {
+ Injectable = $__m.Injectable;
+ }, function($__m) {
+ StringMapWrapper = $__m.StringMapWrapper;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ RequestOptions = (function() {
+ function RequestOptions() {
+ var $__2 = arguments[0] !== (void 0) ? arguments[0] : {
+ method: RequestMethods.GET,
+ mode: RequestModesOpts.Cors
+ },
+ method = $__2.method,
+ headers = $__2.headers,
+ body = $__2.body,
+ mode = $__2.mode,
+ credentials = $__2.credentials,
+ cache = $__2.cache;
+ this.method = RequestMethods.GET;
+ this.mode = RequestModesOpts.Cors;
+ this.method = method;
+ this.headers = headers;
+ this.body = body;
+ this.mode = mode;
+ this.credentials = credentials;
+ this.cache = cache;
+ }
+ return ($traceurRuntime.createClass)(RequestOptions, {merge: function() {
+ var opts = arguments[0] !== (void 0) ? arguments[0] : {};
+ return new RequestOptions(StringMapWrapper.merge(this, opts));
+ }}, {});
+ }());
+ $__export("RequestOptions", RequestOptions);
+ BaseRequestOptions = (function($__super) {
+ function $__0() {
+ $traceurRuntime.superConstructor($__0).call(this);
+ }
+ return ($traceurRuntime.createClass)($__0, {}, {}, $__super);
+ }(RequestOptions));
+ $__export("BaseRequestOptions", BaseRequestOptions);
+ $__export("BaseRequestOptions", BaseRequestOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions));
+ }
+ };
+});
+
+System.register("angular2/src/http/backends/mock_backend", ["angular2/di", "angular2/src/http/static_request", "angular2/src/http/enums", "rx"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/backends/mock_backend";
+ var __decorate,
+ __metadata,
+ Injectable,
+ Request,
+ ReadyStates,
+ Rx,
+ MockConnection,
+ MockBackend;
+ return {
+ setters: [function($__m) {
+ Injectable = $__m.Injectable;
+ }, function($__m) {
+ Request = $__m.Request;
+ }, function($__m) {
+ ReadyStates = $__m.ReadyStates;
+ }, function($__m) {
+ Rx = $__m;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ MockConnection = (function() {
+ function MockConnection(req) {
+ if (Rx.hasOwnProperty('default')) {
+ this.response = new (Rx.default.Rx.Subject)();
+ } else {
+ this.response = new Rx.Subject();
+ }
+ this.readyState = ReadyStates.OPEN;
+ this.request = req;
+ this.dispose = this.dispose.bind(this);
+ }
+ return ($traceurRuntime.createClass)(MockConnection, {
+ dispose: function() {
+ if (this.readyState !== ReadyStates.DONE) {
+ this.readyState = ReadyStates.CANCELLED;
+ }
+ },
+ mockRespond: function(res) {
+ if (this.readyState >= ReadyStates.DONE) {
+ throw new Error('Connection has already been resolved');
+ }
+ this.readyState = ReadyStates.DONE;
+ this.response.onNext(res);
+ this.response.onCompleted();
+ },
+ mockDownload: function(res) {},
+ mockError: function(err) {
+ this.readyState = ReadyStates.DONE;
+ this.response.onError(err);
+ this.response.onCompleted();
+ }
+ }, {});
+ }());
+ $__export("MockConnection", MockConnection);
+ MockBackend = (($traceurRuntime.createClass)(function() {
+ var $__0 = this;
+ var Observable;
+ this.connectionsArray = [];
+ if (Rx.hasOwnProperty('default')) {
+ this.connections = new Rx.default.Rx.Subject();
+ Observable = Rx.default.Rx.Observable;
+ } else {
+ this.connections = new Rx.Subject();
+ Observable = Rx.Observable;
+ }
+ this.connections.subscribe((function(connection) {
+ return $__0.connectionsArray.push(connection);
+ }));
+ this.pendingConnections = Observable.fromArray(this.connectionsArray).filter((function(c) {
+ return c.readyState < ReadyStates.DONE;
+ }));
+ }, {
+ verifyNoPendingRequests: function() {
+ var pending = 0;
+ this.pendingConnections.subscribe((function(c) {
+ return pending++;
+ }));
+ if (pending > 0)
+ throw new Error((pending + " pending connections to be resolved"));
+ },
+ resolveAllConnections: function() {
+ this.connections.subscribe((function(c) {
+ return c.readyState = 4;
+ }));
+ },
+ createConnection: function(req) {
+ if (!req || !(req instanceof Request)) {
+ throw new Error(("createConnection requires an instance of Request, got " + req));
+ }
+ var connection = new MockConnection(req);
+ this.connections.onNext(connection);
+ return connection;
+ }
+ }, {}));
+ $__export("MockBackend", MockBackend);
+ $__export("MockBackend", MockBackend = __decorate([Injectable(), __metadata('design:paramtypes', [])], MockBackend));
+ }
+ };
+});
+
+System.register("angular2/src/http/url_search_params", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/url_search_params";
+ var StringWrapper,
+ Map,
+ MapWrapper,
+ ListWrapper,
+ URLSearchParams;
+ function paramParser(rawParams) {
+ var map = new Map();
+ var params = StringWrapper.split(rawParams, '&');
+ ListWrapper.forEach(params, (function(param) {
+ var split = StringWrapper.split(param, '=');
+ var key = ListWrapper.get(split, 0);
+ var val = ListWrapper.get(split, 1);
+ var list = map.get(key) || [];
+ list.push(val);
+ map.set(key, list);
+ }));
+ return map;
+ }
+ return {
+ setters: [function($__m) {
+ StringWrapper = $__m.StringWrapper;
+ }, function($__m) {
+ Map = $__m.Map;
+ MapWrapper = $__m.MapWrapper;
+ ListWrapper = $__m.ListWrapper;
+ }],
+ execute: function() {
+ URLSearchParams = (function() {
+ function URLSearchParams(rawParams) {
+ this.rawParams = rawParams;
+ this.paramsMap = paramParser(rawParams);
+ }
+ return ($traceurRuntime.createClass)(URLSearchParams, {
+ has: function(param) {
+ return this.paramsMap.has(param);
+ },
+ get: function(param) {
+ return ListWrapper.first(this.paramsMap.get(param));
+ },
+ getAll: function(param) {
+ return this.paramsMap.get(param) || [];
+ },
+ append: function(param, val) {
+ var list = this.paramsMap.get(param) || [];
+ list.push(val);
+ this.paramsMap.set(param, list);
+ },
+ toString: function() {
+ var paramsList = [];
+ MapWrapper.forEach(this.paramsMap, (function(values, k) {
+ ListWrapper.forEach(values, (function(v) {
+ paramsList.push(k + '=' + v);
+ }));
+ }));
+ return ListWrapper.join(paramsList, '&');
+ },
+ delete: function(param) {
+ MapWrapper.delete(this.paramsMap, param);
+ }
+ }, {});
+ }());
+ $__export("URLSearchParams", URLSearchParams);
+ }
+ };
+});
+
System.register("angular2/src/change_detection/parser/ast", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/parser/ast";
- var isPresent,
+ var isBlank,
+ isPresent,
FunctionWrapper,
BaseException,
ListWrapper,
StringMapWrapper,
AST,
EmptyExpr,
ImplicitReceiver,
Chain,
Conditional,
+ If,
AccessMember,
+ SafeAccessMember,
KeyedAccess,
- Pipe,
+ BindingPipe,
LiteralPrimitive,
LiteralArray,
LiteralMap,
Interpolation,
Binary,
PrefixNot,
Assignment,
MethodCall,
+ SafeMethodCall,
FunctionCall,
ASTWithSource,
TemplateBinding,
- AstVisitor,
AstTransformer,
_evalListCache;
function evalList(context, locals, exps) {
var length = exps.length;
if (length > 10) {
@@ -15022,10 +17875,11 @@
}
return result;
}
return {
setters: [function($__m) {
+ isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
FunctionWrapper = $__m.FunctionWrapper;
BaseException = $__m.BaseException;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
@@ -15119,10 +17973,31 @@
return visitor.visitConditional(this);
}
}, {}, $__super);
}(AST));
$__export("Conditional", Conditional);
+ If = (function($__super) {
+ function If(condition, trueExp, falseExp) {
+ $traceurRuntime.superConstructor(If).call(this);
+ this.condition = condition;
+ this.trueExp = trueExp;
+ this.falseExp = falseExp;
+ }
+ return ($traceurRuntime.createClass)(If, {
+ eval: function(context, locals) {
+ if (this.condition.eval(context, locals)) {
+ this.trueExp.eval(context, locals);
+ } else if (isPresent(this.falseExp)) {
+ this.falseExp.eval(context, locals);
+ }
+ },
+ visit: function(visitor) {
+ return visitor.visitIf(this);
+ }
+ }, {}, $__super);
+ }(AST));
+ $__export("If", If);
AccessMember = (function($__super) {
function AccessMember(receiver, name, getter, setter) {
$traceurRuntime.superConstructor(AccessMember).call(this);
this.receiver = receiver;
this.name = name;
@@ -15153,10 +18028,29 @@
return visitor.visitAccessMember(this);
}
}, {}, $__super);
}(AST));
$__export("AccessMember", AccessMember);
+ SafeAccessMember = (function($__super) {
+ function SafeAccessMember(receiver, name, getter, setter) {
+ $traceurRuntime.superConstructor(SafeAccessMember).call(this);
+ this.receiver = receiver;
+ this.name = name;
+ this.getter = getter;
+ this.setter = setter;
+ }
+ return ($traceurRuntime.createClass)(SafeAccessMember, {
+ eval: function(context, locals) {
+ var evaluatedReceiver = this.receiver.eval(context, locals);
+ return isBlank(evaluatedReceiver) ? null : this.getter(evaluatedReceiver);
+ },
+ visit: function(visitor) {
+ return visitor.visitSafeAccessMember(this);
+ }
+ }, {}, $__super);
+ }(AST));
+ $__export("SafeAccessMember", SafeAccessMember);
KeyedAccess = (function($__super) {
function KeyedAccess(obj, key) {
$traceurRuntime.superConstructor(KeyedAccess).call(this);
this.obj = obj;
this.key = key;
@@ -15180,23 +18074,22 @@
return visitor.visitKeyedAccess(this);
}
}, {}, $__super);
}(AST));
$__export("KeyedAccess", KeyedAccess);
- Pipe = (function($__super) {
- function Pipe(exp, name, args, inBinding) {
- $traceurRuntime.superConstructor(Pipe).call(this);
+ BindingPipe = (function($__super) {
+ function BindingPipe(exp, name, args) {
+ $traceurRuntime.superConstructor(BindingPipe).call(this);
this.exp = exp;
this.name = name;
this.args = args;
- this.inBinding = inBinding;
}
- return ($traceurRuntime.createClass)(Pipe, {visit: function(visitor) {
+ return ($traceurRuntime.createClass)(BindingPipe, {visit: function(visitor) {
return visitor.visitPipe(this);
}}, {}, $__super);
}(AST));
- $__export("Pipe", Pipe);
+ $__export("BindingPipe", BindingPipe);
LiteralPrimitive = (function($__super) {
function LiteralPrimitive(value) {
$traceurRuntime.superConstructor(LiteralPrimitive).call(this);
this.value = value;
}
@@ -15374,10 +18267,32 @@
return visitor.visitMethodCall(this);
}
}, {}, $__super);
}(AST));
$__export("MethodCall", MethodCall);
+ SafeMethodCall = (function($__super) {
+ function SafeMethodCall(receiver, name, fn, args) {
+ $traceurRuntime.superConstructor(SafeMethodCall).call(this);
+ this.receiver = receiver;
+ this.name = name;
+ this.fn = fn;
+ this.args = args;
+ }
+ return ($traceurRuntime.createClass)(SafeMethodCall, {
+ eval: function(context, locals) {
+ var evaluatedReceiver = this.receiver.eval(context, locals);
+ if (isBlank(evaluatedReceiver))
+ return null;
+ var evaluatedArgs = evalList(context, locals, this.args);
+ return this.fn(evaluatedReceiver, evaluatedArgs);
+ },
+ visit: function(visitor) {
+ return visitor.visitSafeMethodCall(this);
+ }
+ }, {}, $__super);
+ }(AST));
+ $__export("SafeMethodCall", SafeMethodCall);
FunctionCall = (function($__super) {
function FunctionCall(target, args) {
$traceurRuntime.superConstructor(FunctionCall).call(this);
this.target = target;
this.args = args;
@@ -15430,30 +18345,10 @@
this.expression = expression;
}
return ($traceurRuntime.createClass)(TemplateBinding, {}, {});
}());
$__export("TemplateBinding", TemplateBinding);
- AstVisitor = (function() {
- function AstVisitor() {}
- return ($traceurRuntime.createClass)(AstVisitor, {
- visitAccessMember: function(ast) {},
- visitAssignment: function(ast) {},
- visitBinary: function(ast) {},
- visitChain: function(ast) {},
- visitConditional: function(ast) {},
- visitPipe: function(ast) {},
- visitFunctionCall: function(ast) {},
- visitImplicitReceiver: function(ast) {},
- visitKeyedAccess: function(ast) {},
- visitLiteralArray: function(ast) {},
- visitLiteralMap: function(ast) {},
- visitLiteralPrimitive: function(ast) {},
- visitMethodCall: function(ast) {},
- visitPrefixNot: function(ast) {}
- }, {});
- }());
- $__export("AstVisitor", AstVisitor);
AstTransformer = (function() {
function AstTransformer() {}
return ($traceurRuntime.createClass)(AstTransformer, {
visitImplicitReceiver: function(ast) {
return ast;
@@ -15465,13 +18360,19 @@
return new LiteralPrimitive(ast.value);
},
visitAccessMember: function(ast) {
return new AccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter);
},
+ visitSafeAccessMember: function(ast) {
+ return new SafeAccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter);
+ },
visitMethodCall: function(ast) {
return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args));
},
+ visitSafeMethodCall: function(ast) {
+ return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args));
+ },
visitFunctionCall: function(ast) {
return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args));
},
visitLiteralArray: function(ast) {
return new LiteralArray(this.visitAll(ast.expressions));
@@ -15487,26 +18388,36 @@
},
visitConditional: function(ast) {
return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));
},
visitPipe: function(ast) {
- return new Pipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args), ast.inBinding);
+ return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args));
},
visitKeyedAccess: function(ast) {
return new KeyedAccess(ast.obj.visit(this), ast.key.visit(this));
},
visitAll: function(asts) {
var res = ListWrapper.createFixedSize(asts.length);
for (var i = 0; i < asts.length; ++i) {
res[i] = asts[i].visit(this);
}
return res;
+ },
+ visitChain: function(ast) {
+ return new Chain(this.visitAll(ast.expressions));
+ },
+ visitAssignment: function(ast) {
+ return new Assignment(ast.target.visit(this), ast.value.visit(this));
+ },
+ visitIf: function(ast) {
+ var falseExp = isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null;
+ return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp);
}
}, {});
}());
$__export("AstTransformer", AstTransformer);
- _evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]];
+ _evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
}
};
});
System.register("angular2/src/di/annotations", ["angular2/src/di/annotations_impl"], function($__export) {
@@ -15523,42 +18434,45 @@
}],
execute: function() {}
};
});
-System.register("angular2/src/reflection/reflector", ["angular2/src/facade/collection", "angular2/src/reflection/types"], function($__export) {
+System.register("angular2/src/reflection/reflector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/types"], function($__export) {
"use strict";
var __moduleName = "angular2/src/reflection/reflector";
- var MapWrapper,
+ var isPresent,
+ Map,
StringMapWrapper,
Reflector;
function _mergeMaps(target, config) {
StringMapWrapper.forEach(config, (function(v, k) {
- return MapWrapper.set(target, k, v);
+ return target.set(k, v);
}));
}
return {
setters: [function($__m) {
- MapWrapper = $__m.MapWrapper;
+ isPresent = $__m.isPresent;
+ }, function($__m) {
+ Map = $__m.Map;
StringMapWrapper = $__m.StringMapWrapper;
}, function($__m) {
$__export("SetterFn", $__m.SetterFn);
$__export("GetterFn", $__m.GetterFn);
$__export("MethodFn", $__m.MethodFn);
}],
execute: function() {
Reflector = (function() {
function Reflector(reflectionCapabilities) {
- this._typeInfo = MapWrapper.create();
- this._getters = MapWrapper.create();
- this._setters = MapWrapper.create();
- this._methods = MapWrapper.create();
+ this._typeInfo = new Map();
+ this._getters = new Map();
+ this._setters = new Map();
+ this._methods = new Map();
this.reflectionCapabilities = reflectionCapabilities;
}
return ($traceurRuntime.createClass)(Reflector, {
registerType: function(type, typeInfo) {
- MapWrapper.set(this._typeInfo, type, typeInfo);
+ this._typeInfo.set(type, typeInfo);
},
registerGetters: function(getters) {
_mergeMaps(this._getters, getters);
},
registerSetters: function(setters) {
@@ -15566,50 +18480,64 @@
},
registerMethods: function(methods) {
_mergeMaps(this._methods, methods);
},
factory: function(type) {
- if (MapWrapper.contains(this._typeInfo, type)) {
- return MapWrapper.get(this._typeInfo, type)["factory"];
+ if (this._containsTypeInfo(type)) {
+ return this._getTypeInfoField(type, "factory", null);
} else {
return this.reflectionCapabilities.factory(type);
}
},
- parameters: function(typeOfFunc) {
- if (MapWrapper.contains(this._typeInfo, typeOfFunc)) {
- return MapWrapper.get(this._typeInfo, typeOfFunc)["parameters"];
+ parameters: function(typeOrFunc) {
+ if (this._typeInfo.has(typeOrFunc)) {
+ return this._getTypeInfoField(typeOrFunc, "parameters", []);
} else {
- return this.reflectionCapabilities.parameters(typeOfFunc);
+ return this.reflectionCapabilities.parameters(typeOrFunc);
}
},
- annotations: function(typeOfFunc) {
- if (MapWrapper.contains(this._typeInfo, typeOfFunc)) {
- return MapWrapper.get(this._typeInfo, typeOfFunc)["annotations"];
+ annotations: function(typeOrFunc) {
+ if (this._typeInfo.has(typeOrFunc)) {
+ return this._getTypeInfoField(typeOrFunc, "annotations", []);
} else {
- return this.reflectionCapabilities.annotations(typeOfFunc);
+ return this.reflectionCapabilities.annotations(typeOrFunc);
}
},
+ interfaces: function(type) {
+ if (this._typeInfo.has(type)) {
+ return this._getTypeInfoField(type, "interfaces", []);
+ } else {
+ return this.reflectionCapabilities.interfaces(type);
+ }
+ },
getter: function(name) {
- if (MapWrapper.contains(this._getters, name)) {
- return MapWrapper.get(this._getters, name);
+ if (this._getters.has(name)) {
+ return this._getters.get(name);
} else {
return this.reflectionCapabilities.getter(name);
}
},
setter: function(name) {
- if (MapWrapper.contains(this._setters, name)) {
- return MapWrapper.get(this._setters, name);
+ if (this._setters.has(name)) {
+ return this._setters.get(name);
} else {
return this.reflectionCapabilities.setter(name);
}
},
method: function(name) {
- if (MapWrapper.contains(this._methods, name)) {
- return MapWrapper.get(this._methods, name);
+ if (this._methods.has(name)) {
+ return this._methods.get(name);
} else {
return this.reflectionCapabilities.method(name);
}
+ },
+ _getTypeInfoField: function(typeOrFunc, key, defaultValue) {
+ var res = this._typeInfo.get(typeOrFunc)[key];
+ return isPresent(res) ? res : defaultValue;
+ },
+ _containsTypeInfo: function(typeOrFunc) {
+ return this._typeInfo.has(typeOrFunc);
}
}, {});
}());
$__export("Reflector", Reflector);
}
@@ -15620,10 +18548,11 @@
"use strict";
var __moduleName = "angular2/src/change_detection/change_detection_util";
var isBlank,
BaseException,
StringMapWrapper,
+ DehydratedException,
ExpressionChangedAfterItHasBeenChecked,
WrappedValue,
CHECK_ALWAYS,
CHECK_ONCE,
ON_PUSH,
@@ -15644,10 +18573,11 @@
isBlank = $__m.isBlank;
BaseException = $__m.BaseException;
}, function($__m) {
StringMapWrapper = $__m.StringMapWrapper;
}, function($__m) {
+ DehydratedException = $__m.DehydratedException;
ExpressionChangedAfterItHasBeenChecked = $__m.ExpressionChangedAfterItHasBeenChecked;
}, function($__m) {
WrappedValue = $__m.WrappedValue;
}, function($__m) {
CHECK_ALWAYS = $__m.CHECK_ALWAYS;
@@ -15818,10 +18748,13 @@
}
},
throwOnChange: function(proto, change) {
throw new ExpressionChangedAfterItHasBeenChecked(proto, change);
},
+ throwDehydrated: function() {
+ throw new DehydratedException();
+ },
changeDetectionMode: function(strategy) {
return strategy == ON_PUSH ? CHECK_ONCE : CHECK_ALWAYS;
},
simpleChange: function(previousValue, currentValue) {
return _simpleChange(previousValue, currentValue);
@@ -15830,25 +18763,27 @@
if (isBlank(changes)) {
changes = {};
}
changes[propertyName] = change;
return changes;
+ },
+ isValueBlank: function(value) {
+ return isBlank(value);
}
});
}());
$__export("ChangeDetectionUtil", ChangeDetectionUtil);
}
};
});
-System.register("angular2/src/change_detection/abstract_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/interfaces", "angular2/src/change_detection/constants"], function($__export) {
+System.register("angular2/src/change_detection/abstract_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/constants"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/abstract_change_detector";
var isPresent,
ListWrapper,
ChangeDetectorRef,
- ChangeDetector,
CHECK_ONCE,
CHECKED,
DETACHED,
AbstractChangeDetector;
return {
@@ -15857,35 +18792,33 @@
}, function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
ChangeDetectorRef = $__m.ChangeDetectorRef;
}, function($__m) {
- ChangeDetector = $__m.ChangeDetector;
- }, function($__m) {
CHECK_ONCE = $__m.CHECK_ONCE;
CHECKED = $__m.CHECKED;
DETACHED = $__m.DETACHED;
}],
execute: function() {
- AbstractChangeDetector = (function($__super) {
- function AbstractChangeDetector() {
- $traceurRuntime.superConstructor(AbstractChangeDetector).call(this);
+ AbstractChangeDetector = (function() {
+ function AbstractChangeDetector(id) {
+ this.id = id;
this.lightDomChildren = [];
this.shadowDomChildren = [];
- this.ref = new ChangeDetectorRef(this);
this.mode = null;
+ this.ref = new ChangeDetectorRef(this);
}
return ($traceurRuntime.createClass)(AbstractChangeDetector, {
addChild: function(cd) {
- ListWrapper.push(this.lightDomChildren, cd);
+ this.lightDomChildren.push(cd);
cd.parent = this;
},
removeChild: function(cd) {
ListWrapper.remove(this.lightDomChildren, cd);
},
addShadowDomChild: function(cd) {
- ListWrapper.push(this.shadowDomChildren, cd);
+ this.shadowDomChildren.push(cd);
cd.parent = this;
},
removeShadowDomChild: function(cd) {
ListWrapper.remove(this.shadowDomChildren, cd);
},
@@ -15908,10 +18841,12 @@
this._detectChangesInShadowDomChildren(throwOnChange);
if (this.mode === CHECK_ONCE)
this.mode = CHECKED;
},
detectChangesInRecords: function(throwOnChange) {},
+ hydrate: function(context, locals, directives) {},
+ dehydrate: function() {},
callOnAllChangesDone: function() {},
_detectChangesInLightDomChildren: function(throwOnChange) {
var c = this.lightDomChildren;
for (var i = 0; i < c.length; ++i) {
c[i]._detectChanges(throwOnChange);
@@ -15932,17 +18867,63 @@
if (c.mode === CHECKED)
c.mode = CHECK_ONCE;
c = c.parent;
}
}
- }, {}, $__super);
- }(ChangeDetector));
+ }, {});
+ }());
$__export("AbstractChangeDetector", AbstractChangeDetector);
}
};
});
+System.register("angular2/src/change_detection/jit_proto_change_detector", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection_jit_generator", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_change_detector"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/change_detection/jit_proto_change_detector";
+ var ListWrapper,
+ ChangeDetectorJITGenerator,
+ coalesce,
+ ProtoRecordBuilder,
+ JitProtoChangeDetector;
+ return {
+ setters: [function($__m) {
+ ListWrapper = $__m.ListWrapper;
+ }, function($__m) {
+ ChangeDetectorJITGenerator = $__m.ChangeDetectorJITGenerator;
+ }, function($__m) {
+ coalesce = $__m.coalesce;
+ }, function($__m) {
+ ProtoRecordBuilder = $__m.ProtoRecordBuilder;
+ }],
+ execute: function() {
+ JitProtoChangeDetector = (function() {
+ function JitProtoChangeDetector(_pipeRegistry, definition) {
+ this._pipeRegistry = _pipeRegistry;
+ this.definition = definition;
+ this._factory = this._createFactory(definition);
+ }
+ return ($traceurRuntime.createClass)(JitProtoChangeDetector, {
+ instantiate: function(dispatcher) {
+ return this._factory(dispatcher, this._pipeRegistry);
+ },
+ _createFactory: function(definition) {
+ var recordBuilder = new ProtoRecordBuilder();
+ ListWrapper.forEach(definition.bindingRecords, (function(b) {
+ recordBuilder.add(b, definition.variableNames);
+ }));
+ var records = coalesce(recordBuilder.records);
+ return new ChangeDetectorJITGenerator(definition.id, definition.strategy, records, this.definition.directiveRecords).generate();
+ }
+ }, {isSupported: function() {
+ return true;
+ }});
+ }());
+ $__export("JitProtoChangeDetector", JitProtoChangeDetector);
+ }
+ };
+});
+
System.register("angular2/src/facade/async", ["angular2/src/facade/lang", "rx"], function($__export) {
"use strict";
var __moduleName = "angular2/src/facade/async";
var global,
Rx,
@@ -15991,13 +18972,10 @@
return {
promise: p,
resolve: resolve,
reject: reject
};
- },
- isPromise: function(maybePromise) {
- return maybePromise instanceof Promise;
}
});
}());
$__export("PromiseWrapper", PromiseWrapper);
TimerWrapper = (function() {
@@ -16095,35 +19073,10 @@
$__export("EventEmitter", EventEmitter);
}
};
});
-System.register("angular2/src/core/annotations/visibility", ["angular2/src/core/annotations_impl/visibility"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/core/annotations/visibility";
- return {
- setters: [function($__m) {
- $__export("SelfAnnotation", $__m.Self);
- $__export("AncestorAnnotation", $__m.Ancestor);
- $__export("ParentAnnotation", $__m.Parent);
- $__export("UnboundedAnnotation", $__m.Unbounded);
- }],
- execute: function() {}
- };
-});
-
-System.register("angular2/src/core/annotations/view", ["angular2/src/core/annotations_impl/view"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/core/annotations/view";
- return {
- setters: [function($__m) {
- $__export("ViewAnnotation", $__m.View);
- }],
- execute: function() {}
- };
-});
-
System.register("angular2/src/di/key", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/di/type_literal", "angular2/src/di/forward_ref"], function($__export) {
"use strict";
var __moduleName = "angular2/src/di/key";
var MapWrapper,
stringify,
@@ -16148,15 +19101,15 @@
resolveForwardRef = $__m.resolveForwardRef;
}],
execute: function() {
Key = (function() {
function Key(token, id) {
+ this.token = token;
+ this.id = id;
if (isBlank(token)) {
throw new BaseException('Token must be defined!');
}
- this.token = token;
- this.id = id;
}
return ($traceurRuntime.createClass)(Key, {get displayName() {
return stringify(this.token);
}}, {
get: function(token) {
@@ -16168,26 +19121,26 @@
});
}());
$__export("Key", Key);
KeyRegistry = (function() {
function KeyRegistry() {
- this._allKeys = MapWrapper.create();
+ this._allKeys = new Map();
}
return ($traceurRuntime.createClass)(KeyRegistry, {
get: function(token) {
if (token instanceof Key)
return token;
var theToken = token;
if (token instanceof TypeLiteral) {
theToken = token.type;
}
token = theToken;
- if (MapWrapper.contains(this._allKeys, token)) {
- return MapWrapper.get(this._allKeys, token);
+ if (this._allKeys.has(token)) {
+ return this._allKeys.get(token);
}
var newKey = new Key(token, Key.numberOfKeys);
- MapWrapper.set(this._allKeys, token, newKey);
+ this._allKeys.set(token, newKey);
return newKey;
},
get numberOfKeys() {
return MapWrapper.size(this._allKeys);
}
@@ -16197,17 +19150,42 @@
_globalKeyRegistry = new KeyRegistry();
}
};
});
+System.register("angular2/src/core/annotations/visibility", ["angular2/src/core/annotations_impl/visibility"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/core/annotations/visibility";
+ return {
+ setters: [function($__m) {
+ $__export("SelfAnnotation", $__m.Self);
+ $__export("AncestorAnnotation", $__m.Ancestor);
+ $__export("ParentAnnotation", $__m.Parent);
+ $__export("UnboundedAnnotation", $__m.Unbounded);
+ }],
+ execute: function() {}
+ };
+});
+
+System.register("angular2/src/core/annotations/view", ["angular2/src/core/annotations_impl/view"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/core/annotations/view";
+ return {
+ setters: [function($__m) {
+ $__export("ViewAnnotation", $__m.View);
+ }],
+ execute: function() {}
+ };
+});
+
System.register("angular2/src/dom/browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/dom/generic_browser_adapter"], function($__export) {
"use strict";
var __moduleName = "angular2/src/dom/browser_adapter";
- var MapWrapper,
- ListWrapper,
+ var ListWrapper,
isBlank,
isPresent,
+ global,
setRootDomAdapter,
GenericBrowserDomAdapter,
_attrToPropMap,
DOM_KEY_LOCATION_NUMPAD,
_keyMap,
@@ -16221,15 +19199,15 @@
urlParsingNode.setAttribute('href', url);
return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname;
}
return {
setters: [function($__m) {
- MapWrapper = $__m.MapWrapper;
ListWrapper = $__m.ListWrapper;
}, function($__m) {
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
+ global = $__m.global;
}, function($__m) {
setRootDomAdapter = $__m.setRootDomAdapter;
}, function($__m) {
GenericBrowserDomAdapter = $__m.GenericBrowserDomAdapter;
}],
@@ -16276,10 +19254,22 @@
BrowserDomAdapter = (function($__super) {
function BrowserDomAdapter() {
$traceurRuntime.superConstructor(BrowserDomAdapter).apply(this, arguments);
}
return ($traceurRuntime.createClass)(BrowserDomAdapter, {
+ hasProperty: function(element, name) {
+ return name in element;
+ },
+ setProperty: function(el, name, value) {
+ el[name] = value;
+ },
+ getProperty: function(el, name) {
+ return el[name];
+ },
+ invoke: function(el, methodName, args) {
+ el[methodName].apply(el, args);
+ },
logError: function(error) {
window.console.error(error);
},
get attrToPropMap() {
return _attrToPropMap;
@@ -16304,17 +19294,23 @@
},
dispatchEvent: function(el, evt) {
el.dispatchEvent(evt);
},
createMouseEvent: function(eventType) {
- var evt = new MouseEvent(eventType);
+ var evt = document.createEvent('MouseEvent');
evt.initEvent(eventType, true, true);
return evt;
},
createEvent: function(eventType) {
- return new Event(eventType, true);
+ var evt = document.createEvent('Event');
+ evt.initEvent(eventType, true, true);
+ return evt;
},
+ preventDefault: function(evt) {
+ evt.preventDefault();
+ evt.returnValue = false;
+ },
getInnerHTML: function(el) {
return el.innerHTML;
},
getOuterHTML: function(el) {
return el.outerHTML;
@@ -16425,12 +19421,12 @@
el.setAttribute(attrName, attrValue);
return el;
},
createStyleElement: function(css) {
var doc = arguments[1] !== (void 0) ? arguments[1] : document;
- var style = doc.createElement('STYLE');
- style.innerText = css;
+ var style = doc.createElement('style');
+ this.appendChild(style, this.createTextNode(css));
return style;
},
createShadowRoot: function(el) {
return el.createShadowRoot();
},
@@ -16441,13 +19437,10 @@
return el.host;
},
clone: function(node) {
return node.cloneNode(true);
},
- hasProperty: function(element, name) {
- return name in element;
- },
getElementsByClassName: function(element, name) {
return element.getElementsByClassName(name);
},
getElementsByTagName: function(element, name) {
return element.getElementsByTagName(name);
@@ -16475,15 +19468,15 @@
},
tagName: function(element) {
return element.tagName;
},
attributeMap: function(element) {
- var res = MapWrapper.create();
+ var res = new Map();
var elAttrs = element.attributes;
for (var i = 0; i < elAttrs.length; i++) {
var attrib = elAttrs[i];
- MapWrapper.set(res, attrib.name, attrib.value);
+ res.set(attrib.name, attrib.value);
}
return res;
},
hasAttribute: function(element, attribute) {
return element.hasAttribute(attribute);
@@ -16505,20 +19498,31 @@
},
defaultDoc: function() {
return document;
},
getBoundingClientRect: function(el) {
- return el.getBoundingClientRect();
+ try {
+ return el.getBoundingClientRect();
+ } catch (e) {
+ return {
+ top: 0,
+ bottom: 0,
+ left: 0,
+ right: 0,
+ width: 0,
+ height: 0
+ };
+ }
},
getTitle: function() {
return document.title;
},
setTitle: function(newTitle) {
- document.title = newTitle;
+ document.title = newTitle || '';
},
elementMatches: function(n, selector) {
- return n instanceof HTMLElement && n.matches(selector);
+ return n instanceof HTMLElement && n.matches ? n.matches(selector) : n.msMatchesSelector(selector);
},
isTemplateElement: function(el) {
return el instanceof HTMLElement && el.nodeName == "TEMPLATE";
},
isTextNode: function(node) {
@@ -16592,10 +19596,22 @@
getLocation: function() {
return window.location;
},
getBaseHref: function() {
return relativePath(document.baseURI);
+ },
+ getUserAgent: function() {
+ return window.navigator.userAgent;
+ },
+ setData: function(element, name, value) {
+ element.dataset[name] = value;
+ },
+ getData: function(element, name) {
+ return element.dataset[name];
+ },
+ setGlobalVar: function(name, value) {
+ global[name] = value;
}
}, {makeCurrent: function() {
setRootDomAdapter(new BrowserDomAdapter());
}}, $__super);
}(GenericBrowserDomAdapter));
@@ -16670,37 +19686,45 @@
$__export("DirectiveResolver", DirectiveResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver));
}
};
});
-System.register("angular2/src/core/compiler/view", ["angular2/src/facade/collection", "angular2/change_detection", "angular2/src/core/compiler/element_binder", "angular2/src/facade/lang"], function($__export) {
+System.register("angular2/src/core/compiler/view", ["angular2/src/facade/collection", "angular2/change_detection", "angular2/src/core/compiler/element_binder", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/view";
var ListWrapper,
MapWrapper,
+ Map,
StringMapWrapper,
Locals,
ElementBinder,
isPresent,
isBlank,
BaseException,
+ ViewRef,
+ ElementRef,
AppViewContainer,
AppView,
AppProtoView;
return {
setters: [function($__m) {
ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
StringMapWrapper = $__m.StringMapWrapper;
}, function($__m) {
Locals = $__m.Locals;
}, function($__m) {
ElementBinder = $__m.ElementBinder;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
BaseException = $__m.BaseException;
+ }, function($__m) {
+ ViewRef = $__m.ViewRef;
+ }, function($__m) {
+ ElementRef = $__m.ElementRef;
}],
execute: function() {
AppViewContainer = (function() {
function AppViewContainer() {
this.views = [];
@@ -16711,19 +19735,22 @@
AppView = (function() {
function AppView(renderer, proto, protoLocals) {
this.renderer = renderer;
this.proto = proto;
this.render = null;
- this.changeDetector = null;
this.elementInjectors = null;
- this.rootElementInjectors = null;
+ this.changeDetector = null;
this.componentChildViews = null;
- this.viewContainers = ListWrapper.createFixedSize(this.proto.elementBinders.length);
this.preBuiltObjects = null;
this.context = null;
+ this.viewContainers = ListWrapper.createFixedSize(this.proto.elementBinders.length);
+ this.elementRefs = ListWrapper.createFixedSize(this.proto.elementBinders.length);
+ this.ref = new ViewRef(this);
+ for (var i = 0; i < this.elementRefs.length; i++) {
+ this.elementRefs[i] = new ElementRef(this.ref, i, renderer);
+ }
this.locals = new Locals(null, MapWrapper.clone(protoLocals));
- this.freeHostViews = [];
}
return ($traceurRuntime.createClass)(AppView, {
init: function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, componentChildViews) {
this.changeDetector = changeDetector;
this.elementInjectors = elementInjectors;
@@ -16732,41 +19759,57 @@
this.componentChildViews = componentChildViews;
},
setLocal: function(contextName, value) {
if (!this.hydrated())
throw new BaseException('Cannot set locals on dehydrated view.');
- if (!MapWrapper.contains(this.proto.variableBindings, contextName)) {
+ if (!this.proto.variableBindings.has(contextName)) {
return ;
}
- var templateName = MapWrapper.get(this.proto.variableBindings, contextName);
+ var templateName = this.proto.variableBindings.get(contextName);
this.locals.set(templateName, value);
},
hydrated: function() {
return isPresent(this.context);
},
triggerEventHandlers: function(eventName, eventObj, binderIndex) {
- var locals = MapWrapper.create();
- MapWrapper.set(locals, '$event', eventObj);
+ var locals = new Map();
+ locals.set('$event', eventObj);
this.dispatchEvent(binderIndex, eventName, locals);
},
notifyOnBinding: function(b, currentValue) {
- if (b.isElement()) {
- this.renderer.setElementProperty(this.render, b.elementIndex, b.propertyName, currentValue);
- } else {
+ if (b.isElementProperty()) {
+ this.renderer.setElementProperty(this.elementRefs[b.elementIndex], b.propertyName, currentValue);
+ } else if (b.isElementAttribute()) {
+ this.renderer.setElementAttribute(this.elementRefs[b.elementIndex], b.propertyName, currentValue);
+ } else if (b.isElementClass()) {
+ this.renderer.setElementClass(this.elementRefs[b.elementIndex], b.propertyName, currentValue);
+ } else if (b.isElementStyle()) {
+ var unit = isPresent(b.propertyUnit) ? b.propertyUnit : '';
+ this.renderer.setElementStyle(this.elementRefs[b.elementIndex], b.propertyName, ("" + currentValue + unit));
+ } else if (b.isTextNode()) {
this.renderer.setText(this.render, b.elementIndex, currentValue);
+ } else {
+ throw new BaseException('Unsupported directive record');
}
},
+ notifyOnAllChangesDone: function() {
+ var ei = this.elementInjectors;
+ for (var i = ei.length - 1; i >= 0; i--) {
+ if (isPresent(ei[i]))
+ ei[i].onAllChangesDone();
+ }
+ },
getDirectiveFor: function(directive) {
var elementInjector = this.elementInjectors[directive.elementIndex];
return elementInjector.getDirectiveAtIndex(directive.directiveIndex);
},
getDetectorFor: function(directive) {
var childView = this.componentChildViews[directive.elementIndex];
return isPresent(childView) ? childView.changeDetector : null;
},
- callAction: function(elementIndex, actionExpression, action) {
- this.renderer.callAction(this.render, elementIndex, actionExpression, action);
+ invokeElementMethod: function(elementIndex, methodName, args) {
+ this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args);
},
dispatchEvent: function(elementIndex, eventName, locals) {
var $__0 = this;
var allowDefaultBehavior = true;
if (this.hydrated()) {
@@ -16793,28 +19836,29 @@
}
}, {});
}());
$__export("AppView", AppView);
AppProtoView = (function() {
- function AppProtoView(render, protoChangeDetector, variableBindings) {
+ function AppProtoView(render, protoChangeDetector, variableBindings, variableLocations) {
var $__0 = this;
this.render = render;
this.protoChangeDetector = protoChangeDetector;
this.variableBindings = variableBindings;
+ this.variableLocations = variableLocations;
this.elementBinders = [];
- this.protoLocals = MapWrapper.create();
+ this.protoLocals = new Map();
if (isPresent(variableBindings)) {
MapWrapper.forEach(variableBindings, (function(templateName, _) {
- MapWrapper.set($__0.protoLocals, templateName, null);
+ $__0.protoLocals.set(templateName, null);
}));
}
}
return ($traceurRuntime.createClass)(AppProtoView, {
bindElement: function(parent, distanceToParent, protoElementInjector) {
var componentDirective = arguments[3] !== (void 0) ? arguments[3] : null;
var elBinder = new ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective);
- ListWrapper.push(this.elementBinders, elBinder);
+ this.elementBinders.push(elBinder);
return elBinder;
},
bindEvent: function(eventBindings, boundElementIndex) {
var directiveIndex = arguments[2] !== (void 0) ? arguments[2] : -1;
var elBinder = this.elementBinders[boundElementIndex];
@@ -16826,58 +19870,23 @@
for (var i = 0; i < eventBindings.length; i++) {
var eventBinding = eventBindings[i];
var eventName = eventBinding.fullName;
var event = StringMapWrapper.get(events, eventName);
if (isBlank(event)) {
- event = MapWrapper.create();
+ event = new Map();
StringMapWrapper.set(events, eventName, event);
}
- MapWrapper.set(event, directiveIndex, eventBinding.source);
+ event.set(directiveIndex, eventBinding.source);
}
}
}, {});
}());
$__export("AppProtoView", AppProtoView);
}
};
});
-System.register("angular2/src/core/compiler/element_ref", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/render/dom/view/view"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/core/compiler/element_ref";
- var DOM,
- normalizeBlank,
- resolveInternalDomView,
- ElementRef;
- return {
- setters: [function($__m) {
- DOM = $__m.DOM;
- }, function($__m) {
- normalizeBlank = $__m.normalizeBlank;
- }, function($__m) {
- resolveInternalDomView = $__m.resolveInternalDomView;
- }],
- execute: function() {
- ElementRef = (function() {
- function ElementRef(parentView, boundElementIndex) {
- this.parentView = parentView;
- this.boundElementIndex = boundElementIndex;
- }
- return ($traceurRuntime.createClass)(ElementRef, {
- get domElement() {
- return resolveInternalDomView(this.parentView.render).boundElements[this.boundElementIndex];
- },
- getAttribute: function(name) {
- return normalizeBlank(DOM.getAttribute(this.domElement, name));
- }
- }, {});
- }());
- $__export("ElementRef", ElementRef);
- }
- };
-});
-
System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/compiler/base_query_list"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/query_list";
var BaseQueryList,
QueryList;
@@ -16902,42 +19911,65 @@
$__export("QueryList", QueryList);
}
};
});
-System.register("angular2/src/render/dom/compiler/template_loader", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/dom/dom_adapter", "angular2/src/services/xhr", "angular2/src/services/url_resolver"], function($__export) {
+System.register("angular2/src/render/dom/compiler/style_inliner", ["angular2/di", "angular2/src/render/xhr", "angular2/src/facade/collection", "angular2/src/services/url_resolver", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) {
"use strict";
- var __moduleName = "angular2/src/render/dom/compiler/template_loader";
+ var __moduleName = "angular2/src/render/dom/compiler/style_inliner";
var __decorate,
__metadata,
Injectable,
+ XHR,
+ ListWrapper,
+ UrlResolver,
+ StyleUrlResolver,
isBlank,
isPresent,
- BaseException,
- StringMapWrapper,
+ RegExpWrapper,
+ StringWrapper,
+ isPromise,
PromiseWrapper,
- DOM,
- XHR,
- UrlResolver,
- TemplateLoader;
+ StyleInliner,
+ _importRe,
+ _urlRe,
+ _mediaQueryRe;
+ function _extractUrl(importRule) {
+ var match = RegExpWrapper.firstMatch(_urlRe, importRule);
+ if (isBlank(match))
+ return null;
+ return isPresent(match[1]) ? match[1] : match[2];
+ }
+ function _extractMediaQuery(importRule) {
+ var match = RegExpWrapper.firstMatch(_mediaQueryRe, importRule);
+ if (isBlank(match))
+ return null;
+ var mediaQuery = match[1].trim();
+ return (mediaQuery.length > 0) ? mediaQuery : null;
+ }
+ function _wrapInMediaRule(css, query) {
+ return (isBlank(query)) ? css : ("@media " + query + " {\n" + css + "\n}");
+ }
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
- isBlank = $__m.isBlank;
- isPresent = $__m.isPresent;
- BaseException = $__m.BaseException;
+ XHR = $__m.XHR;
}, function($__m) {
- StringMapWrapper = $__m.StringMapWrapper;
+ ListWrapper = $__m.ListWrapper;
}, function($__m) {
- PromiseWrapper = $__m.PromiseWrapper;
+ UrlResolver = $__m.UrlResolver;
}, function($__m) {
- DOM = $__m.DOM;
+ StyleUrlResolver = $__m.StyleUrlResolver;
}, function($__m) {
- XHR = $__m.XHR;
+ isBlank = $__m.isBlank;
+ isPresent = $__m.isPresent;
+ RegExpWrapper = $__m.RegExpWrapper;
+ StringWrapper = $__m.StringWrapper;
+ isPromise = $__m.isPromise;
}, function($__m) {
- UrlResolver = $__m.UrlResolver;
+ PromiseWrapper = $__m.PromiseWrapper;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -16958,62 +19990,102 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- TemplateLoader = (($traceurRuntime.createClass)(function(xhr, urlResolver) {
- this._xhr = xhr;
- this._htmlCache = StringMapWrapper.create();
- }, {load: function(template) {
- if (isPresent(template.template)) {
- return PromiseWrapper.resolve(DOM.createTemplate(template.template));
+ StyleInliner = (($traceurRuntime.createClass)(function(_xhr, _styleUrlResolver, _urlResolver) {
+ this._xhr = _xhr;
+ this._styleUrlResolver = _styleUrlResolver;
+ this._urlResolver = _urlResolver;
+ }, {
+ inlineImports: function(cssText, baseUrl) {
+ return this._inlineImports(cssText, baseUrl, []);
+ },
+ _inlineImports: function(cssText, baseUrl, inlinedUrls) {
+ var $__0 = this;
+ var partIndex = 0;
+ var parts = StringWrapper.split(cssText, _importRe);
+ if (parts.length === 1) {
+ return cssText;
}
- var url = template.absUrl;
- if (isPresent(url)) {
- var promise = StringMapWrapper.get(this._htmlCache, url);
- if (isBlank(promise)) {
- promise = this._xhr.get(url).then(function(html) {
- var template = DOM.createTemplate(html);
- return template;
- });
- StringMapWrapper.set(this._htmlCache, url, promise);
+ var promises = [];
+ while (partIndex < parts.length - 1) {
+ var prefix = parts[partIndex];
+ var rule = parts[partIndex + 1];
+ var url = _extractUrl(rule);
+ if (isPresent(url)) {
+ url = this._urlResolver.resolve(baseUrl, url);
}
- return promise.then((function(tplElement) {
- return DOM.clone(tplElement);
- }));
+ var mediaQuery = _extractMediaQuery(rule);
+ var promise = void 0;
+ if (isBlank(url)) {
+ promise = PromiseWrapper.resolve(("/* Invalid import rule: \"@import " + rule + ";\" */"));
+ } else if (ListWrapper.contains(inlinedUrls, url)) {
+ promise = PromiseWrapper.resolve(prefix);
+ } else {
+ inlinedUrls.push(url);
+ promise = PromiseWrapper.then(this._xhr.get(url), (function(rawCss) {
+ var inlinedCss = $__0._inlineImports(rawCss, url, inlinedUrls);
+ if (isPromise(inlinedCss)) {
+ return inlinedCss.then((function(css) {
+ return prefix + $__0._transformImportedCss(css, mediaQuery, url) + '\n';
+ }));
+ } else {
+ return prefix + $__0._transformImportedCss(inlinedCss, mediaQuery, url) + '\n';
+ }
+ }), (function(error) {
+ return ("/* failed to import " + url + " */\n");
+ }));
+ }
+ promises.push(promise);
+ partIndex += 2;
}
- throw new BaseException('View should have either the url or template property set');
- }}, {}));
- $__export("TemplateLoader", TemplateLoader);
- $__export("TemplateLoader", TemplateLoader = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, UrlResolver])], TemplateLoader));
+ return PromiseWrapper.all(promises).then(function(cssParts) {
+ var cssText = cssParts.join('');
+ if (partIndex < parts.length) {
+ cssText += parts[partIndex];
+ }
+ return cssText;
+ });
+ },
+ _transformImportedCss: function(css, mediaQuery, url) {
+ css = this._styleUrlResolver.resolveUrls(css, url);
+ return _wrapInMediaRule(css, mediaQuery);
+ }
+ }, {}));
+ $__export("StyleInliner", StyleInliner);
+ $__export("StyleInliner", StyleInliner = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleUrlResolver, UrlResolver])], StyleInliner));
+ _importRe = RegExpWrapper.create('@import\\s+([^;]+);');
+ _urlRe = RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]');
+ _mediaQueryRe = RegExpWrapper.create('[\'"][^\'"]+[\'"]\\s*\\)?\\s*(.*)');
}
};
});
System.register("angular2/src/render/dom/shadow_dom/util", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/shadow_dom/shadow_css"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/shadow_dom/util";
var isBlank,
isPresent,
- MapWrapper,
+ Map,
DOM,
ShadowCss,
_componentUIDs,
_nextComponentUID,
_sharedStyleTexts,
_lastInsertedStyleEl;
function getComponentId(componentStringId) {
- var id = MapWrapper.get(_componentUIDs, componentStringId);
+ var id = _componentUIDs.get(componentStringId);
if (isBlank(id)) {
id = _nextComponentUID++;
- MapWrapper.set(_componentUIDs, componentStringId, id);
+ _componentUIDs.set(componentStringId, id);
}
return id;
}
function insertSharedStyleText(cssText, styleHost, styleEl) {
- if (!MapWrapper.contains(_sharedStyleTexts, cssText)) {
- MapWrapper.set(_sharedStyleTexts, cssText, true);
+ if (!_sharedStyleTexts.has(cssText)) {
+ _sharedStyleTexts.set(cssText, true);
insertStyleElement(styleHost, styleEl);
}
}
function insertStyleElement(host, styleEl) {
if (isBlank(_lastInsertedStyleEl)) {
@@ -17038,13 +20110,13 @@
var id = getComponentId(componentId);
var shadowCss = new ShadowCss();
return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id));
}
function resetShadowDomCache() {
- MapWrapper.clear(_componentUIDs);
+ _componentUIDs.clear();
_nextComponentUID = 0;
- MapWrapper.clear(_sharedStyleTexts);
+ _sharedStyleTexts.clear();
_lastInsertedStyleEl = null;
}
$__export("getComponentId", getComponentId);
$__export("insertSharedStyleText", insertSharedStyleText);
$__export("insertStyleElement", insertStyleElement);
@@ -17055,20 +20127,20 @@
return {
setters: [function($__m) {
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
}, function($__m) {
- MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
}, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
ShadowCss = $__m.ShadowCss;
}],
execute: function() {
- _componentUIDs = MapWrapper.create();
+ _componentUIDs = new Map();
_nextComponentUID = 0;
- _sharedStyleTexts = MapWrapper.create();
+ _sharedStyleTexts = new Map();
}
};
});
System.register("angular2/src/render/dom/events/hammer_gestures", ["angular2/src/render/dom/events/hammer_common", "angular2/src/facade/lang"], function($__export) {
@@ -17127,11 +20199,11 @@
var __moduleName = "angular2/src/core/testability/testability";
var __decorate,
__metadata,
Injectable,
DOM,
- MapWrapper,
+ Map,
ListWrapper,
BaseException,
getTestabilityModule,
Testability,
TestabilityRegistry;
@@ -17139,11 +20211,11 @@
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
- MapWrapper = $__m.MapWrapper;
+ Map = $__m.Map;
ListWrapper = $__m.ListWrapper;
}, function($__m) {
BaseException = $__m.BaseException;
}, function($__m) {
getTestabilityModule = $__m;
@@ -17171,11 +20243,11 @@
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
Testability = (($traceurRuntime.createClass)(function() {
this._pendingCount = 0;
- this._callbacks = ListWrapper.create();
+ this._callbacks = [];
}, {
increaseCount: function() {
var delta = arguments[0] !== (void 0) ? arguments[0] : 1;
this._pendingCount += delta;
if (this._pendingCount < 0) {
@@ -17189,11 +20261,11 @@
while (this._callbacks.length !== 0) {
ListWrapper.removeLast(this._callbacks)();
}
},
whenStable: function(callback) {
- ListWrapper.push(this._callbacks, callback);
+ this._callbacks.push(callback);
if (this._pendingCount === 0) {
this._runCallbacks();
}
},
getPendingCount: function() {
@@ -17204,22 +20276,22 @@
}
}, {}));
$__export("Testability", Testability);
$__export("Testability", Testability = __decorate([Injectable(), __metadata('design:paramtypes', [])], Testability));
TestabilityRegistry = (($traceurRuntime.createClass)(function() {
- this._applications = MapWrapper.create();
+ this._applications = new Map();
getTestabilityModule.GetTestability.addToWindow(this);
}, {
registerApplication: function(token, testability) {
- MapWrapper.set(this._applications, token, testability);
+ this._applications.set(token, testability);
},
findTestabilityInTree: function(elem) {
if (elem == null) {
return null;
}
- if (MapWrapper.contains(this._applications, elem)) {
- return MapWrapper.get(this._applications, elem);
+ if (this._applications.has(elem)) {
+ return this._applications.get(elem);
}
if (DOM.isShadowRoot(elem)) {
return this.findTestabilityInTree(DOM.getHost(elem));
}
return this.findTestabilityInTree(DOM.parentElement(elem));
@@ -17254,42 +20326,51 @@
}, function($__m) {
RenderProtoViewRef = $__m.RenderProtoViewRef;
}],
execute: function() {
DomProtoViewRef = (function($__super) {
- function DomProtoViewRef(protoView) {
+ function DomProtoViewRef(_protoView) {
$traceurRuntime.superConstructor(DomProtoViewRef).call(this);
- this._protoView = protoView;
+ this._protoView = _protoView;
}
return ($traceurRuntime.createClass)(DomProtoViewRef, {}, {}, $__super);
}(RenderProtoViewRef));
$__export("DomProtoViewRef", DomProtoViewRef);
DomProtoView = (function() {
function DomProtoView($__1) {
var $__2 = $__1,
elementBinders = $__2.elementBinders,
- element = $__2.element;
+ element = $__2.element,
+ transitiveContentTagCount = $__2.transitiveContentTagCount,
+ boundTextNodeCount = $__2.boundTextNodeCount;
this.element = element;
this.elementBinders = elementBinders;
+ this.transitiveContentTagCount = transitiveContentTagCount;
this.isTemplateElement = DOM.isTemplateElement(this.element);
this.rootBindingOffset = (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) ? 1 : 0;
+ this.boundTextNodeCount = boundTextNodeCount;
+ this.rootNodeCount = this.isTemplateElement ? DOM.childNodes(DOM.content(this.element)).length : 1;
}
return ($traceurRuntime.createClass)(DomProtoView, {}, {});
}());
$__export("DomProtoView", DomProtoView);
}
};
});
-System.register("angular2/src/render/dom/view/proto_view_builder", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/change_detection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/dom/view/property_setter_factory", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) {
+System.register("angular2/src/render/dom/view/proto_view_builder", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/change_detection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/view/proto_view_builder";
var isPresent,
isBlank,
BaseException,
+ StringWrapper,
ListWrapper,
MapWrapper,
+ Set,
+ SetWrapper,
+ StringMapWrapper,
DOM,
ASTWithSource,
AstTransformer,
AccessMember,
LiteralArray,
@@ -17297,27 +20378,76 @@
DomProtoView,
DomProtoViewRef,
resolveInternalDomProtoView,
ElementBinder,
Event,
- HostAction,
- setterFactory,
api,
NG_BINDING_CLASS,
EVENT_TARGET_SEPARATOR,
ProtoViewBuilder,
+ _ChildNodesInfo,
ElementBinderBuilder,
DirectiveBuilder,
- EventBuilder;
+ EventBuilder,
+ PROPERTY_PARTS_SEPARATOR,
+ ATTRIBUTE_PREFIX,
+ CLASS_PREFIX,
+ STYLE_PREFIX;
+ function buildElementPropertyBindings(protoElement, isNgComponent, bindingsInTemplate, directiveTempaltePropertyNames) {
+ var propertyBindings = [];
+ MapWrapper.forEach(bindingsInTemplate, (function(ast, propertyNameInTemplate) {
+ var propertyBinding = createElementPropertyBinding(ast, propertyNameInTemplate);
+ if (isValidElementPropertyBinding(protoElement, isNgComponent, propertyBinding)) {
+ propertyBindings.push(propertyBinding);
+ } else if (!SetWrapper.has(directiveTempaltePropertyNames, propertyNameInTemplate)) {
+ throw new BaseException(("Can't bind to '" + propertyNameInTemplate + "' since it isn't a know property of the '" + DOM.tagName(protoElement).toLowerCase() + "' element and there are no matching directives with a corresponding property"));
+ }
+ }));
+ return propertyBindings;
+ }
+ function isValidElementPropertyBinding(protoElement, isNgComponent, binding) {
+ if (binding.type === api.PropertyBindingType.PROPERTY) {
+ var tagName = DOM.tagName(protoElement);
+ var possibleCustomElement = tagName.indexOf('-') !== -1;
+ if (possibleCustomElement && !isNgComponent) {
+ return true;
+ } else {
+ return DOM.hasProperty(protoElement, binding.property);
+ }
+ }
+ return true;
+ }
+ function createElementPropertyBinding(ast, propertyNameInTemplate) {
+ var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR);
+ if (parts.length === 1) {
+ var propName = parts[0];
+ var mappedPropName = StringMapWrapper.get(DOM.attrToPropMap, propName);
+ propName = isPresent(mappedPropName) ? mappedPropName : propName;
+ return new api.ElementPropertyBinding(api.PropertyBindingType.PROPERTY, ast, propName);
+ } else if (parts[0] == ATTRIBUTE_PREFIX) {
+ return new api.ElementPropertyBinding(api.PropertyBindingType.ATTRIBUTE, ast, parts[1]);
+ } else if (parts[0] == CLASS_PREFIX) {
+ return new api.ElementPropertyBinding(api.PropertyBindingType.CLASS, ast, parts[1]);
+ } else if (parts[0] == STYLE_PREFIX) {
+ var unit = parts.length > 2 ? parts[2] : null;
+ return new api.ElementPropertyBinding(api.PropertyBindingType.STYLE, ast, parts[1], unit);
+ } else {
+ throw new BaseException(("Invalid property name " + propertyNameInTemplate));
+ }
+ }
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
BaseException = $__m.BaseException;
+ StringWrapper = $__m.StringWrapper;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
+ Set = $__m.Set;
+ SetWrapper = $__m.SetWrapper;
+ StringMapWrapper = $__m.StringMapWrapper;
}, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
ASTWithSource = $__m.ASTWithSource;
AstTransformer = $__m.AstTransformer;
@@ -17329,163 +20459,194 @@
DomProtoViewRef = $__m.DomProtoViewRef;
resolveInternalDomProtoView = $__m.resolveInternalDomProtoView;
}, function($__m) {
ElementBinder = $__m.ElementBinder;
Event = $__m.Event;
- HostAction = $__m.HostAction;
}, function($__m) {
- setterFactory = $__m.setterFactory;
- }, function($__m) {
api = $__m;
}, function($__m) {
NG_BINDING_CLASS = $__m.NG_BINDING_CLASS;
EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR;
}],
execute: function() {
ProtoViewBuilder = (function() {
function ProtoViewBuilder(rootElement, type) {
this.rootElement = rootElement;
- this.elements = [];
- this.variableBindings = MapWrapper.create();
this.type = type;
+ this.variableBindings = new Map();
+ this.elements = [];
}
return ($traceurRuntime.createClass)(ProtoViewBuilder, {
bindElement: function(element) {
var description = arguments[1] !== (void 0) ? arguments[1] : null;
var builder = new ElementBinderBuilder(this.elements.length, element, description);
- ListWrapper.push(this.elements, builder);
+ this.elements.push(builder);
DOM.addClass(element, NG_BINDING_CLASS);
return builder;
},
bindVariable: function(name, value) {
- MapWrapper.set(this.variableBindings, value, name);
+ this.variableBindings.set(value, name);
},
build: function() {
+ var $__0 = this;
var renderElementBinders = [];
var apiElementBinders = [];
+ var transitiveContentTagCount = 0;
+ var boundTextNodeCount = 0;
ListWrapper.forEach(this.elements, (function(ebb) {
- var propertySetters = MapWrapper.create();
- var hostActions = MapWrapper.create();
+ var directiveTemplatePropertyNames = new Set();
var apiDirectiveBinders = ListWrapper.map(ebb.directives, (function(dbb) {
ebb.eventBuilder.merge(dbb.eventBuilder);
- MapWrapper.forEach(dbb.hostPropertyBindings, (function(_, hostPropertyName) {
- MapWrapper.set(propertySetters, hostPropertyName, setterFactory(hostPropertyName));
+ ListWrapper.forEach(dbb.templatePropertyNames, (function(name) {
+ return directiveTemplatePropertyNames.add(name);
}));
- ListWrapper.forEach(dbb.hostActions, (function(hostAction) {
- MapWrapper.set(hostActions, hostAction.actionExpression, hostAction.expression);
- }));
return new api.DirectiveBinder({
directiveIndex: dbb.directiveIndex,
propertyBindings: dbb.propertyBindings,
eventBindings: dbb.eventBindings,
- hostPropertyBindings: dbb.hostPropertyBindings
+ hostPropertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), dbb.hostPropertyBindings, directiveTemplatePropertyNames)
});
}));
- MapWrapper.forEach(ebb.propertyBindings, (function(_, propertyName) {
- MapWrapper.set(propertySetters, propertyName, setterFactory(propertyName));
- }));
var nestedProtoView = isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build() : null;
+ var nestedRenderProtoView = isPresent(nestedProtoView) ? resolveInternalDomProtoView(nestedProtoView.render) : null;
+ if (isPresent(nestedRenderProtoView)) {
+ transitiveContentTagCount += nestedRenderProtoView.transitiveContentTagCount;
+ }
+ if (isPresent(ebb.contentTagSelector)) {
+ transitiveContentTagCount++;
+ }
var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1;
- ListWrapper.push(apiElementBinders, new api.ElementBinder({
+ apiElementBinders.push(new api.ElementBinder({
index: ebb.index,
parentIndex: parentIndex,
distanceToParent: ebb.distanceToParent,
directives: apiDirectiveBinders,
nestedProtoView: nestedProtoView,
- propertyBindings: ebb.propertyBindings,
+ propertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames),
variableBindings: ebb.variableBindings,
eventBindings: ebb.eventBindings,
textBindings: ebb.textBindings,
readAttributes: ebb.readAttributes
}));
- ListWrapper.push(renderElementBinders, new ElementBinder({
- textNodeIndices: ebb.textBindingIndices,
+ var childNodeInfo = $__0._analyzeChildNodes(ebb.element, ebb.textBindingNodes);
+ boundTextNodeCount += ebb.textBindingNodes.length;
+ renderElementBinders.push(new ElementBinder({
+ textNodeIndices: childNodeInfo.boundTextNodeIndices,
contentTagSelector: ebb.contentTagSelector,
parentIndex: parentIndex,
distanceToParent: ebb.distanceToParent,
nestedProtoView: isPresent(nestedProtoView) ? resolveInternalDomProtoView(nestedProtoView.render) : null,
componentId: ebb.componentId,
eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()),
localEvents: ebb.eventBuilder.buildLocalEvents(),
globalEvents: ebb.eventBuilder.buildGlobalEvents(),
- hostActions: hostActions,
- propertySetters: propertySetters
+ elementIsEmpty: childNodeInfo.elementIsEmpty
}));
}));
return new api.ProtoViewDto({
render: new DomProtoViewRef(new DomProtoView({
element: this.rootElement,
- elementBinders: renderElementBinders
+ elementBinders: renderElementBinders,
+ transitiveContentTagCount: transitiveContentTagCount,
+ boundTextNodeCount: boundTextNodeCount
})),
type: this.type,
elementBinders: apiElementBinders,
variableBindings: this.variableBindings
});
+ },
+ _analyzeChildNodes: function(parentElement, boundTextNodes) {
+ var childNodes = DOM.childNodes(DOM.templateAwareRoot(parentElement));
+ var boundTextNodeIndices = [];
+ var indexInBoundTextNodes = 0;
+ var elementIsEmpty = true;
+ for (var i = 0; i < childNodes.length; i++) {
+ var node = childNodes[i];
+ if (indexInBoundTextNodes < boundTextNodes.length && node === boundTextNodes[indexInBoundTextNodes]) {
+ boundTextNodeIndices.push(i);
+ indexInBoundTextNodes++;
+ elementIsEmpty = false;
+ } else if ((DOM.isTextNode(node) && DOM.getText(node).trim().length > 0) || (DOM.isElementNode(node))) {
+ elementIsEmpty = false;
+ }
+ }
+ return new _ChildNodesInfo(boundTextNodeIndices, elementIsEmpty);
}
}, {});
}());
$__export("ProtoViewBuilder", ProtoViewBuilder);
+ _ChildNodesInfo = (function() {
+ function _ChildNodesInfo(boundTextNodeIndices, elementIsEmpty) {
+ this.boundTextNodeIndices = boundTextNodeIndices;
+ this.elementIsEmpty = elementIsEmpty;
+ }
+ return ($traceurRuntime.createClass)(_ChildNodesInfo, {}, {});
+ }());
ElementBinderBuilder = (function() {
function ElementBinderBuilder(index, element, description) {
- this.element = element;
this.index = index;
+ this.element = element;
this.parent = null;
this.distanceToParent = 0;
this.directives = [];
this.nestedProtoView = null;
- this.propertyBindings = MapWrapper.create();
- this.variableBindings = MapWrapper.create();
- this.eventBindings = ListWrapper.create();
+ this.propertyBindings = new Map();
+ this.variableBindings = new Map();
+ this.propertyBindingsToDirectives = new Set();
+ this.eventBindings = [];
this.eventBuilder = new EventBuilder();
+ this.textBindingNodes = [];
this.textBindings = [];
- this.textBindingIndices = [];
this.contentTagSelector = null;
+ this.readAttributes = new Map();
this.componentId = null;
- this.readAttributes = MapWrapper.create();
}
return ($traceurRuntime.createClass)(ElementBinderBuilder, {
setParent: function(parent, distanceToParent) {
this.parent = parent;
if (isPresent(parent)) {
this.distanceToParent = distanceToParent;
}
return this;
},
readAttribute: function(attrName) {
- if (isBlank(MapWrapper.get(this.readAttributes, attrName))) {
- MapWrapper.set(this.readAttributes, attrName, DOM.getAttribute(this.element, attrName));
+ if (isBlank(this.readAttributes.get(attrName))) {
+ this.readAttributes.set(attrName, DOM.getAttribute(this.element, attrName));
}
},
bindDirective: function(directiveIndex) {
var directive = new DirectiveBuilder(directiveIndex);
- ListWrapper.push(this.directives, directive);
+ this.directives.push(directive);
return directive;
},
bindNestedProtoView: function(rootElement) {
if (isPresent(this.nestedProtoView)) {
throw new BaseException('Only one nested view per element is allowed');
}
- this.nestedProtoView = new ProtoViewBuilder(rootElement, api.ProtoViewDto.EMBEDDED_VIEW_TYPE);
+ this.nestedProtoView = new ProtoViewBuilder(rootElement, api.ViewType.EMBEDDED);
return this.nestedProtoView;
},
bindProperty: function(name, expression) {
- MapWrapper.set(this.propertyBindings, name, expression);
+ this.propertyBindings.set(name, expression);
},
+ bindPropertyToDirective: function(name) {
+ this.propertyBindingsToDirectives.add(name);
+ },
bindVariable: function(name, value) {
if (isPresent(this.nestedProtoView)) {
this.nestedProtoView.bindVariable(name, value);
} else {
- MapWrapper.set(this.variableBindings, value, name);
+ this.variableBindings.set(value, name);
}
},
bindEvent: function(name, expression) {
var target = arguments[2] !== (void 0) ? arguments[2] : null;
- ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target));
+ this.eventBindings.push(this.eventBuilder.add(name, expression, target));
},
- bindText: function(index, expression) {
- ListWrapper.push(this.textBindingIndices, index);
- ListWrapper.push(this.textBindings, expression);
+ bindText: function(textNode, expression) {
+ this.textBindingNodes.push(textNode);
+ this.textBindings.push(expression);
},
setContentTagSelector: function(value) {
this.contentTagSelector = value;
},
setComponentId: function(componentId) {
@@ -17495,29 +20656,29 @@
}());
$__export("ElementBinderBuilder", ElementBinderBuilder);
DirectiveBuilder = (function() {
function DirectiveBuilder(directiveIndex) {
this.directiveIndex = directiveIndex;
- this.propertyBindings = MapWrapper.create();
- this.hostPropertyBindings = MapWrapper.create();
- this.hostActions = ListWrapper.create();
- this.eventBindings = ListWrapper.create();
+ this.propertyBindings = new Map();
+ this.templatePropertyNames = [];
+ this.hostPropertyBindings = new Map();
+ this.eventBindings = [];
this.eventBuilder = new EventBuilder();
}
return ($traceurRuntime.createClass)(DirectiveBuilder, {
- bindProperty: function(name, expression) {
- MapWrapper.set(this.propertyBindings, name, expression);
+ bindProperty: function(name, expression, elProp) {
+ this.propertyBindings.set(name, expression);
+ if (isPresent(elProp)) {
+ this.templatePropertyNames.push(elProp);
+ }
},
bindHostProperty: function(name, expression) {
- MapWrapper.set(this.hostPropertyBindings, name, expression);
+ this.hostPropertyBindings.set(name, expression);
},
- bindHostAction: function(actionName, actionExpression, expression) {
- ListWrapper.push(this.hostActions, new HostAction(actionName, actionExpression, expression));
- },
bindEvent: function(name, expression) {
var target = arguments[2] !== (void 0) ? arguments[2] : null;
- ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target));
+ this.eventBindings.push(this.eventBuilder.add(name, expression, target));
}
}, {});
}());
$__export("DirectiveBuilder", DirectiveBuilder);
EventBuilder = (function($__super) {
@@ -17533,13 +20694,13 @@
var adjustedAst = source.ast;
var fullName = isPresent(target) ? target + EVENT_TARGET_SEPARATOR + name : name;
var result = new api.EventBinding(fullName, new ASTWithSource(adjustedAst, source.source, source.location));
var event = new Event(name, target, fullName);
if (isBlank(target)) {
- ListWrapper.push(this.localEvents, event);
+ this.localEvents.push(event);
} else {
- ListWrapper.push(this.globalEvents, event);
+ this.globalEvents.push(event);
}
return result;
},
visitAccessMember: function(ast) {
var isEventAccess = false;
@@ -17550,11 +20711,11 @@
isEventAccess = true;
}
current = am.receiver;
}
if (isEventAccess) {
- ListWrapper.push(this.locals, ast);
+ this.locals.push(ast);
var index = this.locals.length - 1;
return new AccessMember(this._implicitReceiver, ("" + index), (function(arr) {
return arr[index];
}), null);
} else {
@@ -17574,23 +20735,27 @@
this._merge(this.localEvents, eventBuilder.localEvents);
this._merge(this.globalEvents, eventBuilder.globalEvents);
ListWrapper.concat(this.locals, eventBuilder.locals);
},
_merge: function(host, tobeAdded) {
- var names = ListWrapper.create();
+ var names = [];
for (var i = 0; i < host.length; i++) {
- ListWrapper.push(names, host[i].fullName);
+ names.push(host[i].fullName);
}
for (var j = 0; j < tobeAdded.length; j++) {
if (!ListWrapper.contains(names, tobeAdded[j].fullName)) {
- ListWrapper.push(host, tobeAdded[j]);
+ host.push(tobeAdded[j]);
}
}
}
}, {}, $__super);
}(AstTransformer));
$__export("EventBuilder", EventBuilder);
+ PROPERTY_PARTS_SEPARATOR = new RegExp('\\.');
+ ATTRIBUTE_PREFIX = 'attr';
+ CLASS_PREFIX = 'class';
+ STYLE_PREFIX = 'style';
}
};
});
System.register("angular2/src/render/dom/compiler/directive_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/selector", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) {
@@ -17631,16 +20796,16 @@
camelCaseToDashCase = $__m.camelCaseToDashCase;
EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR;
}],
execute: function() {
DirectiveParser = (function() {
- function DirectiveParser(parser, directives) {
- this._parser = parser;
+ function DirectiveParser(_parser, _directives) {
+ this._parser = _parser;
+ this._directives = _directives;
this._selectorMatcher = new SelectorMatcher();
- this._directives = directives;
- for (var i = 0; i < directives.length; i++) {
- var directive = directives[i];
+ for (var i = 0; i < _directives.length; i++) {
+ var directive = _directives[i];
var selector = CssSelector.parse(directive.selector);
this._ensureComponentOnlyHasElementSelector(selector, directive);
this._selectorMatcher.addSelectables(selector, i);
}
}
@@ -17676,62 +20841,68 @@
throw new BaseException(("Only one component directive is allowed per element - check " + current.elementDescription));
}
componentDirective = directive;
elementBinder.setComponentId(directive.id);
} else {
- ListWrapper.push(foundDirectiveIndices, directiveIndex);
+ foundDirectiveIndices.push(directiveIndex);
}
}));
ListWrapper.forEach(foundDirectiveIndices, (function(directiveIndex) {
- var directive = $__0._directives[directiveIndex];
+ var dirMetadata = $__0._directives[directiveIndex];
var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex);
- current.compileChildren = current.compileChildren && directive.compileChildren;
- if (isPresent(directive.properties)) {
- MapWrapper.forEach(directive.properties, (function(bindConfig, dirProperty) {
- $__0._bindDirectiveProperty(dirProperty, bindConfig, current, directiveBinderBuilder);
+ current.compileChildren = current.compileChildren && dirMetadata.compileChildren;
+ if (isPresent(dirMetadata.properties)) {
+ ListWrapper.forEach(dirMetadata.properties, (function(bindConfig) {
+ $__0._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder);
}));
}
- if (isPresent(directive.hostListeners)) {
- MapWrapper.forEach(directive.hostListeners, (function(action, eventName) {
+ if (isPresent(dirMetadata.hostListeners)) {
+ MapWrapper.forEach(dirMetadata.hostListeners, (function(action, eventName) {
$__0._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder);
}));
}
- if (isPresent(directive.hostActions)) {
- MapWrapper.forEach(directive.hostActions, (function(action, actionName) {
- $__0._bindHostAction(actionName, action, current, directiveBinderBuilder);
+ if (isPresent(dirMetadata.hostProperties)) {
+ MapWrapper.forEach(dirMetadata.hostProperties, (function(expression, hostPropertyName) {
+ $__0._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder);
}));
}
- if (isPresent(directive.hostProperties)) {
- MapWrapper.forEach(directive.hostProperties, (function(hostPropertyName, directivePropertyName) {
- $__0._bindHostProperty(hostPropertyName, directivePropertyName, current, directiveBinderBuilder);
- }));
- }
- if (isPresent(directive.hostAttributes)) {
- MapWrapper.forEach(directive.hostAttributes, (function(hostAttrValue, hostAttrName) {
+ if (isPresent(dirMetadata.hostAttributes)) {
+ MapWrapper.forEach(dirMetadata.hostAttributes, (function(hostAttrValue, hostAttrName) {
$__0._addHostAttribute(hostAttrName, hostAttrValue, current);
}));
}
- if (isPresent(directive.readAttributes)) {
- ListWrapper.forEach(directive.readAttributes, (function(attrName) {
+ if (isPresent(dirMetadata.readAttributes)) {
+ ListWrapper.forEach(dirMetadata.readAttributes, (function(attrName) {
elementBinder.readAttribute(attrName);
}));
}
}));
},
- _bindDirectiveProperty: function(dirProperty, bindConfig, compileElement, directiveBinderBuilder) {
- var pipes = this._splitBindConfig(bindConfig);
- var elProp = ListWrapper.removeAt(pipes, 0);
- var bindingAst = MapWrapper.get(compileElement.bindElement().propertyBindings, dashCaseToCamelCase(elProp));
+ _bindDirectiveProperty: function(bindConfig, compileElement, directiveBinderBuilder) {
+ var dirProperty;
+ var elProp;
+ var pipes;
+ var assignIndex = bindConfig.indexOf(':');
+ if (assignIndex > -1) {
+ dirProperty = StringWrapper.substring(bindConfig, 0, assignIndex).trim();
+ pipes = this._splitBindConfig(StringWrapper.substring(bindConfig, assignIndex + 1));
+ elProp = ListWrapper.removeAt(pipes, 0);
+ } else {
+ dirProperty = bindConfig;
+ elProp = bindConfig;
+ pipes = [];
+ }
+ elProp = dashCaseToCamelCase(elProp);
+ var bindingAst = compileElement.bindElement().propertyBindings.get(elProp);
if (isBlank(bindingAst)) {
- var attributeValue = MapWrapper.get(compileElement.attrs(), camelCaseToDashCase(elProp));
+ var attributeValue = compileElement.attrs().get(camelCaseToDashCase(elProp));
if (isPresent(attributeValue)) {
bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription);
}
}
if (isPresent(bindingAst)) {
- var fullExpAstWithBindPipes = this._parser.addPipes(bindingAst, pipes);
- directiveBinderBuilder.bindProperty(dirProperty, fullExpAstWithBindPipes);
+ directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp);
}
},
_bindDirectiveEvent: function(eventName, action, compileElement, directiveBinderBuilder) {
var ast = this._parser.parseAction(action, compileElement.elementDescription);
if (StringWrapper.contains(eventName, EVENT_TARGET_SEPARATOR)) {
@@ -17739,16 +20910,12 @@
directiveBinderBuilder.bindEvent(parts[1], ast, parts[0]);
} else {
directiveBinderBuilder.bindEvent(eventName, ast);
}
},
- _bindHostAction: function(actionName, actionExpression, compileElement, directiveBinderBuilder) {
- var ast = this._parser.parseAction(actionExpression, compileElement.elementDescription);
- directiveBinderBuilder.bindHostAction(actionName, actionExpression, ast);
- },
- _bindHostProperty: function(hostPropertyName, directivePropertyName, compileElement, directiveBinderBuilder) {
- var ast = this._parser.parseBinding(directivePropertyName, ("hostProperties of " + compileElement.elementDescription));
+ _bindHostProperty: function(hostPropertyName, expression, compileElement, directiveBinderBuilder) {
+ var ast = this._parser.parseSimpleBinding(expression, ("hostProperties of " + compileElement.elementDescription));
directiveBinderBuilder.bindHostProperty(hostPropertyName, ast);
},
_addHostAttribute: function(attrName, attrValue, compileElement) {
if (StringWrapper.equals(attrName, 'class')) {
ListWrapper.forEach(attrValue.split(' '), (function(className) {
@@ -17850,35 +21017,60 @@
});
System.register("angular2/src/forms/model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/forms/validators"], function($__export) {
"use strict";
var __moduleName = "angular2/src/forms/model";
- var isPresent,
+ var StringWrapper,
+ isPresent,
+ isBlank,
EventEmitter,
ObservableWrapper,
StringMapWrapper,
ListWrapper,
+ List,
Validators,
VALID,
INVALID,
AbstractControl,
Control,
ControlGroup,
ControlArray;
function isControl(c) {
return c instanceof AbstractControl;
}
+ function _find(c, path) {
+ if (isBlank(path))
+ return null;
+ if (!(path instanceof List)) {
+ path = StringWrapper.split(path, new RegExp("/"));
+ }
+ if (ListWrapper.isEmpty(path))
+ return null;
+ return ListWrapper.reduce(path, (function(v, name) {
+ if (v instanceof ControlGroup) {
+ return isPresent(v.controls[name]) ? v.controls[name] : null;
+ } else if (v instanceof ControlArray) {
+ var index = name;
+ return isPresent(v.at(index)) ? v.at(index) : null;
+ } else {
+ return null;
+ }
+ }), c);
+ }
$__export("isControl", isControl);
return {
setters: [function($__m) {
+ StringWrapper = $__m.StringWrapper;
isPresent = $__m.isPresent;
+ isBlank = $__m.isBlank;
}, function($__m) {
EventEmitter = $__m.EventEmitter;
ObservableWrapper = $__m.ObservableWrapper;
}, function($__m) {
StringMapWrapper = $__m.StringMapWrapper;
ListWrapper = $__m.ListWrapper;
+ List = $__m.List;
}, function($__m) {
Validators = $__m.Validators;
}],
execute: function() {
VALID = "VALID";
@@ -17887,10 +21079,11 @@
$__export("INVALID", INVALID);
AbstractControl = (function() {
function AbstractControl(validator) {
this.validator = validator;
this._pristine = true;
+ this._touched = false;
}
return ($traceurRuntime.createClass)(AbstractControl, {
get value() {
return this._value;
},
@@ -17907,42 +21100,104 @@
return this._pristine;
},
get dirty() {
return !this.pristine;
},
+ get touched() {
+ return this._touched;
+ },
+ get untouched() {
+ return !this._touched;
+ },
get valueChanges() {
return this._valueChanges;
},
+ markAsTouched: function() {
+ this._touched = true;
+ },
+ markAsDirty: function() {
+ var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf;
+ onlySelf = isPresent(onlySelf) ? onlySelf : false;
+ this._pristine = false;
+ if (isPresent(this._parent) && !onlySelf) {
+ this._parent.markAsDirty({onlySelf: onlySelf});
+ }
+ },
setParent: function(parent) {
this._parent = parent;
},
- _updateParent: function() {
- if (isPresent(this._parent)) {
- this._parent._updateValue();
+ updateValidity: function() {
+ var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf;
+ onlySelf = isPresent(onlySelf) ? onlySelf : false;
+ this._errors = this.validator(this);
+ this._status = isPresent(this._errors) ? INVALID : VALID;
+ if (isPresent(this._parent) && !onlySelf) {
+ this._parent.updateValidity({onlySelf: onlySelf});
}
- }
+ },
+ updateValueAndValidity: function() {
+ var $__2 = arguments[0] !== (void 0) ? arguments[0] : {},
+ onlySelf = $__2.onlySelf,
+ emitEvent = $__2.emitEvent;
+ onlySelf = isPresent(onlySelf) ? onlySelf : false;
+ emitEvent = isPresent(emitEvent) ? emitEvent : true;
+ this._updateValue();
+ if (emitEvent) {
+ ObservableWrapper.callNext(this._valueChanges, this._value);
+ }
+ this._errors = this.validator(this);
+ this._status = isPresent(this._errors) ? INVALID : VALID;
+ if (isPresent(this._parent) && !onlySelf) {
+ this._parent.updateValueAndValidity({
+ onlySelf: onlySelf,
+ emitEvent: emitEvent
+ });
+ }
+ },
+ find: function(path) {
+ return _find(this, path);
+ },
+ getError: function(errorCode) {
+ var path = arguments[1] !== (void 0) ? arguments[1] : null;
+ var c = isPresent(path) && !ListWrapper.isEmpty(path) ? this.find(path) : this;
+ if (isPresent(c) && isPresent(c._errors)) {
+ return StringMapWrapper.get(c._errors, errorCode);
+ } else {
+ return null;
+ }
+ },
+ hasError: function(errorCode) {
+ var path = arguments[1] !== (void 0) ? arguments[1] : null;
+ return isPresent(this.getError(errorCode, path));
+ },
+ _updateValue: function() {}
}, {});
}());
$__export("AbstractControl", AbstractControl);
Control = (function($__super) {
function Control(value) {
var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.nullValidator;
$traceurRuntime.superConstructor(Control).call(this, validator);
- this._setValueErrorsStatus(value);
+ this._value = value;
+ this.updateValidity({onlySelf: true});
this._valueChanges = new EventEmitter();
}
return ($traceurRuntime.createClass)(Control, {
updateValue: function(value) {
- this._setValueErrorsStatus(value);
- this._pristine = false;
- ObservableWrapper.callNext(this._valueChanges, this._value);
- this._updateParent();
- },
- _setValueErrorsStatus: function(value) {
+ var $__2 = arguments[1] !== (void 0) ? arguments[1] : {},
+ onlySelf = $__2.onlySelf,
+ emitEvent = $__2.emitEvent;
this._value = value;
- this._errors = this.validator(this);
- this._status = isPresent(this._errors) ? INVALID : VALID;
+ if (isPresent(this._onChange))
+ this._onChange(this._value);
+ this.updateValueAndValidity({
+ onlySelf: onlySelf,
+ emitEvent: emitEvent
+ });
+ },
+ registerOnChange: function(fn) {
+ this._onChange = fn;
}
}, {}, $__super);
}(AbstractControl));
$__export("Control", Control);
ControlGroup = (function($__super) {
@@ -17952,20 +21207,28 @@
$traceurRuntime.superConstructor(ControlGroup).call(this, validator);
this.controls = controls;
this._optionals = isPresent(optionals) ? optionals : {};
this._valueChanges = new EventEmitter();
this._setParentForControls();
- this._setValueErrorsStatus();
+ this._value = this._reduceValue();
+ this.updateValidity({onlySelf: true});
}
return ($traceurRuntime.createClass)(ControlGroup, {
+ addControl: function(name, c) {
+ this.controls[name] = c;
+ c.setParent(this);
+ },
+ removeControl: function(name) {
+ StringMapWrapper.delete(this.controls, name);
+ },
include: function(controlName) {
StringMapWrapper.set(this._optionals, controlName, true);
- this._updateValue();
+ this.updateValueAndValidity();
},
exclude: function(controlName) {
StringMapWrapper.set(this._optionals, controlName, false);
- this._updateValue();
+ this.updateValueAndValidity();
},
contains: function(controlName) {
var c = StringMapWrapper.contains(this.controls, controlName);
return c && this._included(controlName);
},
@@ -17974,19 +21237,11 @@
StringMapWrapper.forEach(this.controls, (function(control, name) {
control.setParent($__0);
}));
},
_updateValue: function() {
- this._setValueErrorsStatus();
- this._pristine = false;
- ObservableWrapper.callNext(this._valueChanges, this._value);
- this._updateParent();
- },
- _setValueErrorsStatus: function() {
this._value = this._reduceValue();
- this._errors = this.validator(this);
- this._status = isPresent(this._errors) ? INVALID : VALID;
},
_reduceValue: function() {
return this._reduceChildren({}, (function(acc, control, name) {
acc[name] = control.value;
return acc;
@@ -18014,59 +21269,296 @@
var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.array;
$traceurRuntime.superConstructor(ControlArray).call(this, validator);
this.controls = controls;
this._valueChanges = new EventEmitter();
this._setParentForControls();
- this._setValueErrorsStatus();
+ this._updateValue();
+ this.updateValidity({onlySelf: true});
}
return ($traceurRuntime.createClass)(ControlArray, {
at: function(index) {
return this.controls[index];
},
push: function(control) {
- ListWrapper.push(this.controls, control);
+ this.controls.push(control);
control.setParent(this);
- this._updateValue();
+ this.updateValueAndValidity();
},
insert: function(index, control) {
ListWrapper.insert(this.controls, index, control);
control.setParent(this);
- this._updateValue();
+ this.updateValueAndValidity();
},
removeAt: function(index) {
ListWrapper.removeAt(this.controls, index);
- this._updateValue();
+ this.updateValueAndValidity();
},
get length() {
return this.controls.length;
},
_updateValue: function() {
- this._setValueErrorsStatus();
- this._pristine = false;
- ObservableWrapper.callNext(this._valueChanges, this._value);
- this._updateParent();
+ this._value = ListWrapper.map(this.controls, (function(c) {
+ return c.value;
+ }));
},
_setParentForControls: function() {
var $__0 = this;
ListWrapper.forEach(this.controls, (function(control) {
control.setParent($__0);
}));
- },
- _setValueErrorsStatus: function() {
- this._value = ListWrapper.map(this.controls, (function(c) {
- return c.value;
- }));
- this._errors = this.validator(this);
- this._status = isPresent(this._errors) ? INVALID : VALID;
}
}, {}, $__super);
}(AbstractControl));
$__export("ControlArray", ControlArray);
}
};
});
+System.register("angular2/src/forms/directives/ng_control_name", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/angular2", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/forms/directives/ng_control_name";
+ var __decorate,
+ __metadata,
+ __param,
+ CONST_EXPR,
+ EventEmitter,
+ ObservableWrapper,
+ StringMapWrapper,
+ Directive,
+ Ancestor,
+ onDestroy,
+ onChange,
+ Query,
+ QueryList,
+ forwardRef,
+ Binding,
+ ControlContainer,
+ NgControl,
+ NgValidator,
+ controlPath,
+ composeNgValidator,
+ controlNameBinding,
+ NgControlName;
+ return {
+ setters: [function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ }, function($__m) {
+ EventEmitter = $__m.EventEmitter;
+ ObservableWrapper = $__m.ObservableWrapper;
+ }, function($__m) {
+ StringMapWrapper = $__m.StringMapWrapper;
+ }, function($__m) {
+ Directive = $__m.Directive;
+ Ancestor = $__m.Ancestor;
+ onDestroy = $__m.onDestroy;
+ onChange = $__m.onChange;
+ Query = $__m.Query;
+ QueryList = $__m.QueryList;
+ }, function($__m) {
+ forwardRef = $__m.forwardRef;
+ Binding = $__m.Binding;
+ }, function($__m) {
+ ControlContainer = $__m.ControlContainer;
+ }, function($__m) {
+ NgControl = $__m.NgControl;
+ }, function($__m) {
+ NgValidator = $__m.NgValidator;
+ }, function($__m) {
+ controlPath = $__m.controlPath;
+ composeNgValidator = $__m.composeNgValidator;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ __param = (this && this.__param) || function(paramIndex, decorator) {
+ return function(target, key) {
+ decorator(target, key, paramIndex);
+ };
+ };
+ controlNameBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() {
+ return NgControlName;
+ }))}));
+ NgControlName = (function($__super) {
+ function $__0(parent, ngValidators) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this.update = new EventEmitter();
+ this._added = false;
+ this._parent = parent;
+ this.ngValidators = ngValidators;
+ }
+ return ($traceurRuntime.createClass)($__0, {
+ onChange: function(c) {
+ if (!this._added) {
+ this.formDirective.addControl(this);
+ this._added = true;
+ }
+ if (StringMapWrapper.contains(c, "model")) {
+ this.formDirective.updateModel(this, this.model);
+ }
+ },
+ onDestroy: function() {
+ this.formDirective.removeControl(this);
+ },
+ viewToModelUpdate: function(newValue) {
+ ObservableWrapper.callNext(this.update, newValue);
+ },
+ get path() {
+ return controlPath(this.name, this._parent);
+ },
+ get formDirective() {
+ return this._parent.formDirective;
+ },
+ get control() {
+ return this.formDirective.getControl(this);
+ },
+ get validator() {
+ return composeNgValidator(this.ngValidators);
+ }
+ }, {}, $__super);
+ }(NgControl));
+ $__export("NgControlName", NgControlName);
+ $__export("NgControlName", NgControlName = __decorate([Directive({
+ selector: '[ng-control]',
+ hostInjector: [controlNameBinding],
+ properties: ['name: ngControl', 'model: ngModel'],
+ events: ['update: ngModel'],
+ lifecycle: [onDestroy, onChange],
+ exportAs: 'form'
+ }), __param(0, Ancestor()), __param(1, Query(NgValidator)), __metadata('design:paramtypes', [ControlContainer, QueryList])], NgControlName));
+ }
+ };
+});
+
+System.register("angular2/src/http/static_request", ["angular2/src/http/enums", "angular2/src/http/headers"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/static_request";
+ var RequestMethods,
+ RequestModesOpts,
+ RequestCredentialsOpts,
+ Headers,
+ Request;
+ return {
+ setters: [function($__m) {
+ RequestMethods = $__m.RequestMethods;
+ RequestModesOpts = $__m.RequestModesOpts;
+ RequestCredentialsOpts = $__m.RequestCredentialsOpts;
+ }, function($__m) {
+ Headers = $__m.Headers;
+ }],
+ execute: function() {
+ Request = (function() {
+ function Request(url) {
+ var $__2,
+ $__3,
+ $__4,
+ $__5;
+ var $__1 = arguments[1] !== (void 0) ? arguments[1] : {},
+ body = $__1.body,
+ method = ($__2 = $__1.method) === void 0 ? RequestMethods.GET : $__2,
+ mode = ($__3 = $__1.mode) === void 0 ? RequestModesOpts.Cors : $__3,
+ credentials = ($__4 = $__1.credentials) === void 0 ? RequestCredentialsOpts.Omit : $__4,
+ headers = ($__5 = $__1.headers) === void 0 ? new Headers() : $__5;
+ this.url = url;
+ this._body = body;
+ this.method = method;
+ this.mode = mode;
+ this.credentials = credentials;
+ this.headers = headers;
+ }
+ return ($traceurRuntime.createClass)(Request, {text: function() {
+ return this._body ? this._body.toString() : '';
+ }}, {});
+ }());
+ $__export("Request", Request);
+ }
+ };
+});
+
+System.register("angular2/src/http/static_response", ["angular2/src/http/base_response_options", "angular2/src/facade/lang", "angular2/src/http/headers"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/static_response";
+ var baseResponseOptions,
+ BaseException,
+ isJsObject,
+ isString,
+ global,
+ Headers,
+ Response;
+ return {
+ setters: [function($__m) {
+ baseResponseOptions = $__m.baseResponseOptions;
+ }, function($__m) {
+ BaseException = $__m.BaseException;
+ isJsObject = $__m.isJsObject;
+ isString = $__m.isString;
+ global = $__m.global;
+ }, function($__m) {
+ Headers = $__m.Headers;
+ }],
+ execute: function() {
+ Response = (function() {
+ function Response(_body) {
+ var $__1 = arguments[1] !== (void 0) ? arguments[1] : baseResponseOptions,
+ status = $__1.status,
+ statusText = $__1.statusText,
+ headers = $__1.headers,
+ type = $__1.type,
+ url = $__1.url;
+ this._body = _body;
+ if (isJsObject(headers)) {
+ headers = new Headers(headers);
+ }
+ this.status = status;
+ this.statusText = statusText;
+ this.headers = headers;
+ this.type = type;
+ this.url = url;
+ }
+ return ($traceurRuntime.createClass)(Response, {
+ blob: function() {
+ throw new BaseException('"blob()" method not implemented on Response superclass');
+ },
+ json: function() {
+ if (isJsObject(this._body)) {
+ return this._body;
+ } else if (isString(this._body)) {
+ return global.JSON.parse(this._body);
+ }
+ },
+ text: function() {
+ return this._body.toString();
+ },
+ arrayBuffer: function() {
+ throw new BaseException('"arrayBuffer()" method not implemented on Response superclass');
+ }
+ }, {});
+ }());
+ $__export("Response", Response);
+ }
+ };
+});
+
System.register("angular2/src/di/decorators", ["angular2/src/di/annotations", "angular2/src/util/decorators"], function($__export) {
"use strict";
var __moduleName = "angular2/src/di/decorators";
var InjectAnnotation,
InjectPromiseAnnotation,
@@ -18135,21 +21627,11 @@
FunctionWrapper,
ListWrapper,
AbstractChangeDetector,
ChangeDetectionUtil,
uninitialized,
- RECORD_TYPE_SELF,
- RECORD_TYPE_PROPERTY,
- RECORD_TYPE_LOCAL,
- RECORD_TYPE_INVOKE_METHOD,
- RECORD_TYPE_CONST,
- RECORD_TYPE_INVOKE_CLOSURE,
- RECORD_TYPE_PRIMITIVE_OP,
- RECORD_TYPE_KEYED_ACCESS,
- RECORD_TYPE_PIPE,
- RECORD_TYPE_BINDING_PIPE,
- RECORD_TYPE_INTERPOLATE,
+ RecordType,
ChangeDetectionError,
DynamicChangeDetector;
function isSame(a, b) {
if (a === b)
return true;
@@ -18171,54 +21653,48 @@
AbstractChangeDetector = $__m.AbstractChangeDetector;
}, function($__m) {
ChangeDetectionUtil = $__m.ChangeDetectionUtil;
uninitialized = $__m.uninitialized;
}, function($__m) {
- RECORD_TYPE_SELF = $__m.RECORD_TYPE_SELF;
- RECORD_TYPE_PROPERTY = $__m.RECORD_TYPE_PROPERTY;
- RECORD_TYPE_LOCAL = $__m.RECORD_TYPE_LOCAL;
- RECORD_TYPE_INVOKE_METHOD = $__m.RECORD_TYPE_INVOKE_METHOD;
- RECORD_TYPE_CONST = $__m.RECORD_TYPE_CONST;
- RECORD_TYPE_INVOKE_CLOSURE = $__m.RECORD_TYPE_INVOKE_CLOSURE;
- RECORD_TYPE_PRIMITIVE_OP = $__m.RECORD_TYPE_PRIMITIVE_OP;
- RECORD_TYPE_KEYED_ACCESS = $__m.RECORD_TYPE_KEYED_ACCESS;
- RECORD_TYPE_PIPE = $__m.RECORD_TYPE_PIPE;
- RECORD_TYPE_BINDING_PIPE = $__m.RECORD_TYPE_BINDING_PIPE;
- RECORD_TYPE_INTERPOLATE = $__m.RECORD_TYPE_INTERPOLATE;
+ RecordType = $__m.RecordType;
}, function($__m) {
ChangeDetectionError = $__m.ChangeDetectionError;
}],
execute: function() {
DynamicChangeDetector = (function($__super) {
- function DynamicChangeDetector(changeControlStrategy, dispatcher, pipeRegistry, protos, directiveRecords) {
- $traceurRuntime.superConstructor(DynamicChangeDetector).call(this);
+ function DynamicChangeDetector(id, changeControlStrategy, dispatcher, pipeRegistry, protos, directiveRecords) {
+ $traceurRuntime.superConstructor(DynamicChangeDetector).call(this, id);
this.changeControlStrategy = changeControlStrategy;
this.dispatcher = dispatcher;
this.pipeRegistry = pipeRegistry;
this.protos = protos;
this.directiveRecords = directiveRecords;
+ this.locals = null;
+ this.directives = null;
+ this.alreadyChecked = false;
this.values = ListWrapper.createFixedSize(protos.length + 1);
this.pipes = ListWrapper.createFixedSize(protos.length + 1);
this.prevContexts = ListWrapper.createFixedSize(protos.length + 1);
this.changes = ListWrapper.createFixedSize(protos.length + 1);
- ListWrapper.fill(this.values, uninitialized);
+ this.values[0] = null;
+ ListWrapper.fill(this.values, uninitialized, 1);
ListWrapper.fill(this.pipes, null);
ListWrapper.fill(this.prevContexts, uninitialized);
ListWrapper.fill(this.changes, false);
- this.locals = null;
- this.directives = null;
}
return ($traceurRuntime.createClass)(DynamicChangeDetector, {
hydrate: function(context, locals, directives) {
this.mode = ChangeDetectionUtil.changeDetectionMode(this.changeControlStrategy);
this.values[0] = context;
this.locals = locals;
this.directives = directives;
+ this.alreadyChecked = false;
},
dehydrate: function() {
this._destroyPipes();
- ListWrapper.fill(this.values, uninitialized);
+ this.values[0] = null;
+ ListWrapper.fill(this.values, uninitialized, 1);
ListWrapper.fill(this.changes, false);
ListWrapper.fill(this.pipes, null);
ListWrapper.fill(this.prevContexts, uninitialized);
this.locals = null;
},
@@ -18228,39 +21704,51 @@
this.pipes[i].onDestroy();
}
}
},
hydrated: function() {
- return this.values[0] !== uninitialized;
+ return this.values[0] !== null;
},
detectChangesInRecords: function(throwOnChange) {
+ if (!this.hydrated()) {
+ ChangeDetectionUtil.throwDehydrated();
+ }
var protos = this.protos;
var changes = null;
var isChanged = false;
for (var i = 0; i < protos.length; ++i) {
var proto = protos[i];
var bindingRecord = proto.bindingRecord;
var directiveRecord = bindingRecord.directiveRecord;
- var change = this._check(proto, throwOnChange);
- if (isPresent(change)) {
- this._updateDirectiveOrElement(change, bindingRecord);
- isChanged = true;
- changes = this._addChange(bindingRecord, change, changes);
- }
- if (proto.lastInDirective) {
- if (isPresent(changes)) {
+ if (proto.isLifeCycleRecord()) {
+ if (proto.name === "onCheck" && !throwOnChange) {
+ this._getDirectiveFor(directiveRecord.directiveIndex).onCheck();
+ } else if (proto.name === "onInit" && !throwOnChange && !this.alreadyChecked) {
+ this._getDirectiveFor(directiveRecord.directiveIndex).onInit();
+ } else if (proto.name === "onChange" && isPresent(changes) && !throwOnChange) {
this._getDirectiveFor(directiveRecord.directiveIndex).onChange(changes);
- changes = null;
}
+ } else {
+ var change = this._check(proto, throwOnChange);
+ if (isPresent(change)) {
+ this._updateDirectiveOrElement(change, bindingRecord);
+ isChanged = true;
+ changes = this._addChange(bindingRecord, change, changes);
+ }
+ }
+ if (proto.lastInDirective) {
+ changes = null;
if (isChanged && bindingRecord.isOnPushChangeDetection()) {
this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce();
}
isChanged = false;
}
}
+ this.alreadyChecked = true;
},
callOnAllChangesDone: function() {
+ this.dispatcher.notifyOnAllChangesDone();
var dirs = this.directiveRecords;
for (var i = dirs.length - 1; i >= 0; --i) {
var dir = dirs[i];
if (dir.callOnAllChangesDone) {
this._getDirectiveFor(dir.directiveIndex).onAllChangesDone();
@@ -18288,11 +21776,11 @@
_getDetectorFor: function(directiveIndex) {
return this.directives.getDetectorFor(directiveIndex);
},
_check: function(proto, throwOnChange) {
try {
- if (proto.mode === RECORD_TYPE_PIPE || proto.mode === RECORD_TYPE_BINDING_PIPE) {
+ if (proto.isPipeRecord()) {
return this._pipeCheck(proto, throwOnChange);
} else {
return this._referenceCheck(proto, throwOnChange);
}
} catch (e) {
@@ -18324,30 +21812,40 @@
return null;
}
},
_calculateCurrValue: function(proto) {
switch (proto.mode) {
- case RECORD_TYPE_SELF:
+ case RecordType.SELF:
return this._readContext(proto);
- case RECORD_TYPE_CONST:
+ case RecordType.CONST:
return proto.funcOrValue;
- case RECORD_TYPE_PROPERTY:
+ case RecordType.PROPERTY:
var context = this._readContext(proto);
return proto.funcOrValue(context);
- case RECORD_TYPE_LOCAL:
+ case RecordType.SAFE_PROPERTY:
+ var context = this._readContext(proto);
+ return isBlank(context) ? null : proto.funcOrValue(context);
+ case RecordType.LOCAL:
return this.locals.get(proto.name);
- case RECORD_TYPE_INVOKE_METHOD:
+ case RecordType.INVOKE_METHOD:
var context = this._readContext(proto);
var args = this._readArgs(proto);
return proto.funcOrValue(context, args);
- case RECORD_TYPE_KEYED_ACCESS:
+ case RecordType.SAFE_INVOKE_METHOD:
+ var context = this._readContext(proto);
+ if (isBlank(context)) {
+ return null;
+ }
+ var args = this._readArgs(proto);
+ return proto.funcOrValue(context, args);
+ case RecordType.KEYED_ACCESS:
var arg = this._readArgs(proto)[0];
return this._readContext(proto)[arg];
- case RECORD_TYPE_INVOKE_CLOSURE:
+ case RecordType.INVOKE_CLOSURE:
return FunctionWrapper.apply(this._readContext(proto), this._readArgs(proto));
- case RECORD_TYPE_INTERPOLATE:
- case RECORD_TYPE_PRIMITIVE_OP:
+ case RecordType.INTERPOLATE:
+ case RecordType.PRIMITIVE_OP:
return FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto));
default:
throw new BaseException(("Unknown operation " + proto.mode));
}
},
@@ -18381,12 +21879,11 @@
return storedPipe;
}
if (isPresent(storedPipe)) {
storedPipe.onDestroy();
}
- var cdr = proto.mode === RECORD_TYPE_BINDING_PIPE ? this.ref : null;
- var pipe = this.pipeRegistry.get(proto.name, context, cdr);
+ var pipe = this.pipeRegistry.get(proto.name, context, this.ref);
this._writePipe(proto, pipe);
return pipe;
},
_readContext: function(proto) {
if (proto.contextIndex == -1) {
@@ -18445,26 +21942,22 @@
__metadata,
ObservableWrapper,
isBlank,
isPresent,
CONST,
- Pipe,
WrappedValue,
- PipeFactory,
ObservablePipe,
ObservablePipeFactory;
return {
setters: [function($__m) {
ObservableWrapper = $__m.ObservableWrapper;
}, function($__m) {
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
CONST = $__m.CONST;
}, function($__m) {
- Pipe = $__m.Pipe;
WrappedValue = $__m.WrappedValue;
- PipeFactory = $__m.PipeFactory;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -18485,14 +21978,13 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- ObservablePipe = (function($__super) {
- function ObservablePipe(ref) {
- $traceurRuntime.superConstructor(ObservablePipe).call(this);
- this._ref = ref;
+ ObservablePipe = (function() {
+ function ObservablePipe(_ref) {
+ this._ref = _ref;
this._latestValue = null;
this._latestReturnedValue = null;
this._subscription = null;
this._observable = null;
}
@@ -18539,26 +22031,21 @@
},
_updateLatestValue: function(value) {
this._latestValue = value;
this._ref.requestCheck();
}
- }, {}, $__super);
- }(Pipe));
+ }, {});
+ }());
$__export("ObservablePipe", ObservablePipe);
- ObservablePipeFactory = (function($__super) {
- function $__1() {
- $traceurRuntime.superConstructor($__1).call(this);
+ ObservablePipeFactory = (($traceurRuntime.createClass)(function() {}, {
+ supports: function(obs) {
+ return ObservableWrapper.isObservable(obs);
+ },
+ create: function(cdRef) {
+ return new ObservablePipe(cdRef);
}
- return ($traceurRuntime.createClass)($__1, {
- supports: function(obs) {
- return ObservableWrapper.isObservable(obs);
- },
- create: function(cdRef) {
- return new ObservablePipe(cdRef);
- }
- }, {}, $__super);
- }(PipeFactory));
+ }, {}));
$__export("ObservablePipeFactory", ObservablePipeFactory);
$__export("ObservablePipeFactory", ObservablePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], ObservablePipeFactory));
}
};
});
@@ -18570,10 +22057,14 @@
__metadata,
Type,
isBlank,
isPresent,
CONST,
+ CONST_EXPR,
+ BaseException,
+ stringify,
+ isArray,
ListWrapper,
reflector,
Key,
Inject,
InjectLazy,
@@ -18589,34 +22080,41 @@
BindingBuilder;
function bind(token) {
return new BindingBuilder(token);
}
function _constructDependencies(factoryFunction, dependencies) {
- return isBlank(dependencies) ? _dependenciesFor(factoryFunction) : ListWrapper.map(dependencies, (function(t) {
- return _extractToken(factoryFunction, t);
- }));
+ if (isBlank(dependencies)) {
+ return _dependenciesFor(factoryFunction);
+ } else {
+ var params = ListWrapper.map(dependencies, (function(t) {
+ return [t];
+ }));
+ return ListWrapper.map(dependencies, (function(t) {
+ return _extractToken(factoryFunction, t, params);
+ }));
+ }
}
function _dependenciesFor(typeOrFunc) {
var params = reflector.parameters(typeOrFunc);
if (isBlank(params))
return [];
if (ListWrapper.any(params, (function(p) {
return isBlank(p);
}))) {
- throw new NoAnnotationError(typeOrFunc);
+ throw new NoAnnotationError(typeOrFunc, params);
}
return ListWrapper.map(params, (function(p) {
- return _extractToken(typeOrFunc, p);
+ return _extractToken(typeOrFunc, p, params);
}));
}
- function _extractToken(typeOrFunc, annotations) {
+ function _extractToken(typeOrFunc, annotations, params) {
var depProps = [];
var token = null;
var optional = false;
var lazy = false;
var asPromise = false;
- if (!ListWrapper.isList(annotations)) {
+ if (!isArray(annotations)) {
return _createDependency(annotations, asPromise, lazy, optional, depProps);
}
for (var i = 0; i < annotations.length; ++i) {
var paramAnnotation = annotations[i];
if (paramAnnotation instanceof Type) {
@@ -18633,18 +22131,18 @@
optional = true;
} else if (paramAnnotation instanceof DependencyAnnotation) {
if (isPresent(paramAnnotation.token)) {
token = paramAnnotation.token;
}
- ListWrapper.push(depProps, paramAnnotation);
+ depProps.push(paramAnnotation);
}
}
token = resolveForwardRef(token);
if (isPresent(token)) {
return _createDependency(token, asPromise, lazy, optional, depProps);
} else {
- throw new NoAnnotationError(typeOrFunc);
+ throw new NoAnnotationError(typeOrFunc, params);
}
}
function _createDependency(token, asPromise, lazy, optional, depProps) {
return new Dependency(Key.get(token), asPromise, lazy, optional, depProps);
}
@@ -18653,10 +22151,14 @@
setters: [function($__m) {
Type = $__m.Type;
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
CONST = $__m.CONST;
+ CONST_EXPR = $__m.CONST_EXPR;
+ BaseException = $__m.BaseException;
+ stringify = $__m.stringify;
+ isArray = $__m.isArray;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
reflector = $__m.reflector;
}, function($__m) {
@@ -18706,11 +22208,11 @@
return ($traceurRuntime.createClass)(Dependency, {}, {fromKey: function(key) {
return new Dependency(key, false, false, false, []);
}});
}());
$__export("Dependency", Dependency);
- _EMPTY_LIST = [];
+ _EMPTY_LIST = CONST_EXPR([]);
Binding = (($traceurRuntime.createClass)(function(token, $__3) {
var $__4 = $__3,
toClass = $__4.toClass,
toValue = $__4.toValue,
toAlias = $__4.toAlias,
@@ -18775,10 +22277,13 @@
},
toValue: function(value) {
return new Binding(this.token, {toValue: value});
},
toAlias: function(aliasToken) {
+ if (isBlank(aliasToken)) {
+ throw new BaseException(("Can not alias " + stringify(this.token) + " to a blank value!"));
+ }
return new Binding(this.token, {toAlias: aliasToken});
},
toFactory: function(factoryFunction, dependencies) {
return new Binding(this.token, {
toFactory: factoryFunction,
@@ -18796,39 +22301,36 @@
$__export("BindingBuilder", BindingBuilder);
}
};
});
-System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/di", "angular2/src/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/directive_resolver"], function($__export) {
+System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/di", "angular2/src/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/facade/lang", "angular2/src/core/compiler/view"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/view_manager_utils";
var __decorate,
__metadata,
Injectable,
ListWrapper,
+ MapWrapper,
eli,
isPresent,
isBlank,
- BaseException,
viewModule,
- DirectiveResolver,
AppViewManagerUtils;
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
+ MapWrapper = $__m.MapWrapper;
}, function($__m) {
eli = $__m;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
- BaseException = $__m.BaseException;
}, function($__m) {
viewModule = $__m;
- }, function($__m) {
- DirectiveResolver = $__m.DirectiveResolver;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -18849,21 +22351,14 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- AppViewManagerUtils = (($traceurRuntime.createClass)(function(metadataReader) {
- this._directiveResolver = metadataReader;
- }, {
+ AppViewManagerUtils = (($traceurRuntime.createClass)(function() {}, {
getComponentInstance: function(parentView, boundElementIndex) {
- var binder = parentView.proto.elementBinders[boundElementIndex];
var eli = parentView.elementInjectors[boundElementIndex];
- if (binder.hasDynamicComponent()) {
- return eli.getDynamicallyLoadedComponent();
- } else {
- return eli.getComponent();
- }
+ return eli.getComponent();
},
createView: function(protoView, renderView, viewManager, renderer) {
var view = new viewModule.AppView(renderer, protoView, protoView.protoLocals);
view.render = renderView;
var changeDetector = protoView.protoChangeDetector.instantiate(view);
@@ -18880,11 +22375,11 @@
if (isPresent(protoElementInjector.parent)) {
var parentElementInjector = elementInjectors[protoElementInjector.parent.index];
elementInjector = protoElementInjector.instantiate(parentElementInjector);
} else {
elementInjector = protoElementInjector.instantiate(null);
- ListWrapper.push(rootElementInjectors, elementInjector);
+ rootElementInjectors.push(elementInjector);
}
}
elementInjectors[binderIdx] = elementInjector;
if (isPresent(elementInjector)) {
var embeddedProtoView = binder.hasEmbeddedProtoView() ? binder.nestedProtoView : null;
@@ -18913,76 +22408,60 @@
},
hydrateRootHostView: function(hostView) {
var injector = arguments[1] !== (void 0) ? arguments[1] : null;
this._hydrateView(hostView, injector, null, new Object(), null);
},
- attachAndHydrateFreeHostView: function(parentComponentHostView, parentComponentBoundElementIndex, hostView) {
- var injector = arguments[3] !== (void 0) ? arguments[3] : null;
- var hostElementInjector = parentComponentHostView.elementInjectors[parentComponentBoundElementIndex];
- var parentView = parentComponentHostView.componentChildViews[parentComponentBoundElementIndex];
- parentView.changeDetector.addChild(hostView.changeDetector);
- ListWrapper.push(parentView.freeHostViews, hostView);
- this._hydrateView(hostView, injector, hostElementInjector, new Object(), null);
- },
- detachFreeHostView: function(parentView, hostView) {
- parentView.changeDetector.removeChild(hostView.changeDetector);
- ListWrapper.remove(parentView.freeHostViews, hostView);
- },
attachViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) {
if (isBlank(contextView)) {
contextView = parentView;
contextBoundElementIndex = boundElementIndex;
}
parentView.changeDetector.addChild(view.changeDetector);
- var viewContainer = parentView.viewContainers[boundElementIndex];
- if (isBlank(viewContainer)) {
- viewContainer = new viewModule.AppViewContainer();
- parentView.viewContainers[boundElementIndex] = viewContainer;
- }
+ var viewContainer = this._getOrCreateViewContainer(parentView, boundElementIndex);
ListWrapper.insert(viewContainer.views, atIndex, view);
var sibling;
if (atIndex == 0) {
sibling = null;
} else {
sibling = ListWrapper.last(viewContainer.views[atIndex - 1].rootElementInjectors);
}
var elementInjector = contextView.elementInjectors[contextBoundElementIndex];
for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) {
- view.rootElementInjectors[i].linkAfter(elementInjector, sibling);
+ if (isPresent(elementInjector.parent)) {
+ view.rootElementInjectors[i].linkAfter(elementInjector.parent, sibling);
+ } else {
+ contextView.rootElementInjectors.push(view.rootElementInjectors[i]);
+ }
}
},
detachViewInContainer: function(parentView, boundElementIndex, atIndex) {
var viewContainer = parentView.viewContainers[boundElementIndex];
var view = viewContainer.views[atIndex];
view.changeDetector.remove();
ListWrapper.removeAt(viewContainer.views, atIndex);
for (var i = 0; i < view.rootElementInjectors.length; ++i) {
- view.rootElementInjectors[i].unlink();
+ var inj = view.rootElementInjectors[i];
+ if (isPresent(inj.parent)) {
+ inj.unlink();
+ } else {
+ var removeIdx = ListWrapper.indexOf(parentView.rootElementInjectors, inj);
+ ListWrapper.removeAt(parentView.rootElementInjectors, removeIdx);
+ }
}
},
hydrateViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, injector) {
if (isBlank(contextView)) {
contextView = parentView;
contextBoundElementIndex = boundElementIndex;
}
var viewContainer = parentView.viewContainers[boundElementIndex];
var view = viewContainer.views[atIndex];
- var elementInjector = contextView.elementInjectors[contextBoundElementIndex].getHost();
- this._hydrateView(view, injector, elementInjector, contextView.context, contextView.locals);
- },
- hydrateDynamicComponentInElementInjector: function(hostView, boundElementIndex, componentBinding) {
- var injector = arguments[3] !== (void 0) ? arguments[3] : null;
- var elementInjector = hostView.elementInjectors[boundElementIndex];
- if (isPresent(elementInjector.getDynamicallyLoadedComponent())) {
- throw new BaseException(("There already is a dynamic component loaded at element " + boundElementIndex));
+ var elementInjector = contextView.elementInjectors[contextBoundElementIndex];
+ if (isBlank(elementInjector.getHost()) && isBlank(injector)) {
+ injector = elementInjector.getShadowDomAppInjector();
}
- if (isBlank(injector)) {
- injector = elementInjector.getLightDomAppInjector();
- }
- var annotation = this._directiveResolver.resolve(componentBinding.token);
- var componentDirective = eli.DirectiveBinding.createFromBinding(componentBinding, annotation);
- elementInjector.dynamicallyCreateComponent(componentDirective, injector);
+ this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals);
},
_hydrateView: function(view, appInjector, hostElementInjector, context, parentLocals) {
if (isBlank(appInjector)) {
appInjector = hostElementInjector.getShadowDomAppInjector();
}
@@ -18994,22 +22473,36 @@
var binders = view.proto.elementBinders;
for (var i = 0; i < binders.length; ++i) {
var elementInjector = view.elementInjectors[i];
if (isPresent(elementInjector)) {
elementInjector.hydrate(appInjector, hostElementInjector, view.preBuiltObjects[i]);
+ this._populateViewLocals(view, elementInjector);
this._setUpEventEmitters(view, elementInjector, i);
this._setUpHostActions(view, elementInjector, i);
- var exportImplicitName = elementInjector.getExportImplicitName();
- if (elementInjector.isExportingComponent()) {
- view.locals.set(exportImplicitName, elementInjector.getComponent());
- } else if (elementInjector.isExportingElement()) {
- view.locals.set(exportImplicitName, elementInjector.getElementRef().domElement);
- }
}
}
view.changeDetector.hydrate(view.context, view.locals, view);
},
+ _populateViewLocals: function(view, elementInjector) {
+ if (isPresent(elementInjector.getDirectiveVariableBindings())) {
+ MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), (function(directiveIndex, name) {
+ if (isBlank(directiveIndex)) {
+ view.locals.set(name, elementInjector.getElementRef().nativeElement);
+ } else {
+ view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex));
+ }
+ }));
+ }
+ },
+ _getOrCreateViewContainer: function(parentView, boundElementIndex) {
+ var viewContainer = parentView.viewContainers[boundElementIndex];
+ if (isBlank(viewContainer)) {
+ viewContainer = new viewModule.AppViewContainer();
+ parentView.viewContainers[boundElementIndex] = viewContainer;
+ }
+ return viewContainer;
+ },
_setUpEventEmitters: function(view, elementInjector, boundElementIndex) {
var emitters = elementInjector.getEventEmitterAccessors();
for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) {
var directiveEmitters = emitters[directiveIndex];
var directive = elementInjector.getDirectiveAtIndex(directiveIndex);
@@ -19044,15 +22537,179 @@
view.context = null;
view.changeDetector.dehydrate();
}
}, {}));
$__export("AppViewManagerUtils", AppViewManagerUtils);
- $__export("AppViewManagerUtils", AppViewManagerUtils = __decorate([Injectable(), __metadata('design:paramtypes', [DirectiveResolver])], AppViewManagerUtils));
+ $__export("AppViewManagerUtils", AppViewManagerUtils = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils));
}
};
});
+System.register("angular2/src/render/dom/compiler/view_loader", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/dom/dom_adapter", "angular2/src/render/xhr", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/render/dom/compiler/style_url_resolver"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/render/dom/compiler/view_loader";
+ var __decorate,
+ __metadata,
+ Injectable,
+ isBlank,
+ isPresent,
+ BaseException,
+ isPromise,
+ Map,
+ ListWrapper,
+ PromiseWrapper,
+ DOM,
+ XHR,
+ StyleInliner,
+ StyleUrlResolver,
+ ViewLoader;
+ function _insertCssTexts(element, cssTexts) {
+ if (cssTexts.length == 0)
+ return ;
+ var insertBefore = DOM.firstChild(element);
+ for (var i = cssTexts.length - 1; i >= 0; i--) {
+ var styleEl = DOM.createStyleElement(cssTexts[i]);
+ if (isPresent(insertBefore)) {
+ DOM.insertBefore(insertBefore, styleEl);
+ } else {
+ DOM.appendChild(element, styleEl);
+ }
+ insertBefore = styleEl;
+ }
+ }
+ return {
+ setters: [function($__m) {
+ Injectable = $__m.Injectable;
+ }, function($__m) {
+ isBlank = $__m.isBlank;
+ isPresent = $__m.isPresent;
+ BaseException = $__m.BaseException;
+ isPromise = $__m.isPromise;
+ }, function($__m) {
+ Map = $__m.Map;
+ ListWrapper = $__m.ListWrapper;
+ }, function($__m) {
+ PromiseWrapper = $__m.PromiseWrapper;
+ }, function($__m) {
+ DOM = $__m.DOM;
+ }, function($__m) {
+ XHR = $__m.XHR;
+ }, function($__m) {
+ StyleInliner = $__m.StyleInliner;
+ }, function($__m) {
+ StyleUrlResolver = $__m.StyleUrlResolver;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ ViewLoader = (($traceurRuntime.createClass)(function(_xhr, _styleInliner, _styleUrlResolver) {
+ this._xhr = _xhr;
+ this._styleInliner = _styleInliner;
+ this._styleUrlResolver = _styleUrlResolver;
+ this._cache = new Map();
+ }, {
+ load: function(view) {
+ var $__0 = this;
+ var tplElAndStyles = [this._loadHtml(view)];
+ if (isPresent(view.styles)) {
+ view.styles.forEach((function(cssText) {
+ var textOrPromise = $__0._resolveAndInlineCssText(cssText, view.templateAbsUrl);
+ tplElAndStyles.push(textOrPromise);
+ }));
+ }
+ if (isPresent(view.styleAbsUrls)) {
+ view.styleAbsUrls.forEach((function(url) {
+ var promise = $__0._loadText(url).then((function(cssText) {
+ return $__0._resolveAndInlineCssText(cssText, view.templateAbsUrl);
+ }));
+ tplElAndStyles.push(promise);
+ }));
+ }
+ return PromiseWrapper.all(tplElAndStyles).then((function(res) {
+ var tplEl = res[0];
+ var cssTexts = ListWrapper.slice(res, 1);
+ _insertCssTexts(DOM.content(tplEl), cssTexts);
+ return tplEl;
+ }));
+ },
+ _loadText: function(url) {
+ var response = this._cache.get(url);
+ if (isBlank(response)) {
+ response = PromiseWrapper.catchError(this._xhr.get(url), (function(_) {
+ return PromiseWrapper.reject(new BaseException(("Failed to fetch url \"" + url + "\"")), null);
+ }));
+ this._cache.set(url, response);
+ }
+ return response;
+ },
+ _loadHtml: function(view) {
+ var $__0 = this;
+ var html;
+ if (isPresent(view.template)) {
+ html = PromiseWrapper.resolve(view.template);
+ } else if (isPresent(view.templateAbsUrl)) {
+ html = this._loadText(view.templateAbsUrl);
+ } else {
+ throw new BaseException('View should have either the templateUrl or template property set');
+ }
+ return html.then((function(html) {
+ var tplEl = DOM.createTemplate(html);
+ var styleEls = DOM.querySelectorAll(DOM.content(tplEl), 'STYLE');
+ var promises = [];
+ for (var i = 0; i < styleEls.length; i++) {
+ var promise = $__0._resolveAndInlineElement(styleEls[i], view.templateAbsUrl);
+ if (isPromise(promise)) {
+ promises.push(promise);
+ }
+ }
+ return promises.length > 0 ? PromiseWrapper.all(promises).then((function(_) {
+ return tplEl;
+ })) : tplEl;
+ }));
+ },
+ _resolveAndInlineElement: function(styleEl, baseUrl) {
+ var textOrPromise = this._resolveAndInlineCssText(DOM.getText(styleEl), baseUrl);
+ if (isPromise(textOrPromise)) {
+ return textOrPromise.then((function(css) {
+ DOM.setText(styleEl, css);
+ }));
+ } else {
+ DOM.setText(styleEl, textOrPromise);
+ return null;
+ }
+ },
+ _resolveAndInlineCssText: function(cssText, baseUrl) {
+ cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl);
+ return this._styleInliner.inlineImports(cssText, baseUrl);
+ }
+ }, {}));
+ $__export("ViewLoader", ViewLoader);
+ $__export("ViewLoader", ViewLoader = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleInliner, StyleUrlResolver])], ViewLoader));
+ }
+ };
+});
+
System.register("angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy", ["angular2/src/dom/dom_adapter", "angular2/src/render/dom/shadow_dom/light_dom", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/util"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy";
var DOM,
LightDom,
@@ -19069,13 +22726,12 @@
}, function($__m) {
insertSharedStyleText = $__m.insertSharedStyleText;
}],
execute: function() {
EmulatedUnscopedShadowDomStrategy = (function($__super) {
- function EmulatedUnscopedShadowDomStrategy(styleUrlResolver, styleHost) {
+ function EmulatedUnscopedShadowDomStrategy(styleHost) {
$traceurRuntime.superConstructor(EmulatedUnscopedShadowDomStrategy).call(this);
- this.styleUrlResolver = styleUrlResolver;
this.styleHost = styleHost;
}
return ($traceurRuntime.createClass)(EmulatedUnscopedShadowDomStrategy, {
hasNativeContentElement: function() {
return false;
@@ -19086,57 +22742,58 @@
constructLightDom: function(lightDomView, el) {
return new LightDom(lightDomView, el);
},
processStyleElement: function(hostComponentId, templateUrl, styleEl) {
var cssText = DOM.getText(styleEl);
- cssText = this.styleUrlResolver.resolveUrls(cssText, templateUrl);
- DOM.setText(styleEl, cssText);
- DOM.remove(styleEl);
insertSharedStyleText(cssText, this.styleHost, styleEl);
- return null;
}
}, {}, $__super);
}(ShadowDomStrategy));
$__export("EmulatedUnscopedShadowDomStrategy", EmulatedUnscopedShadowDomStrategy);
}
};
});
-System.register("angular2/src/render/dom/dom_renderer", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/shadow_dom/content_tag", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/view", "angular2/src/render/dom/view/view_container", "angular2/src/render/dom/util", "angular2/src/render/api"], function($__export) {
+System.register("angular2/src/render/dom/dom_renderer", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/shadow_dom/content_tag", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/view", "angular2/src/render/dom/view/element", "angular2/src/render/dom/view/view_container", "angular2/src/render/dom/util", "angular2/src/render/api"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/dom_renderer";
var __decorate,
__metadata,
__param,
Inject,
Injectable,
+ OpaqueToken,
isPresent,
isBlank,
BaseException,
+ CONST_EXPR,
ListWrapper,
DOM,
Content,
ShadowDomStrategy,
EventManager,
resolveInternalDomProtoView,
DomView,
DomViewRef,
resolveInternalDomView,
+ DomElement,
DomViewContainer,
NG_BINDING_CLASS_SELECTOR,
NG_BINDING_CLASS,
Renderer,
DOCUMENT_TOKEN,
DomRenderer;
return {
setters: [function($__m) {
Inject = $__m.Inject;
Injectable = $__m.Injectable;
+ OpaqueToken = $__m.OpaqueToken;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
BaseException = $__m.BaseException;
+ CONST_EXPR = $__m.CONST_EXPR;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
@@ -19150,10 +22807,12 @@
}, function($__m) {
DomView = $__m.DomView;
DomViewRef = $__m.DomViewRef;
resolveInternalDomView = $__m.resolveInternalDomView;
}, function($__m) {
+ DomElement = $__m.DomElement;
+ }, function($__m) {
DomViewContainer = $__m.DomViewContainer;
}, function($__m) {
NG_BINDING_CLASS_SELECTOR = $__m.NG_BINDING_CLASS_SELECTOR;
NG_BINDING_CLASS = $__m.NG_BINDING_CLASS;
}, function($__m) {
@@ -19185,17 +22844,17 @@
__param = (this && this.__param) || function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
- DOCUMENT_TOKEN = 'DocumentToken';
+ DOCUMENT_TOKEN = CONST_EXPR(new OpaqueToken('DocumentToken'));
$__export("DOCUMENT_TOKEN", DOCUMENT_TOKEN);
DomRenderer = (function($__super) {
- function $__0(eventManager, shadowDomStrategy, document) {
+ function $__0(_eventManager, _shadowDomStrategy, document) {
$traceurRuntime.superConstructor($__0).call(this);
- this._eventManager = eventManager;
- this._shadowDomStrategy = shadowDomStrategy;
+ this._eventManager = _eventManager;
+ this._shadowDomStrategy = _shadowDomStrategy;
this._document = document;
}
return ($traceurRuntime.createClass)($__0, {
createRootHostView: function(hostProtoViewRef, hostElementSelector) {
var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef);
@@ -19203,24 +22862,23 @@
if (isBlank(element)) {
throw new BaseException(("The selector \"" + hostElementSelector + "\" did not match any elements"));
}
return new DomViewRef(this._createView(hostProtoView, element));
},
- detachFreeHostView: function(parentHostViewRef, hostViewRef) {
- var hostView = resolveInternalDomView(hostViewRef);
- this._removeViewNodes(hostView);
- },
createView: function(protoViewRef) {
var protoView = resolveInternalDomProtoView(protoViewRef);
return new DomViewRef(this._createView(protoView, null));
},
destroyView: function(view) {},
- attachComponentView: function(hostViewRef, elementIndex, componentViewRef) {
- var hostView = resolveInternalDomView(hostViewRef);
+ getNativeElementSync: function(location) {
+ return resolveInternalDomView(location.renderView).boundElements[location.boundElementIndex].element;
+ },
+ attachComponentView: function(location, componentViewRef) {
+ var hostView = resolveInternalDomView(location.renderView);
var componentView = resolveInternalDomView(componentViewRef);
- var element = hostView.boundElements[elementIndex];
- var lightDom = hostView.lightDoms[elementIndex];
+ var element = hostView.boundElements[location.boundElementIndex].element;
+ var lightDom = hostView.boundElements[location.boundElementIndex].lightDom;
if (isPresent(lightDom)) {
lightDom.attachShadowDomView(componentView);
}
var shadowRoot = this._shadowDomStrategy.prepareShadowRoot(element);
this._moveViewNodesIntoParent(shadowRoot, componentView);
@@ -19231,36 +22889,35 @@
var componentView = resolveInternalDomView(componentViewRef);
this._removeViewNodes(componentView);
componentView.rootNodes = rootNodes;
this._moveViewNodesIntoParent(componentView.shadowRoot, componentView);
},
- getHostElement: function(hostViewRef) {
- var hostView = resolveInternalDomView(hostViewRef);
- return hostView.boundElements[0];
+ getRootNodes: function(viewRef) {
+ return resolveInternalDomView(viewRef).rootNodes;
},
- detachComponentView: function(hostViewRef, boundElementIndex, componentViewRef) {
- var hostView = resolveInternalDomView(hostViewRef);
+ detachComponentView: function(location, componentViewRef) {
+ var hostView = resolveInternalDomView(location.renderView);
var componentView = resolveInternalDomView(componentViewRef);
this._removeViewNodes(componentView);
- var lightDom = hostView.lightDoms[boundElementIndex];
+ var lightDom = hostView.boundElements[location.boundElementIndex].lightDom;
if (isPresent(lightDom)) {
lightDom.detachShadowDomView();
}
componentView.hostLightDom = null;
componentView.shadowRoot = null;
},
- attachViewInContainer: function(parentViewRef, boundElementIndex, atIndex, viewRef) {
- var parentView = resolveInternalDomView(parentViewRef);
+ attachViewInContainer: function(location, atIndex, viewRef) {
+ var parentView = resolveInternalDomView(location.renderView);
var view = resolveInternalDomView(viewRef);
- var viewContainer = this._getOrCreateViewContainer(parentView, boundElementIndex);
+ var viewContainer = this._getOrCreateViewContainer(parentView, location.boundElementIndex);
ListWrapper.insert(viewContainer.views, atIndex, view);
view.hostLightDom = parentView.hostLightDom;
- var directParentLightDom = parentView.getDirectParentLightDom(boundElementIndex);
+ var directParentLightDom = this._directParentLightDom(parentView, location.boundElementIndex);
if (isBlank(directParentLightDom)) {
var siblingToInsertAfter;
if (atIndex == 0) {
- siblingToInsertAfter = parentView.boundElements[boundElementIndex];
+ siblingToInsertAfter = parentView.boundElements[location.boundElementIndex].element;
} else {
siblingToInsertAfter = ListWrapper.last(viewContainer.views[atIndex - 1].rootNodes);
}
this._moveViewNodesAfterSibling(siblingToInsertAfter, view);
} else {
@@ -19268,17 +22925,17 @@
}
if (isPresent(parentView.hostLightDom)) {
parentView.hostLightDom.redistribute();
}
},
- detachViewInContainer: function(parentViewRef, boundElementIndex, atIndex, viewRef) {
- var parentView = resolveInternalDomView(parentViewRef);
+ detachViewInContainer: function(location, atIndex, viewRef) {
+ var parentView = resolveInternalDomView(location.renderView);
var view = resolveInternalDomView(viewRef);
- var viewContainer = parentView.viewContainers[boundElementIndex];
+ var viewContainer = parentView.boundElements[location.boundElementIndex].viewContainer;
var detachedView = viewContainer.views[atIndex];
ListWrapper.removeAt(viewContainer.views, atIndex);
- var directParentLightDom = parentView.getDirectParentLightDom(boundElementIndex);
+ var directParentLightDom = this._directParentLightDom(parentView, location.boundElementIndex);
if (isBlank(directParentLightDom)) {
this._removeViewNodes(detachedView);
} else {
directParentLightDom.redistribute();
}
@@ -19290,25 +22947,25 @@
hydrateView: function(viewRef) {
var view = resolveInternalDomView(viewRef);
if (view.hydrated)
throw new BaseException('The view is already hydrated.');
view.hydrated = true;
- for (var i = 0; i < view.lightDoms.length; ++i) {
- var lightDom = view.lightDoms[i];
+ for (var i = 0; i < view.boundElements.length; ++i) {
+ var lightDom = view.boundElements[i].lightDom;
if (isPresent(lightDom)) {
lightDom.redistribute();
}
}
- view.eventHandlerRemovers = ListWrapper.create();
+ view.eventHandlerRemovers = [];
var binders = view.proto.elementBinders;
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
var binder = binders[binderIdx];
if (isPresent(binder.globalEvents)) {
for (var i = 0; i < binder.globalEvents.length; i++) {
var globalEvent = binder.globalEvents[i];
var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName);
- ListWrapper.push(view.eventHandlerRemovers, remover);
+ view.eventHandlerRemovers.push(remover);
}
}
}
if (isPresent(view.hostLightDom)) {
view.hostLightDom.redistribute();
@@ -19320,90 +22977,102 @@
view.eventHandlerRemovers[i]();
}
view.eventHandlerRemovers = null;
view.hydrated = false;
},
- setElementProperty: function(viewRef, elementIndex, propertyName, propertyValue) {
- var view = resolveInternalDomView(viewRef);
- view.setElementProperty(elementIndex, propertyName, propertyValue);
+ setElementProperty: function(location, propertyName, propertyValue) {
+ var view = resolveInternalDomView(location.renderView);
+ view.setElementProperty(location.boundElementIndex, propertyName, propertyValue);
},
- callAction: function(viewRef, elementIndex, actionExpression, actionArgs) {
- var view = resolveInternalDomView(viewRef);
- view.callAction(elementIndex, actionExpression, actionArgs);
+ setElementAttribute: function(location, attributeName, attributeValue) {
+ var view = resolveInternalDomView(location.renderView);
+ view.setElementAttribute(location.boundElementIndex, attributeName, attributeValue);
},
+ setElementClass: function(location, className, isAdd) {
+ var view = resolveInternalDomView(location.renderView);
+ view.setElementClass(location.boundElementIndex, className, isAdd);
+ },
+ setElementStyle: function(location, styleName, styleValue) {
+ var view = resolveInternalDomView(location.renderView);
+ view.setElementStyle(location.boundElementIndex, styleName, styleValue);
+ },
+ invokeElementMethod: function(location, methodName, args) {
+ var view = resolveInternalDomView(location.renderView);
+ view.invokeElementMethod(location.boundElementIndex, methodName, args);
+ },
setText: function(viewRef, textNodeIndex, text) {
var view = resolveInternalDomView(viewRef);
DOM.setText(view.boundTextNodes[textNodeIndex], text);
},
setEventDispatcher: function(viewRef, dispatcher) {
var view = resolveInternalDomView(viewRef);
view.eventDispatcher = dispatcher;
},
_createView: function(protoView, inplaceElement) {
- var rootElementClone = isPresent(inplaceElement) ? inplaceElement : DOM.importIntoDoc(protoView.element);
+ var rootElementClone;
var elementsWithBindingsDynamic;
- if (protoView.isTemplateElement) {
- elementsWithBindingsDynamic = DOM.querySelectorAll(DOM.content(rootElementClone), NG_BINDING_CLASS_SELECTOR);
- } else {
- elementsWithBindingsDynamic = DOM.getElementsByClassName(rootElementClone, NG_BINDING_CLASS);
- }
- var elementsWithBindings = ListWrapper.createFixedSize(elementsWithBindingsDynamic.length);
- for (var binderIdx = 0; binderIdx < elementsWithBindingsDynamic.length; ++binderIdx) {
- elementsWithBindings[binderIdx] = elementsWithBindingsDynamic[binderIdx];
- }
var viewRootNodes;
- if (protoView.isTemplateElement) {
- var childNode = DOM.firstChild(DOM.content(rootElementClone));
- viewRootNodes = [];
- while (childNode != null) {
- ListWrapper.push(viewRootNodes, childNode);
- childNode = DOM.nextSibling(childNode);
+ if (isPresent(inplaceElement)) {
+ rootElementClone = inplaceElement;
+ elementsWithBindingsDynamic = [];
+ viewRootNodes = [inplaceElement];
+ } else if (protoView.isTemplateElement) {
+ rootElementClone = DOM.importIntoDoc(DOM.content(protoView.element));
+ elementsWithBindingsDynamic = DOM.querySelectorAll(rootElementClone, NG_BINDING_CLASS_SELECTOR);
+ viewRootNodes = ListWrapper.createFixedSize(protoView.rootNodeCount);
+ var childNode = DOM.firstChild(rootElementClone);
+ for (var i = 0; i < protoView.rootNodeCount; i++, childNode = DOM.nextSibling(childNode)) {
+ viewRootNodes[i] = childNode;
}
} else {
+ rootElementClone = DOM.importIntoDoc(protoView.element);
+ elementsWithBindingsDynamic = DOM.getElementsByClassName(rootElementClone, NG_BINDING_CLASS);
viewRootNodes = [rootElementClone];
}
var binders = protoView.elementBinders;
- var boundTextNodes = [];
+ var boundTextNodes = ListWrapper.createFixedSize(protoView.boundTextNodeCount);
var boundElements = ListWrapper.createFixedSize(binders.length);
- var contentTags = ListWrapper.createFixedSize(binders.length);
+ var boundTextNodeIdx = 0;
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
var binder = binders[binderIdx];
var element = void 0;
+ var childNodes = void 0;
if (binderIdx === 0 && protoView.rootBindingOffset === 1) {
- element = rootElementClone;
+ element = protoView.isTemplateElement ? null : rootElementClone;
+ childNodes = DOM.childNodes(rootElementClone);
} else {
- element = elementsWithBindings[binderIdx - protoView.rootBindingOffset];
+ element = elementsWithBindingsDynamic[binderIdx - protoView.rootBindingOffset];
+ childNodes = DOM.childNodes(element);
}
- boundElements[binderIdx] = element;
- var childNodes = DOM.childNodes(DOM.templateAwareRoot(element));
var textNodeIndices = binder.textNodeIndices;
for (var i = 0; i < textNodeIndices.length; i++) {
- ListWrapper.push(boundTextNodes, childNodes[textNodeIndices[i]]);
+ boundTextNodes[boundTextNodeIdx++] = childNodes[textNodeIndices[i]];
}
var contentTag = null;
if (isPresent(binder.contentTagSelector)) {
contentTag = new Content(element, binder.contentTagSelector);
}
- contentTags[binderIdx] = contentTag;
+ boundElements[binderIdx] = new DomElement(binder, element, contentTag);
}
- var view = new DomView(protoView, viewRootNodes, boundTextNodes, boundElements, contentTags);
+ var view = new DomView(protoView, viewRootNodes, boundTextNodes, boundElements);
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
var binder = binders[binderIdx];
var element = boundElements[binderIdx];
+ var domEl = element.element;
var lightDom = null;
- if (isPresent(binder.componentId)) {
- lightDom = this._shadowDomStrategy.constructLightDom(view, boundElements[binderIdx]);
+ if (isPresent(binder.componentId) && (!binder.elementIsEmpty || isPresent(inplaceElement))) {
+ lightDom = this._shadowDomStrategy.constructLightDom(view, domEl);
}
- view.lightDoms[binderIdx] = lightDom;
- var contentTag = contentTags[binderIdx];
+ element.lightDom = lightDom;
+ var contentTag = element.contentTag;
if (isPresent(contentTag)) {
- var destLightDom = view.getDirectParentLightDom(binderIdx);
- contentTag.init(destLightDom);
+ var directParentLightDom = this._directParentLightDom(view, binderIdx);
+ contentTag.init(directParentLightDom);
}
if (isPresent(binder.eventLocals) && isPresent(binder.localEvents)) {
for (var i = 0; i < binder.localEvents.length; i++) {
- this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals);
+ this._createEventListener(view, domEl, binderIdx, binder.localEvents[i].name, binder.eventLocals);
}
}
}
return view;
},
@@ -19430,17 +23099,22 @@
for (var i = len - 1; i >= 0; --i) {
DOM.removeChild(parent, view.rootNodes[i]);
}
},
_getOrCreateViewContainer: function(parentView, boundElementIndex) {
- var vc = parentView.viewContainers[boundElementIndex];
+ var el = parentView.boundElements[boundElementIndex];
+ var vc = el.viewContainer;
if (isBlank(vc)) {
vc = new DomViewContainer();
- parentView.viewContainers[boundElementIndex] = vc;
+ el.viewContainer = vc;
}
return vc;
},
+ _directParentLightDom: function(view, boundElementIndex) {
+ var directParentEl = view.getDirectParentElement(boundElementIndex);
+ return isPresent(directParentEl) ? directParentEl.lightDom : null;
+ },
_createGlobalEventListener: function(view, elementIndex, eventName, eventTarget, fullName) {
return this._eventManager.addGlobalEventListener(eventTarget, eventName, (function(event) {
view.dispatchEvent(elementIndex, fullName, event);
}));
}
@@ -19450,38 +23124,35 @@
$__export("DomRenderer", DomRenderer = __decorate([Injectable(), __param(2, Inject(DOCUMENT_TOKEN)), __metadata('design:paramtypes', [EventManager, ShadowDomStrategy, Object])], DomRenderer));
}
};
});
-System.register("angular2/src/render/dom/compiler/compile_pipeline", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/compiler/compile_control", "angular2/src/render/dom/view/proto_view_builder", "angular2/src/render/api"], function($__export) {
+System.register("angular2/src/render/dom/compiler/compile_pipeline", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/compiler/compile_control", "angular2/src/render/dom/view/proto_view_builder", "angular2/src/render/api"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/compiler/compile_pipeline";
var isPresent,
isBlank,
- ListWrapper,
DOM,
CompileElement,
CompileControl,
ProtoViewBuilder,
- ProtoViewDto,
+ ViewType,
CompilePipeline;
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
}, function($__m) {
- ListWrapper = $__m.ListWrapper;
- }, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
CompileElement = $__m.CompileElement;
}, function($__m) {
CompileControl = $__m.CompileControl;
}, function($__m) {
ProtoViewBuilder = $__m.ProtoViewBuilder;
}, function($__m) {
- ProtoViewDto = $__m.ProtoViewDto;
+ ViewType = $__m.ViewType;
}],
execute: function() {
CompilePipeline = (function() {
function CompilePipeline(steps) {
this._control = new CompileControl(steps);
@@ -19489,13 +23160,13 @@
return ($traceurRuntime.createClass)(CompilePipeline, {
process: function(rootElement) {
var protoViewType = arguments[1] !== (void 0) ? arguments[1] : null;
var compilationCtxtDescription = arguments[2] !== (void 0) ? arguments[2] : '';
if (isBlank(protoViewType)) {
- protoViewType = ProtoViewDto.COMPONENT_VIEW_TYPE;
+ protoViewType = ViewType.COMPONENT;
}
- var results = ListWrapper.create();
+ var results = [];
var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription);
rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType);
rootCompileElement.isViewRoot = true;
this._process(results, null, rootCompileElement, compilationCtxtDescription);
return results;
@@ -19553,87 +23224,174 @@
ShadowDomCompileStep = $__m.ShadowDomCompileStep;
}],
execute: function() {
CompileStepFactory = (function() {
function CompileStepFactory() {}
- return ($traceurRuntime.createClass)(CompileStepFactory, {createSteps: function(template, subTaskPromises) {
+ return ($traceurRuntime.createClass)(CompileStepFactory, {createSteps: function(view) {
return null;
}}, {});
}());
$__export("CompileStepFactory", CompileStepFactory);
DefaultStepFactory = (function($__super) {
- function DefaultStepFactory(parser, shadowDomStrategy) {
+ function DefaultStepFactory(_parser, _shadowDomStrategy) {
$traceurRuntime.superConstructor(DefaultStepFactory).call(this);
- this._parser = parser;
- this._shadowDomStrategy = shadowDomStrategy;
+ this._parser = _parser;
+ this._shadowDomStrategy = _shadowDomStrategy;
}
- return ($traceurRuntime.createClass)(DefaultStepFactory, {createSteps: function(template, subTaskPromises) {
- return [new ViewSplitter(this._parser), new PropertyBindingParser(this._parser), new DirectiveParser(this._parser, template.directives), new TextInterpolationParser(this._parser), new ShadowDomCompileStep(this._shadowDomStrategy, template, subTaskPromises)];
+ return ($traceurRuntime.createClass)(DefaultStepFactory, {createSteps: function(view) {
+ return [new ViewSplitter(this._parser), new PropertyBindingParser(this._parser), new DirectiveParser(this._parser, view.directives), new TextInterpolationParser(this._parser), new ShadowDomCompileStep(this._shadowDomStrategy, view)];
}}, {}, $__super);
}(CompileStepFactory));
$__export("DefaultStepFactory", DefaultStepFactory);
}
};
});
-System.register("angular2/forms", ["angular2/src/forms/model", "angular2/src/forms/directives", "angular2/src/forms/validators", "angular2/src/forms/validator_directives", "angular2/src/forms/form_builder"], function($__export) {
+System.register("angular2/forms", ["angular2/src/forms/model", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives", "angular2/src/forms/validators", "angular2/src/forms/directives/validators", "angular2/src/forms/form_builder", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/forms";
- var $__exportNames = {};
- var $__exportNames = {};
- var $__exportNames = {};
- var $__exportNames = {};
- var $__exportNames = {};
+ var FormBuilder,
+ CONST_EXPR,
+ formInjectables;
return {
setters: [function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("AbstractControl", $__m.AbstractControl);
+ $__export("Control", $__m.Control);
+ $__export("ControlGroup", $__m.ControlGroup);
+ $__export("ControlArray", $__m.ControlArray);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("NgControlName", $__m.NgControlName);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("NgFormControl", $__m.NgFormControl);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("NgModel", $__m.NgModel);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("NgControl", $__m.NgControl);
+ }, function($__m) {
+ $__export("NgControlGroup", $__m.NgControlGroup);
+ }, function($__m) {
+ $__export("NgFormModel", $__m.NgFormModel);
+ }, function($__m) {
+ $__export("NgForm", $__m.NgForm);
+ }, function($__m) {
+ $__export("DefaultValueAccessor", $__m.DefaultValueAccessor);
+ }, function($__m) {
+ $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor);
+ }, function($__m) {
+ $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor);
+ }, function($__m) {
+ $__export("formDirectives", $__m.formDirectives);
+ }, function($__m) {
+ $__export("Validators", $__m.Validators);
+ }, function($__m) {
+ $__export("NgValidator", $__m.NgValidator);
+ $__export("NgRequiredValidator", $__m.NgRequiredValidator);
+ }, function($__m) {
+ FormBuilder = $__m.FormBuilder;
+ $__export("FormBuilder", $__m.FormBuilder);
+ }, function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
}],
- execute: function() {}
+ execute: function() {
+ formInjectables = CONST_EXPR([FormBuilder]);
+ $__export("formInjectables", formInjectables);
+ }
};
});
+System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/di", "angular2/src/http/backends/browser_xhr", "rx"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/http/backends/xhr_backend";
+ var __decorate,
+ __metadata,
+ RequestMethods,
+ Response,
+ Injectable,
+ BrowserXHR,
+ Rx,
+ XHRConnection,
+ XHRBackend;
+ return {
+ setters: [function($__m) {
+ RequestMethods = $__m.RequestMethods;
+ }, function($__m) {
+ Response = $__m.Response;
+ }, function($__m) {
+ Injectable = $__m.Injectable;
+ }, function($__m) {
+ BrowserXHR = $__m.BrowserXHR;
+ }, function($__m) {
+ Rx = $__m;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ XHRConnection = (function() {
+ function XHRConnection(req, NativeConstruct) {
+ var $__0 = this;
+ this.request = req;
+ if (Rx.hasOwnProperty('default')) {
+ this.response = new Rx.default.Rx.Subject();
+ } else {
+ this.response = new Rx.Subject();
+ }
+ this._xhr = new NativeConstruct();
+ this._xhr.open(RequestMethods[req.method], req.url);
+ this._xhr.addEventListener('load', (function() {
+ $__0.response.onNext(new Response($__0._xhr.response || $__0._xhr.responseText));
+ }));
+ this._xhr.send(this.request.text());
+ }
+ return ($traceurRuntime.createClass)(XHRConnection, {dispose: function() {
+ this._xhr.abort();
+ }}, {});
+ }());
+ $__export("XHRConnection", XHRConnection);
+ XHRBackend = (($traceurRuntime.createClass)(function(_NativeConstruct) {
+ this._NativeConstruct = _NativeConstruct;
+ }, {createConnection: function(request) {
+ return new XHRConnection(request, this._NativeConstruct);
+ }}, {}));
+ $__export("XHRBackend", XHRBackend);
+ $__export("XHRBackend", XHRBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserXHR])], XHRBackend));
+ }
+ };
+});
+
System.register("angular2/src/change_detection/parser/lexer", ["angular2/src/di/decorators", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/parser/lexer";
var __decorate,
__metadata,
Injectable,
- ListWrapper,
SetWrapper,
NumberWrapper,
StringJoiner,
StringWrapper,
BaseException,
- TOKEN_TYPE_CHARACTER,
- TOKEN_TYPE_IDENTIFIER,
- TOKEN_TYPE_KEYWORD,
- TOKEN_TYPE_STRING,
- TOKEN_TYPE_OPERATOR,
- TOKEN_TYPE_NUMBER,
+ isPresent,
+ TokenType,
Lexer,
Token,
EOF,
$EOF,
$TAB,
@@ -19689,26 +23447,26 @@
ScannerError,
_Scanner,
OPERATORS,
KEYWORDS;
function newCharacterToken(index, code) {
- return new Token(index, TOKEN_TYPE_CHARACTER, code, StringWrapper.fromCharCode(code));
+ return new Token(index, TokenType.CHARACTER, code, StringWrapper.fromCharCode(code));
}
function newIdentifierToken(index, text) {
- return new Token(index, TOKEN_TYPE_IDENTIFIER, 0, text);
+ return new Token(index, TokenType.IDENTIFIER, 0, text);
}
function newKeywordToken(index, text) {
- return new Token(index, TOKEN_TYPE_KEYWORD, 0, text);
+ return new Token(index, TokenType.KEYWORD, 0, text);
}
function newOperatorToken(index, text) {
- return new Token(index, TOKEN_TYPE_OPERATOR, 0, text);
+ return new Token(index, TokenType.OPERATOR, 0, text);
}
function newStringToken(index, text) {
- return new Token(index, TOKEN_TYPE_STRING, 0, text);
+ return new Token(index, TokenType.STRING, 0, text);
}
function newNumberToken(index, n) {
- return new Token(index, TOKEN_TYPE_NUMBER, n, "");
+ return new Token(index, TokenType.NUMBER, n, "");
}
function isWhitespace(code) {
return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
}
function isIdentifierStart(code) {
@@ -19744,17 +23502,17 @@
}
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
- ListWrapper = $__m.ListWrapper;
SetWrapper = $__m.SetWrapper;
}, function($__m) {
NumberWrapper = $__m.NumberWrapper;
StringJoiner = $__m.StringJoiner;
StringWrapper = $__m.StringWrapper;
BaseException = $__m.BaseException;
+ isPresent = $__m.isPresent;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -19775,28 +23533,24 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- TOKEN_TYPE_CHARACTER = 1;
- $__export("TOKEN_TYPE_CHARACTER", TOKEN_TYPE_CHARACTER);
- TOKEN_TYPE_IDENTIFIER = 2;
- $__export("TOKEN_TYPE_IDENTIFIER", TOKEN_TYPE_IDENTIFIER);
- TOKEN_TYPE_KEYWORD = 3;
- $__export("TOKEN_TYPE_KEYWORD", TOKEN_TYPE_KEYWORD);
- TOKEN_TYPE_STRING = 4;
- $__export("TOKEN_TYPE_STRING", TOKEN_TYPE_STRING);
- TOKEN_TYPE_OPERATOR = 5;
- $__export("TOKEN_TYPE_OPERATOR", TOKEN_TYPE_OPERATOR);
- TOKEN_TYPE_NUMBER = 6;
- $__export("TOKEN_TYPE_NUMBER", TOKEN_TYPE_NUMBER);
+ (function(TokenType) {
+ TokenType[TokenType["CHARACTER"] = 0] = "CHARACTER";
+ TokenType[TokenType["IDENTIFIER"] = 1] = "IDENTIFIER";
+ TokenType[TokenType["KEYWORD"] = 2] = "KEYWORD";
+ TokenType[TokenType["STRING"] = 3] = "STRING";
+ TokenType[TokenType["OPERATOR"] = 4] = "OPERATOR";
+ TokenType[TokenType["NUMBER"] = 5] = "NUMBER";
+ })(TokenType || (TokenType = {}));
Lexer = (($traceurRuntime.createClass)(function() {}, {tokenize: function(text) {
var scanner = new _Scanner(text);
var tokens = [];
var token = scanner.scanToken();
while (token != null) {
- ListWrapper.push(tokens, token);
+ tokens.push(token);
token = scanner.scanToken();
}
return tokens;
}}, {}));
$__export("Lexer", Lexer);
@@ -19808,59 +23562,68 @@
this.numValue = numValue;
this.strValue = strValue;
}
return ($traceurRuntime.createClass)(Token, {
isCharacter: function(code) {
- return (this.type == TOKEN_TYPE_CHARACTER && this.numValue == code);
+ return (this.type == TokenType.CHARACTER && this.numValue == code);
},
isNumber: function() {
- return (this.type == TOKEN_TYPE_NUMBER);
+ return (this.type == TokenType.NUMBER);
},
isString: function() {
- return (this.type == TOKEN_TYPE_STRING);
+ return (this.type == TokenType.STRING);
},
isOperator: function(operater) {
- return (this.type == TOKEN_TYPE_OPERATOR && this.strValue == operater);
+ return (this.type == TokenType.OPERATOR && this.strValue == operater);
},
isIdentifier: function() {
- return (this.type == TOKEN_TYPE_IDENTIFIER);
+ return (this.type == TokenType.IDENTIFIER);
},
isKeyword: function() {
- return (this.type == TOKEN_TYPE_KEYWORD);
+ return (this.type == TokenType.KEYWORD);
},
isKeywordVar: function() {
- return (this.type == TOKEN_TYPE_KEYWORD && this.strValue == "var");
+ return (this.type == TokenType.KEYWORD && this.strValue == "var");
},
isKeywordNull: function() {
- return (this.type == TOKEN_TYPE_KEYWORD && this.strValue == "null");
+ return (this.type == TokenType.KEYWORD && this.strValue == "null");
},
isKeywordUndefined: function() {
- return (this.type == TOKEN_TYPE_KEYWORD && this.strValue == "undefined");
+ return (this.type == TokenType.KEYWORD && this.strValue == "undefined");
},
isKeywordTrue: function() {
- return (this.type == TOKEN_TYPE_KEYWORD && this.strValue == "true");
+ return (this.type == TokenType.KEYWORD && this.strValue == "true");
},
+ isKeywordIf: function() {
+ return (this.type == TokenType.KEYWORD && this.strValue == "if");
+ },
+ isKeywordElse: function() {
+ return (this.type == TokenType.KEYWORD && this.strValue == "else");
+ },
isKeywordFalse: function() {
- return (this.type == TOKEN_TYPE_KEYWORD && this.strValue == "false");
+ return (this.type == TokenType.KEYWORD && this.strValue == "false");
},
toNumber: function() {
- return (this.type == TOKEN_TYPE_NUMBER) ? this.numValue : -1;
+ return (this.type == TokenType.NUMBER) ? this.numValue : -1;
},
toString: function() {
- var t = this.type;
- if (t >= TOKEN_TYPE_CHARACTER && t <= TOKEN_TYPE_STRING) {
- return this.strValue;
- } else if (t == TOKEN_TYPE_NUMBER) {
- return this.numValue.toString();
- } else {
- return null;
+ switch (this.type) {
+ case TokenType.CHARACTER:
+ case TokenType.STRING:
+ case TokenType.IDENTIFIER:
+ case TokenType.KEYWORD:
+ return this.strValue;
+ case TokenType.NUMBER:
+ return this.numValue.toString();
+ default:
+ return null;
}
}
}, {});
}());
$__export("Token", Token);
- EOF = new Token(-1, 0, 0, "");
+ EOF = new Token(-1, TokenType.CHARACTER, 0, "");
$__export("EOF", EOF);
$EOF = 0;
$__export("$EOF", $EOF);
$TAB = 9;
$__export("$TAB", $TAB);
@@ -19946,13 +23709,13 @@
}(BaseException));
$__export("ScannerError", ScannerError);
_Scanner = (function() {
function _Scanner(input) {
this.input = input;
- this.length = input.length;
this.peek = 0;
this.index = -1;
+ this.length = input.length;
this.advance();
}
return ($traceurRuntime.createClass)(_Scanner, {
advance: function() {
this.peek = ++this.index >= this.length ? $EOF : StringWrapper.charCodeAt(this.input, this.index);
@@ -19996,28 +23759,29 @@
return this.scanCharacter(start, peek);
case $SQ:
case $DQ:
return this.scanString();
case $HASH:
- return this.scanOperator(start, StringWrapper.fromCharCode(peek));
case $PLUS:
case $MINUS:
case $STAR:
case $SLASH:
case $PERCENT:
case $CARET:
- case $QUESTION:
return this.scanOperator(start, StringWrapper.fromCharCode(peek));
+ case $QUESTION:
+ return this.scanComplexOperator(start, '?', $PERIOD, '.');
case $LT:
case $GT:
+ return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=');
case $BANG:
case $EQ:
- return this.scanComplexOperator(start, $EQ, StringWrapper.fromCharCode(peek), '=');
+ return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=', $EQ, '=');
case $AMPERSAND:
- return this.scanComplexOperator(start, $AMPERSAND, '&', '&');
+ return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
case $BAR:
- return this.scanComplexOperator(start, $BAR, '|', '|');
+ return this.scanComplexOperator(start, '|', $BAR, '|');
case $NBSP:
while (isWhitespace(this.peek))
this.advance();
return this.scanToken();
}
@@ -20033,18 +23797,22 @@
assert(this.peek == StringWrapper.charCodeAt(str, 0));
assert(SetWrapper.has(OPERATORS, str));
this.advance();
return newOperatorToken(start, str);
},
- scanComplexOperator: function(start, code, one, two) {
+ scanComplexOperator: function(start, one, twoCode, two, threeCode, three) {
assert(this.peek == StringWrapper.charCodeAt(one, 0));
this.advance();
var str = one;
- while (this.peek == code) {
+ if (this.peek == twoCode) {
this.advance();
str += two;
}
+ if (isPresent(threeCode) && this.peek == threeCode) {
+ this.advance();
+ str += three;
+ }
assert(SetWrapper.has(OPERATORS, str));
return newOperatorToken(start, str);
},
scanIdentifier: function() {
assert(isIdentifierStart(this.peek));
@@ -20132,12 +23900,12 @@
var position = this.index + offset;
throw new ScannerError(("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"));
}
}, {});
}());
- OPERATORS = SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#']);
- KEYWORDS = SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false']);
+ OPERATORS = SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']);
+ KEYWORDS = SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']);
}
};
});
System.register("angular2/src/change_detection/parser/parser", ["angular2/src/di/decorators", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/lexer", "angular2/src/reflection/reflection", "angular2/src/change_detection/parser/ast"], function($__export) {
@@ -20167,29 +23935,33 @@
reflector,
Reflector,
EmptyExpr,
ImplicitReceiver,
AccessMember,
+ SafeAccessMember,
LiteralPrimitive,
Binary,
PrefixNot,
Conditional,
- Pipe,
+ If,
+ BindingPipe,
Assignment,
Chain,
KeyedAccess,
LiteralArray,
LiteralMap,
Interpolation,
MethodCall,
+ SafeMethodCall,
FunctionCall,
TemplateBinding,
ASTWithSource,
_implicitReceiver,
INTERPOLATION_REGEXP,
Parser,
- _ParseAST;
+ _ParseAST,
+ SimpleExpressionChecker;
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
isBlank = $__m.isBlank;
@@ -20217,22 +23989,25 @@
Reflector = $__m.Reflector;
}, function($__m) {
EmptyExpr = $__m.EmptyExpr;
ImplicitReceiver = $__m.ImplicitReceiver;
AccessMember = $__m.AccessMember;
+ SafeAccessMember = $__m.SafeAccessMember;
LiteralPrimitive = $__m.LiteralPrimitive;
Binary = $__m.Binary;
PrefixNot = $__m.PrefixNot;
Conditional = $__m.Conditional;
- Pipe = $__m.Pipe;
+ If = $__m.If;
+ BindingPipe = $__m.BindingPipe;
Assignment = $__m.Assignment;
Chain = $__m.Chain;
KeyedAccess = $__m.KeyedAccess;
LiteralArray = $__m.LiteralArray;
LiteralMap = $__m.LiteralMap;
Interpolation = $__m.Interpolation;
MethodCall = $__m.MethodCall;
+ SafeMethodCall = $__m.SafeMethodCall;
FunctionCall = $__m.FunctionCall;
TemplateBinding = $__m.TemplateBinding;
ASTWithSource = $__m.ASTWithSource;
}],
execute: function() {
@@ -20258,13 +24033,13 @@
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
_implicitReceiver = new ImplicitReceiver();
INTERPOLATION_REGEXP = RegExpWrapper.create('\\{\\{(.*?)\\}\\}');
- Parser = (($traceurRuntime.createClass)(function(lexer) {
+ Parser = (($traceurRuntime.createClass)(function(_lexer) {
var providedReflector = arguments[1] !== (void 0) ? arguments[1] : null;
- this._lexer = lexer;
+ this._lexer = _lexer;
this._reflector = isPresent(providedReflector) ? providedReflector : reflector;
}, {
parseAction: function(input, location) {
var tokens = this._lexer.tokenize(input);
var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain();
@@ -20273,17 +24048,14 @@
parseBinding: function(input, location) {
var tokens = this._lexer.tokenize(input);
var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain();
return new ASTWithSource(ast, input, location);
},
- addPipes: function(bindingAst, pipes) {
- if (ListWrapper.isEmpty(pipes))
- return bindingAst;
- var res = ListWrapper.reduce(pipes, (function(result, currentPipeName) {
- return new Pipe(result, currentPipeName, [], false);
- }), bindingAst.ast);
- return new ASTWithSource(res, bindingAst.source, bindingAst.location);
+ parseSimpleBinding: function(input, location) {
+ var tokens = this._lexer.tokenize(input);
+ var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding();
+ return new ASTWithSource(ast, input, location);
},
parseTemplateBindings: function(input, location) {
var tokens = this._lexer.tokenize(input);
return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings();
},
@@ -20295,15 +24067,15 @@
var strings = [];
var expressions = [];
for (var i = 0; i < parts.length; i++) {
var part = parts[i];
if (i % 2 === 0) {
- ListWrapper.push(strings, part);
+ strings.push(part);
} else {
var tokens = this._lexer.tokenize(part);
var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain();
- ListWrapper.push(expressions, ast);
+ expressions.push(ast);
}
}
return new ASTWithSource(new Interpolation(strings, expressions), input, location);
},
wrapLiteralPrimitive: function(input, location) {
@@ -20390,11 +24162,11 @@
},
parseChain: function() {
var exprs = [];
while (this.index < this.tokens.length) {
var expr = this.parsePipe();
- ListWrapper.push(exprs, expr);
+ exprs.push(expr);
if (this.optionalCharacter($SEMICOLON)) {
if (!this.parseAction) {
this.error("Binding expression cannot contain chained expression");
}
while (this.optionalCharacter($SEMICOLON)) {}
@@ -20406,17 +24178,33 @@
return new EmptyExpr();
if (exprs.length == 1)
return exprs[0];
return new Chain(exprs);
},
+ parseSimpleBinding: function() {
+ var ast = this.parseChain();
+ if (!SimpleExpressionChecker.check(ast)) {
+ this.error("Simple binding expression can only contain field access and constants'");
+ }
+ return ast;
+ },
parsePipe: function() {
var result = this.parseExpression();
if (this.optionalOperator("|")) {
- return this.parseInlinedPipe(result);
- } else {
- return result;
+ if (this.parseAction) {
+ this.error("Cannot have a pipe in an action expression");
+ }
+ do {
+ var name = this.expectIdentifierOrKeyword();
+ var args = [];
+ while (this.optionalCharacter($COLON)) {
+ args.push(this.parsePipe());
+ }
+ result = new BindingPipe(result, name, args);
+ } while (this.optionalOperator("|"));
}
+ return result;
},
parseExpression: function() {
var start = this.inputIndex;
var result = this.parseConditional();
while (this.next.isOperator('=')) {
@@ -20435,17 +24223,17 @@
},
parseConditional: function() {
var start = this.inputIndex;
var result = this.parseLogicalOr();
if (this.optionalOperator('?')) {
- var yes = this.parseExpression();
+ var yes = this.parsePipe();
if (!this.optionalCharacter($COLON)) {
var end = this.inputIndex;
var expression = this.input.substring(start, end);
this.error(("Conditional expression " + expression + " requires all 3 expressions"));
}
- var no = this.parseExpression();
+ var no = this.parsePipe();
return new Conditional(result, yes, no);
} else {
return result;
}
},
@@ -20534,13 +24322,15 @@
},
parseCallChain: function() {
var result = this.parsePrimary();
while (true) {
if (this.optionalCharacter($PERIOD)) {
- result = this.parseAccessMemberOrMethodCall(result);
+ result = this.parseAccessMemberOrMethodCall(result, false);
+ } else if (this.optionalOperator('?.')) {
+ result = this.parseAccessMemberOrMethodCall(result, true);
} else if (this.optionalCharacter($LBRACKET)) {
- var key = this.parseExpression();
+ var key = this.parsePipe();
this.expectCharacter($RBRACKET);
result = new KeyedAccess(result, key);
} else if (this.optionalCharacter($LPAREN)) {
var args = this.parseCallArguments();
this.expectCharacter($RPAREN);
@@ -20562,18 +24352,30 @@
this.advance();
return new LiteralPrimitive(true);
} else if (this.next.isKeywordFalse()) {
this.advance();
return new LiteralPrimitive(false);
+ } else if (this.parseAction && this.next.isKeywordIf()) {
+ this.advance();
+ this.expectCharacter($LPAREN);
+ var condition = this.parseExpression();
+ this.expectCharacter($RPAREN);
+ var ifExp = this.parseExpressionOrBlock();
+ var elseExp;
+ if (this.next.isKeywordElse()) {
+ this.advance();
+ elseExp = this.parseExpressionOrBlock();
+ }
+ return new If(condition, ifExp, elseExp);
} else if (this.optionalCharacter($LBRACKET)) {
var elements = this.parseExpressionList($RBRACKET);
this.expectCharacter($RBRACKET);
return new LiteralArray(elements);
} else if (this.next.isCharacter($LBRACE)) {
return this.parseLiteralMap();
} else if (this.next.isIdentifier()) {
- return this.parseAccessMemberOrMethodCall(_implicitReceiver);
+ return this.parseAccessMemberOrMethodCall(_implicitReceiver, false);
} else if (this.next.isNumber()) {
var value = this.next.toNumber();
this.advance();
return new LiteralPrimitive(value);
} else if (this.next.isString()) {
@@ -20588,11 +24390,11 @@
},
parseExpressionList: function(terminator) {
var result = [];
if (!this.next.isCharacter(terminator)) {
do {
- ListWrapper.push(result, this.parseExpression());
+ result.push(this.parsePipe());
} while (this.optionalCharacter($COMMA));
}
return result;
},
parseLiteralMap: function() {
@@ -20600,59 +24402,67 @@
var values = [];
this.expectCharacter($LBRACE);
if (!this.optionalCharacter($RBRACE)) {
do {
var key = this.expectIdentifierOrKeywordOrString();
- ListWrapper.push(keys, key);
+ keys.push(key);
this.expectCharacter($COLON);
- ListWrapper.push(values, this.parseExpression());
+ values.push(this.parsePipe());
} while (this.optionalCharacter($COMMA));
this.expectCharacter($RBRACE);
}
return new LiteralMap(keys, values);
},
parseAccessMemberOrMethodCall: function(receiver) {
+ var isSafe = arguments[1] !== (void 0) ? arguments[1] : false;
var id = this.expectIdentifierOrKeyword();
if (this.optionalCharacter($LPAREN)) {
var args = this.parseCallArguments();
this.expectCharacter($RPAREN);
var fn = this.reflector.method(id);
- return new MethodCall(receiver, id, fn, args);
+ return isSafe ? new SafeMethodCall(receiver, id, fn, args) : new MethodCall(receiver, id, fn, args);
} else {
var getter = this.reflector.getter(id);
var setter = this.reflector.setter(id);
- var am = new AccessMember(receiver, id, getter, setter);
- if (this.optionalOperator("|")) {
- return this.parseInlinedPipe(am);
- } else {
- return am;
- }
+ return isSafe ? new SafeAccessMember(receiver, id, getter, setter) : new AccessMember(receiver, id, getter, setter);
}
},
- parseInlinedPipe: function(result) {
- do {
- if (this.parseAction) {
- this.error("Cannot have a pipe in an action expression");
- }
- var name = this.expectIdentifierOrKeyword();
- var args = ListWrapper.create();
- while (this.optionalCharacter($COLON)) {
- ListWrapper.push(args, this.parseExpression());
- }
- result = new Pipe(result, name, args, true);
- } while (this.optionalOperator("|"));
- return result;
- },
parseCallArguments: function() {
if (this.next.isCharacter($RPAREN))
return [];
var positionals = [];
do {
- ListWrapper.push(positionals, this.parseExpression());
+ positionals.push(this.parsePipe());
} while (this.optionalCharacter($COMMA));
return positionals;
},
+ parseExpressionOrBlock: function() {
+ if (this.optionalCharacter($LBRACE)) {
+ var block = this.parseBlockContent();
+ this.expectCharacter($RBRACE);
+ return block;
+ }
+ return this.parseExpression();
+ },
+ parseBlockContent: function() {
+ if (!this.parseAction) {
+ this.error("Binding expression cannot contain chained expression");
+ }
+ var exprs = [];
+ while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
+ var expr = this.parseExpression();
+ exprs.push(expr);
+ if (this.optionalCharacter($SEMICOLON)) {
+ while (this.optionalCharacter($SEMICOLON)) {}
+ }
+ }
+ if (exprs.length == 0)
+ return new EmptyExpr();
+ if (exprs.length == 1)
+ return exprs[0];
+ return new Chain(exprs);
+ },
expectTemplateBindingKey: function() {
var result = '';
var operatorFound = false;
do {
result += this.expectIdentifierOrKeywordOrString();
@@ -20677,25 +24487,23 @@
}
}
this.optionalCharacter($COLON);
var name = null;
var expression = null;
- if (this.next !== EOF) {
- if (keyIsVar) {
- if (this.optionalOperator("=")) {
- name = this.expectTemplateBindingKey();
- } else {
- name = '\$implicit';
- }
- } else if (!this.peekKeywordVar()) {
- var start = this.inputIndex;
- var ast = this.parsePipe();
- var source = this.input.substring(start, this.inputIndex);
- expression = new ASTWithSource(ast, source, this.location);
+ if (keyIsVar) {
+ if (this.optionalOperator("=")) {
+ name = this.expectTemplateBindingKey();
+ } else {
+ name = '\$implicit';
}
+ } else if (this.next !== EOF && !this.peekKeywordVar()) {
+ var start = this.inputIndex;
+ var ast = this.parsePipe();
+ var source = this.input.substring(start, this.inputIndex);
+ expression = new ASTWithSource(ast, source, this.location);
}
- ListWrapper.push(bindings, new TemplateBinding(key, keyIsVar, name, expression));
+ bindings.push(new TemplateBinding(key, keyIsVar, name, expression));
if (!this.optionalCharacter($SEMICOLON)) {
this.optionalCharacter($COMMA);
}
}
return bindings;
@@ -20707,42 +24515,95 @@
var location = (index < this.tokens.length) ? ("at column " + (this.tokens[index].index + 1) + " in") : "at the end of the expression";
throw new BaseException(("Parser Error: " + message + " " + location + " [" + this.input + "] in " + this.location));
}
}, {});
}());
+ SimpleExpressionChecker = (function() {
+ function SimpleExpressionChecker() {
+ this.simple = true;
+ }
+ return ($traceurRuntime.createClass)(SimpleExpressionChecker, {
+ visitImplicitReceiver: function(ast) {},
+ visitInterpolation: function(ast) {
+ this.simple = false;
+ },
+ visitLiteralPrimitive: function(ast) {},
+ visitAccessMember: function(ast) {},
+ visitSafeAccessMember: function(ast) {
+ this.simple = false;
+ },
+ visitMethodCall: function(ast) {
+ this.simple = false;
+ },
+ visitSafeMethodCall: function(ast) {
+ this.simple = false;
+ },
+ visitFunctionCall: function(ast) {
+ this.simple = false;
+ },
+ visitLiteralArray: function(ast) {
+ this.visitAll(ast.expressions);
+ },
+ visitLiteralMap: function(ast) {
+ this.visitAll(ast.values);
+ },
+ visitBinary: function(ast) {
+ this.simple = false;
+ },
+ visitPrefixNot: function(ast) {
+ this.simple = false;
+ },
+ visitConditional: function(ast) {
+ this.simple = false;
+ },
+ visitPipe: function(ast) {
+ this.simple = false;
+ },
+ visitKeyedAccess: function(ast) {
+ this.simple = false;
+ },
+ visitAll: function(asts) {
+ var res = ListWrapper.createFixedSize(asts.length);
+ for (var i = 0; i < asts.length; ++i) {
+ res[i] = asts[i].visit(this);
+ }
+ return res;
+ },
+ visitChain: function(ast) {
+ this.simple = false;
+ },
+ visitAssignment: function(ast) {
+ this.simple = false;
+ },
+ visitIf: function(ast) {
+ this.simple = false;
+ }
+ }, {check: function(ast) {
+ var s = new SimpleExpressionChecker();
+ ast.visit(s);
+ return s.simple;
+ }});
+ }());
}
};
});
-System.register("angular2/src/change_detection/proto_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/interfaces", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/change_detection_jit_generator", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_record"], function($__export) {
+System.register("angular2/src/change_detection/proto_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_record"], function($__export) {
"use strict";
var __moduleName = "angular2/src/change_detection/proto_change_detector";
var BaseException,
isPresent,
isString,
ListWrapper,
ImplicitReceiver,
- ProtoChangeDetector,
ChangeDetectionUtil,
DynamicChangeDetector,
- ChangeDetectorJITGenerator,
DirectiveIndex,
coalesce,
ProtoRecord,
- RECORD_TYPE_PROPERTY,
- RECORD_TYPE_LOCAL,
- RECORD_TYPE_INVOKE_METHOD,
- RECORD_TYPE_CONST,
- RECORD_TYPE_INVOKE_CLOSURE,
- RECORD_TYPE_PRIMITIVE_OP,
- RECORD_TYPE_KEYED_ACCESS,
- RECORD_TYPE_PIPE,
- RECORD_TYPE_BINDING_PIPE,
- RECORD_TYPE_INTERPOLATE,
+ RecordType,
DynamicProtoChangeDetector,
- _jitProtoChangeDetectorClassCounter,
- JitProtoChangeDetector,
ProtoRecordBuilder,
_ConvertAstIntoProtoRecords;
function _arrayFn(length) {
switch (length) {
case 0:
@@ -20911,99 +24772,70 @@
}, function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
ImplicitReceiver = $__m.ImplicitReceiver;
}, function($__m) {
- ProtoChangeDetector = $__m.ProtoChangeDetector;
- }, function($__m) {
ChangeDetectionUtil = $__m.ChangeDetectionUtil;
}, function($__m) {
DynamicChangeDetector = $__m.DynamicChangeDetector;
}, function($__m) {
- ChangeDetectorJITGenerator = $__m.ChangeDetectorJITGenerator;
- }, function($__m) {
DirectiveIndex = $__m.DirectiveIndex;
}, function($__m) {
coalesce = $__m.coalesce;
}, function($__m) {
ProtoRecord = $__m.ProtoRecord;
- RECORD_TYPE_PROPERTY = $__m.RECORD_TYPE_PROPERTY;
- RECORD_TYPE_LOCAL = $__m.RECORD_TYPE_LOCAL;
- RECORD_TYPE_INVOKE_METHOD = $__m.RECORD_TYPE_INVOKE_METHOD;
- RECORD_TYPE_CONST = $__m.RECORD_TYPE_CONST;
- RECORD_TYPE_INVOKE_CLOSURE = $__m.RECORD_TYPE_INVOKE_CLOSURE;
- RECORD_TYPE_PRIMITIVE_OP = $__m.RECORD_TYPE_PRIMITIVE_OP;
- RECORD_TYPE_KEYED_ACCESS = $__m.RECORD_TYPE_KEYED_ACCESS;
- RECORD_TYPE_PIPE = $__m.RECORD_TYPE_PIPE;
- RECORD_TYPE_BINDING_PIPE = $__m.RECORD_TYPE_BINDING_PIPE;
- RECORD_TYPE_INTERPOLATE = $__m.RECORD_TYPE_INTERPOLATE;
+ RecordType = $__m.RecordType;
}],
execute: function() {
- DynamicProtoChangeDetector = (function($__super) {
+ DynamicProtoChangeDetector = (function() {
function DynamicProtoChangeDetector(_pipeRegistry, definition) {
- $traceurRuntime.superConstructor(DynamicProtoChangeDetector).call(this);
this._pipeRegistry = _pipeRegistry;
this.definition = definition;
this._records = this._createRecords(definition);
}
return ($traceurRuntime.createClass)(DynamicProtoChangeDetector, {
instantiate: function(dispatcher) {
- return new DynamicChangeDetector(this.definition.strategy, dispatcher, this._pipeRegistry, this._records, this.definition.directiveRecords);
+ return new DynamicChangeDetector(this.definition.id, this.definition.strategy, dispatcher, this._pipeRegistry, this._records, this.definition.directiveRecords);
},
_createRecords: function(definition) {
var recordBuilder = new ProtoRecordBuilder();
ListWrapper.forEach(definition.bindingRecords, (function(b) {
- recordBuilder.addAst(b, definition.variableNames);
+ recordBuilder.add(b, definition.variableNames);
}));
return coalesce(recordBuilder.records);
}
- }, {}, $__super);
- }(ProtoChangeDetector));
+ }, {});
+ }());
$__export("DynamicProtoChangeDetector", DynamicProtoChangeDetector);
- _jitProtoChangeDetectorClassCounter = 0;
- JitProtoChangeDetector = (function($__super) {
- function JitProtoChangeDetector(_pipeRegistry, definition) {
- $traceurRuntime.superConstructor(JitProtoChangeDetector).call(this);
- this._pipeRegistry = _pipeRegistry;
- this.definition = definition;
- this._factory = this._createFactory(definition);
- }
- return ($traceurRuntime.createClass)(JitProtoChangeDetector, {
- instantiate: function(dispatcher) {
- return this._factory(dispatcher, this._pipeRegistry);
- },
- _createFactory: function(definition) {
- var recordBuilder = new ProtoRecordBuilder();
- ListWrapper.forEach(definition.bindingRecords, (function(b) {
- recordBuilder.addAst(b, definition.variableNames);
- }));
- var c = _jitProtoChangeDetectorClassCounter++;
- var records = coalesce(recordBuilder.records);
- var typeName = ("ChangeDetector" + c);
- return new ChangeDetectorJITGenerator(typeName, definition.strategy, records, this.definition.directiveRecords).generate();
- }
- }, {}, $__super);
- }(ProtoChangeDetector));
- $__export("JitProtoChangeDetector", JitProtoChangeDetector);
ProtoRecordBuilder = (function() {
function ProtoRecordBuilder() {
this.records = [];
}
- return ($traceurRuntime.createClass)(ProtoRecordBuilder, {addAst: function(b) {
+ return ($traceurRuntime.createClass)(ProtoRecordBuilder, {
+ add: function(b) {
var variableNames = arguments[1] !== (void 0) ? arguments[1] : null;
var oldLast = ListWrapper.last(this.records);
if (isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) {
oldLast.lastInDirective = false;
}
- _ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
+ this._appendRecords(b, variableNames);
var newLast = ListWrapper.last(this.records);
if (isPresent(newLast) && newLast !== oldLast) {
newLast.lastInBinding = true;
newLast.lastInDirective = true;
}
- }}, {});
+ },
+ _appendRecords: function(b, variableNames) {
+ if (b.isDirectiveLifecycle()) {
+ this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, null, false, false));
+ } else {
+ _ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
+ }
+ }
+ }, {});
}());
+ $__export("ProtoRecordBuilder", ProtoRecordBuilder);
_ConvertAstIntoProtoRecords = (function() {
function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _expressionAsString, _variableNames) {
this._records = _records;
this._bindingRecord = _bindingRecord;
this._expressionAsString = _expressionAsString;
@@ -21013,83 +24845,100 @@
visitImplicitReceiver: function(ast) {
return this._bindingRecord.implicitReceiver;
},
visitInterpolation: function(ast) {
var args = this._visitAll(ast.expressions);
- return this._addRecord(RECORD_TYPE_INTERPOLATE, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0);
+ return this._addRecord(RecordType.INTERPOLATE, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0);
},
visitLiteralPrimitive: function(ast) {
- return this._addRecord(RECORD_TYPE_CONST, "literal", ast.value, [], null, 0);
+ return this._addRecord(RecordType.CONST, "literal", ast.value, [], null, 0);
},
visitAccessMember: function(ast) {
var receiver = ast.receiver.visit(this);
if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ImplicitReceiver) {
- return this._addRecord(RECORD_TYPE_LOCAL, ast.name, ast.name, [], null, receiver);
+ return this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver);
} else {
- return this._addRecord(RECORD_TYPE_PROPERTY, ast.name, ast.getter, [], null, receiver);
+ return this._addRecord(RecordType.PROPERTY, ast.name, ast.getter, [], null, receiver);
}
},
+ visitSafeAccessMember: function(ast) {
+ var receiver = ast.receiver.visit(this);
+ return this._addRecord(RecordType.SAFE_PROPERTY, ast.name, ast.getter, [], null, receiver);
+ },
visitMethodCall: function(ast) {
var receiver = ast.receiver.visit(this);
var args = this._visitAll(ast.args);
if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name)) {
- var target = this._addRecord(RECORD_TYPE_LOCAL, ast.name, ast.name, [], null, receiver);
- return this._addRecord(RECORD_TYPE_INVOKE_CLOSURE, "closure", null, args, null, target);
+ var target = this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver);
+ return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target);
} else {
- return this._addRecord(RECORD_TYPE_INVOKE_METHOD, ast.name, ast.fn, args, null, receiver);
+ return this._addRecord(RecordType.INVOKE_METHOD, ast.name, ast.fn, args, null, receiver);
}
},
+ visitSafeMethodCall: function(ast) {
+ var receiver = ast.receiver.visit(this);
+ var args = this._visitAll(ast.args);
+ return this._addRecord(RecordType.SAFE_INVOKE_METHOD, ast.name, ast.fn, args, null, receiver);
+ },
visitFunctionCall: function(ast) {
var target = ast.target.visit(this);
var args = this._visitAll(ast.args);
- return this._addRecord(RECORD_TYPE_INVOKE_CLOSURE, "closure", null, args, null, target);
+ return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target);
},
visitLiteralArray: function(ast) {
var primitiveName = ("arrayFn" + ast.expressions.length);
- return this._addRecord(RECORD_TYPE_PRIMITIVE_OP, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0);
+ return this._addRecord(RecordType.PRIMITIVE_OP, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0);
},
visitLiteralMap: function(ast) {
- return this._addRecord(RECORD_TYPE_PRIMITIVE_OP, _mapPrimitiveName(ast.keys), ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0);
+ return this._addRecord(RecordType.PRIMITIVE_OP, _mapPrimitiveName(ast.keys), ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0);
},
visitBinary: function(ast) {
var left = ast.left.visit(this);
var right = ast.right.visit(this);
- return this._addRecord(RECORD_TYPE_PRIMITIVE_OP, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0);
+ return this._addRecord(RecordType.PRIMITIVE_OP, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0);
},
visitPrefixNot: function(ast) {
var exp = ast.expression.visit(this);
- return this._addRecord(RECORD_TYPE_PRIMITIVE_OP, "operation_negate", ChangeDetectionUtil.operation_negate, [exp], null, 0);
+ return this._addRecord(RecordType.PRIMITIVE_OP, "operation_negate", ChangeDetectionUtil.operation_negate, [exp], null, 0);
},
visitConditional: function(ast) {
var c = ast.condition.visit(this);
var t = ast.trueExp.visit(this);
var f = ast.falseExp.visit(this);
- return this._addRecord(RECORD_TYPE_PRIMITIVE_OP, "cond", ChangeDetectionUtil.cond, [c, t, f], null, 0);
+ return this._addRecord(RecordType.PRIMITIVE_OP, "cond", ChangeDetectionUtil.cond, [c, t, f], null, 0);
},
visitPipe: function(ast) {
var value = ast.exp.visit(this);
- var type = ast.inBinding ? RECORD_TYPE_BINDING_PIPE : RECORD_TYPE_PIPE;
- return this._addRecord(type, ast.name, ast.name, [], null, value);
+ return this._addRecord(RecordType.PIPE, ast.name, ast.name, [], null, value);
},
visitKeyedAccess: function(ast) {
var obj = ast.obj.visit(this);
var key = ast.key.visit(this);
- return this._addRecord(RECORD_TYPE_KEYED_ACCESS, "keyedAccess", ChangeDetectionUtil.keyedAccess, [key], null, obj);
+ return this._addRecord(RecordType.KEYED_ACCESS, "keyedAccess", ChangeDetectionUtil.keyedAccess, [key], null, obj);
},
+ visitAssignment: function(ast) {
+ throw new BaseException('Not supported');
+ },
+ visitChain: function(ast) {
+ throw new BaseException('Not supported');
+ },
+ visitIf: function(ast) {
+ throw new BaseException('Not supported');
+ },
_visitAll: function(asts) {
var res = ListWrapper.createFixedSize(asts.length);
for (var i = 0; i < asts.length; ++i) {
res[i] = asts[i].visit(this);
}
return res;
},
_addRecord: function(type, name, funcOrValue, args, fixedArgs, context) {
var selfIndex = this._records.length + 1;
if (context instanceof DirectiveIndex) {
- ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, this._expressionAsString, false, false));
+ this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, this._expressionAsString, false, false));
} else {
- ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, this._expressionAsString, false, false));
+ this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, this._expressionAsString, false, false));
}
return selfIndex;
}
}, {append: function(records, b, variableNames) {
var c = new _ConvertAstIntoProtoRecords(records, b, b.ast.toString(), variableNames);
@@ -21098,167 +24947,15 @@
}());
}
};
});
-System.register("angular2/src/change_detection/change_detection", ["angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/pipes/pipe_registry", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/change_detection/pipes/keyvalue_changes", "angular2/src/change_detection/pipes/observable_pipe", "angular2/src/change_detection/pipes/promise_pipe", "angular2/src/change_detection/pipes/uppercase_pipe", "angular2/src/change_detection/pipes/lowercase_pipe", "angular2/src/change_detection/pipes/json_pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/interfaces", "angular2/src/di/decorators", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
- "use strict";
- var __moduleName = "angular2/src/change_detection/change_detection";
- var __decorate,
- __metadata,
- DynamicProtoChangeDetector,
- JitProtoChangeDetector,
- PipeRegistry,
- IterableChangesFactory,
- KeyValueChangesFactory,
- ObservablePipeFactory,
- PromisePipeFactory,
- UpperCaseFactory,
- LowerCaseFactory,
- JsonPipeFactory,
- NullPipeFactory,
- ChangeDetection,
- Injectable,
- StringMapWrapper,
- isPresent,
- keyValDiff,
- iterableDiff,
- async,
- uppercase,
- lowercase,
- json,
- defaultPipes,
- preGeneratedProtoDetectors,
- PreGeneratedChangeDetection,
- DynamicChangeDetection,
- JitChangeDetection,
- defaultPipeRegistry;
- return {
- setters: [function($__m) {
- DynamicProtoChangeDetector = $__m.DynamicProtoChangeDetector;
- JitProtoChangeDetector = $__m.JitProtoChangeDetector;
- }, function($__m) {
- PipeRegistry = $__m.PipeRegistry;
- }, function($__m) {
- IterableChangesFactory = $__m.IterableChangesFactory;
- }, function($__m) {
- KeyValueChangesFactory = $__m.KeyValueChangesFactory;
- }, function($__m) {
- ObservablePipeFactory = $__m.ObservablePipeFactory;
- }, function($__m) {
- PromisePipeFactory = $__m.PromisePipeFactory;
- }, function($__m) {
- UpperCaseFactory = $__m.UpperCaseFactory;
- }, function($__m) {
- LowerCaseFactory = $__m.LowerCaseFactory;
- }, function($__m) {
- JsonPipeFactory = $__m.JsonPipeFactory;
- }, function($__m) {
- NullPipeFactory = $__m.NullPipeFactory;
- }, function($__m) {
- ChangeDetection = $__m.ChangeDetection;
- }, function($__m) {
- Injectable = $__m.Injectable;
- }, function($__m) {
- StringMapWrapper = $__m.StringMapWrapper;
- }, function($__m) {
- isPresent = $__m.isPresent;
- }],
- execute: function() {
- __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
- return Reflect.decorate(decorators, target, key, desc);
- switch (arguments.length) {
- case 2:
- return decorators.reduceRight(function(o, d) {
- return (d && d(o)) || o;
- }, target);
- case 3:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key)), void 0;
- }, void 0);
- case 4:
- return decorators.reduceRight(function(o, d) {
- return (d && d(target, key, o)) || o;
- }, desc);
- }
- };
- __metadata = (this && this.__metadata) || function(k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
- return Reflect.metadata(k, v);
- };
- keyValDiff = [new KeyValueChangesFactory(), new NullPipeFactory()];
- $__export("keyValDiff", keyValDiff);
- iterableDiff = [new IterableChangesFactory(), new NullPipeFactory()];
- $__export("iterableDiff", iterableDiff);
- async = [new ObservablePipeFactory(), new PromisePipeFactory(), new NullPipeFactory()];
- $__export("async", async);
- uppercase = [new UpperCaseFactory(), new NullPipeFactory()];
- $__export("uppercase", uppercase);
- lowercase = [new LowerCaseFactory(), new NullPipeFactory()];
- $__export("lowercase", lowercase);
- json = [new JsonPipeFactory(), new NullPipeFactory()];
- $__export("json", json);
- defaultPipes = {
- "iterableDiff": iterableDiff,
- "keyValDiff": keyValDiff,
- "async": async,
- "uppercase": uppercase,
- "lowercase": lowercase,
- "json": json
- };
- $__export("defaultPipes", defaultPipes);
- preGeneratedProtoDetectors = {};
- $__export("preGeneratedProtoDetectors", preGeneratedProtoDetectors);
- PreGeneratedChangeDetection = (function($__super) {
- function PreGeneratedChangeDetection(registry, protoChangeDetectors) {
- $traceurRuntime.superConstructor(PreGeneratedChangeDetection).call(this);
- this.registry = registry;
- this._dynamicChangeDetection = new DynamicChangeDetection(registry);
- this._protoChangeDetectorFactories = isPresent(protoChangeDetectors) ? protoChangeDetectors : preGeneratedProtoDetectors;
- }
- return ($traceurRuntime.createClass)(PreGeneratedChangeDetection, {createProtoChangeDetector: function(definition) {
- var id = definition.id;
- if (StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) {
- return StringMapWrapper.get(this._protoChangeDetectorFactories, id)(this.registry);
- }
- return this._dynamicChangeDetection.createProtoChangeDetector(definition);
- }}, {}, $__super);
- }(ChangeDetection));
- $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection);
- DynamicChangeDetection = (function($__super) {
- function $__0(registry) {
- $traceurRuntime.superConstructor($__0).call(this);
- this.registry = registry;
- }
- return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) {
- return new DynamicProtoChangeDetector(this.registry, definition);
- }}, {}, $__super);
- }(ChangeDetection));
- $__export("DynamicChangeDetection", DynamicChangeDetection);
- $__export("DynamicChangeDetection", DynamicChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [PipeRegistry])], DynamicChangeDetection));
- JitChangeDetection = (function($__super) {
- function $__0(registry) {
- $traceurRuntime.superConstructor($__0).call(this);
- this.registry = registry;
- }
- return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) {
- return new JitProtoChangeDetector(this.registry, definition);
- }}, {}, $__super);
- }(ChangeDetection));
- $__export("JitChangeDetection", JitChangeDetection);
- $__export("JitChangeDetection", JitChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [PipeRegistry])], JitChangeDetection));
- defaultPipeRegistry = new PipeRegistry(defaultPipes);
- $__export("defaultPipeRegistry", defaultPipeRegistry);
- }
- };
-});
-
System.register("angular2/src/di/injector", ["angular2/src/facade/collection", "angular2/src/di/binding", "angular2/src/di/exceptions", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/di/key", "angular2/src/di/forward_ref"], function($__export) {
"use strict";
var __moduleName = "angular2/src/di/injector";
- var List,
+ var Map,
+ List,
MapWrapper,
ListWrapper,
ResolvedBinding,
Binding,
BindingBuilder,
@@ -21271,10 +24968,11 @@
InvalidBindingError,
FunctionWrapper,
Type,
isPresent,
isBlank,
+ CONST_EXPR,
PromiseWrapper,
Key,
resolveForwardRef,
_constructing,
_notFound,
@@ -21306,14 +25004,14 @@
resolvedList[i] = resolved;
}
return resolvedList;
}
function flattenBindings(bindings) {
- var map = _flattenBindings(bindings, MapWrapper.create());
- var res = ListWrapper.create();
+ var map = _flattenBindings(bindings, new Map());
+ var res = [];
MapWrapper.forEach(map, (function(binding, keyId) {
- return ListWrapper.push(res, binding);
+ return res.push(binding);
}));
return res;
}
function _createListOfBindings(flattenedBindings) {
var bindings = ListWrapper.createFixedSize(Key.numberOfKeys + 1);
@@ -21323,20 +25021,21 @@
return bindings;
}
function _flattenBindings(bindings, res) {
ListWrapper.forEach(bindings, function(b) {
if (b instanceof ResolvedBinding) {
- MapWrapper.set(res, b.key.id, b);
+ res.set(b.key.id, b);
} else if (b instanceof List) {
_flattenBindings(b, res);
}
});
return res;
}
$__export("resolveBindings", resolveBindings);
return {
setters: [function($__m) {
+ Map = $__m.Map;
List = $__m.List;
MapWrapper = $__m.MapWrapper;
ListWrapper = $__m.ListWrapper;
}, function($__m) {
ResolvedBinding = $__m.ResolvedBinding;
@@ -21353,32 +25052,33 @@
}, function($__m) {
FunctionWrapper = $__m.FunctionWrapper;
Type = $__m.Type;
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
+ CONST_EXPR = $__m.CONST_EXPR;
}, function($__m) {
PromiseWrapper = $__m.PromiseWrapper;
}, function($__m) {
Key = $__m.Key;
}, function($__m) {
resolveForwardRef = $__m.resolveForwardRef;
}],
execute: function() {
- _constructing = new Object();
- _notFound = new Object();
+ _constructing = CONST_EXPR(new Object());
+ _notFound = CONST_EXPR(new Object());
_Waiting = (function() {
function _Waiting(promise) {
this.promise = promise;
}
return ($traceurRuntime.createClass)(_Waiting, {}, {});
}());
Injector = (function() {
- function Injector(bindings, parent, defaultBindings) {
- this._bindings = bindings;
+ function Injector(_bindings, _parent, _defaultBindings) {
+ this._bindings = _bindings;
+ this._parent = _parent;
+ this._defaultBindings = _defaultBindings;
this._instances = this._createInstances();
- this._parent = parent;
- this._defaultBindings = defaultBindings;
this._asyncStrategy = new _AsyncInjectorStrategy(this);
this._syncStrategy = new _SyncInjectorStrategy(this);
}
return ($traceurRuntime.createClass)(Injector, {
get parent() {
@@ -21463,11 +25163,11 @@
this._setInstance(key, null);
}
}, {
resolve: function(bindings) {
var resolvedBindings = resolveBindings(bindings);
- var flatten = _flattenBindings(resolvedBindings, MapWrapper.create());
+ var flatten = _flattenBindings(resolvedBindings, new Map());
return _createListOfBindings(flatten);
},
resolveAndCreate: function(bindings) {
var $__3;
var $__2 = arguments[1] !== (void 0) ? arguments[1] : {},
@@ -21482,59 +25182,59 @@
}
});
}());
$__export("Injector", Injector);
_SyncInjectorStrategy = (function() {
- function _SyncInjectorStrategy(injector) {
- this.injector = injector;
+ function _SyncInjectorStrategy(_injector) {
+ this._injector = _injector;
}
return ($traceurRuntime.createClass)(_SyncInjectorStrategy, {
readFromCache: function(key) {
if (key.token === Injector) {
- return this.injector;
+ return this._injector;
}
- var instance = this.injector._getInstance(key);
+ var instance = this._injector._getInstance(key);
if (instance === _constructing) {
throw new CyclicDependencyError(key);
} else if (isPresent(instance) && !_isWaiting(instance)) {
return instance;
} else {
return _notFound;
}
},
instantiate: function(key) {
- var binding = this.injector._getBinding(key);
+ var binding = this._injector._getBinding(key);
if (isBlank(binding))
return _notFound;
if (binding.providedAsPromise)
throw new AsyncBindingError(key);
- this.injector._markAsConstructing(key);
- var deps = this.injector._resolveDependencies(key, binding, false);
+ this._injector._markAsConstructing(key);
+ var deps = this._injector._resolveDependencies(key, binding, false);
return this._createInstance(key, binding, deps);
},
_createInstance: function(key, binding, deps) {
try {
var instance = FunctionWrapper.apply(binding.factory, deps);
- this.injector._setInstance(key, instance);
+ this._injector._setInstance(key, instance);
return instance;
} catch (e) {
- this.injector._clear(key);
+ this._injector._clear(key);
throw new InstantiationError(e, key);
}
}
}, {});
}());
_AsyncInjectorStrategy = (function() {
- function _AsyncInjectorStrategy(injector) {
- this.injector = injector;
+ function _AsyncInjectorStrategy(_injector) {
+ this._injector = _injector;
}
return ($traceurRuntime.createClass)(_AsyncInjectorStrategy, {
readFromCache: function(key) {
if (key.token === Injector) {
- return PromiseWrapper.resolve(this.injector);
+ return PromiseWrapper.resolve(this._injector);
}
- var instance = this.injector._getInstance(key);
+ var instance = this._injector._getInstance(key);
if (instance === _constructing) {
throw new CyclicDependencyError(key);
} else if (_isWaiting(instance)) {
return instance.promise;
} else if (isPresent(instance)) {
@@ -21543,85 +25243,86 @@
return _notFound;
}
},
instantiate: function(key) {
var $__0 = this;
- var binding = this.injector._getBinding(key);
+ var binding = this._injector._getBinding(key);
if (isBlank(binding))
return _notFound;
- this.injector._markAsConstructing(key);
- var deps = this.injector._resolveDependencies(key, binding, true);
+ this._injector._markAsConstructing(key);
+ var deps = this._injector._resolveDependencies(key, binding, true);
var depsPromise = PromiseWrapper.all(deps);
var promise = PromiseWrapper.then(depsPromise, null, (function(e, s) {
return $__0._errorHandler(key, e, s);
})).then((function(deps) {
return $__0._findOrCreate(key, binding, deps);
})).then((function(instance) {
return $__0._cacheInstance(key, instance);
}));
- this.injector._setInstance(key, new _Waiting(promise));
+ this._injector._setInstance(key, new _Waiting(promise));
return promise;
},
_errorHandler: function(key, e, stack) {
if (e instanceof AbstractBindingError)
e.addKey(key);
return PromiseWrapper.reject(e, stack);
},
_findOrCreate: function(key, binding, deps) {
try {
- var instance = this.injector._getInstance(key);
+ var instance = this._injector._getInstance(key);
if (!_isWaiting(instance))
return instance;
return FunctionWrapper.apply(binding.factory, deps);
} catch (e) {
- this.injector._clear(key);
+ this._injector._clear(key);
throw new InstantiationError(e, key);
}
},
_cacheInstance: function(key, instance) {
- this.injector._setInstance(key, instance);
+ this._injector._setInstance(key, instance);
return instance;
}
}, {});
}());
}
};
});
-System.register("angular2/src/core/compiler/view_manager", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref", "angular2/src/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool"], function($__export) {
+System.register("angular2/src/core/compiler/view_manager", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref", "angular2/src/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/view_manager";
var __decorate,
__metadata,
Injectable,
isPresent,
isBlank,
BaseException,
- ViewRef,
internalView,
internalProtoView,
Renderer,
AppViewManagerUtils,
AppViewPool,
+ AppViewListener,
AppViewManager;
return {
setters: [function($__m) {
Injectable = $__m.Injectable;
}, function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
BaseException = $__m.BaseException;
}, function($__m) {
- ViewRef = $__m.ViewRef;
internalView = $__m.internalView;
internalProtoView = $__m.internalProtoView;
}, function($__m) {
Renderer = $__m.Renderer;
}, function($__m) {
AppViewManagerUtils = $__m.AppViewManagerUtils;
}, function($__m) {
AppViewPool = $__m.AppViewPool;
+ }, function($__m) {
+ AppViewListener = $__m.AppViewListener;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
return Reflect.decorate(decorators, target, key, desc);
@@ -21642,44 +25343,45 @@
};
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
- AppViewManager = (($traceurRuntime.createClass)(function(viewPool, utils, renderer) {
- this._renderer = renderer;
- this._viewPool = viewPool;
- this._utils = utils;
+ AppViewManager = (($traceurRuntime.createClass)(function(_viewPool, _viewListener, _utils, _renderer) {
+ this._viewPool = _viewPool;
+ this._viewListener = _viewListener;
+ this._utils = _utils;
+ this._renderer = _renderer;
}, {
getComponentView: function(hostLocation) {
var hostView = internalView(hostLocation.parentView);
var boundElementIndex = hostLocation.boundElementIndex;
- return new ViewRef(hostView.componentChildViews[boundElementIndex]);
+ return hostView.componentChildViews[boundElementIndex].ref;
},
getViewContainer: function(location) {
var hostView = internalView(location.parentView);
return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef();
},
- getComponent: function(hostLocation) {
+ getHostElement: function(hostViewRef) {
+ return internalView(hostViewRef).elementRefs[0];
+ },
+ getNamedElementInComponentView: function(hostLocation, variableName) {
var hostView = internalView(hostLocation.parentView);
var boundElementIndex = hostLocation.boundElementIndex;
- return this._utils.getComponentInstance(hostView, boundElementIndex);
+ var componentView = hostView.componentChildViews[boundElementIndex];
+ if (isBlank(componentView)) {
+ throw new BaseException(("There is no component directive at element " + boundElementIndex));
+ }
+ var elementIndex = componentView.proto.variableLocations.get(variableName);
+ if (isBlank(elementIndex)) {
+ throw new BaseException(("Could not find variable " + variableName));
+ }
+ return componentView.elementRefs[elementIndex];
},
- createDynamicComponentView: function(hostLocation, componentProtoViewRef, componentBinding, injector) {
- var componentProtoView = internalProtoView(componentProtoViewRef);
+ getComponent: function(hostLocation) {
var hostView = internalView(hostLocation.parentView);
var boundElementIndex = hostLocation.boundElementIndex;
- var binder = hostView.proto.elementBinders[boundElementIndex];
- if (!binder.hasDynamicComponent()) {
- throw new BaseException(("There is no dynamic component directive at element " + boundElementIndex));
- }
- var componentView = this._createPooledView(componentProtoView);
- this._renderer.attachComponentView(hostView.render, boundElementIndex, componentView.render);
- this._utils.attachComponentView(hostView, boundElementIndex, componentView);
- this._utils.hydrateDynamicComponentInElementInjector(hostView, boundElementIndex, componentBinding, injector);
- this._utils.hydrateComponentView(hostView, boundElementIndex);
- this._viewHydrateRecurse(componentView);
- return new ViewRef(componentView);
+ return this._utils.getComponentInstance(hostView, boundElementIndex);
},
createRootHostView: function(hostProtoViewRef, overrideSelector, injector) {
var hostProtoView = internalProtoView(hostProtoViewRef);
var hostElementSelector = overrideSelector;
if (isBlank(hostElementSelector)) {
@@ -21687,33 +25389,21 @@
}
var renderView = this._renderer.createRootHostView(hostProtoView.render, hostElementSelector);
var hostView = this._utils.createView(hostProtoView, renderView, this, this._renderer);
this._renderer.setEventDispatcher(hostView.render, hostView);
this._createViewRecurse(hostView);
+ this._viewListener.viewCreated(hostView);
this._utils.hydrateRootHostView(hostView, injector);
this._viewHydrateRecurse(hostView);
- return new ViewRef(hostView);
+ return hostView.ref;
},
destroyRootHostView: function(hostViewRef) {
var hostView = internalView(hostViewRef);
this._viewDehydrateRecurse(hostView, true);
this._renderer.destroyView(hostView.render);
+ this._viewListener.viewDestroyed(hostView);
},
- createFreeHostView: function(parentComponentLocation, hostProtoViewRef, injector) {
- var hostProtoView = internalProtoView(hostProtoViewRef);
- var hostView = this._createPooledView(hostProtoView);
- var parentComponentHostView = internalView(parentComponentLocation.parentView);
- var parentComponentBoundElementIndex = parentComponentLocation.boundElementIndex;
- this._utils.attachAndHydrateFreeHostView(parentComponentHostView, parentComponentBoundElementIndex, hostView, injector);
- this._viewHydrateRecurse(hostView);
- return new ViewRef(hostView);
- },
- destroyFreeHostView: function(parentComponentLocation, hostViewRef) {
- var hostView = internalView(hostViewRef);
- var parentView = internalView(parentComponentLocation.parentView).componentChildViews[parentComponentLocation.boundElementIndex];
- this._destroyFreeHostView(parentView, hostView);
- },
createViewInContainer: function(viewContainerLocation, atIndex, protoViewRef) {
var context = arguments[3] !== (void 0) ? arguments[3] : null;
var injector = arguments[4] !== (void 0) ? arguments[4] : null;
var protoView = internalProtoView(protoViewRef);
var parentView = internalView(viewContainerLocation.parentView);
@@ -21723,15 +25413,15 @@
if (isPresent(context)) {
contextView = internalView(context.parentView);
contextBoundElementIndex = context.boundElementIndex;
}
var view = this._createPooledView(protoView);
- this._renderer.attachViewInContainer(parentView.render, boundElementIndex, atIndex, view.render);
+ this._renderer.attachViewInContainer(viewContainerLocation, atIndex, view.render);
this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view);
this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, injector);
this._viewHydrateRecurse(view);
- return new ViewRef(view);
+ return view.ref;
},
destroyViewInContainer: function(viewContainerLocation, atIndex) {
var parentView = internalView(viewContainerLocation.parentView);
var boundElementIndex = viewContainerLocation.boundElementIndex;
this._destroyViewInContainer(parentView, boundElementIndex, atIndex);
@@ -21739,65 +25429,64 @@
attachViewInContainer: function(viewContainerLocation, atIndex, viewRef) {
var view = internalView(viewRef);
var parentView = internalView(viewContainerLocation.parentView);
var boundElementIndex = viewContainerLocation.boundElementIndex;
this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view);
- this._renderer.attachViewInContainer(parentView.render, boundElementIndex, atIndex, view.render);
+ this._renderer.attachViewInContainer(viewContainerLocation, atIndex, view.render);
return viewRef;
},
detachViewInContainer: function(viewContainerLocation, atIndex) {
var parentView = internalView(viewContainerLocation.parentView);
var boundElementIndex = viewContainerLocation.boundElementIndex;
var viewContainer = parentView.viewContainers[boundElementIndex];
var view = viewContainer.views[atIndex];
this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex);
- this._renderer.detachViewInContainer(parentView.render, boundElementIndex, atIndex, view.render);
- return new ViewRef(view);
+ this._renderer.detachViewInContainer(viewContainerLocation, atIndex, view.render);
+ return view.ref;
},
_createPooledView: function(protoView) {
var view = this._viewPool.getView(protoView);
if (isBlank(view)) {
view = this._utils.createView(protoView, this._renderer.createView(protoView.render), this, this._renderer);
this._renderer.setEventDispatcher(view.render, view);
this._createViewRecurse(view);
+ this._viewListener.viewCreated(view);
}
return view;
},
_createViewRecurse: function(view) {
var binders = view.proto.elementBinders;
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
var binder = binders[binderIdx];
if (binder.hasStaticComponent()) {
var childView = this._createPooledView(binder.nestedProtoView);
- this._renderer.attachComponentView(view.render, binderIdx, childView.render);
+ this._renderer.attachComponentView(view.elementRefs[binderIdx], childView.render);
this._utils.attachComponentView(view, binderIdx, childView);
}
}
},
_destroyPooledView: function(view) {
- this._viewPool.returnView(view);
+ var wasReturned = this._viewPool.returnView(view);
+ if (!wasReturned) {
+ this._renderer.destroyView(view.render);
+ this._viewListener.viewDestroyed(view);
+ }
},
_destroyViewInContainer: function(parentView, boundElementIndex, atIndex) {
var viewContainer = parentView.viewContainers[boundElementIndex];
var view = viewContainer.views[atIndex];
this._viewDehydrateRecurse(view, false);
this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex);
- this._renderer.detachViewInContainer(parentView.render, boundElementIndex, atIndex, view.render);
+ this._renderer.detachViewInContainer(parentView.elementRefs[boundElementIndex], atIndex, view.render);
this._destroyPooledView(view);
},
_destroyComponentView: function(hostView, boundElementIndex, componentView) {
this._viewDehydrateRecurse(componentView, false);
- this._renderer.detachComponentView(hostView.render, boundElementIndex, componentView.render);
+ this._renderer.detachComponentView(hostView.elementRefs[boundElementIndex], componentView.render);
this._utils.detachComponentView(hostView, boundElementIndex);
this._destroyPooledView(componentView);
},
- _destroyFreeHostView: function(parentView, hostView) {
- this._viewDehydrateRecurse(hostView, true);
- this._renderer.detachFreeHostView(parentView.render, hostView.render);
- this._utils.detachFreeHostView(parentView, hostView);
- this._destroyPooledView(hostView);
- },
_viewHydrateRecurse: function(view) {
this._renderer.hydrateView(view.render);
var binders = view.proto.elementBinders;
for (var i = 0; i < binders.length; ++i) {
if (binders[i].hasStaticComponent()) {
@@ -21811,11 +25500,11 @@
this._renderer.dehydrateView(view.render);
var binders = view.proto.elementBinders;
for (var i = 0; i < binders.length; i++) {
var componentView = view.componentChildViews[i];
if (isPresent(componentView)) {
- if (binders[i].hasDynamicComponent() || forceDestroyComponents) {
+ if (forceDestroyComponents) {
this._destroyComponentView(view, i, componentView);
} else {
this._viewDehydrateRecurse(componentView, false);
}
}
@@ -21824,36 +25513,32 @@
for (var j = vc.views.length - 1; j >= 0; j--) {
this._destroyViewInContainer(view, i, j);
}
}
}
- for (var i = view.freeHostViews.length - 1; i >= 0; i--) {
- var hostView = view.freeHostViews[i];
- this._destroyFreeHostView(view, hostView);
- }
}
}, {}));
$__export("AppViewManager", AppViewManager);
- $__export("AppViewManager", AppViewManager = __decorate([Injectable(), __metadata('design:paramtypes', [AppViewPool, AppViewManagerUtils, Renderer])], AppViewManager));
+ $__export("AppViewManager", AppViewManager = __decorate([Injectable(), __metadata('design:paramtypes', [AppViewPool, AppViewListener, AppViewManagerUtils, Renderer])], AppViewManager));
}
};
});
-System.register("angular2/src/render/dom/compiler/compiler", ["angular2/di", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/api", "angular2/src/render/dom/compiler/compile_pipeline", "angular2/src/render/dom/compiler/template_loader", "angular2/src/render/dom/compiler/compile_step_factory", "angular2/change_detection", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy"], function($__export) {
+System.register("angular2/src/render/dom/compiler/compiler", ["angular2/di", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/api", "angular2/src/render/dom/compiler/compile_pipeline", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/compile_step_factory", "angular2/change_detection", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy"], function($__export) {
"use strict";
var __moduleName = "angular2/src/render/dom/compiler/compiler";
var __decorate,
__metadata,
Injectable,
PromiseWrapper,
BaseException,
DOM,
ViewDefinition,
- ProtoViewDto,
+ ViewType,
RenderCompiler,
CompilePipeline,
- TemplateLoader,
+ ViewLoader,
DefaultStepFactory,
Parser,
ShadowDomStrategy,
DomCompiler,
DefaultDomCompiler;
@@ -21866,16 +25551,16 @@
BaseException = $__m.BaseException;
}, function($__m) {
DOM = $__m.DOM;
}, function($__m) {
ViewDefinition = $__m.ViewDefinition;
- ProtoViewDto = $__m.ProtoViewDto;
+ ViewType = $__m.ViewType;
RenderCompiler = $__m.RenderCompiler;
}, function($__m) {
CompilePipeline = $__m.CompilePipeline;
}, function($__m) {
- TemplateLoader = $__m.TemplateLoader;
+ ViewLoader = $__m.ViewLoader;
}, function($__m) {
DefaultStepFactory = $__m.DefaultStepFactory;
}, function($__m) {
Parser = $__m.Parser;
}, function($__m) {
@@ -21903,157 +25588,203 @@
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
DomCompiler = (function($__super) {
- function DomCompiler(stepFactory, templateLoader) {
+ function DomCompiler(_stepFactory, _viewLoader) {
$traceurRuntime.superConstructor(DomCompiler).call(this);
- this._templateLoader = templateLoader;
- this._stepFactory = stepFactory;
+ this._stepFactory = _stepFactory;
+ this._viewLoader = _viewLoader;
}
return ($traceurRuntime.createClass)(DomCompiler, {
- compile: function(template) {
+ compile: function(view) {
var $__0 = this;
- var tplPromise = this._templateLoader.load(template);
+ var tplPromise = this._viewLoader.load(view);
return PromiseWrapper.then(tplPromise, (function(el) {
- return $__0._compileTemplate(template, el, ProtoViewDto.COMPONENT_VIEW_TYPE);
- }), (function(_) {
- throw new BaseException(("Failed to load the template \"" + template.componentId + "\""));
+ return $__0._compileTemplate(view, el, ViewType.COMPONENT);
+ }), (function(e) {
+ throw new BaseException(("Failed to load the template for \"" + view.componentId + "\" : " + e));
}));
},
compileHost: function(directiveMetadata) {
var hostViewDef = new ViewDefinition({
componentId: directiveMetadata.id,
- absUrl: null,
+ templateAbsUrl: null,
template: null,
+ styles: null,
+ styleAbsUrls: null,
directives: [directiveMetadata]
});
var element = DOM.createElement(directiveMetadata.selector);
- return this._compileTemplate(hostViewDef, element, ProtoViewDto.HOST_VIEW_TYPE);
+ return this._compileTemplate(hostViewDef, element, ViewType.HOST);
},
_compileTemplate: function(viewDef, tplElement, protoViewType) {
- var subTaskPromises = [];
- var pipeline = new CompilePipeline(this._stepFactory.createSteps(viewDef, subTaskPromises));
+ var pipeline = new CompilePipeline(this._stepFactory.createSteps(viewDef));
var compileElements = pipeline.process(tplElement, protoViewType, viewDef.componentId);
- var protoView = compileElements[0].inheritedProtoView.build();
- if (subTaskPromises.length > 0) {
- return PromiseWrapper.all(subTaskPromises).then((function(_) {
- return protoView;
- }));
- } else {
- return PromiseWrapper.resolve(protoView);
- }
+ return PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build());
}
}, {}, $__super);
}(RenderCompiler));
$__export("DomCompiler", DomCompiler);
DefaultDomCompiler = (function($__super) {
- function $__1(parser, shadowDomStrategy, templateLoader) {
- $traceurRuntime.superConstructor($__1).call(this, new DefaultStepFactory(parser, shadowDomStrategy), templateLoader);
+ function $__1(parser, shadowDomStrategy, viewLoader) {
+ $traceurRuntime.superConstructor($__1).call(this, new DefaultStepFactory(parser, shadowDomStrategy), viewLoader);
}
return ($traceurRuntime.createClass)($__1, {}, {}, $__super);
}(DomCompiler));
$__export("DefaultDomCompiler", DefaultDomCompiler);
- $__export("DefaultDomCompiler", DefaultDomCompiler = __decorate([Injectable(), __metadata('design:paramtypes', [Parser, ShadowDomStrategy, TemplateLoader])], DefaultDomCompiler));
+ $__export("DefaultDomCompiler", DefaultDomCompiler = __decorate([Injectable(), __metadata('design:paramtypes', [Parser, ShadowDomStrategy, ViewLoader])], DefaultDomCompiler));
}
};
});
-System.register("angular2/change_detection", ["angular2/src/change_detection/parser/ast", "angular2/src/change_detection/parser/lexer", "angular2/src/change_detection/parser/parser", "angular2/src/change_detection/parser/locals", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/interfaces", "angular2/src/change_detection/constants", "angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/binding_record", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/pipes/pipe_registry", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/pipes/pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/change_detection"], function($__export) {
+System.register("angular2/src/http/http", ["angular2/src/di/decorators", "angular2/src/http/static_request", "angular2/src/http/backends/xhr_backend", "angular2/src/http/base_request_options", "angular2/src/http/enums", "rx"], function($__export) {
"use strict";
- var __moduleName = "angular2/change_detection";
+ var __moduleName = "angular2/src/http/http";
+ var __decorate,
+ __metadata,
+ Injectable,
+ Request,
+ XHRBackend,
+ BaseRequestOptions,
+ RequestMethods,
+ Rx,
+ Http,
+ Observable;
+ function httpRequest(backend, request) {
+ return (Observable.create((function(observer) {
+ var connection = backend.createConnection(request);
+ var internalSubscription = connection.response.subscribe(observer);
+ return (function() {
+ internalSubscription.dispose();
+ connection.dispose();
+ });
+ })));
+ }
+ function HttpFactory(backend, defaultOptions) {
+ return function(url, options) {
+ if (typeof url === 'string') {
+ return httpRequest(backend, new Request(url, defaultOptions.merge(options)));
+ } else if (url instanceof Request) {
+ return httpRequest(backend, url);
+ }
+ };
+ }
+ $__export("HttpFactory", HttpFactory);
return {
setters: [function($__m) {
- $__export("ASTWithSource", $__m.ASTWithSource);
- $__export("AST", $__m.AST);
- $__export("AstTransformer", $__m.AstTransformer);
- $__export("AccessMember", $__m.AccessMember);
- $__export("LiteralArray", $__m.LiteralArray);
- $__export("ImplicitReceiver", $__m.ImplicitReceiver);
+ Injectable = $__m.Injectable;
}, function($__m) {
- $__export("Lexer", $__m.Lexer);
+ Request = $__m.Request;
}, function($__m) {
- $__export("Parser", $__m.Parser);
+ XHRBackend = $__m.XHRBackend;
}, function($__m) {
- $__export("Locals", $__m.Locals);
+ BaseRequestOptions = $__m.BaseRequestOptions;
}, function($__m) {
- $__export("ExpressionChangedAfterItHasBeenChecked", $__m.ExpressionChangedAfterItHasBeenChecked);
- $__export("ChangeDetectionError", $__m.ChangeDetectionError);
+ RequestMethods = $__m.RequestMethods;
}, function($__m) {
- $__export("ProtoChangeDetector", $__m.ProtoChangeDetector);
- $__export("ChangeDispatcher", $__m.ChangeDispatcher);
- $__export("ChangeDetector", $__m.ChangeDetector);
- $__export("ChangeDetection", $__m.ChangeDetection);
- $__export("ChangeDetectorDefinition", $__m.ChangeDetectorDefinition);
- }, function($__m) {
- $__export("CHECK_ONCE", $__m.CHECK_ONCE);
- $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS);
- $__export("DETACHED", $__m.DETACHED);
- $__export("CHECKED", $__m.CHECKED);
- $__export("ON_PUSH", $__m.ON_PUSH);
- $__export("DEFAULT", $__m.DEFAULT);
- }, function($__m) {
- $__export("DynamicProtoChangeDetector", $__m.DynamicProtoChangeDetector);
- $__export("JitProtoChangeDetector", $__m.JitProtoChangeDetector);
- }, function($__m) {
- $__export("BindingRecord", $__m.BindingRecord);
- }, function($__m) {
- $__export("DirectiveIndex", $__m.DirectiveIndex);
- $__export("DirectiveRecord", $__m.DirectiveRecord);
- }, function($__m) {
- $__export("DynamicChangeDetector", $__m.DynamicChangeDetector);
- }, function($__m) {
- $__export("ChangeDetectorRef", $__m.ChangeDetectorRef);
- }, function($__m) {
- $__export("PipeRegistry", $__m.PipeRegistry);
- }, function($__m) {
- $__export("uninitialized", $__m.uninitialized);
- }, function($__m) {
- $__export("WrappedValue", $__m.WrappedValue);
- $__export("Pipe", $__m.Pipe);
- }, function($__m) {
- $__export("NullPipe", $__m.NullPipe);
- $__export("NullPipeFactory", $__m.NullPipeFactory);
- }, function($__m) {
- $__export("defaultPipes", $__m.defaultPipes);
- $__export("DynamicChangeDetection", $__m.DynamicChangeDetection);
- $__export("JitChangeDetection", $__m.JitChangeDetection);
- $__export("PreGeneratedChangeDetection", $__m.PreGeneratedChangeDetection);
- $__export("preGeneratedProtoDetectors", $__m.preGeneratedProtoDetectors);
- $__export("defaultPipeRegistry", $__m.defaultPipeRegistry);
+ Rx = $__m;
}],
- execute: function() {}
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ Http = (($traceurRuntime.createClass)(function(_backend, _defaultOptions) {
+ this._backend = _backend;
+ this._defaultOptions = _defaultOptions;
+ }, {
+ request: function(url, options) {
+ if (typeof url === 'string') {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options)));
+ } else if (url instanceof Request) {
+ return httpRequest(this._backend, url);
+ }
+ },
+ get: function(url, options) {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options).merge({method: RequestMethods.GET})));
+ },
+ post: function(url, body, options) {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options).merge({
+ body: body,
+ method: RequestMethods.POST
+ })));
+ },
+ put: function(url, body, options) {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options).merge({
+ body: body,
+ method: RequestMethods.PUT
+ })));
+ },
+ delete: function(url, options) {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options).merge({method: RequestMethods.DELETE})));
+ },
+ patch: function(url, body, options) {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options).merge({
+ body: body,
+ method: RequestMethods.PATCH
+ })));
+ },
+ head: function(url, options) {
+ return httpRequest(this._backend, new Request(url, this._defaultOptions.merge(options).merge({method: RequestMethods.HEAD})));
+ }
+ }, {}));
+ $__export("Http", Http);
+ $__export("Http", Http = __decorate([Injectable(), __metadata('design:paramtypes', [XHRBackend, BaseRequestOptions])], Http));
+ if (Rx.hasOwnProperty('default')) {
+ Observable = Rx.default.Rx.Observable;
+ } else {
+ Observable = Rx.Observable;
+ }
+ }
};
});
System.register("angular2/di", ["angular2/src/di/annotations", "angular2/src/di/decorators", "angular2/src/di/forward_ref", "angular2/src/di/injector", "angular2/src/di/binding", "angular2/src/di/key", "angular2/src/di/exceptions", "angular2/src/di/opaque_token"], function($__export) {
"use strict";
var __moduleName = "angular2/di";
- var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
return {
setters: [function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("InjectAnnotation", $__m.InjectAnnotation);
+ $__export("InjectPromiseAnnotation", $__m.InjectPromiseAnnotation);
+ $__export("InjectLazyAnnotation", $__m.InjectLazyAnnotation);
+ $__export("OptionalAnnotation", $__m.OptionalAnnotation);
+ $__export("InjectableAnnotation", $__m.InjectableAnnotation);
+ $__export("DependencyAnnotation", $__m.DependencyAnnotation);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("Inject", $__m.Inject);
+ $__export("InjectPromise", $__m.InjectPromise);
+ $__export("InjectLazy", $__m.InjectLazy);
+ $__export("Optional", $__m.Optional);
+ $__export("Injectable", $__m.Injectable);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("forwardRef", $__m.forwardRef);
+ $__export("resolveForwardRef", $__m.resolveForwardRef);
}, function($__m) {
$__export("resolveBindings", $__m.resolveBindings);
$__export("Injector", $__m.Injector);
}, function($__m) {
$__export("Binding", $__m.Binding);
+ $__export("BindingBuilder", $__m.BindingBuilder);
$__export("ResolvedBinding", $__m.ResolvedBinding);
$__export("Dependency", $__m.Dependency);
$__export("bind", $__m.bind);
}, function($__m) {
$__export("Key", $__m.Key);
@@ -22072,17 +25803,19 @@
}],
execute: function() {}
};
});
-System.register("angular2/src/core/compiler/element_injector", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/di", "angular2/src/core/annotations_impl/visibility", "angular2/src/core/annotations_impl/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/annotations_impl/annotations", "angular2/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/reflection/reflection", "angular2/src/render/api"], function($__export) {
+System.register("angular2/src/core/compiler/element_injector", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/di", "angular2/src/core/annotations_impl/visibility", "angular2/src/core/annotations_impl/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/annotations_impl/annotations", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/reflection/reflection", "angular2/src/render/api"], function($__export) {
"use strict";
var __moduleName = "angular2/src/core/compiler/element_injector";
var isPresent,
isBlank,
BaseException,
stringify,
+ CONST_EXPR,
+ StringWrapper,
ObservableWrapper,
ListWrapper,
MapWrapper,
Injector,
Key,
@@ -22090,26 +25823,27 @@
Binding,
ResolvedBinding,
NoBindingError,
AbstractBindingError,
CyclicDependencyError,
- resolveForwardRef,
resolveBindings,
Visibility,
self,
Attribute,
Query,
avmModule,
ViewContainerRef,
ElementRef,
ProtoViewRef,
- ViewRef,
Directive,
Component,
onChange,
onDestroy,
+ onCheck,
+ onInit,
onAllChangesDone,
+ hasLifecycleHook,
ChangeDetectorRef,
QueryList,
reflector,
DirectiveMetadata,
_MAX_DIRECTIVE_CONSTRUCTION_COUNTER,
@@ -22126,20 +25860,26 @@
LIGHT_DOM,
SHADOW_DOM,
LIGHT_DOM_AND_SHADOW_DOM,
BindingData,
ProtoElementInjector,
+ _ProtoElementInjectorInlineStrategy,
+ _ProtoElementInjectorDynamicStrategy,
ElementInjector,
+ ElementInjectorInlineStrategy,
+ ElementInjectorDynamicStrategy,
OutOfBoundsAccess,
QueryError,
QueryRef;
return {
setters: [function($__m) {
isPresent = $__m.isPresent;
isBlank = $__m.isBlank;
BaseException = $__m.BaseException;
stringify = $__m.stringify;
+ CONST_EXPR = $__m.CONST_EXPR;
+ StringWrapper = $__m.StringWrapper;
}, function($__m) {
ObservableWrapper = $__m.ObservableWrapper;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
MapWrapper = $__m.MapWrapper;
@@ -22150,11 +25890,10 @@
Binding = $__m.Binding;
ResolvedBinding = $__m.ResolvedBinding;
NoBindingError = $__m.NoBindingError;
AbstractBindingError = $__m.AbstractBindingError;
CyclicDependencyError = $__m.CyclicDependencyError;
- resolveForwardRef = $__m.resolveForwardRef;
resolveBindings = $__m.resolveBindings;
}, function($__m) {
Visibility = $__m.Visibility;
self = $__m.self;
}, function($__m) {
@@ -22166,29 +25905,32 @@
ViewContainerRef = $__m.ViewContainerRef;
}, function($__m) {
ElementRef = $__m.ElementRef;
}, function($__m) {
ProtoViewRef = $__m.ProtoViewRef;
- ViewRef = $__m.ViewRef;
}, function($__m) {
Directive = $__m.Directive;
Component = $__m.Component;
onChange = $__m.onChange;
onDestroy = $__m.onDestroy;
+ onCheck = $__m.onCheck;
+ onInit = $__m.onInit;
onAllChangesDone = $__m.onAllChangesDone;
}, function($__m) {
+ hasLifecycleHook = $__m.hasLifecycleHook;
+ }, function($__m) {
ChangeDetectorRef = $__m.ChangeDetectorRef;
}, function($__m) {
QueryList = $__m.QueryList;
}, function($__m) {
reflector = $__m.reflector;
}, function($__m) {
DirectiveMetadata = $__m.DirectiveMetadata;
}],
execute: function() {
_MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
- _undefined = new Object();
+ _undefined = CONST_EXPR(new Object());
StaticKeys = (function() {
function StaticKeys() {
this.viewManagerId = Key.get(avmModule.AppViewManager).id;
this.protoViewId = Key.get(ProtoViewRef).id;
this.viewContainerId = Key.get(ViewContainerRef).id;
@@ -22208,73 +25950,37 @@
this._next = null;
if (isPresent(parent))
parent.addChild(this);
}
return ($traceurRuntime.createClass)(TreeNode, {
- _assertConsistency: function() {
- this._assertHeadBeforeTail();
- this._assertTailReachable();
- this._assertPresentInParentList();
- },
- _assertHeadBeforeTail: function() {
- if (isBlank(this._tail) && isPresent(this._head))
- throw new BaseException('null tail but non-null head');
- },
- _assertTailReachable: function() {
- if (isBlank(this._tail))
- return ;
- if (isPresent(this._tail._next))
- throw new BaseException('node after tail');
- var p = this._head;
- while (isPresent(p) && p != this._tail)
- p = p._next;
- if (isBlank(p) && isPresent(this._tail))
- throw new BaseException('tail not reachable.');
- },
- _assertPresentInParentList: function() {
- var p = this._parent;
- if (isBlank(p)) {
- return ;
- }
- var cur = p._head;
- while (isPresent(cur) && cur != this)
- cur = cur._next;
- if (isBlank(cur))
- throw new BaseException('node not reachable through parent.');
- },
addChild: function(child) {
if (isPresent(this._tail)) {
this._tail._next = child;
this._tail = child;
} else {
this._tail = this._head = child;
}
child._next = null;
child._parent = this;
- this._assertConsistency();
},
addChildAfter: function(child, prevSibling) {
- this._assertConsistency();
if (isBlank(prevSibling)) {
var prevHead = this._head;
this._head = child;
child._next = prevHead;
if (isBlank(this._tail))
this._tail = child;
} else if (isBlank(prevSibling._next)) {
this.addChild(child);
return ;
} else {
- prevSibling._assertPresentInParentList();
child._next = prevSibling._next;
prevSibling._next = child;
}
child._parent = this;
- this._assertConsistency();
},
remove: function() {
- this._assertConsistency();
if (isBlank(this.parent))
return ;
var nextSibling = this._next;
var prevSibling = this._findPrev();
if (isBlank(prevSibling)) {
@@ -22283,14 +25989,12 @@
prevSibling._next = this._next;
}
if (isBlank(nextSibling)) {
this._parent._tail = prevSibling;
}
- this._parent._assertConsistency();
this._parent = null;
this._next = null;
- this._assertConsistency();
},
_findPrev: function() {
var node = this.parent._head;
if (node == this)
return null;
@@ -22303,11 +26007,11 @@
},
get children() {
var res = [];
var child = this._head;
while (child != null) {
- ListWrapper.push(res, child);
+ res.push(child);
child = child._next;
}
return res;
}
}, {});
@@ -22332,19 +26036,19 @@
}
}, $__super);
}(Dependency));
$__export("DependencyWithVisibility", DependencyWithVisibility);
DirectiveDependency = (function($__super) {
- function DirectiveDependency(key, asPromise, lazy, optional, properties, visibility, attributeName, queryDirective) {
+ function DirectiveDependency(key, asPromise, lazy, optional, properties, visibility, attributeName, queryDecorator) {
$traceurRuntime.superConstructor(DirectiveDependency).call(this, key, asPromise, lazy, optional, properties, visibility);
this.attributeName = attributeName;
- this.queryDirective = queryDirective;
+ this.queryDecorator = queryDecorator;
this._verify();
}
return ($traceurRuntime.createClass)(DirectiveDependency, {_verify: function() {
var count = 0;
- if (isPresent(this.queryDirective))
+ if (isPresent(this.queryDecorator))
count++;
if (isPresent(this.attributeName))
count++;
if (count > 1)
throw new BaseException('A directive injectable can contain only one of the following @Attribute or @Query.');
@@ -22357,14 +26061,13 @@
return p instanceof Attribute;
}));
return isPresent(p) ? p.attributeName : null;
},
_query: function(properties) {
- var p = ListWrapper.find(properties, (function(p) {
+ return ListWrapper.find(properties, (function(p) {
return p instanceof Query;
}));
- return isPresent(p) ? resolveForwardRef(p.directive) : null;
}
}, $__super);
}(DependencyWithVisibility));
$__export("DirectiveDependency", DirectiveDependency);
DirectiveBinding = (function($__super) {
@@ -22390,11 +26093,11 @@
},
get eventEmitters() {
return isPresent(this.metadata) && isPresent(this.metadata.events) ? this.metadata.events : [];
},
get hostActions() {
- return isPresent(this.metadata) && isPresent(this.metadata.hostActions) ? this.metadata.hostActions : MapWrapper.create();
+ return isPresent(this.metadata) && isPresent(this.metadata.hostActions) ? this.metadata.hostActions : new Map();
},
get changeDetection() {
return this.metadata.changeDetection;
}
}, {
@@ -22405,34 +26108,34 @@
var rb = binding.resolve();
var deps = ListWrapper.map(rb.dependencies, DirectiveDependency.createFrom);
var resolvedAppInjectables = ann instanceof Component && isPresent(ann.appInjector) ? Injector.resolve(ann.appInjector) : [];
var resolvedHostInjectables = isPresent(ann.hostInjector) ? resolveBindings(ann.hostInjector) : [];
var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ? resolveBindings(ann.viewInjector) : [];
- var metadata = new DirectiveMetadata({
+ var metadata = DirectiveMetadata.create({
id: stringify(rb.key.token),
type: ann instanceof Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE,
selector: ann.selector,
compileChildren: ann.compileChildren,
events: ann.events,
- hostListeners: isPresent(ann.hostListeners) ? MapWrapper.createFromStringMap(ann.hostListeners) : null,
- hostProperties: isPresent(ann.hostProperties) ? MapWrapper.createFromStringMap(ann.hostProperties) : null,
- hostAttributes: isPresent(ann.hostAttributes) ? MapWrapper.createFromStringMap(ann.hostAttributes) : null,
- hostActions: isPresent(ann.hostActions) ? MapWrapper.createFromStringMap(ann.hostActions) : null,
- properties: isPresent(ann.properties) ? MapWrapper.createFromStringMap(ann.properties) : null,
+ host: isPresent(ann.host) ? MapWrapper.createFromStringMap(ann.host) : null,
+ properties: ann.properties,
readAttributes: DirectiveBinding._readAttributes(deps),
- callOnDestroy: ann.hasLifecycleHook(onDestroy),
- callOnChange: ann.hasLifecycleHook(onChange),
- callOnAllChangesDone: ann.hasLifecycleHook(onAllChangesDone),
- changeDetection: ann instanceof Component ? ann.changeDetection : null
+ callOnDestroy: hasLifecycleHook(onDestroy, rb.key.token, ann),
+ callOnChange: hasLifecycleHook(onChange, rb.key.token, ann),
+ callOnCheck: hasLifecycleHook(onCheck, rb.key.token, ann),
+ callOnInit: hasLifecycleHook(onInit, rb.key.token, ann),
+ callOnAllChangesDone: hasLifecycleHook(onAllChangesDone, rb.key.token, ann),
+ changeDetection: ann instanceof Component ? ann.changeDetection : null,
+ exportAs: ann.exportAs
});
return new DirectiveBinding(rb.key, rb.factory, deps, rb.providedAsPromise, resolvedAppInjectables, resolvedHostInjectables, resolvedViewInjectables, metadata);
},
_readAttributes: function(deps) {
var readAttributes = [];
ListWrapper.forEach(deps, (function(dep) {
if (isPresent(dep.attributeName)) {
- ListWrapper.push(readAttributes, dep.attributeName);
+ readAttributes.push(dep.attributeName);
}
}));
return readAttributes;
},
createFromType: function(type, annotation) {
@@ -22464,19 +26167,19 @@
}));
}}, {});
}());
$__export("EventEmitterAccessor", EventEmitterAccessor);
HostActionAccessor = (function() {
- function HostActionAccessor(actionExpression, getter) {
- this.actionExpression = actionExpression;
+ function HostActionAccessor(methodName, getter) {
+ this.methodName = methodName;
this.getter = getter;
}
return ($traceurRuntime.createClass)(HostActionAccessor, {subscribe: function(view, boundElementIndex, directive) {
var $__0 = this;
var eventEmitter = this.getter(directive);
- return ObservableWrapper.subscribe(eventEmitter, (function(actionObj) {
- return view.callAction(boundElementIndex, $__0.actionExpression, actionObj);
+ return ObservableWrapper.subscribe(eventEmitter, (function(actionArgs) {
+ return view.invokeElementMethod(boundElementIndex, $__0.methodName, actionArgs);
}));
}}, {});
}());
$__export("HostActionAccessor", HostActionAccessor);
LIGHT_DOM = 1;
@@ -22493,150 +26196,208 @@
},
createEventEmitterAccessors: function() {
if (!(this.binding instanceof DirectiveBinding))
return [];
var db = this.binding;
- return ListWrapper.map(db.eventEmitters, (function(eventName) {
- return new EventEmitterAccessor(eventName, reflector.getter(eventName));
+ return ListWrapper.map(db.eventEmitters, (function(eventConfig) {
+ var fieldName;
+ var eventName;
+ var colonIdx = eventConfig.indexOf(':');
+ if (colonIdx > -1) {
+ fieldName = StringWrapper.substring(eventConfig, 0, colonIdx).trim();
+ eventName = StringWrapper.substring(eventConfig, colonIdx + 1).trim();
+ } else {
+ fieldName = eventName = eventConfig;
+ }
+ return new EventEmitterAccessor(eventName, reflector.getter(fieldName));
}));
},
createHostActionAccessors: function() {
if (!(this.binding instanceof DirectiveBinding))
return [];
var res = [];
var db = this.binding;
MapWrapper.forEach(db.hostActions, (function(actionExpression, actionName) {
- ListWrapper.push(res, new HostActionAccessor(actionExpression, reflector.getter(actionName)));
+ res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName)));
}));
return res;
}
}, {});
}());
$__export("BindingData", BindingData);
ProtoElementInjector = (function() {
- function ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent) {
+ function ProtoElementInjector(parent, index, bd, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) {
this.parent = parent;
this.index = index;
this.distanceToParent = distanceToParent;
- this.exportComponent = false;
- this.exportElement = false;
- this._firstBindingIsComponent = firstBindingIsComponent;
+ this._firstBindingIsComponent = _firstBindingIsComponent;
+ this.directiveVariableBindings = directiveVariableBindings;
+ var length = bd.length;
+ this.eventEmitterAccessors = ListWrapper.createFixedSize(length);
+ this.hostActionAccessors = ListWrapper.createFixedSize(length);
+ this._strategy = length > _MAX_DIRECTIVE_CONSTRUCTION_COUNTER ? new _ProtoElementInjectorDynamicStrategy(this, bd) : new _ProtoElementInjectorInlineStrategy(this, bd);
+ }
+ return ($traceurRuntime.createClass)(ProtoElementInjector, {
+ instantiate: function(parent) {
+ return new ElementInjector(this, parent);
+ },
+ directParent: function() {
+ return this.distanceToParent < 2 ? this.parent : null;
+ },
+ get hasBindings() {
+ return this._strategy.hasBindings();
+ },
+ getBindingAtIndex: function(index) {
+ return this._strategy.getBindingAtIndex(index);
+ }
+ }, {
+ create: function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) {
+ var bd = [];
+ ProtoElementInjector._createDirectiveBindingData(bindings, bd, firstBindingIsComponent);
+ if (firstBindingIsComponent) {
+ ProtoElementInjector._createViewInjectorBindingData(bindings, bd);
+ }
+ ProtoElementInjector._createHostInjectorBindingData(bindings, bd, firstBindingIsComponent);
+ return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings);
+ },
+ _createDirectiveBindingData: function(dirBindings, bd, firstBindingIsComponent) {
+ ListWrapper.forEach(dirBindings, (function(dirBinding) {
+ bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding, dirBindings, dirBinding));
+ }));
+ },
+ _createHostInjectorBindingData: function(dirBindings, bd, firstBindingIsComponent) {
+ ListWrapper.forEach(dirBindings, (function(dirBinding) {
+ ListWrapper.forEach(dirBinding.resolvedHostInjectables, (function(b) {
+ bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding, dirBindings, ProtoElementInjector._createBinding(b)));
+ }));
+ }));
+ },
+ _createBindingData: function(firstBindingIsComponent, dirBinding, dirBindings, binding) {
+ var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding;
+ return new BindingData(binding, isComponent ? LIGHT_DOM_AND_SHADOW_DOM : LIGHT_DOM);
+ },
+ _createViewInjectorBindingData: function(bindings, bd) {
+ var db = bindings[0];
+ ListWrapper.forEach(db.resolvedViewInjectables, (function(b) {
+ return bd.push(new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM));
+ }));
+ },
+ _createBinding: function(b) {
+ var deps = ListWrapper.map(b.dependencies, (function(d) {
+ return DependencyWithVisibility.createFrom(d);
+ }));
+ return new ResolvedBinding(b.key, b.factory, deps, b.providedAsPromise);
+ }
+ });
+ }());
+ $__export("ProtoElementInjector", ProtoElementInjector);
+ _ProtoElementInjectorInlineStrategy = (function() {
+ function _ProtoElementInjectorInlineStrategy(protoEI, bd) {
this._binding0 = null;
- this._keyId0 = null;
- this._visibility0 = null;
this._binding1 = null;
- this._keyId1 = null;
- this._visibility1 = null;
this._binding2 = null;
- this._keyId2 = null;
- this._visibility2 = null;
this._binding3 = null;
- this._keyId3 = null;
- this._visibility3 = null;
this._binding4 = null;
- this._keyId4 = null;
- this._visibility4 = null;
this._binding5 = null;
- this._keyId5 = null;
- this._visibility5 = null;
this._binding6 = null;
- this._keyId6 = null;
- this._visibility6 = null;
this._binding7 = null;
- this._keyId7 = null;
- this._visibility7 = null;
this._binding8 = null;
- this._keyId8 = null;
- this._visibility8 = null;
this._binding9 = null;
+ this._keyId0 = null;
+ this._keyId1 = null;
+ this._keyId2 = null;
+ this._keyId3 = null;
+ this._keyId4 = null;
+ this._keyId5 = null;
+ this._keyId6 = null;
+ this._keyId7 = null;
+ this._keyId8 = null;
this._keyId9 = null;
+ this._visibility0 = null;
+ this._visibility1 = null;
+ this._visibility2 = null;
+ this._visibility3 = null;
+ this._visibility4 = null;
+ this._visibility5 = null;
+ this._visibility6 = null;
+ this._visibility7 = null;
+ this._visibility8 = null;
this._visibility9 = null;
var length = bd.length;
- this.eventEmitterAccessors = ListWrapper.createFixedSize(length);
- this.hostActionAccessors = ListWrapper.createFixedSize(length);
if (length > 0) {
this._binding0 = bd[0].binding;
this._keyId0 = bd[0].getKeyId();
this._visibility0 = bd[0].visibility;
- this.eventEmitterAccessors[0] = bd[0].createEventEmitterAccessors();
- this.hostActionAccessors[0] = bd[0].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[0] = bd[0].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[0] = bd[0].createHostActionAccessors();
}
if (length > 1) {
this._binding1 = bd[1].binding;
this._keyId1 = bd[1].getKeyId();
this._visibility1 = bd[1].visibility;
- this.eventEmitterAccessors[1] = bd[1].createEventEmitterAccessors();
- this.hostActionAccessors[1] = bd[1].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[1] = bd[1].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[1] = bd[1].createHostActionAccessors();
}
if (length > 2) {
this._binding2 = bd[2].binding;
this._keyId2 = bd[2].getKeyId();
this._visibility2 = bd[2].visibility;
- this.eventEmitterAccessors[2] = bd[2].createEventEmitterAccessors();
- this.hostActionAccessors[2] = bd[2].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[2] = bd[2].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[2] = bd[2].createHostActionAccessors();
}
if (length > 3) {
this._binding3 = bd[3].binding;
this._keyId3 = bd[3].getKeyId();
this._visibility3 = bd[3].visibility;
- this.eventEmitterAccessors[3] = bd[3].createEventEmitterAccessors();
- this.hostActionAccessors[3] = bd[3].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[3] = bd[3].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[3] = bd[3].createHostActionAccessors();
}
if (length > 4) {
this._binding4 = bd[4].binding;
this._keyId4 = bd[4].getKeyId();
this._visibility4 = bd[4].visibility;
- this.eventEmitterAccessors[4] = bd[4].createEventEmitterAccessors();
- this.hostActionAccessors[4] = bd[4].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[4] = bd[4].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[4] = bd[4].createHostActionAccessors();
}
if (length > 5) {
this._binding5 = bd[5].binding;
this._keyId5 = bd[5].getKeyId();
this._visibility5 = bd[5].visibility;
- this.eventEmitterAccessors[5] = bd[5].createEventEmitterAccessors();
- this.hostActionAccessors[5] = bd[5].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[5] = bd[5].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[5] = bd[5].createHostActionAccessors();
}
if (length > 6) {
this._binding6 = bd[6].binding;
this._keyId6 = bd[6].getKeyId();
this._visibility6 = bd[6].visibility;
- this.eventEmitterAccessors[6] = bd[6].createEventEmitterAccessors();
- this.hostActionAccessors[6] = bd[6].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[6] = bd[6].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[6] = bd[6].createHostActionAccessors();
}
if (length > 7) {
this._binding7 = bd[7].binding;
this._keyId7 = bd[7].getKeyId();
this._visibility7 = bd[7].visibility;
- this.eventEmitterAccessors[7] = bd[7].createEventEmitterAccessors();
- this.hostActionAccessors[7] = bd[7].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[7] = bd[7].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[7] = bd[7].createHostActionAccessors();
}
if (length > 8) {
this._binding8 = bd[8].binding;
this._keyId8 = bd[8].getKeyId();
this._visibility8 = bd[8].visibility;
- this.eventEmitterAccessors[8] = bd[8].createEventEmitterAccessors();
- this.hostActionAccessors[8] = bd[8].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[8] = bd[8].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[8] = bd[8].createHostActionAccessors();
}
if (length > 9) {
this._binding9 = bd[9].binding;
this._keyId9 = bd[9].getKeyId();
this._visibility9 = bd[9].visibility;
- this.eventEmitterAccessors[9] = bd[9].createEventEmitterAccessors();
- this.hostActionAccessors[9] = bd[9].createHostActionAccessors();
+ protoEI.eventEmitterAccessors[9] = bd[9].createEventEmitterAccessors();
+ protoEI.hostActionAccessors[9] = bd[9].createHostActionAccessors();
}
- if (length > 10) {
- throw 'Maximum number of directives per element has been reached.';
- }
}
- return ($traceurRuntime.createClass)(ProtoElementInjector, {
- instantiate: function(parent) {
- return new ElementInjector(this, parent);
- },
- directParent: function() {
- return this.distanceToParent < 2 ? this.parent : null;
- },
- get hasBindings() {
+ return ($traceurRuntime.createClass)(_ProtoElementInjectorInlineStrategy, {
+ hasBindings: function() {
return isPresent(this._binding0);
},
getBindingAtIndex: function(index) {
if (index == 0)
return this._binding0;
@@ -22657,221 +26418,148 @@
if (index == 8)
return this._binding8;
if (index == 9)
return this._binding9;
throw new OutOfBoundsAccess(index);
+ },
+ createElementInjectorStrategy: function(ei) {
+ return new ElementInjectorInlineStrategy(this, ei);
}
- }, {
- create: function(parent, index, bindings, firstBindingIsComponent, distanceToParent) {
- var bd = [];
- ProtoElementInjector._createDirectiveBindingData(bindings, bd, firstBindingIsComponent);
- ProtoElementInjector._createHostInjectorBindingData(bindings, bd);
- if (firstBindingIsComponent) {
- ProtoElementInjector._createViewInjectorBindingData(bindings, bd);
- }
- return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent);
+ }, {});
+ }());
+ _ProtoElementInjectorDynamicStrategy = (function() {
+ function _ProtoElementInjectorDynamicStrategy(protoInj, bd) {
+ var len = bd.length;
+ this._bindings = ListWrapper.createFixedSize(len);
+ this._keyIds = ListWrapper.createFixedSize(len);
+ this._visibilities = ListWrapper.createFixedSize(len);
+ for (var i = 0; i < len; i++) {
+ this._bindings[i] = bd[i].binding;
+ this._keyIds[i] = bd[i].getKeyId();
+ this._visibilities[i] = bd[i].visibility;
+ protoInj.eventEmitterAccessors[i] = bd[i].createEventEmitterAccessors();
+ protoInj.hostActionAccessors[i] = bd[i].createHostActionAccessors();
+ }
+ }
+ return ($traceurRuntime.createClass)(_ProtoElementInjectorDynamicStrategy, {
+ hasBindings: function() {
+ return isPresent(this._bindings[0]);
},
- _createDirectiveBindingData: function(bindings, bd, firstBindingIsComponent) {
- if (firstBindingIsComponent) {
- ListWrapper.push(bd, new BindingData(bindings[0], LIGHT_DOM_AND_SHADOW_DOM));
- for (var i = 1; i < bindings.length; ++i) {
- ListWrapper.push(bd, new BindingData(bindings[i], LIGHT_DOM));
- }
- } else {
- ListWrapper.forEach(bindings, (function(b) {
- ListWrapper.push(bd, new BindingData(b, LIGHT_DOM));
- }));
+ getBindingAtIndex: function(index) {
+ if (index < 0 || index >= this._bindings.length) {
+ throw new OutOfBoundsAccess(index);
}
+ return this._bindings[index];
},
- _createHostInjectorBindingData: function(bindings, bd) {
- ListWrapper.forEach(bindings, (function(b) {
- ListWrapper.forEach(b.resolvedHostInjectables, (function(b) {
- ListWrapper.push(bd, new BindingData(ProtoElementInjector._createBinding(b), LIGHT_DOM));
- }));
- }));
- },
- _createViewInjectorBindingData: function(bindings, bd) {
- var db = bindings[0];
- ListWrapper.forEach(db.resolvedViewInjectables, (function(b) {
- return ListWrapper.push(bd, new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM));
- }));
- },
- _createBinding: function(b) {
- var deps = ListWrapper.map(b.dependencies, (function(d) {
- return DependencyWithVisibility.createFrom(d);
- }));
- return new ResolvedBinding(b.key, b.factory, deps, b.providedAsPromise);
+ createElementInjectorStrategy: function(ei) {
+ return new ElementInjectorDynamicStrategy(this, ei);
}
- });
+ }, {});
}());
- $__export("ProtoElementInjector", ProtoElementInjector);
ElementInjector = (function($__super) {
- function ElementInjector(proto, parent) {
+ function ElementInjector(_proto, parent) {
$traceurRuntime.superConstructor(ElementInjector).call(this, parent);
- this._proto = proto;
- this._preBuiltObjects = null;
+ this._proto = _proto;
this._lightDomAppInjector = null;
this._shadowDomAppInjector = null;
- this._obj0 = null;
- this._obj1 = null;
- this._obj2 = null;
- this._obj3 = null;
- this._obj4 = null;
- this._obj5 = null;
- this._obj6 = null;
- this._obj7 = null;
- this._obj8 = null;
- this._obj9 = null;
+ this._preBuiltObjects = null;
this._constructionCounter = 0;
- this._inheritQueries(parent);
+ this._strategy = _proto._strategy.createElementInjectorStrategy(this);
+ this._constructionCounter = 0;
+ this.hydrated = false;
this._buildQueries();
+ this._addParentQueries();
}
return ($traceurRuntime.createClass)(ElementInjector, {
dehydrate: function() {
+ this.hydrated = false;
this._host = null;
this._preBuiltObjects = null;
this._lightDomAppInjector = null;
this._shadowDomAppInjector = null;
- var p = this._proto;
- if (p._binding0 instanceof DirectiveBinding && p._binding0.callOnDestroy) {
- this._obj0.onDestroy();
+ this._strategy.callOnDestroy();
+ this._strategy.clearInstances();
+ this._constructionCounter = 0;
+ },
+ onAllChangesDone: function() {
+ if (isPresent(this._query0) && this._query0.originator === this) {
+ this._query0.list.fireCallbacks();
}
- if (p._binding1 instanceof DirectiveBinding && p._binding1.callOnDestroy) {
- this._obj1.onDestroy();
+ if (isPresent(this._query1) && this._query1.originator === this) {
+ this._query1.list.fireCallbacks();
}
- if (p._binding2 instanceof DirectiveBinding && p._binding2.callOnDestroy) {
- this._obj2.onDestroy();
+ if (isPresent(this._query2) && this._query2.originator === this) {
+ this._query2.list.fireCallbacks();
}
- if (p._binding3 instanceof DirectiveBinding && p._binding3.callOnDestroy) {
- this._obj3.onDestroy();
- }
- if (p._binding4 instanceof DirectiveBinding && p._binding4.callOnDestroy) {
- this._obj4.onDestroy();
- }
- if (p._binding5 instanceof DirectiveBinding && p._binding5.callOnDestroy) {
- this._obj5.onDestroy();
- }
- if (p._binding6 instanceof DirectiveBinding && p._binding6.callOnDestroy) {
- this._obj6.onDestroy();
- }
- if (p._binding7 instanceof DirectiveBinding && p._binding7.callOnDestroy) {
- this._obj7.onDestroy();
- }
- if (p._binding8 instanceof DirectiveBinding && p._binding8.callOnDestroy) {
- this._obj8.onDestroy();
- }
- if (p._binding9 instanceof DirectiveBinding && p._binding9.callOnDestroy) {
- this._obj9.onDestroy();
- }
- if (isPresent(this._dynamicallyCreatedComponentBinding) && this._dynamicallyCreatedComponentBinding.callOnDestroy) {
- this._dynamicallyCreatedComponent.onDestroy();
- }
- this._obj0 = null;
- this._obj1 = null;
- this._obj2 = null;
- this._obj3 = null;
- this._obj4 = null;
- this._obj5 = null;
- this._obj6 = null;
- this._obj7 = null;
- this._obj8 = null;
- this._obj9 = null;
- this._dynamicallyCreatedComponent = null;
- this._dynamicallyCreatedComponentBinding = null;
- this._constructionCounter = 0;
},
hydrate: function(injector, host, preBuiltObjects) {
var p = this._proto;
this._host = host;
this._lightDomAppInjector = injector;
this._preBuiltObjects = preBuiltObjects;
if (p._firstBindingIsComponent) {
- this._shadowDomAppInjector = this._createShadowDomAppInjector(p._binding0, injector);
+ this._shadowDomAppInjector = this._createShadowDomAppInjector(this._strategy.getComponentBinding(), injector);
}
this._checkShadowDomAppInjector(this._shadowDomAppInjector);
- if (isPresent(p._keyId0))
- this._getObjByKeyId(p._keyId0, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId1))
- this._getObjByKeyId(p._keyId1, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId2))
- this._getObjByKeyId(p._keyId2, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId3))
- this._getObjByKeyId(p._keyId3, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId4))
- this._getObjByKeyId(p._keyId4, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId5))
- this._getObjByKeyId(p._keyId5, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId6))
- this._getObjByKeyId(p._keyId6, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId7))
- this._getObjByKeyId(p._keyId7, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId8))
- this._getObjByKeyId(p._keyId8, LIGHT_DOM_AND_SHADOW_DOM);
- if (isPresent(p._keyId9))
- this._getObjByKeyId(p._keyId9, LIGHT_DOM_AND_SHADOW_DOM);
+ this._strategy.hydrate();
+ this._addVarBindingsToQueries();
+ this.hydrated = true;
},
+ hasVariableBinding: function(name) {
+ var vb = this._proto.directiveVariableBindings;
+ return isPresent(vb) && vb.has(name);
+ },
+ getVariableBinding: function(name) {
+ var index = this._proto.directiveVariableBindings.get(name);
+ return isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef();
+ },
_createShadowDomAppInjector: function(componentDirective, appInjector) {
if (!ListWrapper.isEmpty(componentDirective.resolvedAppInjectables)) {
return appInjector.createChildFromResolved(componentDirective.resolvedAppInjectables);
} else {
return appInjector;
}
},
- dynamicallyCreateComponent: function(componentDirective, parentInjector) {
- this._shadowDomAppInjector = this._createShadowDomAppInjector(componentDirective, parentInjector);
- this._dynamicallyCreatedComponentBinding = componentDirective;
- this._dynamicallyCreatedComponent = this._new(this._dynamicallyCreatedComponentBinding);
- return this._dynamicallyCreatedComponent;
- },
_checkShadowDomAppInjector: function(shadowDomAppInjector) {
if (this._proto._firstBindingIsComponent && isBlank(shadowDomAppInjector)) {
throw new BaseException('A shadowDomAppInjector is required as this ElementInjector contains a component');
} else if (!this._proto._firstBindingIsComponent && isPresent(shadowDomAppInjector)) {
throw new BaseException('No shadowDomAppInjector allowed as there is not component stored in this ElementInjector');
}
},
get: function(token) {
- if (this._isDynamicallyLoadedComponent(token)) {
- return this._dynamicallyCreatedComponent;
- }
return this._getByKey(Key.get(token), self, false, null);
},
- _isDynamicallyLoadedComponent: function(token) {
- return isPresent(this._dynamicallyCreatedComponentBinding) && Key.get(token) === this._dynamicallyCreatedComponentBinding.key;
- },
hasDirective: function(type) {
- return this._getObjByKeyId(Key.get(type).id, LIGHT_DOM_AND_SHADOW_DOM) !== _undefined;
+ return this._strategy.getObjByKeyId(Key.get(type).id, LIGHT_DOM_AND_SHADOW_DOM) !== _undefined;
},
getEventEmitterAccessors: function() {
return this._proto.eventEmitterAccessors;
},
getHostActionAccessors: function() {
return this._proto.hostActionAccessors;
},
+ getDirectiveVariableBindings: function() {
+ return this._proto.directiveVariableBindings;
+ },
getComponent: function() {
- return this._obj0;
+ return this._strategy.getComponent();
},
getElementRef: function() {
- return new ElementRef(new ViewRef(this._preBuiltObjects.view), this._proto.index);
+ return this._preBuiltObjects.view.elementRefs[this._proto.index];
},
getViewContainerRef: function() {
return new ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef());
},
- getDynamicallyLoadedComponent: function() {
- return this._dynamicallyCreatedComponent;
- },
directParent: function() {
return this._proto.distanceToParent < 2 ? this.parent : null;
},
_isComponentKey: function(key) {
- return this._proto._firstBindingIsComponent && isPresent(key) && key.id === this._proto._keyId0;
+ return this._strategy.isComponentKey(key);
},
- _isDynamicallyLoadedComponentKey: function(key) {
- return isPresent(this._dynamicallyCreatedComponentBinding) && key.id === this._dynamicallyCreatedComponentBinding.key.id;
- },
_new: function(binding) {
- if (this._constructionCounter++ > _MAX_DIRECTIVE_CONSTRUCTION_COUNTER) {
+ if (this._constructionCounter++ > this._strategy.getMaxDirectives()) {
throw new CyclicDependencyError(binding.key);
}
var factory = binding.factory;
var deps = binding.dependencies;
var length = deps.length;
@@ -22934,12 +26622,10 @@
obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8);
break;
case 10:
obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9);
break;
- default:
- throw ("Directive " + binding.key.token + " can only have up to 10 dependencies.");
}
this._addToQueries(obj, binding.key.token);
return obj;
},
_getByDependency: function(dep, requestor) {
@@ -22947,12 +26633,12 @@
return this._getByKey(dep.key, dep.visibility, dep.optional, requestor);
}
var dirDep = dep;
if (isPresent(dirDep.attributeName))
return this._buildAttribute(dirDep);
- if (isPresent(dirDep.queryDirective))
- return this._findQuery(dirDep.queryDirective).list;
+ if (isPresent(dirDep.queryDecorator))
+ return this._findQuery(dirDep.queryDecorator).list;
if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) {
var componentView = this._preBuiltObjects.view.componentChildViews[this._proto.index];
return componentView.changeDetector.ref;
}
if (dirDep.key.id === StaticKeys.instance().elementRefId) {
@@ -22972,144 +26658,127 @@
}
return this._getByKey(dirDep.key, dirDep.visibility, dirDep.optional, requestor);
},
_buildAttribute: function(dep) {
var attributes = this._proto.attributes;
- if (isPresent(attributes) && MapWrapper.contains(attributes, dep.attributeName)) {
- return MapWrapper.get(attributes, dep.attributeName);
+ if (isPresent(attributes) && attributes.has(dep.attributeName)) {
+ return attributes.get(dep.attributeName);
} else {
return null;
}
},
_buildQueriesForDeps: function(deps) {
for (var i = 0; i < deps.length; i++) {
var dep = deps[i];
- if (isPresent(dep.queryDirective)) {
- this._createQueryRef(dep.queryDirective);
+ if (isPresent(dep.queryDecorator)) {
+ this._createQueryRef(dep.queryDecorator);
}
}
},
- _createQueryRef: function(directive) {
+ _addVarBindingsToQueries: function() {
+ this._addVarBindingsToQuery(this._query0);
+ this._addVarBindingsToQuery(this._query1);
+ this._addVarBindingsToQuery(this._query2);
+ },
+ _addVarBindingsToQuery: function(queryRef) {
+ if (isBlank(queryRef) || !queryRef.query.isVarBindingQuery)
+ return ;
+ var vb = queryRef.query.varBindings;
+ for (var i = 0; i < vb.length; ++i) {
+ if (this.hasVariableBinding(vb[i])) {
+ queryRef.list.add(this.getVariableBinding(vb[i]));
+ }
+ }
+ },
+ _createQueryRef: function(query) {
var queryList = new QueryList();
if (isBlank(this._query0)) {
- this._query0 = new QueryRef(directive, queryList, this);
+ this._query0 = new QueryRef(query, queryList, this);
} else if (isBlank(this._query1)) {
- this._query1 = new QueryRef(directive, queryList, this);
+ this._query1 = new QueryRef(query, queryList, this);
} else if (isBlank(this._query2)) {
- this._query2 = new QueryRef(directive, queryList, this);
+ this._query2 = new QueryRef(query, queryList, this);
} else
throw new QueryError();
},
_addToQueries: function(obj, token) {
- if (isPresent(this._query0) && (this._query0.directive === token)) {
+ if (isPresent(this._query0) && (this._query0.query.selector === token)) {
this._query0.list.add(obj);
}
- if (isPresent(this._query1) && (this._query1.directive === token)) {
+ if (isPresent(this._query1) && (this._query1.query.selector === token)) {
this._query1.list.add(obj);
}
- if (isPresent(this._query2) && (this._query2.directive === token)) {
+ if (isPresent(this._query2) && (this._query2.query.selector === token)) {
this._query2.list.add(obj);
}
},
- _inheritQueries: function(parent) {
- if (isBlank(parent))
- return ;
- if (isPresent(parent._query0)) {
- this._query0 = parent._query0;
- }
- if (isPresent(parent._query1)) {
- this._query1 = parent._query1;
- }
- if (isPresent(parent._query2)) {
- this._query2 = parent._query2;
- }
+ addDirectivesMatchingQuery: function(query, list) {
+ this._strategy.addDirectivesMatchingQuery(query, list);
},
_buildQueries: function() {
- if (isBlank(this._proto))
- return ;
- var p = this._proto;
- if (p._binding0 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding0.dependencies);
+ if (isPresent(this._proto)) {
+ this._strategy.buildQueries();
}
- if (p._binding1 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding1.dependencies);
- }
- if (p._binding2 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding2.dependencies);
- }
- if (p._binding3 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding3.dependencies);
- }
- if (p._binding4 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding4.dependencies);
- }
- if (p._binding5 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding5.dependencies);
- }
- if (p._binding6 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding6.dependencies);
- }
- if (p._binding7 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding7.dependencies);
- }
- if (p._binding8 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding8.dependencies);
- }
- if (p._binding9 instanceof DirectiveBinding) {
- this._buildQueriesForDeps(p._binding9.dependencies);
- }
},
- _findQuery: function(token) {
- if (isPresent(this._query0) && this._query0.directive === token) {
+ _findQuery: function(query) {
+ if (isPresent(this._query0) && this._query0.query === query) {
return this._query0;
}
- if (isPresent(this._query1) && this._query1.directive === token) {
+ if (isPresent(this._query1) && this._query1.query === query) {
return this._query1;
}
- if (isPresent(this._query2) && this._query2.directive === token) {
+ if (isPresent(this._query2) && this._query2.query === query) {
return this._query2;
}
- throw new BaseException(("Cannot find query for directive " + token + "."));
+ throw new BaseException(("Cannot find query for directive " + query + "."));
},
+ _hasQuery: function(query) {
+ return this._query0 == query || this._query1 == query || this._query2 == query;
+ },
link: function(parent) {
parent.addChild(this);
this._addParentQueries();
},
linkAfter: function(parent, prevSibling) {
parent.addChildAfter(this, prevSibling);
this._addParentQueries();
},
_addParentQueries: function() {
+ if (isBlank(this.parent))
+ return ;
if (isPresent(this.parent._query0)) {
this._addQueryToTree(this.parent._query0);
- this.parent._query0.update();
+ if (this.hydrated)
+ this.parent._query0.update();
}
if (isPresent(this.parent._query1)) {
this._addQueryToTree(this.parent._query1);
- this.parent._query1.update();
+ if (this.hydrated)
+ this.parent._query1.update();
}
if (isPresent(this.parent._query2)) {
this._addQueryToTree(this.parent._query2);
- this.parent._query2.update();
+ if (this.hydrated)
+ this.parent._query2.update();
}
},
unlink: function() {
- var queriesToUpDate = [];
+ var queriesToUpdate = [];
if (isPresent(this.parent._query0)) {
this._pruneQueryFromTree(this.parent._query0);
- ListWrapper.push(queriesToUpDate, this.parent._query0);
+ queriesToUpdate.push(this.parent._query0);
}
if (isPresent(this.parent._query1)) {
this._pruneQueryFromTree(this.parent._query1);
- ListWrapper.push(queriesToUpDate, this.parent._query1);
+ queriesToUpdate.push(this.parent._query1);
}
if (isPresent(this.parent._query2)) {
this._pruneQueryFromTree(this.parent._query2);
- ListWrapper.push(queriesToUpDate, this.parent._query2);
+ queriesToUpdate.push(this.parent._query2);
}
this.remove();
- ListWrapper.forEach(queriesToUpDate, (function(q) {
+ ListWrapper.forEach(queriesToUpdate, (function(q) {
return q.update();
}));
},
_pruneQueryFromTree: function(query) {
this._removeQueryRef(query);
@@ -23117,15 +26786,26 @@
while (isPresent(child)) {
child._pruneQueryFromTree(query);
child = child._next;
}
},
- _addQueryToTree: function(query) {
- this._assignQueryRef(query);
+ _addQueryToTree: function(queryRef) {
+ if (queryRef.query.descendants == false) {
+ if (this == queryRef.originator) {
+ this._addQueryToTreeSelfAndRecurse(queryRef);
+ } else if (this.parent == queryRef.originator) {
+ this._assignQueryRef(queryRef);
+ }
+ } else {
+ this._addQueryToTreeSelfAndRecurse(queryRef);
+ }
+ },
+ _addQueryToTreeSelfAndRecurse: function(queryRef) {
+ this._assignQueryRef(queryRef);
var child = this._head;
while (isPresent(child)) {
- child._addQueryToTree(query);
+ child._addQueryToTree(queryRef);
child = child._next;
}
},
_assignQueryRef: function(query) {
if (isBlank(this._query0)) {
@@ -23150,11 +26830,11 @@
},
_getByKey: function(key, visibility, optional, requestor) {
var ei = this;
var currentVisibility = this._isComponentKey(requestor) ? LIGHT_DOM_AND_SHADOW_DOM : LIGHT_DOM;
var depth = visibility.depth;
- if (!visibility.shouldIncludeSelf()) {
+ if (!visibility.includeSelf) {
depth -= ei._proto.distanceToParent;
if (isPresent(ei._parent)) {
ei = ei._parent;
} else {
ei = ei._host;
@@ -23178,20 +26858,18 @@
currentVisibility = visibility.crossComponentBoundaries ? LIGHT_DOM : SHADOW_DOM;
}
}
if (isPresent(this._host) && this._host._isComponentKey(key)) {
return this._host.getComponent();
- } else if (isPresent(this._host) && this._host._isDynamicallyLoadedComponentKey(key)) {
- return this._host.getDynamicallyLoadedComponent();
} else if (optional) {
return this._appInjector(requestor).getOptional(key);
} else {
return this._appInjector(requestor).get(key);
}
},
_appInjector: function(requestor) {
- if (isPresent(requestor) && (this._isComponentKey(requestor) || this._isDynamicallyLoadedComponentKey(requestor))) {
+ if (isPresent(requestor) && this._isComponentKey(requestor)) {
return this._shadowDomAppInjector;
} else {
return this._lightDomAppInjector;
}
},
@@ -23200,68 +26878,239 @@
if (keyId === staticKeys.viewManagerId)
return this._preBuiltObjects.viewManager;
return _undefined;
},
_getObjByKeyId: function(keyId, visibility) {
- var p = this._proto;
+ return this._strategy.getObjByKeyId(keyId, visibility);
+ },
+ getDirectiveAtIndex: function(index) {
+ return this._strategy.getDirectiveAtIndex(index);
+ },
+ hasInstances: function() {
+ return this._constructionCounter > 0;
+ },
+ getLightDomAppInjector: function() {
+ return this._lightDomAppInjector;
+ },
+ getShadowDomAppInjector: function() {
+ return this._shadowDomAppInjector;
+ },
+ getHost: function() {
+ return this._host;
+ },
+ getBoundElementIndex: function() {
+ return this._proto.index;
+ }
+ }, {}, $__super);
+ }(TreeNode));
+ $__export("ElementInjector", ElementInjector);
+ ElementInjectorInlineStrategy = (function() {
+ function ElementInjectorInlineStrategy(_protoStrategy, _ei) {
+ this._protoStrategy = _protoStrategy;
+ this._ei = _ei;
+ this._obj0 = null;
+ this._obj1 = null;
+ this._obj2 = null;
+ this._obj3 = null;
+ this._obj4 = null;
+ this._obj5 = null;
+ this._obj6 = null;
+ this._obj7 = null;
+ this._obj8 = null;
+ this._obj9 = null;
+ }
+ return ($traceurRuntime.createClass)(ElementInjectorInlineStrategy, {
+ callOnDestroy: function() {
+ var p = this._protoStrategy;
+ if (p._binding0 instanceof DirectiveBinding && p._binding0.callOnDestroy) {
+ this._obj0.onDestroy();
+ }
+ if (p._binding1 instanceof DirectiveBinding && p._binding1.callOnDestroy) {
+ this._obj1.onDestroy();
+ }
+ if (p._binding2 instanceof DirectiveBinding && p._binding2.callOnDestroy) {
+ this._obj2.onDestroy();
+ }
+ if (p._binding3 instanceof DirectiveBinding && p._binding3.callOnDestroy) {
+ this._obj3.onDestroy();
+ }
+ if (p._binding4 instanceof DirectiveBinding && p._binding4.callOnDestroy) {
+ this._obj4.onDestroy();
+ }
+ if (p._binding5 instanceof DirectiveBinding && p._binding5.callOnDestroy) {
+ this._obj5.onDestroy();
+ }
+ if (p._binding6 instanceof DirectiveBinding && p._binding6.callOnDestroy) {
+ this._obj6.onDestroy();
+ }
+ if (p._binding7 instanceof DirectiveBinding && p._binding7.callOnDestroy) {
+ this._obj7.onDestroy();
+ }
+ if (p._binding8 instanceof DirectiveBinding && p._binding8.callOnDestroy) {
+ this._obj8.onDestroy();
+ }
+ if (p._binding9 instanceof DirectiveBinding && p._binding9.callOnDestroy) {
+ this._obj9.onDestroy();
+ }
+ },
+ clearInstances: function() {
+ this._obj0 = null;
+ this._obj1 = null;
+ this._obj2 = null;
+ this._obj3 = null;
+ this._obj4 = null;
+ this._obj5 = null;
+ this._obj6 = null;
+ this._obj7 = null;
+ this._obj8 = null;
+ this._obj9 = null;
+ },
+ hydrate: function() {
+ var p = this._protoStrategy;
+ var e = this._ei;
+ if (isPresent(p._keyId0) && isBlank(this._obj0))
+ this._obj0 = e._new(p._binding0);
+ if (isPresent(p._keyId1) && isBlank(this._obj1))
+ this._obj1 = e._new(p._binding1);
+ if (isPresent(p._keyId2) && isBlank(this._obj2))
+ this._obj2 = e._new(p._binding2);
+ if (isPresent(p._keyId3) && isBlank(this._obj3))
+ this._obj3 = e._new(p._binding3);
+ if (isPresent(p._keyId4) && isBlank(this._obj4))
+ this._obj4 = e._new(p._binding4);
+ if (isPresent(p._keyId5) && isBlank(this._obj5))
+ this._obj5 = e._new(p._binding5);
+ if (isPresent(p._keyId6) && isBlank(this._obj6))
+ this._obj6 = e._new(p._binding6);
+ if (isPresent(p._keyId7) && isBlank(this._obj7))
+ this._obj7 = e._new(p._binding7);
+ if (isPresent(p._keyId8) && isBlank(this._obj8))
+ this._obj8 = e._new(p._binding8);
+ if (isPresent(p._keyId9) && isBlank(this._obj9))
+ this._obj9 = e._new(p._binding9);
+ },
+ getComponent: function() {
+ return this._obj0;
+ },
+ isComponentKey: function(key) {
+ return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === this._protoStrategy._keyId0;
+ },
+ buildQueries: function() {
+ var p = this._protoStrategy;
+ if (p._binding0 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding0.dependencies);
+ }
+ if (p._binding1 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding1.dependencies);
+ }
+ if (p._binding2 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding2.dependencies);
+ }
+ if (p._binding3 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding3.dependencies);
+ }
+ if (p._binding4 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding4.dependencies);
+ }
+ if (p._binding5 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding5.dependencies);
+ }
+ if (p._binding6 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding6.dependencies);
+ }
+ if (p._binding7 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding7.dependencies);
+ }
+ if (p._binding8 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding8.dependencies);
+ }
+ if (p._binding9 instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._binding9.dependencies);
+ }
+ },
+ addDirectivesMatchingQuery: function(query, list) {
+ var p = this._protoStrategy;
+ if (isPresent(p._binding0) && p._binding0.key.token === query.selector)
+ list.push(this._obj0);
+ if (isPresent(p._binding1) && p._binding1.key.token === query.selector)
+ list.push(this._obj1);
+ if (isPresent(p._binding2) && p._binding2.key.token === query.selector)
+ list.push(this._obj2);
+ if (isPresent(p._binding3) && p._binding3.key.token === query.selector)
+ list.push(this._obj3);
+ if (isPresent(p._binding4) && p._binding4.key.token === query.selector)
+ list.push(this._obj4);
+ if (isPresent(p._binding5) && p._binding5.key.token === query.selector)
+ list.push(this._obj5);
+ if (isPresent(p._binding6) && p._binding6.key.token === query.selector)
+ list.push(this._obj6);
+ if (isPresent(p._binding7) && p._binding7.key.token === query.selector)
+ list.push(this._obj7);
+ if (isPresent(p._binding8) && p._binding8.key.token === query.selector)
+ list.push(this._obj8);
+ if (isPresent(p._binding9) && p._binding9.key.token === query.selector)
+ list.push(this._obj9);
+ },
+ getObjByKeyId: function(keyId, visibility) {
+ var p = this._protoStrategy;
if (p._keyId0 === keyId && (p._visibility0 & visibility) > 0) {
if (isBlank(this._obj0)) {
- this._obj0 = this._new(p._binding0);
+ this._obj0 = this._ei._new(p._binding0);
}
return this._obj0;
}
if (p._keyId1 === keyId && (p._visibility1 & visibility) > 0) {
if (isBlank(this._obj1)) {
- this._obj1 = this._new(p._binding1);
+ this._obj1 = this._ei._new(p._binding1);
}
return this._obj1;
}
if (p._keyId2 === keyId && (p._visibility2 & visibility) > 0) {
if (isBlank(this._obj2)) {
- this._obj2 = this._new(p._binding2);
+ this._obj2 = this._ei._new(p._binding2);
}
return this._obj2;
}
if (p._keyId3 === keyId && (p._visibility3 & visibility) > 0) {
if (isBlank(this._obj3)) {
- this._obj3 = this._new(p._binding3);
+ this._obj3 = this._ei._new(p._binding3);
}
return this._obj3;
}
if (p._keyId4 === keyId && (p._visibility4 & visibility) > 0) {
if (isBlank(this._obj4)) {
- this._obj4 = this._new(p._binding4);
+ this._obj4 = this._ei._new(p._binding4);
}
return this._obj4;
}
if (p._keyId5 === keyId && (p._visibility5 & visibility) > 0) {
if (isBlank(this._obj5)) {
- this._obj5 = this._new(p._binding5);
+ this._obj5 = this._ei._new(p._binding5);
}
return this._obj5;
}
if (p._keyId6 === keyId && (p._visibility6 & visibility) > 0) {
if (isBlank(this._obj6)) {
- this._obj6 = this._new(p._binding6);
+ this._obj6 = this._ei._new(p._binding6);
}
return this._obj6;
}
if (p._keyId7 === keyId && (p._visibility7 & visibility) > 0) {
if (isBlank(this._obj7)) {
- this._obj7 = this._new(p._binding7);
+ this._obj7 = this._ei._new(p._binding7);
}
return this._obj7;
}
if (p._keyId8 === keyId && (p._visibility8 & visibility) > 0) {
if (isBlank(this._obj8)) {
- this._obj8 = this._new(p._binding8);
+ this._obj8 = this._ei._new(p._binding8);
}
return this._obj8;
}
if (p._keyId9 === keyId && (p._visibility9 & visibility) > 0) {
if (isBlank(this._obj9)) {
- this._obj9 = this._new(p._binding9);
+ this._obj9 = this._ei._new(p._binding9);
}
return this._obj9;
}
return _undefined;
},
@@ -23286,37 +27135,91 @@
return this._obj8;
if (index == 9)
return this._obj9;
throw new OutOfBoundsAccess(index);
},
- hasInstances: function() {
- return this._constructionCounter > 0;
+ getComponentBinding: function() {
+ return this._protoStrategy._binding0;
},
- isExportingComponent: function() {
- return this._proto.exportComponent;
+ getMaxDirectives: function() {
+ return _MAX_DIRECTIVE_CONSTRUCTION_COUNTER;
+ }
+ }, {});
+ }());
+ ElementInjectorDynamicStrategy = (function() {
+ function ElementInjectorDynamicStrategy(_protoStrategy, _ei) {
+ this._protoStrategy = _protoStrategy;
+ this._ei = _ei;
+ this._objs = ListWrapper.createFixedSize(_protoStrategy._bindings.length);
+ }
+ return ($traceurRuntime.createClass)(ElementInjectorDynamicStrategy, {
+ callOnDestroy: function() {
+ var p = this._protoStrategy;
+ for (var i = 0; i < p._bindings.length; i++) {
+ if (p._bindings[i] instanceof DirectiveBinding && p._bindings[i].callOnDestroy) {
+ this._objs[i].onDestroy();
+ }
+ }
},
- isExportingElement: function() {
- return this._proto.exportElement;
+ clearInstances: function() {
+ ListWrapper.fill(this._objs, null);
},
- getExportImplicitName: function() {
- return this._proto.exportImplicitName;
+ hydrate: function() {
+ var p = this._protoStrategy;
+ for (var i = 0; i < p._keyIds.length; i++) {
+ if (isPresent(p._keyIds[i]) && isBlank(this._objs[i])) {
+ this._objs[i] = this._ei._new(p._bindings[i]);
+ }
+ }
},
- getLightDomAppInjector: function() {
- return this._lightDomAppInjector;
+ getComponent: function() {
+ return this._objs[0];
},
- getShadowDomAppInjector: function() {
- return this._shadowDomAppInjector;
+ isComponentKey: function(key) {
+ return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === this._protoStrategy._keyIds[0];
},
- getHost: function() {
- return this._host;
+ buildQueries: function() {
+ var p = this._protoStrategy;
+ for (var i = 0; i < p._bindings.length; i++) {
+ if (p._bindings[i] instanceof DirectiveBinding) {
+ this._ei._buildQueriesForDeps(p._bindings[i].dependencies);
+ }
+ }
},
- getBoundElementIndex: function() {
- return this._proto.index;
+ addDirectivesMatchingQuery: function(query, list) {
+ var p = this._protoStrategy;
+ for (var i = 0; i < p._bindings.length; i++) {
+ if (p._bindings[i].key.token === query.selector)
+ list.push(this._objs[i]);
+ }
+ },
+ getObjByKeyId: function(keyId, visibility) {
+ var p = this._protoStrategy;
+ for (var i = 0; i < p._keyIds.length; i++) {
+ if (p._keyIds[i] === keyId && (p._visibilities[i] & visibility) > 0) {
+ if (isBlank(this._objs[i])) {
+ this._objs[i] = this._ei._new(p._bindings[i]);
+ }
+ return this._objs[i];
+ }
+ }
+ return _undefined;
+ },
+ getDirectiveAtIndex: function(index) {
+ if (index < 0 || index >= this._objs.length) {
+ throw new OutOfBoundsAccess(index);
+ }
+ return this._objs[index];
+ },
+ getComponentBinding: function() {
+ return this._protoStrategy._bindings[0];
+ },
+ getMaxDirectives: function() {
+ return this._objs.length;
}
- }, {}, $__super);
- }(TreeNode));
- $__export("ElementInjector", ElementInjector);
+ }, {});
+ }());
OutOfBoundsAccess = (function($__super) {
function OutOfBoundsAccess(index) {
$traceurRuntime.superConstructor(OutOfBoundsAccess).call(this);
this.message = ("Index " + index + " is out-of-bounds.");
}
@@ -23332,41 +27235,294 @@
return ($traceurRuntime.createClass)(QueryError, {toString: function() {
return this.message;
}}, {}, $__super);
}(BaseException));
QueryRef = (function() {
- function QueryRef(directive, list, originator) {
- this.directive = directive;
+ function QueryRef(query, list, originator) {
+ this.query = query;
this.list = list;
this.originator = originator;
}
return ($traceurRuntime.createClass)(QueryRef, {
update: function() {
var aggregator = [];
this.visit(this.originator, aggregator);
this.list.reset(aggregator);
},
visit: function(inj, aggregator) {
- if (isBlank(inj))
+ if (isBlank(inj) || !inj._hasQuery(this))
return ;
- if (inj.hasDirective(this.directive)) {
- ListWrapper.push(aggregator, inj.get(this.directive));
+ if (this.query.isVarBindingQuery) {
+ this._aggregateVariableBindings(inj, aggregator);
+ } else {
+ this._aggregateDirective(inj, aggregator);
}
var child = inj._head;
while (isPresent(child)) {
this.visit(child, aggregator);
child = child._next;
}
+ },
+ _aggregateVariableBindings: function(inj, aggregator) {
+ var vb = this.query.varBindings;
+ for (var i = 0; i < vb.length; ++i) {
+ if (inj.hasVariableBinding(vb[i])) {
+ aggregator.push(inj.getVariableBinding(vb[i]));
+ }
+ }
+ },
+ _aggregateDirective: function(inj, aggregator) {
+ inj.addDirectivesMatchingQuery(this.query, aggregator);
}
}, {});
}());
}
};
});
-System.register("angular2/src/core/compiler/compiler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/template_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/services/url_resolver", "angular2/src/render/api"], function($__export) {
+System.register("angular2/http", ["angular2/di", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/base_request_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], function($__export) {
"use strict";
+ var __moduleName = "angular2/http";
+ var bind,
+ Http,
+ HttpFactory,
+ XHRBackend,
+ XHRConnection,
+ BrowserXHR,
+ BaseRequestOptions,
+ RequestOptions,
+ httpInjectables;
+ var $__exportNames = {
+ Http: true,
+ XHRBackend: true,
+ XHRConnection: true,
+ BaseRequestOptions: true,
+ RequestOptions: true,
+ HttpFactory: true,
+ httpInjectables: true,
+ undefined: true
+ };
+ return {
+ setters: [function($__m) {
+ bind = $__m.bind;
+ }, function($__m) {
+ Http = $__m.Http;
+ HttpFactory = $__m.HttpFactory;
+ }, function($__m) {
+ XHRBackend = $__m.XHRBackend;
+ XHRConnection = $__m.XHRConnection;
+ }, function($__m) {
+ BrowserXHR = $__m.BrowserXHR;
+ }, function($__m) {
+ BaseRequestOptions = $__m.BaseRequestOptions;
+ RequestOptions = $__m.RequestOptions;
+ }, function($__m) {
+ $__export("MockConnection", $__m.MockConnection);
+ $__export("MockBackend", $__m.MockBackend);
+ }, function($__m) {
+ $__export("Request", $__m.Request);
+ }, function($__m) {
+ $__export("Response", $__m.Response);
+ }, function($__m) {
+ $__export("Headers", $__m.Headers);
+ }, function($__m) {
+ Object.keys($__m).forEach(function(p) {
+ if (!$__exportNames[p])
+ $__export(p, $__m[p]);
+ });
+ }, function($__m) {
+ $__export("URLSearchParams", $__m.URLSearchParams);
+ }],
+ execute: function() {
+ $__export("Http", Http), $__export("XHRBackend", XHRBackend), $__export("XHRConnection", XHRConnection), $__export("BaseRequestOptions", BaseRequestOptions), $__export("RequestOptions", RequestOptions), $__export("HttpFactory", HttpFactory);
+ httpInjectables = [bind(BrowserXHR).toValue(BrowserXHR), XHRBackend, BaseRequestOptions, bind(HttpFactory).toFactory(HttpFactory, [XHRBackend, BaseRequestOptions]), Http];
+ $__export("httpInjectables", httpInjectables);
+ }
+ };
+});
+
+System.register("angular2/src/change_detection/change_detection", ["angular2/src/change_detection/jit_proto_change_detector", "angular2/src/change_detection/pregen_proto_change_detector", "angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/pipes/pipe_registry", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/change_detection/pipes/keyvalue_changes", "angular2/src/change_detection/pipes/observable_pipe", "angular2/src/change_detection/pipes/promise_pipe", "angular2/src/change_detection/pipes/uppercase_pipe", "angular2/src/change_detection/pipes/lowercase_pipe", "angular2/src/change_detection/pipes/json_pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/interfaces", "angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) {
+ "use strict";
+ var __moduleName = "angular2/src/change_detection/change_detection";
+ var __decorate,
+ __metadata,
+ __param,
+ JitProtoChangeDetector,
+ PregenProtoChangeDetector,
+ DynamicProtoChangeDetector,
+ PipeRegistry,
+ IterableChangesFactory,
+ KeyValueChangesFactory,
+ ObservablePipeFactory,
+ PromisePipeFactory,
+ UpperCaseFactory,
+ LowerCaseFactory,
+ JsonPipe,
+ NullPipeFactory,
+ ChangeDetection,
+ Inject,
+ Injectable,
+ OpaqueToken,
+ Optional,
+ StringMapWrapper,
+ CONST_EXPR,
+ isPresent,
+ keyValDiff,
+ iterableDiff,
+ async,
+ uppercase,
+ lowercase,
+ json,
+ defaultPipes,
+ preGeneratedProtoDetectors,
+ PROTO_CHANGE_DETECTOR_KEY,
+ PreGeneratedChangeDetection,
+ DynamicChangeDetection,
+ JitChangeDetection,
+ defaultPipeRegistry;
+ return {
+ setters: [function($__m) {
+ JitProtoChangeDetector = $__m.JitProtoChangeDetector;
+ }, function($__m) {
+ PregenProtoChangeDetector = $__m.PregenProtoChangeDetector;
+ }, function($__m) {
+ DynamicProtoChangeDetector = $__m.DynamicProtoChangeDetector;
+ }, function($__m) {
+ PipeRegistry = $__m.PipeRegistry;
+ }, function($__m) {
+ IterableChangesFactory = $__m.IterableChangesFactory;
+ }, function($__m) {
+ KeyValueChangesFactory = $__m.KeyValueChangesFactory;
+ }, function($__m) {
+ ObservablePipeFactory = $__m.ObservablePipeFactory;
+ }, function($__m) {
+ PromisePipeFactory = $__m.PromisePipeFactory;
+ }, function($__m) {
+ UpperCaseFactory = $__m.UpperCaseFactory;
+ }, function($__m) {
+ LowerCaseFactory = $__m.LowerCaseFactory;
+ }, function($__m) {
+ JsonPipe = $__m.JsonPipe;
+ }, function($__m) {
+ NullPipeFactory = $__m.NullPipeFactory;
+ }, function($__m) {
+ ChangeDetection = $__m.ChangeDetection;
+ }, function($__m) {
+ Inject = $__m.Inject;
+ Injectable = $__m.Injectable;
+ OpaqueToken = $__m.OpaqueToken;
+ Optional = $__m.Optional;
+ }, function($__m) {
+ StringMapWrapper = $__m.StringMapWrapper;
+ }, function($__m) {
+ CONST_EXPR = $__m.CONST_EXPR;
+ isPresent = $__m.isPresent;
+ }],
+ execute: function() {
+ __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
+ return Reflect.decorate(decorators, target, key, desc);
+ switch (arguments.length) {
+ case 2:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(o)) || o;
+ }, target);
+ case 3:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key)), void 0;
+ }, void 0);
+ case 4:
+ return decorators.reduceRight(function(o, d) {
+ return (d && d(target, key, o)) || o;
+ }, desc);
+ }
+ };
+ __metadata = (this && this.__metadata) || function(k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
+ return Reflect.metadata(k, v);
+ };
+ __param = (this && this.__param) || function(paramIndex, decorator) {
+ return function(target, key) {
+ decorator(target, key, paramIndex);
+ };
+ };
+ keyValDiff = [new KeyValueChangesFactory(), new NullPipeFactory()];
+ $__export("keyValDiff", keyValDiff);
+ iterableDiff = [new IterableChangesFactory(), new NullPipeFactory()];
+ $__export("iterableDiff", iterableDiff);
+ async = [new ObservablePipeFactory(), new PromisePipeFactory(), new NullPipeFactory()];
+ $__export("async", async);
+ uppercase = [new UpperCaseFactory(), new NullPipeFactory()];
+ $__export("uppercase", uppercase);
+ lowercase = [new LowerCaseFactory(), new NullPipeFactory()];
+ $__export("lowercase", lowercase);
+ json = [new JsonPipe(), new NullPipeFactory()];
+ $__export("json", json);
+ defaultPipes = {
+ "iterableDiff": iterableDiff,
+ "keyValDiff": keyValDiff,
+ "async": async,
+ "uppercase": uppercase,
+ "lowercase": lowercase,
+ "json": json
+ };
+ $__export("defaultPipes", defaultPipes);
+ preGeneratedProtoDetectors = {};
+ $__export("preGeneratedProtoDetectors", preGeneratedProtoDetectors);
+ PROTO_CHANGE_DETECTOR_KEY = CONST_EXPR(new OpaqueToken('ProtoChangeDetectors'));
+ $__export("PROTO_CHANGE_DETECTOR_KEY", PROTO_CHANGE_DETECTOR_KEY);
+ PreGeneratedChangeDetection = (function($__super) {
+ function $__0(registry, protoChangeDetectorsForTest) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this.registry = registry;
+ this._dynamicChangeDetection = new DynamicChangeDetection(registry);
+ this._protoChangeDetectorFactories = isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : preGeneratedProtoDetectors;
+ }
+ return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) {
+ var id = definition.id;
+ if (StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) {
+ return StringMapWrapper.get(this._protoChangeDetectorFactories, id)(this.registry, definition);
+ }
+ return this._dynamicChangeDetection.createProtoChangeDetector(definition);
+ }}, {isSupported: function() {
+ return PregenProtoChangeDetector.isSupported();
+ }}, $__super);
+ }(ChangeDetection));
+ $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection);
+ $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection = __decorate([Injectable(), __param(1, Inject(PROTO_CHANGE_DETECTOR_KEY)), __param(1, Optional()), __metadata('design:paramtypes', [PipeRegistry, Object])], PreGeneratedChangeDetection));
+ DynamicChangeDetection = (function($__super) {
+ function $__0(registry) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this.registry = registry;
+ }
+ return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) {
+ return new DynamicProtoChangeDetector(this.registry, definition);
+ }}, {}, $__super);
+ }(ChangeDetection));
+ $__export("DynamicChangeDetection", DynamicChangeDetection);
+ $__export("DynamicChangeDetection", DynamicChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [PipeRegistry])], DynamicChangeDetection));
+ JitChangeDetection = (function($__super) {
+ function $__0(registry) {
+ $traceurRuntime.superConstructor($__0).call(this);
+ this.registry = registry;
+ }
+ return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) {
+ return new JitProtoChangeDetector(this.registry, definition);
+ }}, {isSupported: function() {
+ return JitProtoChangeDetector.isSupported();
+ }}, $__super);
+ }(ChangeDetection));
+ $__export("JitChangeDetection", JitChangeDetection);
+ $__export("JitChangeDetection", JitChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [PipeRegistry])], JitChangeDetection));
+ defaultPipeRegistry = new PipeRegistry(defaultPipes);
+ $__export("defaultPipeRegistry", defaultPipeRegistry);
+ }
+ };
+});
+
+System.register("angular2/src/core/compiler/compiler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/render/api"], function($__export) {
+ "use strict";
var __moduleName = "angular2/src/core/compiler/compiler";
var __decorate,
__metadata,
Binding,
resolveForwardRef,
@@ -23375,20 +27531,24 @@
isBlank,
isPresent,
BaseException,
normalizeBlank,
stringify,
+ isArray,
+ isPromise,
PromiseWrapper,
ListWrapper,
+ Map,
MapWrapper,
DirectiveResolver,
ProtoViewRef,
DirectiveBinding,
- TemplateResolver,
+ ViewResolver,
ComponentUrlMapper,
ProtoViewFactory,
UrlResolver,
+ AppRootUrl,
renderApi,
CompilerCache,
Compiler;
return {
setters: [function($__m) {
@@ -23400,30 +27560,35 @@
isBlank = $__m.isBlank;
isPresent = $__m.isPresent;
BaseException = $__m.BaseException;
normalizeBlank = $__m.normalizeBlank;
stringify = $__m.stringify;
+ isArray = $__m.isArray;
+ isPromise = $__m.isPromise;
}, function($__m) {
PromiseWrapper = $__m.PromiseWrapper;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
+ Map = $__m.Map;
MapWrapper = $__m.MapWrapper;
}, function($__m) {
DirectiveResolver = $__m.DirectiveResolver;
}, function($__m) {
ProtoViewRef = $__m.ProtoViewRef;
}, function($__m) {
DirectiveBinding = $__m.DirectiveBinding;
}, function($__m) {
- TemplateResolver = $__m.TemplateResolver;
+ ViewResolver = $__m.ViewResolver;
}, function($__m) {
ComponentUrlMapper = $__m.ComponentUrlMapper;
}, function($__m) {
ProtoViewFactory = $__m.ProtoViewFactory;
}, function($__m) {
UrlResolver = $__m.UrlResolver;
}, function($__m) {
+ AppRootUrl = $__m.AppRootUrl;
+ }, function($__m) {
renderApi = $__m;
}],
execute: function() {
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -23446,33 +27611,42 @@
__metadata = (this && this.__metadata) || function(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(k, v);
};
CompilerCache = (($traceurRuntime.createClass)(function() {
- this._cache = MapWrapper.create();
+ this._cache = new Map();
+ this._hostCache = new Map();
}, {
set: function(component, protoView) {
- MapWrapper.set(this._cache, component, protoView);
+ this._cache.set(component, protoView);
},
get: function(component) {
- var result = MapWrapper.get(this._cache, component);
+ var result = this._cache.get(component);
return normalizeBlank(result);
},
+ setHost: function(component, protoView) {
+ this._hostCache.set(component, protoView);
+ },
+ getHost: function(component) {
+ var result = this._hostCache.get(component);
+ return normalizeBlank(result);
+ },
clear: function() {
- MapWrapper.clear(this._cache);
+ this._cache.clear();
+ this._hostCache.clear();
}
}, {}));
$__export("CompilerCache", CompilerCache);
$__export("CompilerCache", CompilerCache = __decorate([Injectable(), __metadata('design:paramtypes', [])], CompilerCache));
- Compiler = (($traceurRuntime.createClass)(function(reader, cache, templateResolver, componentUrlMapper, urlResolver, render, protoViewFactory) {
+ Compiler = (($traceurRuntime.createClass)(function(reader, cache, viewResolver, componentUrlMapper, urlResolver, render, protoViewFactory, appUrl) {
this._reader = reader;
this._compilerCache = cache;
- this._compiling = MapWrapper.create();
- this._templateResolver = templateResolver;
+ this._compiling = new Map();
+ this._viewResolver = viewResolver;
this._componentUrlMapper = componentUrlMapper;
this._urlResolver = urlResolver;
- this._appUrl = urlResolver.resolve(null, './');
+ this._appUrl = appUrl.value;
this._render = render;
this._protoViewFactory = protoViewFactory;
}, {
_bindDirective: function(directiveTypeOrBinding) {
if (directiveTypeOrBinding instanceof DirectiveBinding) {
@@ -23488,75 +27662,75 @@
compileInHost: function(componentTypeOrBinding) {
var $__0 = this;
var componentBinding = this._bindDirective(componentTypeOrBinding);
Compiler._assertTypeIsComponent(componentBinding);
var directiveMetadata = componentBinding.metadata;
- return this._render.compileHost(directiveMetadata).then((function(hostRenderPv) {
- return $__0._compileNestedProtoViews(componentBinding, hostRenderPv, [componentBinding]);
- })).then((function(appProtoView) {
- return new ProtoViewRef(appProtoView);
+ var hostPvPromise;
+ var component = componentBinding.key.token;
+ var hostAppProtoView = this._compilerCache.getHost(component);
+ if (isPresent(hostAppProtoView)) {
+ hostPvPromise = PromiseWrapper.resolve(hostAppProtoView);
+ } else {
+ hostPvPromise = this._render.compileHost(directiveMetadata).then((function(hostRenderPv) {
+ return $__0._compileNestedProtoViews(componentBinding, hostRenderPv, [componentBinding]);
+ }));
+ }
+ return hostPvPromise.then((function(hostAppProtoView) {
+ return new ProtoViewRef(hostAppProtoView);
}));
},
- compile: function(component) {
- var componentBinding = this._bindDirective(component);
- Compiler._assertTypeIsComponent(componentBinding);
- var pvOrPromise = this._compile(componentBinding);
- var pvPromise = PromiseWrapper.isPromise(pvOrPromise) ? pvOrPromise : PromiseWrapper.resolve(pvOrPromise);
- return pvPromise.then((function(appProtoView) {
- return new ProtoViewRef(appProtoView);
- }));
- },
_compile: function(componentBinding) {
var $__0 = this;
var component = componentBinding.key.token;
var protoView = this._compilerCache.get(component);
if (isPresent(protoView)) {
return protoView;
}
- var pvPromise = MapWrapper.get(this._compiling, component);
+ var pvPromise = this._compiling.get(component);
if (isPresent(pvPromise)) {
return pvPromise;
}
- var template = this._templateResolver.resolve(component);
- if (isBlank(template)) {
- return null;
- }
- var directives = this._flattenDirectives(template);
+ var view = this._viewResolver.resolve(component);
+ var directives = this._flattenDirectives(view);
for (var i = 0; i < directives.length; i++) {
if (!Compiler._isValidDirective(directives[i])) {
throw new BaseException(("Unexpected directive value '" + stringify(directives[i]) + "' on the View of component '" + stringify(component) + "'"));
}
}
var boundDirectives = ListWrapper.map(directives, (function(directive) {
return $__0._bindDirective(directive);
}));
- var renderTemplate = this._buildRenderTemplate(component, template, boundDirectives);
+ var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives);
pvPromise = this._render.compile(renderTemplate).then((function(renderPv) {
return $__0._compileNestedProtoViews(componentBinding, renderPv, boundDirectives);
}));
- MapWrapper.set(this._compiling, component, pvPromise);
+ this._compiling.set(component, pvPromise);
return pvPromise;
},
_compileNestedProtoViews: function(componentBinding, renderPv, directives) {
var $__0 = this;
var protoViews = this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, directives);
var protoView = protoViews[0];
- if (renderPv.type === renderApi.ProtoViewDto.COMPONENT_VIEW_TYPE && isPresent(componentBinding)) {
+ if (isPresent(componentBinding)) {
var component = componentBinding.key.token;
- this._compilerCache.set(component, protoView);
- MapWrapper.delete(this._compiling, component);
+ if (renderPv.type === renderApi.ViewType.COMPONENT) {
+ this._compilerCache.set(component, protoView);
+ MapWrapper.delete(this._compiling, component);
+ } else {
+ this._compilerCache.setHost(component, protoView);
+ }
}
var nestedPVPromises = [];
ListWrapper.forEach(this._collectComponentElementBinders(protoViews), (function(elementBinder) {
var nestedComponent = elementBinder.componentDirective;
var elementBinderDone = (function(nestedPv) {
elementBinder.nestedProtoView = nestedPv;
});
var nestedCall = $__0._compile(nestedComponent);
- if (PromiseWrapper.isPromise(nestedCall)) {
- ListWrapper.push(nestedPVPromises, nestedCall.then(elementBinderDone));
- } else if (isPresent(nestedCall)) {
+ if (isPromise(nestedCall)) {
+ nestedPVPromises.push(nestedCall.then(elementBinderDone));
+ } else {
elementBinderDone(nestedCall);
}
}));
if (nestedPVPromises.length > 0) {
return PromiseWrapper.all(nestedPVPromises).then((function(_) {
@@ -23569,28 +27743,37 @@
_collectComponentElementBinders: function(protoViews) {
var componentElementBinders = [];
ListWrapper.forEach(protoViews, (function(protoView) {
ListWrapper.forEach(protoView.elementBinders, (function(elementBinder) {
if (isPresent(elementBinder.componentDirective)) {
- ListWrapper.push(componentElementBinders, elementBinder);
+ componentElementBinders.push(elementBinder);
}
}));
}));
return componentElementBinders;
},
_buildRenderTemplate: function(component, view, directives) {
+ var $__0 = this;
var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component));
var templateAbsUrl = null;
+ var styleAbsUrls = null;
if (isPresent(view.templateUrl)) {
templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl);
} else if (isPresent(view.template)) {
templateAbsUrl = componentUrl;
}
+ if (isPresent(view.styleUrls)) {
+ styleAbsUrls = ListWrapper.map(view.styleUrls, (function(url) {
+ return $__0._urlResolver.resolve(componentUrl, url);
+ }));
+ }
return new renderApi.ViewDefinition({
componentId: stringify(component),
- absUrl: templateAbsUrl,
+ templateAbsUrl: templateAbsUrl,
template: view.template,
+ styleAbsUrls: styleAbsUrls,
+ styles: view.styles,
directives: ListWrapper.map(directives, (function(directiveBinding) {
return directiveBinding.metadata;
}))
});
},
@@ -23602,14 +27785,14 @@
return directives;
},
_flattenList: function(tree, out) {
for (var i = 0; i < tree.length; i++) {
var item = resolveForwardRef(tree[i]);
- if (ListWrapper.isList(item)) {
+ if (isArray(item)) {
this._flattenList(item, out);
} else {
- ListWrapper.push(out, item);
+ out.push(item);
}
}
}
}, {
_isValidDirective: function(value) {
@@ -23620,17 +27803,81 @@
throw new BaseException(("Could not load '" + stringify(directiveBinding.key.token) + "' because it is not a component."));
}
}
}));
$__export("Compiler", Compiler);
- $__export("Compiler", Compiler = __decorate([Injectable(), __metadata('design:paramtypes', [DirectiveResolver, CompilerCache, TemplateResolver, ComponentUrlMapper, UrlResolver, renderApi.RenderCompiler, ProtoViewFactory])], Compiler));
+ $__export("Compiler", Compiler = __decorate([Injectable(), __metadata('design:paramtypes', [DirectiveResolver, CompilerCache, ViewResolver, ComponentUrlMapper, UrlResolver, renderApi.RenderCompiler, ProtoViewFactory, AppRootUrl])], Compiler));
}
};
});
-System.register("angular2/src/core/application", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/browser_adapter", "angular2/src/dom/dom_adapter", "angular2/src/core/compiler/compiler", "angular2/src/reflection/reflection", "angular2/change_detection", "angular2/src/core/exception_handler", "angular2/src/render/dom/compiler/template_loader", "angular2/src/core/compiler/template_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/core/zone/ng_zone", "angular2/src/core/life_cycle/life_cycle", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy", "angular2/src/services/xhr", "angular2/src/services/xhr_impl", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/events/key_events", "angular2/src/render/dom/events/hammer_gestures", "angular2/src/core/compiler/component_url_mapper", "angular2/src/services/url_resolver", "angular2/src/render/dom/shadow_dom/style_url_resolver", "angular2/src/render/dom/shadow_dom/style_inliner", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/testability/testability", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/proto_view_factory", "angular2/src/render/api", "angular2/src/render/dom/dom_renderer", "angular2/src/render/dom/view/view", "angular2/src/render/dom/compiler/compiler", "angular2/src/core/compiler/view_ref", "angular2/src/core/application_tokens"], function($__export) {
+System.register("angular2/change_detection", ["angular2/src/change_detection/parser/ast", "angular2/src/change_detection/parser/lexer", "angular2/src/change_detection/parser/parser", "angular2/src/change_detection/parser/locals", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/interfaces", "angular2/src/change_detection/constants", "angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/binding_record", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/pipes/pipe_registry", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/pipes/pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/change_detection"], function($__export) {
"use strict";
+ var __moduleName = "angular2/change_detection";
+ return {
+ setters: [function($__m) {
+ $__export("ASTWithSource", $__m.ASTWithSource);
+ $__export("AST", $__m.AST);
+ $__export("AstTransformer", $__m.AstTransformer);
+ $__export("AccessMember", $__m.AccessMember);
+ $__export("LiteralArray", $__m.LiteralArray);
+ $__export("ImplicitReceiver", $__m.ImplicitReceiver);
+ }, function($__m) {
+ $__export("Lexer", $__m.Lexer);
+ }, function($__m) {
+ $__export("Parser", $__m.Parser);
+ }, function($__m) {
+ $__export("Locals", $__m.Locals);
+ }, function($__m) {
+ $__export("DehydratedException", $__m.DehydratedException);
+ $__export("ExpressionChangedAfterItHasBeenChecked", $__m.ExpressionChangedAfterItHasBeenChecked);
+ $__export("ChangeDetectionError", $__m.ChangeDetectionError);
+ }, function($__m) {
+ $__export("ChangeDetection", $__m.ChangeDetection);
+ $__export("ChangeDetectorDefinition", $__m.ChangeDetectorDefinition);
+ }, function($__m) {
+ $__export("CHECK_ONCE", $__m.CHECK_ONCE);
+ $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS);
+ $__export("DETACHED", $__m.DETACHED);
+ $__export("CHECKED", $__m.CHECKED);
+ $__export("ON_PUSH", $__m.ON_PUSH);
+ $__export("DEFAULT", $__m.DEFAULT);
+ }, function($__m) {
+ $__export("DynamicProtoChangeDetector", $__m.DynamicProtoChangeDetector);
+ }, function($__m) {
+ $__export("BindingRecord", $__m.BindingRecord);
+ }, function($__m) {
+ $__export("DirectiveIndex", $__m.DirectiveIndex);
+ $__export("DirectiveRecord", $__m.DirectiveRecord);
+ }, function($__m) {
+ $__export("DynamicChangeDetector", $__m.DynamicChangeDetector);
+ }, function($__m) {
+ $__export("ChangeDetectorRef", $__m.ChangeDetectorRef);
+ }, function($__m) {
+ $__export("PipeRegistry", $__m.PipeRegistry);
+ }, function($__m) {
+ $__export("uninitialized", $__m.uninitialized);
+ }, function($__m) {
+ $__export("WrappedValue", $__m.WrappedValue);
+ $__export("BasePipe", $__m.BasePipe);
+ }, function($__m) {
+ $__export("NullPipe", $__m.NullPipe);
+ $__export("NullPipeFactory", $__m.NullPipeFactory);
+ }, function($__m) {
+ $__export("defaultPipes", $__m.defaultPipes);
+ $__export("DynamicChangeDetection", $__m.DynamicChangeDetection);
+ $__export("JitChangeDetection", $__m.JitChangeDetection);
+ $__export("PreGeneratedChangeDetection", $__m.PreGeneratedChangeDetection);
+ $__export("preGeneratedProtoDetectors", $__m.preGeneratedProtoDetectors);
+ $__export("defaultPipeRegistry", $__m.defaultPipeRegistry);
+ }],
+ execute: function() {}
+ };
+});
+
+System.register("angular2/src/core/application", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/browser_adapter", "angular2/src/dom/dom_adapter", "angular2/src/core/compiler/compiler", "angular2/src/reflection/reflection", "angular2/change_detection", "angular2/src/core/exception_handler", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/core/zone/ng_zone", "angular2/src/core/life_cycle/life_cycle", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy", "angular2/src/render/xhr", "angular2/src/render/xhr_impl", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/events/key_events", "angular2/src/render/dom/events/hammer_gestures", "angular2/src/core/compiler/component_url_mapper", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/testability/testability", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/proto_view_factory", "angular2/src/render/api", "angular2/src/render/dom/dom_renderer", "angular2/src/render/dom/compiler/compiler", "angular2/src/core/compiler/view_ref", "angular2/src/core/application_tokens"], function($__export) {
+ "use strict";
var __moduleName = "angular2/src/core/application";
var Injector,
bind,
isBlank,
isPresent,
@@ -23643,15 +27890,19 @@
reflector,
Parser,
Lexer,
ChangeDetection,
DynamicChangeDetection,
+ JitChangeDetection,
+ PreGeneratedChangeDetection,
PipeRegistry,
defaultPipeRegistry,
ExceptionHandler,
- TemplateLoader,
- TemplateResolver,
+ ViewLoader,
+ StyleUrlResolver,
+ StyleInliner,
+ ViewResolver,
DirectiveResolver,
ListWrapper,
PromiseWrapper,
NgZone,
LifeCycle,
@@ -23663,53 +27914,53 @@
DomEventsPlugin,
KeyEventsPlugin,
HammerGesturesPlugin,
ComponentUrlMapper,
UrlResolver,
- StyleUrlResolver,
- StyleInliner,
+ AppRootUrl,
DynamicComponentLoader,
TestabilityRegistry,
Testability,
AppViewPool,
APP_VIEW_POOL_CAPACITY,
AppViewManager,
AppViewManagerUtils,
+ AppViewListener,
ProtoViewFactory,
Renderer,
RenderCompiler,
DomRenderer,
DOCUMENT_TOKEN,
- resolveInternalDomView,
DefaultDomCompiler,
internalView,
appComponentRefToken,
appComponentTypeToken,
_rootInjector,
_rootBindings,
ApplicationRef;
function _injectorBindings(appComponentType) {
+ var bestChangeDetection = DynamicChangeDetection;
+ if (PreGeneratedChangeDetection.isSupported()) {
+ bestChangeDetection = PreGeneratedChangeDetection;
+ } else if (JitChangeDetection.isSupported()) {
+ bestChangeDetection = JitChangeDetection;
+ }
return [bind(DOCUMENT_TOKEN).toValue(DOM.defaultDoc()), bind(appComponentTypeToken).toValue(appComponentType), bind(appComponentRefToken).toAsyncFactory((function(dynamicComponentLoader, injector, testability, registry) {
return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then((function(componentRef) {
- var domView = resolveInternalDomView(componentRef.hostView.render);
- registry.registerApplication(domView.boundElements[0], testability);
+ registry.registerApplication(componentRef.location.nativeElement, testability);
return componentRef;
}));
}), [DynamicComponentLoader, Injector, Testability, TestabilityRegistry]), bind(appComponentType).toFactory((function(ref) {
return ref.instance;
}), [appComponentRefToken]), bind(LifeCycle).toFactory((function(exceptionHandler) {
return new LifeCycle(exceptionHandler, null, assertionsEnabled());
}), [ExceptionHandler]), bind(EventManager).toFactory((function(ngZone) {
var plugins = [new HammerGesturesPlugin(), new KeyEventsPlugin(), new DomEventsPlugin()];
return new EventManager(plugins, ngZone);
- }), [NgZone]), bind(ShadowDomStrategy).toFactory((function(styleUrlResolver, doc) {
- return new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head);
- }), [StyleUrlResolver, DOCUMENT_TOKEN]), bind(DomRenderer).toFactory((function(eventManager, shadowDomStrategy, doc) {
- return new DomRenderer(eventManager, shadowDomStrategy, doc);
- }), [EventManager, ShadowDomStrategy, DOCUMENT_TOKEN]), DefaultDomCompiler, bind(Renderer).toAlias(DomRenderer), bind(RenderCompiler).toAlias(DefaultDomCompiler), ProtoViewFactory, bind(AppViewPool).toFactory((function(capacity) {
- return new AppViewPool(capacity);
- }), [APP_VIEW_POOL_CAPACITY]), bind(APP_VIEW_POOL_CAPACITY).toValue(10000), AppViewManager, AppViewManagerUtils, Compiler, CompilerCache, TemplateResolver, bind(PipeRegistry).toValue(defaultPipeRegistry), bind(ChangeDetection).toClass(DynamicChangeDetection), TemplateLoader, DirectiveResolver, Parser, Lexer, ExceptionHandler, bind(XHR).toValue(new XHRImpl()), ComponentUrlMapper, UrlResolver, StyleUrlResolver, StyleInliner, DynamicComponentLoader, Testability];
+ }), [NgZone]), bind(ShadowDomStrategy).toFactory((function(doc) {
+ return new EmulatedUnscopedShadowDomStrategy(doc.head);
+ }), [DOCUMENT_TOKEN]), DomRenderer, DefaultDomCompiler, bind(Renderer).toAlias(DomRenderer), bind(RenderCompiler).toAlias(DefaultDomCompiler), ProtoViewFactory, AppViewPool, bind(APP_VIEW_POOL_CAPACITY).toValue(10000), AppViewManager, AppViewManagerUtils, AppViewListener, Compiler, CompilerCache, ViewResolver, bind(PipeRegistry).toValue(defaultPipeRegistry), bind(ChangeDetection).toClass(bestChangeDetection), ViewLoader, DirectiveResolver, Parser, Lexer, ExceptionHandler, bind(XHR).toValue(new XHRImpl()), ComponentUrlMapper, UrlResolver, StyleUrlResolver, StyleInliner, DynamicComponentLoader, Testability, AppRootUrl];
}
function _createNgZone(givenReporter) {
var defaultErrorReporter = (function(exception, stackTrace) {
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
DOM.logError((exception + "\n\n" + longStackTrace));
@@ -23742,11 +27993,11 @@
}
function _createAppInjector(appComponentType, bindings, zone) {
if (isBlank(_rootInjector))
_rootInjector = Injector.resolveAndCreate(_rootBindings);
var mergedBindings = isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) : _injectorBindings(appComponentType);
- ListWrapper.push(mergedBindings, bind(NgZone).toValue(zone));
+ mergedBindings.push(bind(NgZone).toValue(zone));
return _rootInjector.resolveAndCreateChild(mergedBindings);
}
$__export("bootstrap", bootstrap);
return {
setters: [function($__m) {
@@ -23769,19 +28020,25 @@
}, function($__m) {
Parser = $__m.Parser;
Lexer = $__m.Lexer;
ChangeDetection = $__m.ChangeDetection;
DynamicChangeDetection = $__m.DynamicChangeDetection;
+ JitChangeDetection = $__m.JitChangeDetection;
+ PreGeneratedChangeDetection = $__m.PreGeneratedChangeDetection;
PipeRegistry = $__m.PipeRegistry;
defaultPipeRegistry = $__m.defaultPipeRegistry;
}, function($__m) {
ExceptionHandler = $__m.ExceptionHandler;
}, function($__m) {
- TemplateLoader = $__m.TemplateLoader;
+ ViewLoader = $__m.ViewLoader;
}, function($__m) {
- TemplateResolver = $__m.TemplateResolver;
+ StyleUrlResolver = $__m.StyleUrlResolver;
}, function($__m) {
+ StyleInliner = $__m.StyleInliner;
+ }, function($__m) {
+ ViewResolver = $__m.ViewResolver;
+ }, function($__m) {
DirectiveResolver = $__m.DirectiveResolver;
}, function($__m) {
ListWrapper = $__m.ListWrapper;
}, function($__m) {
PromiseWrapper = $__m.PromiseWrapper;
@@ -23807,14 +28064,12 @@
}, function($__m) {
ComponentUrlMapper = $__m.ComponentUrlMapper;
}, function($__m) {
UrlResolver = $__m.UrlResolver;
}, function($__m) {
- StyleUrlResolver = $__m.StyleUrlResolver;
+ AppRootUrl = $__m.AppRootUrl;
}, function($__m) {
- StyleInliner = $__m.StyleInliner;
- }, function($__m) {
DynamicComponentLoader = $__m.DynamicComponentLoader;
}, function($__m) {
TestabilityRegistry = $__m.TestabilityRegistry;
Testability = $__m.Testability;
}, function($__m) {
@@ -23823,20 +28078,20 @@
}, function($__m) {
AppViewManager = $__m.AppViewManager;
}, function($__m) {
AppViewManagerUtils = $__m.AppViewManagerUtils;
}, function($__m) {
+ AppViewListener = $__m.AppViewListener;
+ }, function($__m) {
ProtoViewFactory = $__m.ProtoViewFactory;
}, function($__m) {
Renderer = $__m.Renderer;
RenderCompiler = $__m.RenderCompiler;
}, function($__m) {
DomRenderer = $__m.DomRenderer;
DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN;
}, function($__m) {
- resolveInternalDomView = $__m.resolveInternalDomView;
- }, function($__m) {
DefaultDomCompiler = $__m.DefaultDomCompiler;
}, function($__m) {
internalView = $__m.internalView;
}, function($__m) {
appComponentRefToken = $__m.appComponentRefToken;
@@ -23868,11 +28123,11 @@
$__export("ApplicationRef", ApplicationRef);
}
};
});
-System.register("angular2/core", ["angular2/src/core/annotations/visibility", "angular2/src/core/annotations/view", "angular2/src/core/application", "angular2/src/core/application_tokens", "angular2/src/core/annotations/di", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/compiler", "angular2/src/render/dom/compiler/template_loader", "angular2/src/render/dom/shadow_dom/shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy", "angular2/src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref"], function($__export) {
+System.register("angular2/core", ["angular2/src/core/annotations/visibility", "angular2/src/core/annotations/view", "angular2/src/core/application", "angular2/src/core/application_tokens", "angular2/src/core/annotations/di", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/interfaces", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/zone/ng_zone"], function($__export) {
"use strict";
var __moduleName = "angular2/core";
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
@@ -23881,13 +28136,10 @@
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
return {
setters: [function($__m) {
Object.keys($__m).forEach(function(p) {
if (!$__exportNames[p])
$__export(p, $__m[p]);
@@ -23936,57 +28188,79 @@
Object.keys($__m).forEach(function(p) {
if (!$__exportNames[p])
$__export(p, $__m[p]);
});
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
- }, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
- }, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
- }, function($__m) {
$__export("ViewRef", $__m.ViewRef);
$__export("ProtoViewRef", $__m.ProtoViewRef);
}, function($__m) {
$__export("ViewContainerRef", $__m.ViewContainerRef);
}, function($__m) {
$__export("ElementRef", $__m.ElementRef);
+ }, function($__m) {
+ $__export("NgZone", $__m.NgZone);
}],
execute: function() {}
};
});
-System.register("angular2/angular2", ["angular2/change_detection", "angular2/core", "angular2/annotations", "angular2/directives", "angular2/forms", "angular2/di", "angular2/src/facade/async", "angular2/src/render/api", "angular2/src/render/dom/dom_renderer"], function($__export) {
+System.register("angular2/angular2", ["angular2/change_detection", "angular2/di", "angular2/core", "angular2/annotations", "angular2/directives", "angular2/forms", "angular2/http", "angular2/src/facade/async", "angular2/src/render/api", "angular2/src/render/dom/dom_renderer"], function($__export) {
"use strict";
var __moduleName = "angular2/angular2";
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
- var $__exportNames = {undefined: true};
return {
setters: [function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("DehydratedException", $__m.DehydratedException);
+ $__export("ExpressionChangedAfterItHasBeenChecked", $__m.ExpressionChangedAfterItHasBeenChecked);
+ $__export("ChangeDetectionError", $__m.ChangeDetectionError);
+ $__export("ChangeDetection", $__m.ChangeDetection);
+ $__export("ON_PUSH", $__m.ON_PUSH);
+ $__export("DEFAULT", $__m.DEFAULT);
+ $__export("ChangeDetectorRef", $__m.ChangeDetectorRef);
+ $__export("PipeRegistry", $__m.PipeRegistry);
+ $__export("WrappedValue", $__m.WrappedValue);
+ $__export("NullPipe", $__m.NullPipe);
+ $__export("NullPipeFactory", $__m.NullPipeFactory);
+ $__export("defaultPipes", $__m.defaultPipes);
+ $__export("DynamicChangeDetection", $__m.DynamicChangeDetection);
+ $__export("JitChangeDetection", $__m.JitChangeDetection);
+ $__export("PreGeneratedChangeDetection", $__m.PreGeneratedChangeDetection);
+ $__export("preGeneratedProtoDetectors", $__m.preGeneratedProtoDetectors);
+ $__export("defaultPipeRegistry", $__m.defaultPipeRegistry);
+ $__export("DirectiveIndex", $__m.DirectiveIndex);
+ $__export("BindingRecord", $__m.BindingRecord);
+ $__export("Locals", $__m.Locals);
+ $__export("ChangeDetectorDefinition", $__m.ChangeDetectorDefinition);
+ $__export("BasePipe", $__m.BasePipe);
+ $__export("DirectiveRecord", $__m.DirectiveRecord);
}, function($__m) {
- Object.keys($__m).forEach(function(p) {
- if (!$__exportNames[p])
- $__export(p, $__m[p]);
- });
+ $__export("Inject", $__m.Inject);
+ $__export("InjectPromise", $__m.InjectPromise);
+ $__export("InjectLazy", $__m.InjectLazy);
+ $__export("Optional", $__m.Optional);
+ $__export("Injectable", $__m.Injectable);
+ $__export("forwardRef", $__m.forwardRef);
+ $__export("resolveForwardRef", $__m.resolveForwardRef);
+ $__export("Injector", $__m.Injector);
+ $__export("Binding", $__m.Binding);
+ $__export("bind", $__m.bind);
+ $__export("Key", $__m.Key);
+ $__export("NoBindingError", $__m.NoBindingError);
+ $__export("AbstractBindingError", $__m.AbstractBindingError);
+ $__export("AsyncBindingError", $__m.AsyncBindingError);
+ $__export("CyclicDependencyError", $__m.CyclicDependencyError);
+ $__export("InstantiationError", $__m.InstantiationError);
+ $__export("InvalidBindingError", $__m.InvalidBindingError);
+ $__export("NoAnnotationError", $__m.NoAnnotationError);
+ $__export("OpaqueToken", $__m.OpaqueToken);
+ $__export("ResolvedBinding", $__m.ResolvedBinding);
+ $__export("BindingBuilder", $__m.BindingBuilder);
+ $__export("Dependency", $__m.Dependency);
}, function($__m) {
Object.keys($__m).forEach(function(p) {
if (!$__exportNames[p])
$__export(p, $__m[p]);
});
@@ -23998,9 +28272,30 @@
}, function($__m) {
Object.keys($__m).forEach(function(p) {
if (!$__exportNames[p])
$__export(p, $__m[p]);
});
+ }, function($__m) {
+ $__export("AbstractControl", $__m.AbstractControl);
+ $__export("Control", $__m.Control);
+ $__export("ControlGroup", $__m.ControlGroup);
+ $__export("ControlArray", $__m.ControlArray);
+ $__export("NgControlName", $__m.NgControlName);
+ $__export("NgFormControl", $__m.NgFormControl);
+ $__export("NgModel", $__m.NgModel);
+ $__export("NgControl", $__m.NgControl);
+ $__export("NgControlGroup", $__m.NgControlGroup);
+ $__export("NgFormModel", $__m.NgFormModel);
+ $__export("NgForm", $__m.NgForm);
+ $__export("DefaultValueAccessor", $__m.DefaultValueAccessor);
+ $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor);
+ $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor);
+ $__export("formDirectives", $__m.formDirectives);
+ $__export("Validators", $__m.Validators);
+ $__export("NgValidator", $__m.NgValidator);
+ $__export("NgRequiredValidator", $__m.NgRequiredValidator);
+ $__export("FormBuilder", $__m.FormBuilder);
+ $__export("formInjectables", $__m.formInjectables);
}, function($__m) {
Object.keys($__m).forEach(function(p) {
if (!$__exportNames[p])
$__export(p, $__m[p]);
});
\ No newline at end of file