sproutcore 1.5.0.pre.4.1 → 1.5.0.pre.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/VERSION.yml +1 -1
- data/lib/buildtasks/manifest.rake +4 -3
- data/lib/frameworks/sproutcore/Buildfile +1 -2
- data/lib/frameworks/sproutcore/CHANGELOG.md +8 -3
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/app-selector.css +19 -23
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/button.css +139 -135
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/dock.css +5 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/general.css +0 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/menu.css +10 -13
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/modal.css +9 -8
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/picker.css +19 -12
- data/lib/frameworks/sproutcore/apps/greenhouse/models/design.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +1 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +31 -20
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +23 -45
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +60 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/ready/done.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/layout.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +51 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +261 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +55 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +2 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +96 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/prepareContext.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/updateLayerLocation.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +179 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +8 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +51 -114
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +84 -36
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +4 -67
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +244 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +23 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/loadRecord.js +64 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +38 -35
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/system/datetime.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/datetime/tests/system/datetime.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +11 -3
- data/lib/frameworks/sproutcore/frameworks/designer/ext/binding.js +33 -0
- data/lib/frameworks/sproutcore/frameworks/designer/ext/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/ext/page.js +5 -33
- data/lib/frameworks/sproutcore/frameworks/designer/ext/view.js +0 -27
- data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/designer/tests/designers/view_designer.js +47 -0
- data/lib/frameworks/sproutcore/frameworks/designer/views/drawing.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +19 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +133 -39
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/border.js +6 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +1 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +17 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +60 -27
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/system/cookie.js +29 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +18 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +62 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/cookie.js +20 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +235 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +19 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +6 -13
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +23 -117
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/bind.js +136 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/collection.js +75 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/localization.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/view.js +115 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +143 -80
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/video.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +25 -17
- data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/pointers.psd +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/18px/button.css +18 -12
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/24px/button.css +30 -16
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/30px/button.css +27 -15
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +5 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/button.css +8 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/24px/button.css +25 -16
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/30px/button.css +21 -15
- data/lib/frameworks/sproutcore/themes/ace/resources/imagebutton/ace/imagebutton.css +11 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/panel.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/picker.css +41 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/pointers.png +0 -0
- data/lib/sproutcore.rb +2 -0
- data/lib/sproutcore/buildfile.rb +17 -17
- data/lib/sproutcore/buildfile/task.rb +4 -12
- data/lib/sproutcore/buildfile/task_manager.rb +13 -4
- data/lib/sproutcore/models/manifest.rb +3 -3
- data/lib/sproutcore/models/target.rb +1 -1
- data/spec/fixtures/real_world/Buildfile +1 -1
- data/vendor/chance/lib/chance/imagers/data_url.rb +38 -19
- data/vendor/chance/lib/chance/instance.rb +4 -7
- data/vendor/chance/lib/chance/slicing.rb +6 -10
- metadata +18 -5
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/tabbed.css +0 -68
- data/lib/frameworks/sproutcore/frameworks/designer/coders/localization.js +0 -19
- data/lib/sproutcore/buildfile/cloneable.rb +0 -34
@@ -0,0 +1,33 @@
|
|
1
|
+
// ========================================================================
|
2
|
+
// SproutCore -- JavaScript Application Framework
|
3
|
+
// ========================================================================
|
4
|
+
|
5
|
+
/**
|
6
|
+
Extend SC.Binding with properites that make it easier to detect bindings
|
7
|
+
in the inspector
|
8
|
+
*/
|
9
|
+
SC.Binding.isBinding = true;
|
10
|
+
|
11
|
+
|
12
|
+
SC.Binding.displayValue = function(){
|
13
|
+
var from = this._fromRoot ? "<%@>:%@".fmt(this._fromRoot,this._fromPropertyPath) : this._fromPropertyPath;
|
14
|
+
|
15
|
+
var to = this._toPropertyPath;
|
16
|
+
|
17
|
+
var oneWay = this._oneWay ? '[oneWay]' : '';
|
18
|
+
return "%@ -> %@ %@".fmt(from, to, oneWay);
|
19
|
+
|
20
|
+
};
|
21
|
+
|
22
|
+
|
23
|
+
SC.Binding.encodeDesign = function(coder){
|
24
|
+
var ret = "SC.Binding";
|
25
|
+
|
26
|
+
if(this._fromPropertyPath){
|
27
|
+
ret= ret+".from('"+this._fromPropertyPath+"')";
|
28
|
+
}
|
29
|
+
if(this._oneWay){
|
30
|
+
ret = ret+".oneWay()";
|
31
|
+
}
|
32
|
+
return ret;//coder.js(key,ret);
|
33
|
+
};
|
@@ -39,48 +39,20 @@ SC.Page.prototype.designController = function() {
|
|
39
39
|
return this._designController ;
|
40
40
|
}.property().cacheable();
|
41
41
|
|
42
|
-
/**
|
43
|
-
Extend SC.Page to emit the localization for the current configuration of the
|
44
|
-
view and all of its subviews.
|
45
|
-
*/
|
46
|
-
SC.Page.prototype.emitLocalization = function(design) {
|
47
|
-
|
48
|
-
// awake all views. this is needed to emit the design for them.
|
49
|
-
this.awake();
|
50
|
-
|
51
|
-
// the pageName must be set on the page so we can emit properly
|
52
|
-
var pageName = this.get('pageName');
|
53
|
-
|
54
|
-
// now encode the page.
|
55
|
-
var ret = SC.LocalizationCoder.encode(this);
|
56
|
-
|
57
|
-
// and add some wrapper
|
58
|
-
ret = ['// SproutCore ViewBuilder Localization Format v1.0',
|
59
|
-
'// WARNING: This file is automatically generated. DO NOT EDIT. Changes you',
|
60
|
-
'// make to this file will be lost.', '',
|
61
|
-
'%@.loc(%@);'.fmt(pageName, ret),''].join("\n");
|
62
|
-
return ret ;
|
63
|
-
} ;
|
64
|
-
|
65
42
|
/** @private implement support for encoders */
|
66
43
|
SC.Page.prototype.encodeDesign = function(c) {
|
67
44
|
// step through and find all views. encode them.
|
68
45
|
for(var key in this) {
|
46
|
+
if(!this.hasOwnProperty(key)) continue;
|
69
47
|
var view = this[key];
|
70
|
-
if (
|
48
|
+
if (key !== '__sc_super__' && key !== '_designController' &&
|
49
|
+
(view instanceof SC.View || view instanceof SC.Controller || view instanceof SC.Object)){
|
50
|
+
c.js(key, view.emitDesign());
|
51
|
+
}
|
71
52
|
}
|
72
53
|
|
73
54
|
// save page name;
|
74
55
|
c.string('pageName', this.get('pageName'));
|
75
56
|
};
|
76
|
-
|
77
|
-
SC.Page.prototype.encodeLoc = function(c) {
|
78
|
-
// step through and find all views. encode them.
|
79
|
-
for(var key in this) {
|
80
|
-
var view = this[key];
|
81
|
-
if (view instanceof SC.View) c.js(key, view.emitLocalization());
|
82
|
-
}
|
83
|
-
};
|
84
|
-
|
85
57
|
|
86
58
|
|
@@ -18,25 +18,6 @@ SC.View.prototype.emitDesign = function() {
|
|
18
18
|
return ret ;
|
19
19
|
};
|
20
20
|
|
21
|
-
/**
|
22
|
-
Extend SC.View to emit the localization for the current configuration of the
|
23
|
-
view and all of its subviews.
|
24
|
-
*/
|
25
|
-
SC.View.prototype.emitLocalization = function(design) {
|
26
|
-
var ret = SC.LocalizationCoder.encode(this);
|
27
|
-
|
28
|
-
// prepare rootElement HTML. Get the design, apply loc and generate the
|
29
|
-
// emptyElement HTML...
|
30
|
-
if (!design) design = this.emitDesign();
|
31
|
-
var views = eval(design).loc(eval(ret)).create() ;
|
32
|
-
var emptyElement = views.computeEmptyElement().replace(/\'/g,"\'");
|
33
|
-
views.destroy();
|
34
|
-
|
35
|
-
// now insert as extra param at end...
|
36
|
-
ret = ret.replace(/\)$/, ", '%@')".fmt(emptyElement)) ;
|
37
|
-
return ret ;
|
38
|
-
} ;
|
39
|
-
|
40
21
|
/**
|
41
22
|
Patch SC.View to respond to encodeDesign(). This will proxy to the paired
|
42
23
|
designer, if there is one. If there is no paired designer, returns NO.
|
@@ -44,11 +25,3 @@ SC.View.prototype.emitLocalization = function(design) {
|
|
44
25
|
SC.View.prototype.encodeDesign = function(coder) {
|
45
26
|
return this.designer ? this.designer.encodeDesign(coder) : NO ;
|
46
27
|
};
|
47
|
-
|
48
|
-
/**
|
49
|
-
Patch SC.View to respond to encodeDesign(). This will proxy to the paired
|
50
|
-
designer, if there is one. If there is no paired designer, returns NO.
|
51
|
-
*/
|
52
|
-
SC.View.prototype.encodeLoc = function(coder) {
|
53
|
-
return this.designer ? this.designer.encodeLoc(coder) : NO ;
|
54
|
-
};
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// License: Licensed under MIT license (see license.js)
|
4
|
+
// ==========================================================================
|
5
|
+
/*globals module ok equals same test Sample */
|
6
|
+
var basic, baseTypes, bindingPage, testView, design;
|
7
|
+
|
8
|
+
|
9
|
+
module('SC.DesignCoder', {
|
10
|
+
setup: function () {
|
11
|
+
basic = SC.Page.design({});
|
12
|
+
testView = SC.View.extend({});
|
13
|
+
testView.Designer = SC.ViewDesigner.extend({
|
14
|
+
designProperties: 's n b a h valueBinding'.w()
|
15
|
+
});
|
16
|
+
|
17
|
+
|
18
|
+
baseTypes = SC.Page.create({
|
19
|
+
needsDesigner: true,
|
20
|
+
mainView: testView.design({s:'string',n:12,b:false,a:[1, 2, 3],h:{a:'b',c:'d'}})
|
21
|
+
});
|
22
|
+
|
23
|
+
bindingPage = SC.Page.create({
|
24
|
+
number: 12,
|
25
|
+
needsDesigner: true,
|
26
|
+
mainView: testView.design({valueBinding: SC.Binding.from('.page.number')})//.create() //to get it to run on the binding itself...
|
27
|
+
});
|
28
|
+
|
29
|
+
},
|
30
|
+
|
31
|
+
teardown: function () {
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
test('Verify basic page file encoding', function () {
|
36
|
+
design = SC.DesignCoder.encode(basic);
|
37
|
+
equals(design.trim(), 'SC.Page.design({})', 'basic page encoded');
|
38
|
+
});
|
39
|
+
|
40
|
+
test('Verify view in page encoding', function () {
|
41
|
+
baseTypes.awake();
|
42
|
+
design = SC.DesignCoder.encode(baseTypes);
|
43
|
+
equals(design.trim(),'SC.Page.design({mainView: SC.View.design({s: "string",n: 12,b: false,a: [1,2,3],h: {"a": "b","c": "d"}})})', 'basic types encoded');
|
44
|
+
});
|
45
|
+
|
46
|
+
test('Verify binding in page encoding', function () {
|
47
|
+
SC.RunLoop.begin();
|
48
|
+
bindingPage.awake();
|
49
|
+
bindingPage.get('mainView');
|
50
|
+
SC.RunLoop.end();
|
51
|
+
|
52
|
+
design = SC.DesignCoder.encode(bindingPage);
|
53
|
+
equals(design.trim(),'SC.Page.design({mainView: SC.View.design({valueBinding: SC.Binding.from(\'.page.number\')})})', 'binding types encoded');
|
54
|
+
});
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2011 Mike Ball and contributors.
|
4
|
+
// portions copyright @2009 Apple Inc.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
/*global module test htmlbody ok equals same stop start v*/
|
8
|
+
|
9
|
+
(function() {
|
10
|
+
var basic, testView, page;
|
11
|
+
// ..........................................................
|
12
|
+
// TEST VIEWS
|
13
|
+
//
|
14
|
+
module('SC.ViewDesigner', {
|
15
|
+
setup: function () {
|
16
|
+
testView = SC.View.extend({
|
17
|
+
mouseDown: function(){
|
18
|
+
var page = this.get('page');
|
19
|
+
page.set('mouseDownInView', YES);
|
20
|
+
}
|
21
|
+
});
|
22
|
+
testView.Designer = SC.ViewDesigner.extend({
|
23
|
+
mouseDown: function(){
|
24
|
+
var page = this.get('page');
|
25
|
+
page.set('mouseDownInDesigner', YES);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
basic = SC.Page.design({
|
29
|
+
needsDesigner: true,
|
30
|
+
mouseDownInView: false,
|
31
|
+
mouseDownInDesigner: false,
|
32
|
+
view: testView.design({})
|
33
|
+
});
|
34
|
+
|
35
|
+
|
36
|
+
},
|
37
|
+
teardown: function () {}
|
38
|
+
});
|
39
|
+
|
40
|
+
test("tryToPerform redirects to designer",function() {
|
41
|
+
var view = basic.get('view');
|
42
|
+
view.tryToPerform('mouseDown', {});
|
43
|
+
ok(basic.get('mouseDownInDesigner'), "designer got mouseDown");
|
44
|
+
ok(!basic.get('mouseDownInView'), "view did not get mouseDown");
|
45
|
+
});
|
46
|
+
|
47
|
+
})();
|
@@ -173,15 +173,15 @@ SC.DrawingView = SC.View.extend({
|
|
173
173
|
this._drawShapes(cntx);
|
174
174
|
}
|
175
175
|
else {
|
176
|
-
|
176
|
+
SC.Logger.error("SC.DrawingView.render(): Canvas object context is not accessible.");
|
177
177
|
}
|
178
178
|
}
|
179
179
|
else {
|
180
|
-
|
180
|
+
SC.Logger.error("SC.DrawingView.render(): Canvas element array length is zero.");
|
181
181
|
}
|
182
182
|
}
|
183
183
|
else {
|
184
|
-
|
184
|
+
SC.Logger.error("SC.DrawingView.render(): Canvas element is not accessible.");
|
185
185
|
}
|
186
186
|
}
|
187
187
|
|
@@ -190,7 +190,7 @@ SC.DrawingView = SC.View.extend({
|
|
190
190
|
|
191
191
|
registerShapeDrawing: function(name, drawingFunction){
|
192
192
|
if (!name) {
|
193
|
-
|
193
|
+
SC.Logger.error('Can\'t register this drawing paradigm because name is null');
|
194
194
|
return NO;
|
195
195
|
}
|
196
196
|
|
@@ -100,7 +100,9 @@ SC.Border = {
|
|
100
100
|
|
101
101
|
/** @private */
|
102
102
|
initMixin: function() {
|
103
|
+
console.warn("SC.Border is deprecated, please set border in your layout");
|
103
104
|
this._sc_border_borderStyleDidChange();
|
105
|
+
this._sc_border_borderDimensionsDidChange();
|
104
106
|
},
|
105
107
|
|
106
108
|
/** @private */
|
@@ -119,12 +121,23 @@ SC.Border = {
|
|
119
121
|
borderSize = SC.Border.dimensions[borderStyle];
|
120
122
|
|
121
123
|
if (borderSize) {
|
122
|
-
this.
|
123
|
-
this.
|
124
|
-
this.
|
125
|
-
this.
|
124
|
+
this.beginPropertyChanges();
|
125
|
+
this.set('borderTop', borderSize);
|
126
|
+
this.set('borderRight', borderSize);
|
127
|
+
this.set('borderBottom', borderSize);
|
128
|
+
this.set('borderLeft', borderSize);
|
129
|
+
this.endPropertyChanges();
|
126
130
|
}
|
127
|
-
}
|
131
|
+
},
|
132
|
+
|
133
|
+
_sc_border_borderDimensionsDidChange: function(){
|
134
|
+
var borderTop = this.get('borderTop'),
|
135
|
+
borderRight = this.get('borderRight'),
|
136
|
+
borderBottom = this.get('borderBottom'),
|
137
|
+
borderLeft = this.get('borderLeft');
|
138
|
+
this.adjust({ borderTop: borderTop, borderRight: borderRight, borderBottom: borderBottom, borderLeft: borderLeft });
|
139
|
+
}.observes('borderTop', 'borderRight', 'borderBottom', 'borderLeft')
|
140
|
+
|
128
141
|
};
|
129
142
|
|
130
143
|
SC.mixin(SC.Border, {
|
@@ -135,4 +148,4 @@ SC.mixin(SC.Border, {
|
|
135
148
|
'sc-top-border': 1,
|
136
149
|
'sc-bottom-border': 1
|
137
150
|
}
|
138
|
-
});
|
151
|
+
});
|
@@ -8,7 +8,7 @@
|
|
8
8
|
/**
|
9
9
|
@namespace
|
10
10
|
|
11
|
-
A Collection View Delegate is consulted by a SC.CollectionView
|
11
|
+
A Collection View Delegate is consulted by a SC.CollectionView to make
|
12
12
|
policy decisions about certain behaviors such as selection control and
|
13
13
|
drag and drop. If you need to control other aspects of your data, you may
|
14
14
|
also want to add the SC.CollectionContent mixin.
|
@@ -34,7 +34,7 @@ SC.NavigationBuilder = {
|
|
34
34
|
this.mixin(animatable);
|
35
35
|
} else if (!animatable) {
|
36
36
|
// check that we actually have SC.Animatable
|
37
|
-
|
37
|
+
SC.Logger.error(
|
38
38
|
"SC.NavigationView and SC.NavigationBuilder require SC.Animatable " +
|
39
39
|
"to perform animations, but it is not present. Please ensure your app or framework " +
|
40
40
|
"references it."
|
@@ -22,7 +22,7 @@ SC.Scrollable = {
|
|
22
22
|
|
23
23
|
//@if(debug)
|
24
24
|
initMixin: function() {
|
25
|
-
|
25
|
+
SC.Logger.warn("SC.Scrollable is deprecated and will be removed in a future version of SproutCore. Consider pulling the mixin into your own app if you want to keep using it.");
|
26
26
|
},
|
27
27
|
//@endif
|
28
28
|
|
@@ -34,87 +34,181 @@ SC.POINTER_LAYOUT = ["perfectRight", "perfectLeft", "perfectTop", "perfectBottom
|
|
34
34
|
|
35
35
|
/**
|
36
36
|
@class
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
|
38
|
+
Display a non-modal pane that automatically repositions around a view so as
|
39
|
+
to remain visible.
|
40
|
+
|
41
|
+
An `SC.PickerPane` repositions around the view to which it is anchored as the
|
42
|
+
browser window is resized so as to ensure the pane's content remains visible.
|
43
|
+
A picker pane is useful for displaying supplementary information and does not
|
44
|
+
block the user's interaction with other UI elements. Picker panes typically
|
45
|
+
provide a better user experience than modal panels.
|
46
|
+
|
47
|
+
An `SC.PickerPane` repositions itself according to the optional `preferMatrix`
|
48
|
+
argument passed in the `.popup()` method call. The `preferMatrix` either
|
49
|
+
specifies an offset-based arrangement behavior or a position-based arrangement
|
50
|
+
behavior depending on the `preferType` argument in the `.popup()` call.
|
51
|
+
|
52
|
+
The simplest way to create and display a picker pane:
|
41
53
|
|
42
54
|
{{{
|
43
|
-
SC.PickerPane.create({
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}).popup(anchor);
|
55
|
+
SC.PickerPane.create({
|
56
|
+
layout: { width: 400, height: 200 },
|
57
|
+
contentView: SC.View.extend({})
|
58
|
+
}).popup(someView);
|
48
59
|
}}}
|
49
60
|
|
50
|
-
This
|
61
|
+
This displays the `SC.PickerPane` anchored to `someView`.
|
62
|
+
|
63
|
+
h2. Positioning
|
64
|
+
|
65
|
+
Picker pane positioning can be classified into two broad categories:
|
66
|
+
offset-based and position-based.
|
67
|
+
|
68
|
+
h3. Offset-based
|
69
|
+
|
70
|
+
When `preferType` is unspecified, `SC.PICKER_MENU` or `SC.PICKER_FIXED`, then
|
71
|
+
the `preferMatrix` array describes the offset that is used to position the
|
72
|
+
pane below the anchor. The offset is described by an array of three values,
|
73
|
+
defaulting to `[1, 4, 3]`. The first value controls the x offset and the second
|
74
|
+
value the y offset. The third value can be `0` (right) or `3` (bottom),
|
75
|
+
controlling whether the origin of the pane is further offset by the width
|
76
|
+
(in the case of 0) or the height (in the case of 3) of the anchor.
|
77
|
+
|
78
|
+
|
79
|
+
h3. Position-based
|
80
|
+
|
81
|
+
When `preferType` is `SC.PICKER_POINTER` or `SC.PICKER_MENU_POINTER`, then
|
82
|
+
the `preferMatrix` specifies the sides in the order in which you want the
|
83
|
+
`SC.PickerPane` to try to arrange itself around the view to which it is
|
84
|
+
anchored. The fifth element in the `preferMatrix` specifies which side the
|
85
|
+
`SC.PickerPane` should display on when there isn't enough space around any
|
86
|
+
of the preferred sides.
|
87
|
+
|
88
|
+
Anchor sides are defined by their index in `SC.POINTER_LAYOUT`, where right
|
89
|
+
is `0`, left is `1`, top is `2`, and bottom is `3`.
|
90
|
+
|
91
|
+
For example, the `preferMatrix` of `[3, 0, 1, 2, 2]` says: "Display below the
|
92
|
+
anchor (3); if there isn't enough space then display to the right of the anchor (0).
|
93
|
+
If there isn't enough space either below or to the right of the anchor, then appear
|
94
|
+
to the left (1), unless there is also no space on the left, in which case display
|
95
|
+
above the anchor (2)."
|
96
|
+
|
97
|
+
h2. Position Rules
|
98
|
+
|
99
|
+
When invoking `.popup()` you can optionally specify a picker position rule with
|
100
|
+
the `preferType` argument.
|
101
|
+
|
102
|
+
If no `preferType` is specified, the picker pane is displayed just below the anchor.
|
103
|
+
The pane will reposition automatically for optimal visibility, ensuring the top-left
|
104
|
+
corner is visible.
|
105
|
+
|
106
|
+
These position rules have the following behaviors:
|
107
|
+
|
108
|
+
h3. `SC.PICKER_MENU`
|
109
|
+
|
110
|
+
Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]`.
|
111
|
+
Furthermore, a minimum left and right padding to window, of 7px and 8px, respectively,
|
112
|
+
is enforced.
|
113
|
+
|
114
|
+
|
115
|
+
h3. `SC.PICKER_FIXED`
|
116
|
+
|
117
|
+
Positioning is offset-based, with `preferMatrix` defaulting to `[1, 4, 3]` and
|
118
|
+
skipping `fitPositionToScreen`.
|
119
|
+
|
120
|
+
|
121
|
+
h3. `SC.PICKER_POINTER`
|
122
|
+
|
123
|
+
Positioning is position-based, with `preferMatrix` defaulting to `[0, 1, 2, 3, 2]`,
|
124
|
+
i.e. right > left > top > bottom; fallback to top.
|
125
|
+
|
126
|
+
|
127
|
+
h3. `SC.PICKER_MENU_POINTER`
|
128
|
+
|
129
|
+
Positioning is position-based, with `preferMatrix` defaulting to `[3, 0, 1, 2, 3]`,
|
130
|
+
i.e. bottom, right, left, top; fallback to bottom.
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
h2. Examples
|
51
135
|
|
52
|
-
Picker pane is a simple way to provide non-modal messaging that won't
|
53
|
-
blocks the user's interaction with your application. Picker panes are
|
54
|
-
useful for showing important detail informations with optimized position around anchor.
|
55
|
-
They provide a better user experience than modal panel.
|
56
|
-
|
57
136
|
Examples for applying popular customized picker position rules:
|
58
137
|
|
59
138
|
1. default:
|
60
139
|
{{{
|
61
|
-
SC.PickerPane.create({
|
140
|
+
SC.PickerPane.create({
|
141
|
+
layout: { width: 400, height: 200 },
|
142
|
+
contentView: SC.View.extend({})
|
62
143
|
}).popup(anchor);
|
63
144
|
}}}
|
64
145
|
|
65
|
-
2. menu below the anchor with default
|
146
|
+
2. menu below the anchor with default `preferMatrix` of `[1,4,3]`:
|
66
147
|
{{{
|
67
|
-
SC.PickerPane.create({
|
148
|
+
SC.PickerPane.create({
|
149
|
+
layout: { width: 400, height: 200 },
|
150
|
+
contentView: SC.View.extend({})
|
68
151
|
}).popup(anchor, SC.PICKER_MENU);
|
69
152
|
}}}
|
70
153
|
|
71
|
-
3. menu on the right side of anchor with custom
|
154
|
+
3. menu on the right side of anchor with custom `preferMatrix` of `[2,6,0]`:
|
72
155
|
{{{
|
73
|
-
SC.PickerPane.create({
|
156
|
+
SC.PickerPane.create({
|
157
|
+
layout: { width: 400, height: 200 },
|
158
|
+
contentView: SC.View.extend({})
|
74
159
|
}).popup(anchor, SC.PICKER_MENU, [2,6,0]);
|
75
160
|
}}}
|
76
161
|
|
77
|
-
4. fixed below the anchor with default
|
162
|
+
4. fixed below the anchor with default `preferMatrix` of `[1,4,3]`:
|
78
163
|
{{{
|
79
|
-
SC.PickerPane.create({
|
164
|
+
SC.PickerPane.create({
|
165
|
+
layout: { width: 400, height: 200 },
|
166
|
+
contentView: SC.View.extend({})
|
80
167
|
}).popup(anchor, SC.PICKER_FIXED);
|
81
168
|
}}}
|
82
169
|
|
83
|
-
5. fixed on the right side of anchor with
|
170
|
+
5. fixed on the right side of anchor with `preferMatrix` of `[-22,-17,0]`:
|
84
171
|
{{{
|
85
|
-
SC.PickerPane.create({
|
172
|
+
SC.PickerPane.create({
|
173
|
+
layout: { width: 400, height: 200 },
|
174
|
+
contentView: SC.View.extend({})
|
86
175
|
}).popup(anchor, SC.PICKER_FIXED, [-22,-17,0]);
|
87
176
|
}}}
|
88
177
|
|
89
|
-
6. pointer with default
|
178
|
+
6. pointer with default `preferMatrix` of `[0,1,2,3,2]`:
|
90
179
|
{{{
|
91
|
-
SC.PickerPane.create({
|
180
|
+
SC.PickerPane.create({
|
181
|
+
layout: { width: 400, height: 200 },
|
182
|
+
contentView: SC.View.extend({})
|
92
183
|
}).popup(anchor, SC.PICKER_POINTER);
|
93
184
|
}}}
|
94
|
-
|
95
|
-
|
185
|
+
|
186
|
+
Positioning: right (0) > left (1) > top (2) > bottom (3). Fallback to top (2).
|
96
187
|
|
97
|
-
7. pointer with custom
|
188
|
+
7. pointer with custom `preferMatrix` of `[3,0,1,2,2]`:
|
98
189
|
{{{
|
99
|
-
SC.PickerPane.create({
|
190
|
+
SC.PickerPane.create({
|
191
|
+
layout: { width: 400, height: 200 },
|
192
|
+
contentView: SC.View.extend({})
|
100
193
|
}).popup(anchor, SC.PICKER_POINTER, [3,0,1,2,2]);
|
101
194
|
}}}
|
102
195
|
|
103
|
-
|
104
|
-
fallback to perfect top (2)
|
196
|
+
Positioning: bottom (3) > right (0) > left (1) > top (2). Fallback to top (2).
|
105
197
|
|
106
|
-
8. menu-pointer with default
|
198
|
+
8. menu-pointer with default `preferMatrix` of `[3,0,1,2,3]`:
|
107
199
|
{{{
|
108
|
-
SC.PickerPane.create({
|
200
|
+
SC.PickerPane.create({
|
201
|
+
layout: { width: 400, height: 200 },
|
202
|
+
contentView: SC.View.extend({})
|
109
203
|
}).popup(anchor, SC.PICKER_MENU_POINTER);
|
110
204
|
}}}
|
111
|
-
perfect bottom (3) > perfect right (0) > perfect left (1) > perfect top (2)
|
112
|
-
fallback to perfect bottom (3)
|
113
205
|
|
206
|
+
Positioning: bottom (3) > right (0) > left (1) > top (2). Fallback to bottom (3).
|
207
|
+
|
114
208
|
@extends SC.PalettePane
|
115
209
|
@since SproutCore 1.0
|
116
210
|
*/
|
117
|
-
SC.PickerPane = SC.PalettePane.extend({
|
211
|
+
SC.PickerPane = SC.PalettePane.extend( /** @scope SC.PickerPane.prototype */ {
|
118
212
|
|
119
213
|
classNames: 'sc-picker',
|
120
214
|
isAnchored: YES,
|
@@ -227,12 +321,12 @@ SC.PickerPane = SC.PalettePane.extend({
|
|
227
321
|
case SC.PICKER_MENU:
|
228
322
|
case SC.PICKER_FIXED:
|
229
323
|
if(!preferMatrix || preferMatrix.length !== 3) {
|
230
|
-
// default below the anchor with fine
|
324
|
+
// default below the anchor with fine-tuned visual alignment
|
231
325
|
// for Menu to appear just below the anchorElement.
|
232
326
|
this.set('preferMatrix', [1, 4, 3]) ;
|
233
327
|
}
|
234
328
|
|
235
|
-
// fine
|
329
|
+
// fine-tuned visual alignment from preferMatrix
|
236
330
|
origin.x += ((this.preferMatrix[2]===0) ? origin.width : 0) + this.preferMatrix[0] ;
|
237
331
|
origin.y += ((this.preferMatrix[2]===3) ? origin.height : 0) + this.preferMatrix[1];
|
238
332
|
break;
|