From 24b483db367291b72170f969de78efcb1a9b95bd Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 3 May 2012 22:53:07 -0700 Subject: integrating the latest montage version Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/anchor.reel/anchor.js | 78 ++- node_modules/montage/ui/application.js | 4 +- .../autocomplete.reel/autocomplete.css | 12 + .../autocomplete.reel/autocomplete.html | 10 + .../autocomplete/autocomplete.reel/autocomplete.js | 498 ++++++++++++++++ .../ui/autocomplete/autocomplete.reel/loading.gif | Bin 0 -> 1456 bytes .../results-list.reel/results-list.css | 30 + .../results-list.reel/results-list.html | 62 ++ .../autocomplete/results-list.reel/results-list.js | 16 + .../bluemoon/button-group.reel/button-group.html | 3 +- .../montage/ui/bluemoon/button.reel/button.html | 3 +- .../ui/bluemoon/progress.reel/progress.html | 7 +- .../montage/ui/bluemoon/slider.reel/slider.html | 35 +- node_modules/montage/ui/button.reel/button.js | 214 +++++-- node_modules/montage/ui/check-input.js | 23 +- node_modules/montage/ui/checkbox.reel/checkbox.js | 63 +- node_modules/montage/ui/component.js | 201 ++++--- node_modules/montage/ui/composer/composer.js | 45 +- node_modules/montage/ui/composer/press-composer.js | 28 +- .../montage/ui/composer/translate-composer.js | 641 +++++++++++---------- .../montage/ui/controller/array-controller.js | 1 - .../montage/ui/date-input.reel/date-input.js | 33 +- .../ui/dynamic-element.reel/dynamic-element.js | 143 +++++ .../montage/ui/dynamic-text.reel/dynamic-text.js | 45 +- node_modules/montage/ui/flow-path-cubic.js | 115 ++++ node_modules/montage/ui/flow-path-lerp.js | 112 ++++ node_modules/montage/ui/flow-path-linear.js | 83 +++ node_modules/montage/ui/flow-path-sigmoid.js | 148 +++++ node_modules/montage/ui/flow-path.js | 215 +++++++ node_modules/montage/ui/flow.reel/flow.html | 38 +- node_modules/montage/ui/flow.reel/flow.js | 482 +++------------- node_modules/montage/ui/image.reel/image.js | 36 +- node_modules/montage/ui/list.reel/list.html | 13 +- node_modules/montage/ui/loader.reel/loader.js | 30 +- .../ui/loading-panel.reel/loading-panel.html | 24 +- node_modules/montage/ui/loading.reel/loading.html | 5 +- node_modules/montage/ui/native-control.js | 185 ++++-- .../montage/ui/number-input.reel/number-input.js | 32 +- .../montage/ui/popup/alert.reel/alert.html | 25 +- .../montage/ui/popup/confirm.reel/confirm.html | 24 +- .../montage/ui/popup/notifier.reel/notifier.html | 7 +- node_modules/montage/ui/popup/popup.reel/popup.css | 20 +- .../montage/ui/popup/popup.reel/popup.html | 12 +- node_modules/montage/ui/popup/popup.reel/popup.js | 16 +- node_modules/montage/ui/progress.reel/progress.js | 34 +- .../montage/ui/radio-button.reel/radio-button.js | 65 ++- .../montage/ui/range-input.reel/range-input.js | 31 +- .../rich-text-linkpopup.html | 10 +- .../rich-text-linkpopup.js | 1 + .../rich-text-resizer.reel/rich-text-resizer.css | 32 +- .../rich-text-resizer.reel/rich-text-resizer.html | 26 +- .../rich-text-resizer.reel/rich-text-resizer.js | 10 +- .../rich-text-editor.reel/rich-text-editor-base.js | 34 +- .../rich-text-editor.reel/rich-text-editor.html | 10 +- .../rich-text-editor.reel/rich-text-editor.js | 223 ++++--- .../montage/ui/scroll-bars.reel/scroll-bars.html | 17 +- .../montage/ui/scroller.reel/scroller.html | 26 +- node_modules/montage/ui/scroller.reel/scroller.js | 21 +- .../montage/ui/scrollview.reel/scrollview.js | 193 +------ .../montage/ui/select-input.reel/select-input.js | 86 ++- node_modules/montage/ui/tabs.reel/tabs.html | 12 +- node_modules/montage/ui/text-input.js | 148 ++--- node_modules/montage/ui/textarea.reel/textarea.js | 94 ++- .../montage/ui/textfield.reel/textfield.js | 14 +- .../montage/ui/toggle-button.reel/toggle-button.js | 74 +-- .../montage/ui/video-player.reel/video-player.html | 97 ++-- 66 files changed, 3441 insertions(+), 1634 deletions(-) create mode 100644 node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.css create mode 100644 node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.html create mode 100644 node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.js create mode 100644 node_modules/montage/ui/autocomplete/autocomplete.reel/loading.gif create mode 100644 node_modules/montage/ui/autocomplete/results-list.reel/results-list.css create mode 100644 node_modules/montage/ui/autocomplete/results-list.reel/results-list.html create mode 100644 node_modules/montage/ui/autocomplete/results-list.reel/results-list.js mode change 100755 => 100644 node_modules/montage/ui/controller/array-controller.js create mode 100644 node_modules/montage/ui/dynamic-element.reel/dynamic-element.js create mode 100644 node_modules/montage/ui/flow-path-cubic.js create mode 100644 node_modules/montage/ui/flow-path-lerp.js create mode 100644 node_modules/montage/ui/flow-path-linear.js create mode 100644 node_modules/montage/ui/flow-path-sigmoid.js create mode 100644 node_modules/montage/ui/flow-path.js (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/anchor.reel/anchor.js b/node_modules/montage/ui/anchor.reel/anchor.js index d8ac1d8f..2c12684b 100644 --- a/node_modules/montage/ui/anchor.reel/anchor.js +++ b/node_modules/montage/ui/anchor.reel/anchor.js @@ -3,24 +3,78 @@ 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. */ + +/** + @module "montage/ui/anchor.reel" + @requires montage/core/core + @requires montage/ui/native-control +*/ var Montage = require("montage").Montage, Component = require("ui/component").Component, NativeControl = require("ui/native-control").NativeControl; - /** - * The native control with binding support for the standard attributes - */ + The Anchor component wraps a native <a> element and exposes its standard attributes as bindable properties. + @class module:"montage/ui/anchor.reel".Anchor + @extends module:montage/native-control.NativeControl + +*/ var Anchor = exports.Anchor = Montage.create(NativeControl, { + // HTMLAnchorElement methods + + blur: { value: function() { this._element.blur(); } }, + focus: { value: function() { this._element.focus(); } } + }); -http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element -Anchor.addAttributes({ - textContent: null, - href: null, - hreflang: null, - media: null, - rel: null, - target: null, - type: null +Anchor.addAttributes( /** @lends module:"montage/ui/anchor.reel".Anchor# */ { + +/** + The text displayed by the link. + @type string + @default null +*/ + textContent: null, + +/** + The link target URL. + @type string + @default null +*/ + href: null, + +/** + The language of the linked resource. + @type string + @default null +*/ + hreflang: null, + +/** + The media type for which the target document was designed. + @type string + @default null +*/ + media: null, + +/** + Controls what kinds of links the elements create. + @type string + @default null +*/ + rel: null, + +/** + The target window the link will open in. + @type string + @default null +*/ + target: null, + +/** + The MIME type of the linked resource. + @type string + @default null +*/ + type: null }); diff --git a/node_modules/montage/ui/application.js b/node_modules/montage/ui/application.js index 7cb4bd97..bbce6835 100755 --- a/node_modules/montage/ui/application.js +++ b/node_modules/montage/ui/application.js @@ -169,7 +169,7 @@ var Application = exports.Application = Montage.create(Montage, /** @lends monta _zIndex: {value: null}, _isSystemPopup: {value: function(type) { - return (type === 'alert' || type === 'confirm' || type === 'loading'); + return (type === 'alert' || type === 'confirm' || type === 'notify'); }}, _createPopupSlot: {value: function(zIndex) { @@ -201,7 +201,7 @@ var Application = exports.Application = Montage.create(Montage, /** @lends monta case "confirm": zIndex = 9003; break; - case "loading": + case "notify": zIndex = 9002; break; } diff --git a/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.css b/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.css new file mode 100644 index 00000000..972c41f5 --- /dev/null +++ b/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.css @@ -0,0 +1,12 @@ +/* + 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. +
*/ + .montage-autocomplete { + padding-right: 20px; + } + .montage-autocomplete-loading { + background: url('loading.gif') no-repeat; + background-position: right; + } \ No newline at end of file diff --git a/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.html b/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.html new file mode 100644 index 00000000..256804c7 --- /dev/null +++ b/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.html @@ -0,0 +1,10 @@ + + + + + Autocomplete Template + + + + + diff --git a/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.js b/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.js new file mode 100644 index 00000000..0ce1ab85 --- /dev/null +++ b/node_modules/montage/ui/autocomplete/autocomplete.reel/autocomplete.js @@ -0,0 +1,498 @@ +/* + 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, + TextInput = require("ui/text-input").TextInput, + logger = require("core/logger").logger("autocomplete"), + ResultsList = require("ui/autocomplete/results-list.reel/results-list").ResultsList, + ArrayController = require("ui/controller/array-controller").ArrayController, + Popup = require("ui/popup/popup.reel").Popup, + PressComposer = require("ui/composer/press-composer").PressComposer; + +var KEY_UP = 38, + KEY_DOWN = 40, + KEY_RIGHT = 39, + KEY_ENTER = 13, + KEY_ESC = 27; + +var getElementPosition = function(obj) { + var curleft = 0, curtop = 0, curHt = 0, curWd = 0; + if (obj.offsetParent) { + do { + curleft += obj.offsetLeft; + curtop += obj.offsetTop; + curHt += obj.offsetHeight; + curWd += obj.offsetWidth; + } while ((obj = obj.offsetParent)); + } + return { + top: curtop, + left: curleft, + height: curHt, + width: curWd + }; +}; + +/** + * The Autocomplete input + */ +var Autocomplete = exports.Autocomplete = Montage.create(TextInput, { + + didCreate: { + value: function() { + this.delay = 500; + this.minLength = 2; + } + }, + + hasTemplate: {value: true}, + + delegate: { + value: null + }, + + separator: { + value: ',', + distinct: true + }, + + _delay: {value: null}, + delay: { + distinct: true, + get: function(){ + return this._delay; + }, + set: function(value) { + if(value !== this._delay) { + if(String.isString(value)) { + value = parseInt(value, 10); + } + this._delay = value; + } + } + }, + + /** + * Number of characters the user must type before the suggest query is fired + * Default = 2 + */ + minLength: { + value: null + }, + + _tokens: {value: null}, + tokens: { + get: function() { + return this._tokens; + }, + set: function(value) { + this._tokens = value; + this._valueSyncedWithInputField = false; + this.needsDraw = true; + }, + modify: function(v) { + this._tokens = v; + }, + distinct: true + }, + + // overridden here to get the substring/searchString + value: { + get: function() { + return this._value; + //var arr = this.tokens; + //return (arr ? arr.join(',') : this._value); + }, + set: function(newValue, fromInput) { + this._value = newValue ? newValue.trim() : ''; + + // get the entered text after the separator + var value = this._value; + + + if(fromInput) { + this._valueSyncedWithInputField = true; + if(value) { + var arr = value.split(this.separator).map(function(item) { + return item.trim(); + }); + this.activeTokenIndex = this._findActiveTokenIndex(this.tokens, arr); + this._tokens = value.split(this.separator).map(function(item) { + return item.trim(); + }); + if(this._tokens.length && this._tokens.length > 0) { + var searchTerm = this._tokens[this.activeTokenIndex]; + searchTerm = searchTerm ? searchTerm.trim() : ''; + if(searchTerm.length >= this.minLength) { + var self = this; + clearTimeout(this.delayTimer); + this.delayTimer = setTimeout(function() { + self.delayTimer = null; + if (logger.isDebug) { + logger.debug('SEARCH for ', searchTerm); + } + self.performSearch(searchTerm); + }, this.delay); + } else { + this.showPopup = false; + } + } else { + this.showPopup = false; + } + } + } else { + this.activeTokenIndex = 0; + this._tokens = []; + this.showPopup = false; + + this._valueSyncedWithInputField = false; + this.needsDraw = true; + } + } + }, + + + + //---- Private + + // width of the popup + overlayWidth: { + value: null, + enumerable: false + }, + + delayTimer: { + value: null, + enumerable: false + }, + + // valid values are 'loading', 'complete' and 'timeout' + // --> ResultList.loadingStatus + _loadingStatus: {value: false, enumerable: false}, + loadingStatus: { + enumerable: false, + get: function() { + return this._loadingStatus; + }, + set: function(value) { + this._loadingStatus = value; + if(this._loadingStatus === 'loading') { + this.showPopup = false; + } + this.needsDraw = true; + } + }, + + // the index of the token in the tokens Array that is being worked on + activeTokenIndex: {value: null}, + + /** @private */ + _findActiveTokenIndex: { + enumerable: false, + value: function(before, after) { + if(before == null || after == null) { + return 0; + } + var i=0, len = after.length; + for(i=0; i< len; i++) { + if(i < before.length) { + if(before[i] === after[i]) { + continue; + } else { + break; + } + } + } + return i; + + } + }, + + + // -> resultsController.activeIndexes + _activeIndexes: {value: null, enumerable: false}, + activeItemIndex: { + enumerable: false, + get: function() { + if(this._activeIndexes && this._activeIndexes.length > 0) { + return this._activeIndexes[0]; + } + return null; + }, + set: function(value) { + if(value == null) { + this._activeIndexes = []; + } else { + this._activeIndexes = [value]; + } + + } + }, + + _suggestedValue: {value: null}, + suggestedValue: { + distinct: true, + enumerable: false, + get: function() { + return this._suggestedValue; + }, + set: function(value) { + if(value) { + this._suggestedValue = value; + var arr = this.tokens; + arr[this.activeTokenIndex] = this._suggestedValue; + this.tokens = arr; + this.showPopup = false; + } + } + }, + + // private + + popup: { + enumerable: false, + value: null + }, + + _showPopup: {value: null}, + showPopup: { + enumerable: false, + get: function() { + return this._showPopup; + }, + set: function(value) { + if(value != this._showPopup) { + this._showPopup = value; + this.needsDraw = true; + } + } + }, + + // the delegate should set the suggestions. + // suggestions -> resultsController.objects + _suggestions: {value: null}, + suggestions: { + enumerable: false, + get: function() { + return this._suggestions; + }, + set: function(value) { + if (logger.isDebug) { + logger.debug('got suggestions: ', value); + } + this.loadingStatus = 'complete'; + this._suggestions = value; + this.showPopup = (value && value.length > 0); + } + }, + + // resultsController -> resultsList.contentController + resultsController: { + enumerable: false, + value: null + }, + + // repetition + resultsList: { + enumerable: false, + value: null + }, + + performSearch: { + enumerable: false, + value: function(searchTerm) { + if(this.delegate) { + // index on the popup + this.activeItemIndex = 0; + this.loadingStatus = 'loading'; + //this.showPopup = true; + // delegate must set the results on the AutoComplete + var fn = this.identifier + 'ShouldGetSuggestions'; + if(typeof this.delegate[fn] === 'function') { + this.delegate[fn](this, searchTerm); + } else if(typeof this.delegate.shouldGetSuggestions === 'function') { + this.delegate.shouldGetSuggestions(this, searchTerm); + } else { + // error - d + } + } + } + }, + + + _addEventListeners: { + enumerable: false, + value: function() { + this.element.addEventListener("keyup", this); + this.element.addEventListener("input", this); + } + }, + + _removeEventListeners: { + enumerable: false, + value: function() { + this.element.removeEventListener("keyup", this); + this.element.removeEventListener("input", this); + } + }, + + _getPopup: { + enumerable: false, + value: function() { + + var popup = this.popup; + + if(!popup) { + popup = Popup.create(); + popup.content = this.resultsList; + popup.anchor = this.element; + popup.delegate = this; + // dont let the popup take away the focus + // we need the focus on the textfield + popup.focusOnShow = false; + this.popup = popup; + } + return this.popup; + + } + }, + + // Delegate method to position the suggest popup + willPositionPopup: { + value: function(popup, defaultPosition) { + var anchor = popup.anchorElement, anchorPosition = getElementPosition(anchor); + return { + left: anchorPosition.left, + top: anchorPosition.top + 30 + }; + + } + }, + + prepareForDraw: { + value: function() { + this._addEventListeners(); + this.element.classList.add('montage-autocomplete'); + + // create the Repetition for the suggestions + this.resultsController = ArrayController.create(); + Object.defineBinding(this.resultsController, "content", { + boundObject: this, + boundObjectPropertyPath: "suggestions", + oneway: true + }); + + Object.defineBinding(this, "suggestedValue", { + boundObject: this.resultsController, + boundObjectPropertyPath: "selectedObjects.0", + oneway: true + }); + + this.resultsList = ResultsList.create(); + Object.defineBinding(this.resultsList, "contentController", { + boundObject: this, + boundObjectPropertyPath: "resultsController", + oneway: true + }); + + Object.defineBinding(this.resultsList, "activeIndexes", { + boundObject: this, + boundObjectPropertyPath: "_activeIndexes", + oneway: true + }); + + var popup = this._getPopup(); + } + }, + + prepareForActivationEvents: { + value: function() { + // add pressComposer to handle the claimPointer related work + var pressComposer = PressComposer.create(); + this.addComposer(pressComposer); + } + }, + + draw: { + value: function() { + var el = this.element; + + var fn = Object.getPrototypeOf(Autocomplete).draw; + fn.call(this); + + if (!this._valueSyncedWithInputField) { + this.value = this.tokens.join(this.separator); + this.element.value = this.value; + this._valueSyncedWithInputField = true; + } + + if(this.showPopup) { + this.popup.show(); + // reset active index + this.activeItemIndex = 0; + } else { + if(this.popup && this.popup.displayed) { + this.popup.hide(); + } + } + + var isLoading = (this.loadingStatus === 'loading'); + this.element.classList[isLoading ? 'add' : 'remove']('montage-autocomplete-loading'); + + + } + }, + + + handleKeyup: { + enumerable: false, + value: function(e) { + var code = e.keyCode, popup = this._getPopup(); + + switch(code) { + case KEY_DOWN: + if(popup.displayed == false) { + popup.show(); + this.activeItemIndex = 0; + } else { + var list = this.suggestions || []; + if(list.length > 0 && this.activeItemIndex < list.length-1) { + this.activeItemIndex++; + } else { + this.activeItemIndex = 0; + } + + } + + break; + + case KEY_UP: + if(popup.displayed == true) { + if(this.activeItemIndex > 0) { + this.activeItemIndex --; + } else { + this.activeItemIndex = 0; + } + } + + break; + + case KEY_ENTER: + if(popup.displayed == true) { + this.resultsController.selectedIndexes = [this.activeItemIndex]; + //this.selectSuggestedValue(); + // select the currently active item in the results list + } + + break; + + } + this.element.focus(); + } + } + +}); + diff --git a/node_modules/montage/ui/autocomplete/autocomplete.reel/loading.gif b/node_modules/montage/ui/autocomplete/autocomplete.reel/loading.gif new file mode 100644 index 00000000..18abf9aa Binary files /dev/null and b/node_modules/montage/ui/autocomplete/autocomplete.reel/loading.gif differ diff --git a/node_modules/montage/ui/autocomplete/results-list.reel/results-list.css b/node_modules/montage/ui/autocomplete/results-list.reel/results-list.css new file mode 100644 index 00000000..cc8791bc --- /dev/null +++ b/node_modules/montage/ui/autocomplete/results-list.reel/results-list.css @@ -0,0 +1,30 @@ +/* + 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. +
*/ +div.results-list { + min-width: 300px; + } + div.results-list ul { + list-style: none; + margin: 0; + } + div.results-list ul li { + cursor: default; + padding: 5px 5px 5px 10px; + } + div.results-list ul li.active{ + background-color: #eee; + color: #333; + cursor: pointer; + } + div.results-list ul .selected { + background-color: #fff; + cursor: default; + font-weight: bold; + } + div.results-list div.loading { + padding: 5px 10px; + + } diff --git a/node_modules/montage/ui/autocomplete/results-list.reel/results-list.html b/node_modules/montage/ui/autocomplete/results-list.reel/results-list.html new file mode 100644 index 00000000..73612736 --- /dev/null +++ b/node_modules/montage/ui/autocomplete/results-list.reel/results-list.html @@ -0,0 +1,62 @@ + + + + + Autocomplete Results Template + + + + + + +
+
    +
  • +
+
+ + + diff --git a/node_modules/montage/ui/autocomplete/results-list.reel/results-list.js b/node_modules/montage/ui/autocomplete/results-list.reel/results-list.js new file mode 100644 index 00000000..795e74e0 --- /dev/null +++ b/node_modules/montage/ui/autocomplete/results-list.reel/results-list.js @@ -0,0 +1,16 @@ +/* + 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; + +exports.ResultsList = Montage.create(Component, { + + // contentController -> this.repetition.contentController + contentController: {value: null}, + + activeIndexes: {value: null} + +}); diff --git a/node_modules/montage/ui/bluemoon/button-group.reel/button-group.html b/node_modules/montage/ui/bluemoon/button-group.reel/button-group.html index 4bda1401..8b192be4 100644 --- a/node_modules/montage/ui/bluemoon/button-group.reel/button-group.html +++ b/node_modules/montage/ui/bluemoon/button-group.reel/button-group.html @@ -11,8 +11,7 @@