From 2a5484af59544a9dfdda854d707455f08a24fe69 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 15 Feb 2012 14:28:21 -0800 Subject: Latest Montage Updates 0.6 Fixes Signed-off-by: Armen Kesablyan --- node_modules/montage/core/converter/converter.js | 10 - .../montage/core/converter/date-converter.js | 10 +- node_modules/montage/core/core.js | 42 +- node_modules/montage/core/deserializer.js | 4 +- node_modules/montage/core/event/binding.js | 8 +- node_modules/montage/core/event/event-manager.js | 5 +- node_modules/montage/core/event/mutable-event.js | 1 + node_modules/montage/core/promise.js | 36 +- node_modules/montage/core/shim/string.js | 15 + node_modules/montage/data/context.js | 5 +- node_modules/montage/montage.js | 2 +- node_modules/montage/node.js | 5 + node_modules/montage/package.json | 2 +- node_modules/montage/require/browser.js | 28 +- node_modules/montage/require/node.js | 5 + node_modules/montage/ui/button.reel/button.js | 206 ++-------- node_modules/montage/ui/check-input.js | 93 ++++- node_modules/montage/ui/component.js | 6 - node_modules/montage/ui/composer/composer.js | 1 - node_modules/montage/ui/composer/press-composer.js | 434 +++++++++++++++++++++ .../montage/ui/condition.reel/condition.js | 67 +++- .../montage/ui/date-input.reel/date-input.js | 20 +- node_modules/montage/ui/flow-path-cubic.js | 6 + node_modules/montage/ui/flow-path-lerp.js | 6 + node_modules/montage/ui/flow-path-linear.js | 6 + node_modules/montage/ui/flow-path-sigmoid.js | 6 + node_modules/montage/ui/flow-path.js | 6 + node_modules/montage/ui/flow.reel/flow.js | 6 + node_modules/montage/ui/native-control.js | 175 +++++---- .../ui/nearest-neighbor-component-search.js | 6 + .../montage/ui/number-input.reel/number-input.js | 9 +- .../montage/ui/radio-button.reel/radio-button.js | 19 +- .../montage/ui/range-input.reel/range-input.js | 48 ++- .../montage/ui/scroll-bars.reel/scroll-bars.js | 6 + node_modules/montage/ui/scroll.js | 6 + node_modules/montage/ui/scroller.reel/scroller.js | 6 + .../montage/ui/scrollview.reel/scrollview.js | 43 +- .../montage/ui/select-input.reel/select-input.js | 53 ++- node_modules/montage/ui/text-input.js | 109 +++--- .../montage/ui/textfield.reel/textfield.js | 5 +- .../montage/ui/toggle-button.reel/toggle-button.js | 4 +- .../ui/toggle-switch.reel/toggle-switch.css | 162 -------- .../ui/toggle-switch.reel/toggle-switch.html | 16 - .../montage/ui/toggle-switch.reel/toggle-switch.js | 424 -------------------- 44 files changed, 1044 insertions(+), 1088 deletions(-) create mode 100644 node_modules/montage/ui/composer/press-composer.js delete mode 100755 node_modules/montage/ui/toggle-switch.reel/toggle-switch.css delete mode 100755 node_modules/montage/ui/toggle-switch.reel/toggle-switch.html delete mode 100644 node_modules/montage/ui/toggle-switch.reel/toggle-switch.js (limited to 'node_modules/montage') diff --git a/node_modules/montage/core/converter/converter.js b/node_modules/montage/core/converter/converter.js index abce44e2..a23d2702 100755 --- a/node_modules/montage/core/converter/converter.js +++ b/node_modules/montage/core/converter/converter.js @@ -20,16 +20,6 @@ var FUNCTION_CLASS = '[object Function]', var _toString = Object.prototype.toString; -// TODO should maybe move these into String.isString and Number.isNumber to parallel Array.isArray - -/** - @exports module:montage/core/converter#isString - @function -*/ -var isString = function(object) { - return _toString.call(object) === STRING_CLASS; -}; -exports.isString = isString; /** @exports module:montage/core/converter#isNumber diff --git a/node_modules/montage/core/converter/date-converter.js b/node_modules/montage/core/converter/date-converter.js index f0d3e540..f484f7aa 100755 --- a/node_modules/montage/core/converter/date-converter.js +++ b/node_modules/montage/core/converter/date-converter.js @@ -2502,16 +2502,13 @@ var _toString = Object.prototype.toString; var isDate = function(object) { return _toString.call(object) === DATE_CLASS; }; -var isString = function(object) { - return _toString.call(object) === STRING_CLASS; -}; var isNumber = function(object) { return _toString.call(object) === NUMBER_CLASS; }; var formatDate = function(v, format) { var date; - if (isString(v)) { + if (String.isString(v)) { // try to create a Date instance from the string // date must be a string that can be parsed by Date // see - http://www.w3schools.com/jsref/jsref_parse.asp @@ -2605,7 +2602,7 @@ var DateConverter = exports.DateConverter = Montage.create(Converter,/** @lends */ convert: { value: function(v) { - if (isDate(v) || isString(v) || isNumber(v)) { + if (isDate(v) || String.isString(v) || isNumber(v)) { return formatDate(v, this.pattern); } return v; @@ -2617,6 +2614,9 @@ var DateConverter = exports.DateConverter = Montage.create(Converter,/** @lends */ revert: { value: function(v) { + if(isDate(v)) { + return v; + } this.validator.pattern = this.pattern; var result = this.validator.validate(v); diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js index 8c1f4249..ff94f303 100755 --- a/node_modules/montage/core/core.js +++ b/node_modules/montage/core/core.js @@ -12,6 +12,16 @@ */ require("core/shim"); +var ATTRIBUTE_PROPERTIES = "AttributeProperties", + UNDERSCORE = "_", + PROTO = "__proto__", + VALUE = "value", + ENUMERABLE = "enumerable", + SERIALIZABLE = "serializable", + MODIFY = "modify"; + + + /** @external Object */ @@ -78,14 +88,14 @@ Object.defineProperty(M, "create", { } }); -var extendedPropertyAttributes = ["serializable", "modify"]; +var extendedPropertyAttributes = [SERIALIZABLE, MODIFY]; // Extended property attributes, the property name format is "_" + attributeName + "AttributeProperties" /** @member external:Object#extendedPropertyAttributes */ extendedPropertyAttributes.forEach(function(name) { - Object.defineProperty(Object.prototype, "_" + name + "AttributeProperties", { + Object.defineProperty(Object.prototype, UNDERSCORE + name + ATTRIBUTE_PROPERTIES, { enumerable: false, configurable: false, writable: false, @@ -112,11 +122,11 @@ Object.defineProperty(M, "defineProperty", { value: function(obj, prop, descriptor) { var dependencies = descriptor.dependencies; //reset defaults appropriately for framework. - if ("__proto__" in descriptor) { - descriptor.__proto__ = ("value" in descriptor ? (typeof descriptor.value === "function" ? _defaultFunctionValueProperty : _defaultObjectValueProperty) : _defaultAccessorProperty); + if (PROTO in descriptor) { + descriptor.__proto__ = (VALUE in descriptor ? (typeof descriptor.value === "function" ? _defaultFunctionValueProperty : _defaultObjectValueProperty) : _defaultAccessorProperty); } else { var defaults; - if ("value" in descriptor) { + if (VALUE in descriptor) { if (typeof descriptor.value === "function") { defaults = _defaultFunctionValueProperty; } else { @@ -133,7 +143,7 @@ Object.defineProperty(M, "defineProperty", { } - if (!descriptor.hasOwnProperty("enumerable") && prop.charAt(0) === "_") { + if (!descriptor.hasOwnProperty(ENUMERABLE) && prop.charAt(0) === UNDERSCORE) { descriptor.enumerable = false; } if (dependencies) { @@ -146,13 +156,13 @@ Object.defineProperty(M, "defineProperty", { } - if ("serializable" in descriptor) { + if (SERIALIZABLE in descriptor) { // get the _serializableAttributeProperties property or creates it through the entire chain if missing. - getAttributeProperties(obj, "serializable")[prop] = descriptor.serializable; + getAttributeProperties(obj, SERIALIZABLE)[prop] = descriptor.serializable; } - if ("modify" in descriptor) { - getAttributeProperties(obj, "modify")[prop] = descriptor.modify; + if (MODIFY in descriptor) { + getAttributeProperties(obj, MODIFY)[prop] = descriptor.modify; } //this is added to enable value properties with [] or Objects that are new for every instance @@ -268,7 +278,7 @@ Object.defineProperty(M, "defineProperty", { } }); } - })("_" + prop, descriptor.value); + })(UNDERSCORE + prop, descriptor.value); } else { return Object.defineProperty(obj, prop, descriptor); @@ -390,7 +400,7 @@ M.defineProperty(M, "removeDependencyFromProperty", {value: function(obj, indepe }}); function getAttributeProperties(proto, attributeName) { - var attributePropertyName = "_" + attributeName + "AttributeProperties"; + var attributePropertyName = UNDERSCORE + attributeName + ATTRIBUTE_PROPERTIES; if (proto.hasOwnProperty(attributePropertyName)) { return proto[attributePropertyName]; @@ -474,7 +484,7 @@ M.defineProperty(M, "getSerializablePropertyNames", {value: function(anObject) { */ M.defineProperty(M, "getPropertyAttribute", {value: function(anObject, propertyName, attributeName) { - var attributePropertyName = "_" + attributeName + "AttributeProperties", + var attributePropertyName = UNDERSCORE + attributeName + ATTRIBUTE_PROPERTIES, attributes = anObject[attributePropertyName]; if (attributes) { @@ -491,7 +501,7 @@ M.defineProperty(M, "getPropertyAttribute", {value: function(anObject, propertyN */ M.defineProperty(M, "getPropertyAttributes", {value: function(anObject, attributeName) { var attributeValues = {}, - attributePropertyName = "_" + attributeName + "AttributeProperties", + attributePropertyName = UNDERSCORE + attributeName + ATTRIBUTE_PROPERTIES, attributes = anObject[attributePropertyName]; if (!attributes) { @@ -623,7 +633,7 @@ var uuidGetGenerator = function() { }); } //This is really because re-defining the property on DOMWindow actually doesn't work, so the original property with the getter is still there and return this._uuid if there. - if (this instanceof Element || !info.isInstance || !("value" in Object.getOwnPropertyDescriptor(this, "uuid")) || !("__proto__" in this /* lame way to detect IE */)) { + if (this instanceof Element || !info.isInstance || !(VALUE in Object.getOwnPropertyDescriptor(this, "uuid")) || !(PROTO in this /* lame way to detect IE */)) { //This is needed to workaround some bugs in Safari where re-defining uuid doesn't work for DOMWindow. this._uuid = uuid; } @@ -846,7 +856,7 @@ Object.defineProperty(Object.prototype, "setProperty", { // For these mutation/addition/removal events, use the 'modify' attribute of this property's descriptor if (changeEvent && (changeEvent.currentTarget === lastObjectAtPath) && - (modify = M.getPropertyAttribute(setObject, aPropertyPath, "modify"))) { + (modify = M.getPropertyAttribute(setObject, aPropertyPath, MODIFY))) { modify.call(setObject, changeEvent.type, changeEvent.newValue, changeEvent.prevValue); } } diff --git a/node_modules/montage/core/deserializer.js b/node_modules/montage/core/deserializer.js index 09635153..0abc924b 100755 --- a/node_modules/montage/core/deserializer.js +++ b/node_modules/montage/core/deserializer.js @@ -62,7 +62,7 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri @private */ // list of ids that were just created for optimization - _optimizedIds: {value: {}}, + _optimizedIds: {value: Object.create(null)}, _indexedDeserializationUnits: {value: {}}, @@ -388,7 +388,7 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri value: function(doc) { var idAttributeName = Deserializer._MONTAGE_ID_ATTRIBUTE, elements = doc.querySelectorAll('*[' + idAttributeName + ']'), - ids = this._optimizedIds = {}; + ids = this._optimizedIds = Object.create(null); for (var i = 0, element; (element = elements[i]); i++) { if (!element.id) { diff --git a/node_modules/montage/core/event/binding.js b/node_modules/montage/core/event/binding.js index f061e89a..21b40609 100755 --- a/node_modules/montage/core/event/binding.js +++ b/node_modules/montage/core/event/binding.js @@ -19,7 +19,9 @@ var Montage = require("montage").Montage, Serializer = require("core/serializer").Serializer, Deserializer = require("core/deserializer").Deserializer, defaultEventManager = require("core/event/event-manager").defaultEventManager, - AT_TARGET = 2; + AT_TARGET = 2, + UNDERSCORE = "_"; + /** @member external:Array#dispatchChangeEvent @@ -918,7 +920,7 @@ Object.defineProperty(Object.prototype, "addEventListener", { if ("value" in currentPropertyDescriptor) { //Create internal storage: - Object.defineProperty(currentObject, (internalStorageProperty = "_" + key), { + Object.defineProperty(currentObject, (internalStorageProperty = UNDERSCORE + key), { value: currentObject.getProperty(key), configurable: true, writable: true @@ -1009,7 +1011,7 @@ Object.defineProperty(Object.prototype, "addEventListener", { //TODO this is all duplicated from above, clean it up //Create internal storage: - Object.defineProperty(currentObject, (internalStorageProperty = "_" + key), { + Object.defineProperty(currentObject, (internalStorageProperty = UNDERSCORE + key), { value: currentObject.getProperty(key), configurable: true, writable: true diff --git a/node_modules/montage/core/event/event-manager.js b/node_modules/montage/core/event/event-manager.js index b3e97dbe..bef8a67c 100755 --- a/node_modules/montage/core/event/event-manager.js +++ b/node_modules/montage/core/event/event-manager.js @@ -19,7 +19,6 @@ var Montage = require("montage").Montage, MutableEvent = require("core/event/mutable-event").MutableEvent, - ActionEventListener = require("core/event/action-event-listener").ActionEventListener, Serializer = require("core/serializer").Serializer, Deserializer = require("core/deserializer").Deserializer, defaultEventManager; @@ -28,9 +27,7 @@ var Montage = require("montage").Montage, if (typeof window !== "undefined") { // client-side /* This is to handle browsers that have TouchEvents but don't have the global constructor function Touch */ -//if(TouchEvent && typeof window.Touch === "undefined") { -// HACK: The commented expression fails because Chrome on the desktop also has TouchEvent and in the code we're either registering touch events OR mouse events on most components. -if (typeof window.Touch === "undefined" && /Xoom|TouchPad/.test(navigator.userAgent)) { +if (typeof window.Touch === "undefined" && "ontouchstart" in window) { window.Touch = function() { }; (function() { diff --git a/node_modules/montage/core/event/mutable-event.js b/node_modules/montage/core/event/mutable-event.js index f94ee0b9..6f6a0cfd 100755 --- a/node_modules/montage/core/event/mutable-event.js +++ b/node_modules/montage/core/event/mutable-event.js @@ -105,6 +105,7 @@ var MutableEvent = exports.MutableEvent = Montage.create(Montage,/** @lends modu var changeEvent = new _changeEventConstructor(); changeEvent.type = "change@" + key; changeEvent.minus = minus; + changeEvent.plus = undefined; changeEvent.propertyChange = ChangeTypes.MODIFICATION; return changeEvent; } diff --git a/node_modules/montage/core/promise.js b/node_modules/montage/core/promise.js index df063846..eb9ccd86 100755 --- a/node_modules/montage/core/promise.js +++ b/node_modules/montage/core/promise.js @@ -30,7 +30,15 @@ "use strict"; -var TIMER; +var GET = "get", + PUT = "put", + DELETE = "delete", + POST = "post", + APPLY = "apply", + KEYS = "keys", + THEN = "then", + TIMER; + try { // bootstrapping can't handle relative identifiers TIMER = require("core/next-tick"); @@ -76,7 +84,7 @@ var Creatable = Object.create(Object.prototype, { }, writable: true, configurable: true - }, + } }); // Common implementation details of FulfilledPromise, RejectedPromise, and @@ -335,7 +343,7 @@ var PrimordialPromise = Creatable.create({ this.Promise.reject(reason, error) ); } - }, + } }) }, @@ -370,7 +378,7 @@ var PrimordialPromise = Creatable.create({ } }) - }, + } }); @@ -433,11 +441,11 @@ var Promise = PrimordialPromise.create({}, { // Descriptor for each of the three toPromise(value) .sendPromise( fulfill, - "then", + THEN, reject ) }, - "then", + THEN, function (reason, error, rejection) { if (done) { return; @@ -473,51 +481,51 @@ var Promise = PrimordialPromise.create({}, { // Descriptor for each of the three get: { value: function () { - return this.send("get", arguments); + return this.send(GET, arguments); } }, put: { value: function () { - return this.send("put", arguments); + return this.send(PUT, arguments); } }, "delete": { value: function () { - return this.send("delete", arguments); + return this.send(DELETE, arguments); } }, post: { value: function () { - return this.send("post", arguments); + return this.send(POST, arguments); } }, invoke: { value: function (name /*, ...args*/) { var args = Array.prototype.slice.call(arguments, 1); - return this.send("post", [name, args]); + return this.send(POST, [name, args]); } }, apply: { value: function () { - return this.send("apply", arguments); + return this.send(APPLY, arguments); } }, call: { value: function (thisp /*, ...args*/) { var args = Array.prototype.slice.call(arguments, 1); - return this.send("apply", [thisp, args]); + return this.send(APPLY, [thisp, args]); } }, keys: { value: function () { - return this.send("keys", []); + return this.send(KEYS, []); } }, diff --git a/node_modules/montage/core/shim/string.js b/node_modules/montage/core/shim/string.js index 1b71cec3..52f89710 100755 --- a/node_modules/montage/core/shim/string.js +++ b/node_modules/montage/core/shim/string.js @@ -63,4 +63,19 @@ Object.defineProperties(String.prototype, /** @lends external:String.prototype#* }); +/** + Shim implementation of String.isString() for browsers that don't yet support it. + @function external:String.isString() + @param {object} obj The object to determine if its a String. + @returns {boolean} Object.prototype.toString.call(obj) === "[object String]" +*/ +if (!String.isString) { + Object.defineProperty(String, "isString", { + value: function(obj) { + return Object.prototype.toString.call(obj) === "[object String]"; + } + }); +} + + diff --git a/node_modules/montage/data/context.js b/node_modules/montage/data/context.js index 694198e3..ca992ff0 100755 --- a/node_modules/montage/data/context.js +++ b/node_modules/montage/data/context.js @@ -148,10 +148,11 @@ var Context = exports.Context = Montage.create(Store, /** @lends module:montage/ if (instance.context === null) { instance.context = this; this._inserted.add(instance); + var self = this; return this.initializeObject(instance, this).then(function(instance) { - this._objectMap.set(instance.objectId, instance); + self._objectMap.set(instance.objectId, instance); return Promise.ref(instance); - }.bind(this)); + }); } else if (instance.context !== this) { throw Exception.initWithMessageTargetAndMethod("This instance is already inserted in another context.", this, "insert"); } diff --git a/node_modules/montage/montage.js b/node_modules/montage/montage.js index cee1f27a..495b6c72 100755 --- a/node_modules/montage/montage.js +++ b/node_modules/montage/montage.js @@ -78,7 +78,7 @@ if (typeof window !== "undefined") { Require.PackageSandbox(params.montageBase, config) .then(function (montageRequire) { montageRequire.inject("core/promise", Promise); - montageRequire.inject("core/shim/timeers", {}); + montageRequire.inject("core/shim/timers", {}); // install the linter, which loads on the first error config.lint = function (module) { diff --git a/node_modules/montage/node.js b/node_modules/montage/node.js index 5ac51ed7..3d0a1edb 100644 --- a/node_modules/montage/node.js +++ b/node_modules/montage/node.js @@ -1,3 +1,8 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ var FS = require("fs"); var PATH = require("path"); diff --git a/node_modules/montage/package.json b/node_modules/montage/package.json index 6cc0c079..a7e04341 100755 --- a/node_modules/montage/package.json +++ b/node_modules/montage/package.json @@ -1,6 +1,6 @@ { "name": "montage", - "version": "0.3.1", + "version": "0.6.0", "description": "A UI Framework", "main": "montage", "exclude": [ diff --git a/node_modules/montage/require/browser.js b/node_modules/montage/require/browser.js index e249d355..3fdd58d4 100755 --- a/node_modules/montage/require/browser.js +++ b/node_modules/montage/require/browser.js @@ -5,11 +5,13 @@ */ bootstrap("require/browser", function (require) { -var Require = require("require/require"); -var Promise = require("core/promise").Promise; -var URL = require("core/mini-url"); - -var global = typeof global !== "undefined" ? global : window; +var Require = require("require/require"), + Promise = require("core/promise").Promise, + URL = require("core/mini-url"), + GET = "GET", + APPLICATION_JAVASCRIPT_MIMETYPE = "application/javascript", + FILE_PROTOCOL = "file:", + global = typeof global !== "undefined" ? global : window; Require.getLocation = function() { return URL.resolve(window.location, "."); @@ -24,7 +26,7 @@ Require.overlays = ["browser", "montage"]; // http://dl.dropbox.com/u/131998/yui/misc/get/browser-capabilities.html Require.read = function (url) { - if (URL.resolve(window.location, url).indexOf("file:") === 0) { + if (URL.resolve(window.location, url).indexOf(FILE_PROTOCOL) === 0) { throw new Error("XHR does not function for file: protocol"); } @@ -44,8 +46,8 @@ Require.read = function (url) { } try { - request.open("GET", url, true); - request.overrideMimeType("application/javascript"); + request.open(GET, url, true); + request.overrideMimeType(APPLICATION_JAVASCRIPT_MIMETYPE); request.onreadystatechange = function () { if (request.readyState === 4) { onload(); @@ -77,6 +79,12 @@ if (global.navigator && global.navigator.userAgent.indexOf("Firefox") >= 0) { globalEval = new Function("evalString", "return eval(evalString)"); } +var __FILE__String = "__FILE__", + DoubleUnderscoreString = "__" + globalEvalConstantA = "(function ", + globalEvalConstantB = "(require, exports, module) {", + globalEvalConstantC = "//*/\n})\n//@ sourceURL="; + Require.Compiler = function (config) { return function(module) { if (module.factory || module.text === void 0) @@ -91,10 +99,10 @@ Require.Compiler = function (config) { // TODO: investigate why this isn't working in Firebug. // 3. set displayName property on the factory function (Safari, Chrome) - var displayName = "__FILE__"+module.location.replace(/\.\w+$|\W/g, "__"); + var displayName = __FILE__String+module.location.replace(/\.\w+$|\W/g, DoubleUnderscoreString); try { - module.factory = globalEval("(function "+displayName+"(require, exports, module) {"+module.text+"//*/\n})"+"\n//@ sourceURL="+module.location); + module.factory = globalEval(globalEvalConstantA+displayName+globalEvalConstantB+module.text+globalEvalConstantC+module.location); } catch (exception) { throw new SyntaxError("in " + module.location + ": " + exception.message); } diff --git a/node_modules/montage/require/node.js b/node_modules/montage/require/node.js index 568410cf..9fcea3f5 100644 --- a/node_modules/montage/require/node.js +++ b/node_modules/montage/require/node.js @@ -1,3 +1,8 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ var Require = require("./require"); var URL = require("../core/url"); diff --git a/node_modules/montage/ui/button.reel/button.js b/node_modules/montage/ui/button.reel/button.js index 51f4c011..5da92482 100644 --- a/node_modules/montage/ui/button.reel/button.js +++ b/node_modules/montage/ui/button.reel/button.js @@ -3,11 +3,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ + /*global require, exports*/ var Montage = require("montage").Montage, Component = require("ui/component").Component, - NativeControl = require("ui/native-control").NativeControl; + NativeControl = require("ui/native-control").NativeControl, + PressComposer = require("ui/composer/press-composer").PressComposer; /** - * The Text input + * The Button input */ var Button = exports.Button = Montage.create(NativeControl, { @@ -127,56 +129,25 @@ var Button = exports.Button = Montage.create(NativeControl, { } }, - // Low-level event listeners - - /** - Description TODO - @function - @param {Event} event The handleMousedown event - */ - handleMousedown: { - value: function(event) { - if (this._observedPointer !== null) { - return; - } - if (!this._disabled) { - this._startInteraction("mouse"); - } - - event.preventDefault(); - - if (!this._preventFocus) { - this._element.focus(); - } - } - }, - /** - Description TODO - @function - @param {Event} event The handleMouseup event - */ - handleMouseup: { - value: function(event) { - this._interpretInteraction(event); + prepareForActivationEvents: { + value: function() { + var pressComposer = PressComposer.create(); + this.addComposer(pressComposer); + pressComposer.addEventListener("pressstart", this, false); + pressComposer.addEventListener("press", this, false); + pressComposer.addEventListener("presscancel", this, false); } }, + // Handlers + /** - Description TODO - @function - @param {Event} event The handleTouchstart event + Called when the user starts interacting with the component. */ - handleTouchstart: { + handlePressstart: { value: function(event) { - if (this._observedPointer !== null) { - return; - } - if (!this._disabled) { - this._startInteraction(event.changedTouches[0].identifier); - } + this.active = true; - // NOTE preventingDefault disables the magnifying class - // sadly it also disables double tapping on the button to zoom... event.preventDefault(); if (!this._preventFocus) { @@ -184,142 +155,38 @@ var Button = exports.Button = Montage.create(NativeControl, { } } }, - /** - Description TODO - @function - @param {Event} event The handleTouchend event - */ - handleTouchend: { - value: function(event) { - var i = 0, changedTouchCount = event.changedTouches.length; - - for (; i < changedTouchCount; i++) { - if (event.changedTouches[i].identifier === this._observedPointer) { - this._interpretInteraction(event); - return; - } - } - } - }, /** - Description TODO - @function - @param {Event} event The handleTouchcancel event + Called when the user has interacted with the button. */ - handleTouchcancel: { + handlePress: { value: function(event) { - var i = 0, changedTouchCount = event.changedTouches.length; - - for (; i < changedTouchCount; i++) { - if (event.changedTouches[i].identifier === this._observedPointer) { - this._endInteraction(); - return; - } - } - - } - }, - - /** - If we have to surrender the pointer we are no longer active. This will - stop the action event being dispatched. - */ - surrenderPointer: { - value: function(pointer, component) { - if (pointer === this._observedPointer) { - this._endInteraction(); - } - return true; + this.active = false; + this._dispatchActionEvent(); } }, - // Internal state management - - /** - Stores the pointer that pressed down the button. Needed for multitouch. - @private - */ - _observedPointer: { - enumerable: true, - value: null - }, - - /** - Called when the user starts interacting with the component. Adds release - (touch and mouse) listeners. - @private - */ - _startInteraction: { - value: function(pointer) { - this.eventManager.claimPointer(pointer, this); - this._observedPointer = pointer; - this.active = true; - - if (window.Touch) { - document.addEventListener("touchend", this); - document.addEventListener("touchcancel", this); - } else { - document.addEventListener("mouseup", this); - } - }, - enumerable: false - }, - /** - Called when the user has interacted with the button. Decides whether to - dispatch an action event. - @private + Called when all interaction is over. */ - _interpretInteraction: { + handlePresscancel: { value: function(event) { - if (!this._active) { - return; - } - - var target = event.target; - while (target !== this.element && target && target.parentNode) { - target = target.parentNode; - } - - if (this.element === target) { - this._dispatchActionEvent(); - } - - this._endInteraction(); - }, - enumerable: false - }, - /** - Called when all interaction is over. Removes listeners. - @private - */ - _endInteraction: { - value: function() { - if (window.Touch) { - document.removeEventListener("touchend", this); - document.removeEventListener("touchcancel", this); - } else { - document.removeEventListener("mouseup", this); - } - - if (this.eventManager.isPointerClaimedByComponent(this._observedPointer, this)) { - this.eventManager.forfeitPointer(this._observedPointer, this); - } - this._observedPointer = null; this.active = false; } }, /** - Description TODO + If this is an input element then the label is handled differently. @private */ - _isInputElement: {value: false}, + _isInputElement: { + value: false, + enumerable: false + }, - deserializedFromTemplate: { + didSetElement: { value: function() { - var o = Object.getPrototypeOf(Button).deserializedFromTemplate.call(this); + var o = NativeControl.didSetElement.call(this); this._element.classList.add("montage-button"); this._element.setAttribute("aria-role", "button"); @@ -356,20 +223,6 @@ var Button = exports.Button = Montage.create(NativeControl, { } }, - /** - Description TODO - @function - */ - prepareForActivationEvents: { - value: function() { - if (window.Touch) { - this._element.addEventListener("touchstart", this); - } else { - this._element.addEventListener("mousedown", this); - } - - } - }, /** Draws the label to the DOM. @@ -411,6 +264,7 @@ Button.addAttributes({ formmethod: null, formnovalidate: null, formtarget: null, + type: {value: 'button'}, name: null, value: null }); diff --git a/node_modules/montage/ui/check-input.js b/node_modules/montage/ui/check-input.js index 6338c42c..42538c02 100644 --- a/node_modules/montage/ui/check-input.js +++ b/node_modules/montage/ui/check-input.js @@ -3,10 +3,11 @@ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ - +/*global require, exports */ var Montage = require("montage").Montage, Component = require("ui/component").Component, - NativeControl = require("ui/native-control").NativeControl; + NativeControl = require("ui/native-control").NativeControl, + PressComposer = require("ui/composer/press-composer").PressComposer; var CheckInput = exports.CheckInput = Montage.create(NativeControl, { @@ -14,33 +15,97 @@ var CheckInput = exports.CheckInput = Montage.create(NativeControl, { draw: { value: function() { // Call super - Object.getPrototypeOf(CheckInput).draw.call(this); + NativeControl.draw.call(this); this._element.setAttribute("aria-checked", this._checked); } }, + _pressComposer: { + enumerable: false, + value: null + }, + + prepareForActivationEvents: { + value: function() { + var pressComposer = this._pressComposer = PressComposer.create(); + this.addComposer(pressComposer); + pressComposer.addEventListener("pressstart", this, false); + pressComposer.addEventListener("press", this, false); + } + }, + + prepareForDraw: { + enumerable: false, + value: function() { + this._element.addEventListener('change', this); + } + }, + + + /** - Description TODO - @function + Fake the checking of the element. + + Changes the checked property of the element and dispatches a change event. + Radio button overrides this. + + @private */ - prepareForDraw: { + _fakeCheck: { enumerable: false, value: function() { - this.element.addEventListener('change', this); + var changeEvent; + // NOTE: this may be BAD, modifying the element outside of + // the draw loop, but it's what a click/touch would + // actually have done + this._element.checked = !this._element.checked; + changeEvent = document.createEvent("HTMLEvents"); + changeEvent.initEvent("change", true, true); + this._element.dispatchEvent(changeEvent); } }, -/** - Description TODO - @function - @param {Event Handler} event TODO + /** + Stores if we need to fake checking. + + When preventDefault is called on touchstart and touchend events (e.g. by + the scrollview component) the checkbox doesn't check itself, so we need + to fake it later. + + @default false + @private */ + _shouldFakeCheck: { + enumerable: false, + value: false + }, + + // Handlers + + handlePressstart: { + value: function(event) { + this._shouldFakeCheck = event.defaultPrevented; + } + }, + + + handlePress: { + value: function(event) { + if (this._shouldFakeCheck) { + this._shouldFakeCheck = false; + this._fakeCheck(); + } + } + }, + handleChange: { enumerable: false, value: function(event) { - Object.getPropertyDescriptor(this, "checked").set.call(this, - this.element.checked, true); - this._dispatchActionEvent(); + if (!this._pressComposer || this._pressComposer.state !== PressComposer.CANCELLED) { + Object.getPropertyDescriptor(this, "checked").set.call(this, + this.element.checked, true); + this._dispatchActionEvent(); + } } } }); diff --git a/node_modules/montage/ui/component.js b/node_modules/montage/ui/component.js index e41a1958..d347f655 100755 --- a/node_modules/montage/ui/component.js +++ b/node_modules/montage/ui/component.js @@ -6,7 +6,6 @@ /** @module montage/ui/component @requires montage/core/core - @requires montage/core/event/mutable-event @requires montage/ui/reel @requires montage/core/gate @requires montage/core/logger | component @@ -14,7 +13,6 @@ @requires montage/core/event/event-manager */ var Montage = require("montage").Montage, - MutableEvent = require("core/event/mutable-event").MutableEvent, Template = require("ui/template").Template, Gate = require("core/gate").Gate, logger = require("core/logger").logger("component"), @@ -441,10 +439,6 @@ var Component = exports.Component = Montage.create(Montage,/** @lends module:mon childComponents.splice(ix, 1); childComponent._cachedParentComponent = null; } - - if (element && element.parentNode) { - element.parentNode.removeChild(element); - } } }, /** diff --git a/node_modules/montage/ui/composer/composer.js b/node_modules/montage/ui/composer/composer.js index eee7be67..52027a7c 100644 --- a/node_modules/montage/ui/composer/composer.js +++ b/node_modules/montage/ui/composer/composer.js @@ -47,7 +47,6 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer * cycle after addComposer has been called on its associated component. If * `true` loading of the composer is delayed until its associated component * has prepareForActivationEvents called. - * @property * @default false */ lazyLoad: { diff --git a/node_modules/montage/ui/composer/press-composer.js b/node_modules/montage/ui/composer/press-composer.js new file mode 100644 index 00000000..942de162 --- /dev/null +++ b/node_modules/montage/ui/composer/press-composer.js @@ -0,0 +1,434 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/*global require, exports*/ +/** + @module montage/ui/composer/press-composer + @requires montage + @requires montage/ui/composer/composer +*/ +var Montage = require("montage").Montage, + Composer = require("ui/composer/composer").Composer, + MutableEvent = require("core/event/mutable-event").MutableEvent; +/** + @class module:montage/ui/composer/press-composer.PressComposer + @extends module:montage/ui/composer/composer.Composer +*/ +var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends module:montage/ui/event/composer/press-composer.PressComposer# */ { + + /** + @event + @name pressstart + @param {Event} event + + Dispatched when a press begins. It is ended by either a {@link press} or + {@link presscancel} event. + */ + + /** + @event + @name press + @param {Event} event + + Dispatched when a press is complete. + */ + + /** + @event + @name presscancel + @param {Event} event + + Dispatched when a press is canceled. This could be because the pointer + left the element, was claimed by another component or maybe a phone call + came in. + */ + + // Load/unload + + load: { + value: function() { + if (window.Touch) { + this._element.addEventListener("touchstart", this); + } else { + this._element.addEventListener("mousedown", this); + } + } + }, + + unload: { + value: function() { + if (window.Touch) { + this._element.removeEventListener("touchstart", this); + } else { + this._element.removeEventListener("mousedown", this); + } + } + }, + + UNPRESSED: { + value: 0 + }, + PRESSED: { + value: 1 + }, + CANCELLED: { + value: 2 + }, + + _state: { + enumerable: false, + value: 0 + }, + state: { + get: function() { + return this._state; + } + }, + + // Magic + + /** + @default null + @private + */ + _observedPointer: { + enumerable: false, + value: null + }, + + // TODO: maybe this should be split and moved into handleTouchstart + // and handleMousedown + _startInteraction: { + enumerable: false, + value: function(event) { + if ("disabled" in this.component && this.component.disabled) { + return false; + } + + var i = 0, changedTouchCount; + + if (event.type === "touchstart") { + changedTouchCount = event.changedTouches.length; + for (; i < changedTouchCount; i++) { + if (!this.component.eventManager.componentClaimingPointer(event.changedTouches[i].identifier)) { + this._observedPointer = event.changedTouches[i].identifier; + break; + } + } + + if (this._observedPointer === null) { + // All touches have been claimed + return false; + } + + document.addEventListener("touchend", this); + document.addEventListener("touchcancel", this); + } else if (event.type === "mousedown") { + this._observedPointer = "mouse"; + // Needed to cancel action event dispatch is mouseup'd when + // not on the component + document.addEventListener("mouseup", this); + // Needed to preventDefault if another component has claimed + // the pointer + document.addEventListener("click", this); + } + + this.component.eventManager.claimPointer(this._observedPointer, this); + + this._dispatchPressstart(event); + } + }, + + /** + Decides what should be done based on an interaction. + + @param {Event} event The event that caused this to be called. + */ + _interpretInteraction: { + value: function(event) { + // TODO maybe the code should be moved out to handleClick and + // handleMouseup + var isSurrendered, target, isTarget; + + if (this._observedPointer === null) { + this._endInteraction(event); + return; + } + + isSurrendered = !this.component.eventManager.isPointerClaimedByComponent(this._observedPointer, this); + target = event.target; + while (target !== this._element && target && target.parentNode) { + target = target.parentNode; + } + isTarget = target === this.component.element; + + if (isSurrendered && event.type === "click") { + // Pointer surrendered, so prevent the default action + event.preventDefault(); + // No need to dispatch an event as presscancel was dispatched + // in surrenderPointer, just end the interaction. + this._endInteraction(event); + return; + } + + if (!isSurrendered && isTarget && event.type === "mouseup") { + this._dispatchPress(event); + this._endInteraction(event); + return; + } + + if (!isSurrendered && !isTarget && event.type === "mouseup") { + this._dispatchPresscancel(event); + this._endInteraction(event); + return; + } + } + }, + + /** + Remove event listeners after an interaction has finished. + */ + _endInteraction: { + value: function(event) { + if (!event || event.type === "touchend" || event.type === "touchcancel") { + document.removeEventListener("touchend", this); + document.removeEventListener("touchcancel", this); + } else if (!event || event.type === "click" || event.type === "mouseup") { + document.removeEventListener("click", this); + document.removeEventListener("mouseup", this); + } + + if (this.component.eventManager.isPointerClaimedByComponent(this._observedPointer, this)) { + this.component.eventManager.forfeitPointer(this._observedPointer, this); + } + this._observedPointer = null; + this._state = PressComposer.UNPRESSED; + } + }, + + /** + Checks if we are observing one of the changed touches. Returns the index + of the changed touch if one matches, otherwise returns false. Make sure + to check against !== false or === false as the + matching index might be 0. + + @function + @private + @returns {Number,Boolean} The index of the matching touch, or false + */ + _changedTouchisObserved: { + value: function(changedTouches) { + if (this._observedPointer === null) { + return false; + } + + var i = 0, changedTouchCount = event.changedTouches.length; + + for (; i < changedTouchCount; i++) { + if (event.changedTouches[i].identifier === this._observedPointer) { + return i; + } + } + return false; + } + }, + + // Surrender pointer + + surrenderPointer: { + value: function(pointer, component) { + var shouldSurrender = this.callDelegateMethod("surrenderPointer", pointer, component); + if (typeof shouldSurrender !== "undefined" && shouldSurrender === false) { + return false; + } + + this._dispatchPresscancel(); + return true; + } + }, + + // Handlers + + handleTouchstart: { + value: function(event) { + this._startInteraction(event); + } + }, + handleTouchend: { + value: function(event) { + if (this._observedPointer === null) { + this._endInteraction(event); + return; + } + + if (this._changedTouchisObserved(event.changedTouches) !== false) { + if (this.component.eventManager.isPointerClaimedByComponent(this._observedPointer, this)) { + this._dispatchPress(event); + } else { + event.preventDefault(); + } + this._endInteraction(event); + } + } + }, + handleTouchcancel: { + value: function(event) { + if (this._observedPointer === null || this._changedTouchisObserved(event.changedTouches) !== false) { + if (this.component.eventManager.isPointerClaimedByComponent(this._observedPointer, this)) { + this._dispatchPresscancel(event); + } + this._endInteraction(event); + } + } + }, + + handleMousedown: { + value: function(event) { + this._startInteraction(event); + } + }, + handleClick: { + value: function(event) { + this._interpretInteraction(event); + } + }, + handleMouseup: { + value: function(event) { + this._interpretInteraction(event); + } + }, + + // Event dispatch + + _createPressEvent: { + enumerable: false, + value: function(name, event) { + var pressEvent, detail, index; + + if (!event) { + event = document.createEvent("CustomEvent"); + event.initCustomEvent(name, true, true, null); + } + + pressEvent = PressEvent.create(); + pressEvent.event = event; + pressEvent.type = name; + pressEvent.pointer = this._observedPointer; + + if (event.changedTouches && + (index = this._changedTouchisObserved(event.changedTouches)) !== false + ) { + pressEvent.touch = event.changedTouches[index]; + } + + return pressEvent; + } + }, + + /** + Dispatch the pressstart event + @private + */ + _dispatchPressstart: { + enumerable: false, + value: function (event) { + this._state = PressComposer.PRESSED; + this.dispatchEvent(this._createPressEvent("pressstart", event)); + } + }, + + /** + Dispatch the press event + @private + */ + _dispatchPress: { + enumerable: false, + value: function (event) { + this.dispatchEvent(this._createPressEvent("press", event)); + this._state = PressComposer.UNPRESSED; + } + }, + + /** + Dispatch the presscancel event + @private + */ + _dispatchPresscancel: { + enumerable: false, + value: function (event) { + this._state = PressComposer.CANCELLED; + this.dispatchEvent(this._createPressEvent("presscancel", event)); + } + } + +}); + + +var PressEvent = (function(){ + var value, eventProps, typeProps, eventPropDescriptor, typePropDescriptor, i; + + value = Montage.create(Montage, { + type: { + value: "press" + }, + _event: { + enumerable: false, + value: null + }, + event: { + get: function() { + return this._event; + }, + set: function(value) { + this._event = value; + } + }, + _touch: { + enumerable: false, + value: null + }, + touch: { + get: function() { + return this._touch; + }, + set: function(value) { + this._touch = value; + } + } + }); + + // These properties are available directly on the event + eventProps = ["altKey", "ctrlKey", "metaKey", "shiftKey", + "cancelBubble", "clipboardData", "currentTarget", "defaultPrevented", + "eventPhase", "returnValue", "srcElement", "timeStamp", "preventDefault", + "stopImmediatePropagation", "stopPropagation"]; + // These properties are available on the event in the case of mouse, and + // on the _touch in the case of touch + typeProps = ["clientX", "clientY", "pageX", "pageY", "screenX", "screenY", "target"]; + + eventPropDescriptor = function(prop) { + return { + get: function() { + return this._event[prop]; + } + }; + }; + typePropDescriptor = function(prop) { + return { + get: function() { + return (this._touch) ? this._touch[prop] : this._event[prop]; + } + }; + }; + + for (i = eventProps.length - 1; i >= 0; i--) { + Montage.defineProperty(value, eventProps[i], eventPropDescriptor(eventProps[i])); + } + for (i = typeProps.length - 1; i >= 0; i--) { + Montage.defineProperty(value, typeProps[i], typePropDescriptor(typeProps[i])); + } + + return value; +}()); diff --git a/node_modules/montage/ui/condition.reel/condition.js b/node_modules/montage/ui/condition.reel/condition.js index 298edb13..e88d96a1 100755 --- a/node_modules/montage/ui/condition.reel/condition.js +++ b/node_modules/montage/ui/condition.reel/condition.js @@ -53,6 +53,13 @@ exports.Condition = Montage.create(Component, /** @lends module:"montage/ui/cond this._condition = value; this.needsDraw = true; + if (this.removalStrategy === "remove") { + if (value) { + this._slot.content = this.content; + } else { + this._slot.content = null; + } + } }, get: function() { return this._condition; @@ -83,16 +90,59 @@ exports.Condition = Montage.create(Component, /** @lends module:"montage/ui/cond this._content = value; this.needsDraw = true; + + if (this.removalStrategy === "remove") { + if (this.condition) { + this._slot.content = value; + } + } else { + this._slot.content = value; + } + } }, + /** + @private + */ + _removalStrategy:{ + value: "remove", + enumerable:false + }, + + /** + + */ // TODO should this strategy be part of another class? // TODO expose the options as an exported enum - removalStrategy: { - enumerable: false, - value: "remove" + removalStrategy:{ + get:function () { + return this._removalStrategy; + }, + set:function (value) { + if (this._removalStrategy === value) { + return; + } + if (value === "hide" || this.condition) { + // was remove OR was hide + this._slot.content = this.content; + } + this._removalStrategy = value; + } }, + /** + + @param + @returns + */ + didCreate:{ + value:function () { + this._slot = Slot.create(); + } + }, + + /** Description TODO @function @@ -117,10 +167,6 @@ exports.Condition = Montage.create(Component, /** @lends module:"montage/ui/cond var slotRoot = document.createElement("div"); this.element.appendChild(slotRoot); - this.content.parentNode.removeChild(this.content); - slotRoot.appendChild(this.content); - - this._slot = Slot.create(); this._slot.element = slotRoot; } }, @@ -133,14 +179,9 @@ exports.Condition = Montage.create(Component, /** @lends module:"montage/ui/cond value: function() { if (this.condition) { - this._slot.content = this.content; this.element.classList.remove("montage-invisible"); } else { - if ("hide" === this.removalStrategy) { - this.element.classList.add("montage-invisible"); - } else { - this._slot.content = null; - } + this.element.classList.add("montage-invisible"); } } diff --git a/node_modules/montage/ui/date-input.reel/date-input.js b/node_modules/montage/ui/date-input.reel/date-input.js index af163258..0d8ff613 100644 --- a/node_modules/montage/ui/date-input.reel/date-input.js +++ b/node_modules/montage/ui/date-input.reel/date-input.js @@ -10,22 +10,10 @@ var Montage = require("montage").Montage, * The Component wrapper for input type="date" */ var DateInput = exports.DateInput = Montage.create(TextInput, { - hasTemplate: {value: true} }); DateInput.addAttributes({ - autocomplete: null, - disabled: {dataType: 'boolean'}, - list: null, // list of autocomplete options - max: null, - maxlength: null, - min: null, - multiple: null, - name: null, - pattern: null, - placeholder: null, - readonly: {dataType: 'boolean'}, - required: {dataType: 'boolean'}, - size: null, - src: null -}); + max: null, + min: null, + step: null // 'any' or a floating point number +}); \ No newline at end of file diff --git a/node_modules/montage/ui/flow-path-cubic.js b/node_modules/montage/ui/flow-path-cubic.js index a4be0dbe..ec4c6600 100644 --- a/node_modules/montage/ui/flow-path-cubic.js +++ b/node_modules/montage/ui/flow-path-cubic.js @@ -1,3 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + var Montage = require("montage").Montage; var FlowPathCubic = exports.FlowPathCubic = Montage.create(Montage, { diff --git a/node_modules/montage/ui/flow-path-lerp.js b/node_modules/montage/ui/flow-path-lerp.js index b88fee39..bc550500 100644 --- a/node_modules/montage/ui/flow-path-lerp.js +++ b/node_modules/montage/ui/flow-path-lerp.js @@ -1,3 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + var Montage = require("montage").Montage; var FlowPathLerp = exports.FlowPathLerp = Montage.create(Montage, { diff --git a/node_modules/montage/ui/flow-path-linear.js b/node_modules/montage/ui/flow-path-linear.js index b95ddb92..9bf83279 100644 --- a/node_modules/montage/ui/flow-path-linear.js +++ b/node_modules/montage/ui/flow-path-linear.js @@ -1,3 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + var Montage = require("montage").Montage; var FlowPathLinear = exports.FlowPathLinear = Montage.create(Montage, { diff --git a/node_modules/montage/ui/flow-path-sigmoid.js b/node_modules/montage/ui/flow-path-sigmoid.js index 2e776b5a..5f161544 100644 --- a/node_modules/montage/ui/flow-path-sigmoid.js +++ b/node_modules/montage/ui/flow-path-sigmoid.js @@ -1,3 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + var Montage = require("montage").Montage; var FlowPathSigmoid = exports.FlowPathSigmoid = Montage.create(Montage, { diff --git a/node_modules/montage/ui/flow-path.js b/node_modules/montage/ui/flow-path.js index ecb1d8fa..51ecd63c 100644 --- a/node_modules/montage/ui/flow-path.js +++ b/node_modules/montage/ui/flow-path.js @@ -1,3 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + var Montage = require("montage").Montage; var FlowPath = exports.FlowPath = Montage.create(Montage, { diff --git a/node_modules/montage/ui/flow.reel/flow.js b/node_modules/montage/ui/flow.reel/flow.js index 21556e41..f1311292 100644 --- a/node_modules/montage/ui/flow.reel/flow.js +++ b/node_modules/montage/ui/flow.reel/flow.js @@ -1,3 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + var Montage = require("montage").Montage, Component = require("ui/component").Component; diff --git a/node_modules/montage/ui/native-control.js b/node_modules/montage/ui/native-control.js index d3c3a635..d308ad89 100644 --- a/node_modules/montage/ui/native-control.js +++ b/node_modules/montage/ui/native-control.js @@ -11,48 +11,31 @@ var isUndefined = function(obj) { return (typeof obj === 'undefined'); }; -var extend = function(destination, source) { - for (var property in source) { - destination[property] = source[property]; - } - return destination; -}; - -var STRING_CLASS = '[object String]'; -var _toString = Object.prototype.toString; -var isString = function(object) { - return _toString.call(object) === STRING_CLASS; -}; /** * Base component for all native controls. */ -exports.NativeControl = Montage.create(Component, { +var NativeControl = exports.NativeControl = Montage.create(Component, { hasTemplate: { value: false }, - //http://www.w3.org/TR/html5/elements.html#global-attributes - _baseElementProperties: { - value: { - accesskey: null, - contenteditable: null, // true, false, inherit - contextmenu: null, - 'class': null, - dir: null, - draggable: {dataType: 'boolean'}, - dropzone: null, // copy/move/link - hidden: {dataType: 'boolean'}, - //id: null, - lang: null, - spellcheck: null, - style: null, - tabindex: null, - title: null + element: { + serializable: true, + enumerable: true, + get: function() { + return this._element; + }, + set: function(value) { + //var component = Object.getPrototypeOf(NativeControl); + // call super set + Object.getPropertyDescriptor(Component, "element").set.call(this, value); + this.didSetElement();