sproutcore 1.8.2.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (274) hide show
  1. data/VERSION.yml +2 -2
  2. data/lib/buildtasks/helpers/file_rule_list.rb +3 -3
  3. data/lib/frameworks/sproutcore/Buildfile +1 -1
  4. data/lib/frameworks/sproutcore/CHANGELOG.md +235 -16
  5. data/lib/frameworks/sproutcore/apps/media_examples/Buildfile +13 -0
  6. data/lib/frameworks/sproutcore/apps/media_examples/core.js +35 -0
  7. data/lib/frameworks/sproutcore/apps/media_examples/resources/loading.rhtml +3 -0
  8. data/lib/frameworks/sproutcore/apps/media_examples/resources/main_page.js +53 -0
  9. data/lib/frameworks/sproutcore/apps/media_examples/views/audio_view.js +100 -0
  10. data/lib/frameworks/sproutcore/apps/media_examples/views/camera_view.js +39 -0
  11. data/lib/frameworks/sproutcore/apps/media_examples/views/capabilities_view.js +116 -0
  12. data/lib/frameworks/sproutcore/apps/media_examples/views/microphone_view.js +40 -0
  13. data/lib/frameworks/sproutcore/apps/media_examples/views/video_view.js +107 -0
  14. data/lib/frameworks/sproutcore/apps/showcase/Buildfile +11 -0
  15. data/lib/frameworks/sproutcore/apps/showcase/README +15 -0
  16. data/lib/frameworks/sproutcore/apps/showcase/controllers/source_controller.js +15 -0
  17. data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +212 -0
  18. data/lib/frameworks/sproutcore/apps/showcase/core.js +170 -0
  19. data/lib/frameworks/sproutcore/apps/showcase/main.js +27 -0
  20. data/lib/frameworks/sproutcore/apps/showcase/resources/_theme.css +18 -0
  21. data/lib/frameworks/sproutcore/apps/showcase/resources/api.css +80 -0
  22. data/lib/frameworks/sproutcore/apps/showcase/resources/favicon.ico +0 -0
  23. data/lib/frameworks/sproutcore/apps/showcase/resources/images/alarm-clock.png +0 -0
  24. data/lib/frameworks/sproutcore/apps/showcase/resources/images/balloon-facebook.png +0 -0
  25. data/lib/frameworks/sproutcore/apps/showcase/resources/images/balloon-twitter.png +0 -0
  26. data/lib/frameworks/sproutcore/apps/showcase/resources/images/balloon.png +0 -0
  27. data/lib/frameworks/sproutcore/apps/showcase/resources/images/bullet.png +0 -0
  28. data/lib/frameworks/sproutcore/apps/showcase/resources/images/calendar-insert.png +0 -0
  29. data/lib/frameworks/sproutcore/apps/showcase/resources/images/cross.png +0 -0
  30. data/lib/frameworks/sproutcore/apps/showcase/resources/images/example-box-bg.png +0 -0
  31. data/lib/frameworks/sproutcore/apps/showcase/resources/images/fruit-grape.png +0 -0
  32. data/lib/frameworks/sproutcore/apps/showcase/resources/images/fruit-lime.png +0 -0
  33. data/lib/frameworks/sproutcore/apps/showcase/resources/images/fruit-orange.png +0 -0
  34. data/lib/frameworks/sproutcore/apps/showcase/resources/images/fruit.png +0 -0
  35. data/lib/frameworks/sproutcore/apps/showcase/resources/images/glow.png +0 -0
  36. data/lib/frameworks/sproutcore/apps/showcase/resources/images/green-dot.png +0 -0
  37. data/lib/frameworks/sproutcore/apps/showcase/resources/images/grey-dot.png +0 -0
  38. data/lib/frameworks/sproutcore/apps/showcase/resources/images/logo.png +0 -0
  39. data/lib/frameworks/sproutcore/apps/showcase/resources/images/pixels.png +0 -0
  40. data/lib/frameworks/sproutcore/apps/showcase/resources/images/red-dot.png +0 -0
  41. data/lib/frameworks/sproutcore/apps/showcase/resources/images/sproutcore-logo.png +0 -0
  42. data/lib/frameworks/sproutcore/apps/showcase/resources/images/sproutcore-startup-landscape.jpg +0 -0
  43. data/lib/frameworks/sproutcore/apps/{test_controls → showcase}/resources/loading.rhtml +1 -1
  44. data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +61 -0
  45. data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +365 -0
  46. data/lib/frameworks/sproutcore/apps/showcase/resources/views_page.js +64 -0
  47. data/lib/frameworks/sproutcore/apps/showcase/system/views_item_content.js +59 -0
  48. data/lib/frameworks/sproutcore/apps/showcase/theme.js +27 -0
  49. data/lib/frameworks/sproutcore/apps/showcase/views/button_views.js +55 -0
  50. data/lib/frameworks/sproutcore/apps/showcase/views/checkbox_views.js +34 -0
  51. data/lib/frameworks/sproutcore/apps/showcase/views/container_views.js +29 -0
  52. data/lib/frameworks/sproutcore/apps/showcase/views/date_field_views.js +30 -0
  53. data/lib/frameworks/sproutcore/apps/showcase/views/disclosure_views.js +22 -0
  54. data/lib/frameworks/sproutcore/apps/showcase/views/grid_views.js +28 -0
  55. data/lib/frameworks/sproutcore/apps/showcase/views/image_button_views.js +22 -0
  56. data/lib/frameworks/sproutcore/apps/showcase/views/image_views.js +51 -0
  57. data/lib/frameworks/sproutcore/apps/showcase/views/label_views.js +53 -0
  58. data/lib/frameworks/sproutcore/apps/showcase/views/list_views.js +31 -0
  59. data/lib/frameworks/sproutcore/apps/showcase/views/popup_button_views.js +24 -0
  60. data/lib/frameworks/sproutcore/apps/showcase/views/progress_views.js +26 -0
  61. data/lib/frameworks/sproutcore/apps/showcase/views/radio_views.js +30 -0
  62. data/lib/frameworks/sproutcore/apps/showcase/views/scroll_views.js +40 -0
  63. data/lib/frameworks/sproutcore/apps/showcase/views/segmented_views.js +90 -0
  64. data/lib/frameworks/sproutcore/apps/showcase/views/select_views.js +64 -0
  65. data/lib/frameworks/sproutcore/apps/showcase/views/slider_views.js +46 -0
  66. data/lib/frameworks/sproutcore/apps/showcase/views/source_list_views.js +23 -0
  67. data/lib/frameworks/sproutcore/apps/showcase/views/split_views.js +22 -0
  68. data/lib/frameworks/sproutcore/apps/showcase/views/stacked_views.js +23 -0
  69. data/lib/frameworks/sproutcore/apps/showcase/views/static_content_views.js +23 -0
  70. data/lib/frameworks/sproutcore/apps/showcase/views/tab_views.js +51 -0
  71. data/lib/frameworks/sproutcore/apps/showcase/views/text_field_views.js +52 -0
  72. data/lib/frameworks/sproutcore/apps/showcase/views/toolbar_views.js +23 -0
  73. data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +91 -0
  74. data/lib/frameworks/sproutcore/apps/showcase/views/views_list_view.js +67 -0
  75. data/lib/frameworks/sproutcore/apps/showcase/views/web_views.js +32 -0
  76. data/lib/frameworks/sproutcore/apps/showcase/views/well_views.js +29 -0
  77. data/lib/frameworks/sproutcore/apps/showcase/views/workspace_views.js +23 -0
  78. data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +2 -1
  79. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +91 -51
  80. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +93 -27
  81. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +196 -15
  82. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +1 -1
  83. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +26 -10
  84. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +90 -92
  85. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +69 -39
  86. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/selection_support.js +1 -1
  87. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +769 -0
  88. data/lib/frameworks/sproutcore/frameworks/{desktop → core_foundation}/system/key_bindings.js +0 -0
  89. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +4 -4
  90. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/req_anim_frame.js +31 -0
  91. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +7 -1
  92. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +8 -6
  93. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +49 -0
  94. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/selection_support.js +1 -1
  95. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/ext/object_test.js +106 -0
  96. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/color.js +448 -0
  97. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/escape_html.js +8 -1
  98. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/timer/invokeLater.js +24 -24
  99. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +5 -5
  100. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +90 -30
  101. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +14 -6
  102. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/touch.js +113 -0
  103. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +64 -8
  104. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +20 -4
  105. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +58 -38
  106. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +32 -39
  107. data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +20 -15
  108. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +19 -15
  109. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
  110. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +16 -16
  111. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +32 -32
  112. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +53 -38
  113. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -8
  114. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +26 -26
  115. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +1 -3
  116. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +4 -3
  117. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +0 -4
  118. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +96 -8
  119. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/datetime_recordattribute.js +22 -4
  120. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +24 -24
  121. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +376 -37
  122. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +51 -53
  123. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +108 -66
  124. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +33 -35
  125. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +6 -4
  126. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare.js +33 -3
  127. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +181 -15
  128. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +6 -0
  129. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +3 -1
  130. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +2 -1
  131. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +153 -6
  132. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +39 -18
  133. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +2 -1
  134. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +6 -7
  135. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +139 -50
  136. data/lib/frameworks/sproutcore/frameworks/{foundation → desktop}/resources/button_view.css +3 -3
  137. data/lib/frameworks/sproutcore/frameworks/{foundation → desktop}/resources/checkbox_view.css +4 -0
  138. data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +2 -2
  139. data/lib/frameworks/sproutcore/frameworks/{foundation → desktop}/resources/radio_view.css +0 -0
  140. data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +23 -17
  141. data/lib/frameworks/sproutcore/frameworks/desktop/resources/web.css +5 -0
  142. data/lib/frameworks/sproutcore/frameworks/desktop/tests/integration/dialog.js +4 -5
  143. data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/border.js +3 -12
  144. data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/collection_fast_path.js +58 -0
  145. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -2
  146. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +79 -12
  147. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +13 -0
  148. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +2 -2
  149. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +147 -0
  150. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +123 -2
  151. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +150 -0
  152. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +58 -44
  153. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/methods.js +9 -80
  154. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +54 -130
  155. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/observers.js +78 -0
  156. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +64 -9
  157. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +11 -11
  158. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +28 -2
  159. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/methods.js +74 -0
  160. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/ui.js +141 -0
  161. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +4 -1
  162. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +69 -36
  163. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +27 -11
  164. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +41 -25
  165. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +51 -89
  166. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +59 -34
  167. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +59 -49
  168. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +1 -1
  169. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +4 -1
  170. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +14 -14
  171. data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +8 -8
  172. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +13 -1
  173. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +4 -1
  174. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/colors.js +21 -22
  175. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/tree/selection_support.js +26 -0
  176. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +4 -5
  177. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/image_queue.js +68 -44
  178. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/user_defaults.js +10 -0
  179. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +0 -10
  180. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +24 -59
  181. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +47 -34
  182. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +96 -12
  183. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +38 -0
  184. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +38 -50
  185. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +6 -2
  186. data/lib/frameworks/sproutcore/frameworks/media/media_capabilities.js +211 -0
  187. data/lib/frameworks/sproutcore/frameworks/media/render_delegates/media_slider.js +77 -0
  188. data/lib/frameworks/sproutcore/frameworks/media/resources/playeras3.fla +0 -0
  189. data/lib/frameworks/sproutcore/frameworks/media/resources/video.css +129 -115
  190. data/lib/frameworks/sproutcore/frameworks/media/resources/videoCanvas.swf +0 -0
  191. data/lib/frameworks/sproutcore/frameworks/media/tests/media_capabilities.js +194 -0
  192. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +56 -173
  193. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +15 -18
  194. data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +63 -219
  195. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +4 -2
  196. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +4 -8
  197. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +51 -160
  198. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +138 -102
  199. data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +8 -0
  200. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  201. data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +8 -2
  202. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +32 -12
  203. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +28 -24
  204. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +0 -2
  205. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +111 -12
  206. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +9 -7
  207. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +8 -2
  208. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +160 -115
  209. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +64 -19
  210. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/mixin.js +83 -0
  211. data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/bind.js +3 -0
  212. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +13 -0
  213. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/handlebars.js +4 -2
  214. data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +5 -5
  215. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/18px/button.css +5 -1
  216. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +13 -12
  217. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +9 -2
  218. data/lib/frameworks/sproutcore/themes/ace/resources/progress/ace/progress.css +105 -5
  219. data/lib/frameworks/sproutcore/themes/ace/resources/progress/ace/progress_view_indeterminate_content.png +0 -0
  220. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +19 -15
  221. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +93 -21
  222. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented_vertical_active.png +0 -0
  223. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented_vertical_normal.png +0 -0
  224. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented_vertical_selected.png +0 -0
  225. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented_vertical_selected_active.png +0 -0
  226. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +91 -15
  227. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented_vertical_active.png +0 -0
  228. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented_vertical_normal.png +0 -0
  229. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented_vertical_selected.png +0 -0
  230. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented_vertical_selected_active.png +0 -0
  231. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +21 -17
  232. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +26 -25
  233. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/menu_item_view.css +2 -4
  234. data/lib/sproutcore/helpers/minifier.rb +5 -5
  235. data/lib/sproutcore/tools/build.rb +1 -1
  236. data/sproutcore.gemspec +6 -1
  237. data/vendor/chance/lib/chance/instance/slicing.rb +2 -2
  238. metadata +143 -60
  239. data/lib/frameworks/sproutcore/apps/test_controls/Buildfile +0 -0
  240. data/lib/frameworks/sproutcore/apps/test_controls/controllers/alert.js +0 -39
  241. data/lib/frameworks/sproutcore/apps/test_controls/controllers/buttons.js +0 -21
  242. data/lib/frameworks/sproutcore/apps/test_controls/controllers/categories.js +0 -125
  243. data/lib/frameworks/sproutcore/apps/test_controls/controllers/category.js +0 -36
  244. data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +0 -12
  245. data/lib/frameworks/sproutcore/apps/test_controls/controllers/split.js +0 -74
  246. data/lib/frameworks/sproutcore/apps/test_controls/core.js +0 -29
  247. data/lib/frameworks/sproutcore/apps/test_controls/main.js +0 -14
  248. data/lib/frameworks/sproutcore/apps/test_controls/resources/buttons_page.js +0 -158
  249. data/lib/frameworks/sproutcore/apps/test_controls/resources/checkboxes_page.js +0 -53
  250. data/lib/frameworks/sproutcore/apps/test_controls/resources/flow_layout_page.js +0 -85
  251. data/lib/frameworks/sproutcore/apps/test_controls/resources/list_page.js +0 -40
  252. data/lib/frameworks/sproutcore/apps/test_controls/resources/main_page.css +0 -60
  253. data/lib/frameworks/sproutcore/apps/test_controls/resources/main_page.js +0 -151
  254. data/lib/frameworks/sproutcore/apps/test_controls/resources/panels_page.js +0 -62
  255. data/lib/frameworks/sproutcore/apps/test_controls/resources/progress_page.js +0 -33
  256. data/lib/frameworks/sproutcore/apps/test_controls/resources/radio_page.js +0 -55
  257. data/lib/frameworks/sproutcore/apps/test_controls/resources/scroll_page.js +0 -77
  258. data/lib/frameworks/sproutcore/apps/test_controls/resources/segmented_page.js +0 -99
  259. data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +0 -75
  260. data/lib/frameworks/sproutcore/apps/test_controls/resources/sliders_page.js +0 -54
  261. data/lib/frameworks/sproutcore/apps/test_controls/resources/split_page.js +0 -141
  262. data/lib/frameworks/sproutcore/apps/test_controls/resources/strings.js +0 -50
  263. data/lib/frameworks/sproutcore/apps/test_controls/resources/tab_page.js +0 -53
  264. data/lib/frameworks/sproutcore/apps/test_controls/resources/text_field_page.js +0 -65
  265. data/lib/frameworks/sproutcore/apps/test_controls/theme.js +0 -34
  266. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/detail.js +0 -15
  267. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/source.js +0 -15
  268. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/target.js +0 -15
  269. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/targets.js +0 -15
  270. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/tests.js +0 -15
  271. data/lib/frameworks/sproutcore/apps/tests/tests/models/target.js +0 -15
  272. data/lib/frameworks/sproutcore/apps/tests/tests/models/test.js +0 -15
  273. data/lib/frameworks/sproutcore/apps/tests/tests/views/offset_checkbox.js +0 -15
  274. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/console.js +0 -21
@@ -12,40 +12,40 @@ sc_require('controllers/controller') ;
12
12
  An ObjectController gives you a simple way to manage the editing state of
13
13
  an object. You can use an ObjectController instance as a "proxy" for your
14
14
  model objects.
15
-
16
- Any properties you get or set on the object controller, will be passed
15
+
16
+ Any properties you get or set on the object controller, will be passed
17
17
  through to its content object. This allows you to setup bindings to your
18
- object controller one time for all of your views and then swap out the
18
+ object controller one time for all of your views and then swap out the
19
19
  content as needed.
20
-
20
+
21
21
  ## Working with Arrays
22
-
23
- An ObjectController can accept both arrays and single objects as content.
24
- If the content is an array, the ObjectController will do its best to treat
22
+
23
+ An ObjectController can accept both arrays and single objects as content.
24
+ If the content is an array, the ObjectController will do its best to treat
25
25
  the array as a single object. For example, if you set the content of an
26
26
  ObjectController to an array of Contact records and then call:
27
-
27
+
28
28
  contactController.get('name');
29
29
 
30
- The controller will check the name property of each Contact in the array.
31
- If the value of the property for each Contact is the same, that value will
32
- be returned. If the any values are different, then an array will be
33
- returned with the values from each Contact in them.
34
-
35
- Most SproutCore views can work with both arrays and single content, which
30
+ The controller will check the name property of each Contact in the array.
31
+ If the value of the property for each Contact is the same, that value will
32
+ be returned. If the any values are different, then an array will be
33
+ returned with the values from each Contact in them.
34
+
35
+ Most SproutCore views can work with both arrays and single content, which
36
36
  means that most of the time, you can simply hook up your views and this will
37
37
  work.
38
-
39
- If you would prefer to make sure that your ObjectController is always
40
- working with a single object and you are using bindings, you can always
41
- setup your bindings so that they will convert the content to a single object
38
+
39
+ If you would prefer to make sure that your ObjectController is always
40
+ working with a single object and you are using bindings, you can always
41
+ setup your bindings so that they will convert the content to a single object
42
42
  like so:
43
-
43
+
44
44
  contentBinding: SC.Binding.single('MyApp.listController.selection') ;
45
45
 
46
- This will ensure that your content property is always a single object
46
+ This will ensure that your content property is always a single object
47
47
  instead of an array.
48
-
48
+
49
49
  @extends SC.Controller
50
50
  @since SproutCore 1.0
51
51
  */
@@ -54,8 +54,8 @@ SC.ObjectController = SC.Controller.extend(
54
54
 
55
55
  // ..........................................................
56
56
  // PROPERTIES
57
- //
58
-
57
+ //
58
+
59
59
  /**
60
60
  Set to the object you want this controller to manage. The object should
61
61
  usually be a single value; not an array or enumerable. If you do supply
@@ -64,21 +64,21 @@ SC.ObjectController = SC.Controller.extend(
64
64
 
65
65
  Usually your content object should implement the SC.Observable mixin, but
66
66
  this is not required. All SC.Object-based objects support SC.Observable
67
-
67
+
68
68
  @property {Object}
69
69
  */
70
70
  content: null,
71
71
 
72
72
  /**
73
- If YES, then setting the content to an enumerable or an array with more
73
+ If YES, then setting the content to an enumerable or an array with more
74
74
  than one item will cause the Controller to attempt to treat the array as
75
75
  a single object. Use of get(), for example, will get every property on
76
76
  the enumerable and return it. set() will set the property on every item
77
- in the enumerable.
78
-
77
+ in the enumerable.
78
+
79
79
  If NO, then setting content to an enumerable with multiple items will be
80
80
  treated like setting a null value. hasContent will be NO.
81
-
81
+
82
82
  @property {Boolean}
83
83
  */
84
84
  allowsMultipleContent: NO,
@@ -86,95 +86,95 @@ SC.ObjectController = SC.Controller.extend(
86
86
  /**
87
87
  Becomes YES whenever this object is managing content. Usually this means
88
88
  the content property contains a single object or an array or enumerable
89
- with a single item. Array's or enumerables with multiple items will
89
+ with a single item. Array's or enumerables with multiple items will
90
90
  normally make this property NO unless allowsMultipleContent is YES.
91
-
91
+
92
92
  @property {Boolean}
93
93
  */
94
94
  hasContent: function() {
95
95
  return !SC.none(this.get('observableContent'));
96
96
  }.property('observableContent'),
97
-
97
+
98
98
  /**
99
- Makes a controller editable or not editable. The SC.Controller class
100
- itself does not do anything with this property but subclasses will
99
+ Makes a controller editable or not editable. The SC.Controller class
100
+ itself does not do anything with this property but subclasses will
101
101
  respect it when modifying content.
102
-
102
+
103
103
  @property {Boolean}
104
104
  */
105
105
  isEditable: YES,
106
-
106
+
107
107
  /**
108
- Primarily for internal use. Normally you should not access this property
109
- directly.
110
-
111
- Returns the actual observable object proxied by this controller. Usually
112
- this property will mirror the content property. In some cases - notably
108
+ Primarily for internal use. Normally you should not access this property
109
+ directly.
110
+
111
+ Returns the actual observable object proxied by this controller. Usually
112
+ this property will mirror the content property. In some cases - notably
113
113
  when setting content to an enumerable, this may return a different object.
114
-
114
+
115
115
  Note that if you set the content to an enumerable which itself contains
116
116
  enumerables and allowsMultipleContent is NO, this will become null.
117
-
117
+
118
118
  @property {Object}
119
119
  */
120
120
  observableContent: function() {
121
121
  var content = this.get('content'),
122
122
  len, allowsMultiple;
123
-
123
+
124
124
  // if enumerable, extract the first item or possibly become null
125
125
  if (content && content.isEnumerable) {
126
126
  len = content.get('length');
127
127
  allowsMultiple = this.get('allowsMultipleContent');
128
-
128
+
129
129
  if (len === 1) content = content.firstObject();
130
130
  else if (len===0 || !allowsMultiple) content = null;
131
-
131
+
132
132
  // if we got some new content, it better not be enum also...
133
133
  if (content && !allowsMultiple && content.isEnumerable) content=null;
134
134
  }
135
-
135
+
136
136
  return content;
137
137
  }.property('content', 'allowsMultipleContent').cacheable(),
138
138
 
139
139
  // ..........................................................
140
140
  // METHODS
141
- //
141
+ //
142
142
 
143
143
  /**
144
144
  Override this method to destroy the selected object.
145
-
145
+
146
146
  The default just passes this call onto the content object if it supports
147
- it, and then sets the content to null.
148
-
149
- Unlike most calls to destroy() this will not actually destroy the
150
- controller itself; only the the content. You continue to use the
147
+ it, and then sets the content to null.
148
+
149
+ Unlike most calls to destroy() this will not actually destroy the
150
+ controller itself; only the the content. You continue to use the
151
151
  controller by setting the content to a new value.
152
-
152
+
153
153
  @returns {SC.ObjectController} receiver
154
154
  */
155
155
  destroy: function() {
156
156
  var content = this.get('observableContent') ;
157
157
  if (content && SC.typeOf(content.destroy) === SC.T_FUNCTION) {
158
158
  content.destroy();
159
- }
160
- this.set('content', null) ;
159
+ }
160
+ this.set('content', null) ;
161
161
  return this;
162
162
  },
163
-
163
+
164
164
  /**
165
- Invoked whenever any property on the content object changes.
165
+ Invoked whenever any property on the content object changes.
166
166
 
167
- The default implementation will simply notify any observers that the
168
- property has changed. You can override this method if you need to do
167
+ The default implementation will simply notify any observers that the
168
+ property has changed. You can override this method if you need to do
169
169
  some custom work when the content property changes.
170
-
171
- If you have set the content property to an enumerable with multiple
172
- objects and you set allowsMultipleContent to YES, this method will be
170
+
171
+ If you have set the content property to an enumerable with multiple
172
+ objects and you set allowsMultipleContent to YES, this method will be
173
173
  called anytime any property in the set changes.
174
174
 
175
- If all properties have changed on the content or if the content itself
175
+ If all properties have changed on the content or if the content itself
176
176
  has changed, this method will be called with a key of "*".
177
-
177
+
178
178
  @param {Object} target the content object
179
179
  @param {String} key the property that changes
180
180
  @returns {void}
@@ -183,26 +183,26 @@ SC.ObjectController = SC.Controller.extend(
183
183
  if (key === '*') this.allPropertiesDidChange();
184
184
  else this.notifyPropertyChange(key);
185
185
  },
186
-
186
+
187
187
  /**
188
- Called whenver you try to get/set an unknown property. The default
189
- implementation will pass through to the underlying content object but
190
- you can override this method to do some other kind of processing if
188
+ Called whenver you try to get/set an unknown property. The default
189
+ implementation will pass through to the underlying content object but
190
+ you can override this method to do some other kind of processing if
191
191
  needed.
192
-
192
+
193
193
  @property {String} key key being retrieved
194
194
  @property {Object} value value to set or undefined if reading only
195
195
  @returns {Object} property value
196
196
  */
197
197
  unknownProperty: function(key,value) {
198
-
198
+
199
199
  // avoid circular references
200
200
  if (key==='content') {
201
201
  if (value !== undefined) this.content = value;
202
202
  return this.content;
203
203
  }
204
-
205
- // for all other keys, just pass through to the observable object if
204
+
205
+ // for all other keys, just pass through to the observable object if
206
206
  // there is one. Use getEach() and setEach() on enumerable objects.
207
207
  var content = this.get('observableContent'), loc, cur, isSame;
208
208
  if (content===null || content===undefined) return undefined; // empty
@@ -225,21 +225,21 @@ SC.ObjectController = SC.Controller.extend(
225
225
  } else value = undefined; // empty array.
226
226
 
227
227
  } else value = (content.isObservable) ? content.get(key) : content[key];
228
-
228
+
229
229
  // setter
230
230
  } else {
231
231
  if (!this.get('isEditable')) {
232
232
  throw "%@.%@ is not editable".fmt(this,key);
233
233
  }
234
-
234
+
235
235
  if (content.isEnumerable) content.setEach(key, value);
236
236
  else if (content.isObservable) content.set(key, value);
237
237
  else content[key] = value;
238
238
  }
239
-
239
+
240
240
  return value;
241
241
  },
242
-
242
+
243
243
  // ...............................
244
244
  // INTERNAL SUPPORT
245
245
  //
@@ -254,23 +254,21 @@ SC.ObjectController = SC.Controller.extend(
254
254
  _scoc_contentDidChange: function () {
255
255
  var last = this._scoc_content,
256
256
  cur = this.get('content');
257
-
257
+
258
258
  if (last !== cur) {
259
259
  this._scoc_content = cur;
260
260
  var func = this._scoc_enumerableContentDidChange;
261
261
  if (last && last.isEnumerable) {
262
- //console.log('no longer observing [] on last');
263
262
  last.removeObserver('[]', this, func);
264
263
  }
265
264
  if (cur && cur.isEnumerable) {
266
- //console.log('observing [] on cur');
267
265
  cur.addObserver('[]', this, func);
268
266
  }
269
267
  }
270
268
  }.observes("content"),
271
-
269
+
272
270
  /** @private
273
-
271
+
274
272
  Called whenever the observable content property changes. This will setup
275
273
  observers on the content if needed.
276
274
  */
@@ -282,15 +280,15 @@ SC.ObjectController = SC.Controller.extend(
282
280
 
283
281
  if (last === cur) return this; // nothing to do
284
282
  //console.log('observableContentDidChange');
285
-
283
+
286
284
  this._scoc_observableContent = cur; // save old content
287
-
285
+
288
286
  // stop observing last item -- if enumerable stop observing set
289
287
  if (last) {
290
288
  if (last.isEnumerable) last.removeObserver('[]', this, efunc);
291
289
  else if (last.isObservable) last.removeObserver('*', this, func);
292
290
  }
293
-
291
+
294
292
  if (cur) {
295
293
  if (cur.isEnumerable) cur.addObserver('[]', this, efunc);
296
294
  else if (cur.isObservable) cur.addObserver('*', this, func);
@@ -302,10 +300,10 @@ SC.ObjectController = SC.Controller.extend(
302
300
  } else this.contentPropertyDidChange(cur, '*');
303
301
 
304
302
  }.observes("observableContent"),
305
-
303
+
306
304
  /** @private
307
305
  Called when observed enumerable content has changed. This will teardown
308
- and setup observers on the enumerable content items and then calls
306
+ and setup observers on the enumerable content items and then calls
309
307
  contentPropertyDidChange(). This method may be called even if the new
310
308
  'cur' is not enumerable but the last content was enumerable.
311
309
  */
@@ -313,7 +311,7 @@ SC.ObjectController = SC.Controller.extend(
313
311
  var cur = this.get('observableContent'),
314
312
  set = this._scoc_observableContentItems,
315
313
  func = this.contentPropertyDidChange;
316
-
314
+
317
315
  // stop observing each old item
318
316
  if (set) {
319
317
  set.forEach(function(item) {
@@ -321,7 +319,7 @@ SC.ObjectController = SC.Controller.extend(
321
319
  }, this);
322
320
  set.clear();
323
321
  }
324
-
322
+
325
323
  // start observing new items if needed
326
324
  if (cur && cur.isEnumerable) {
327
325
  if (!set) set = SC.Set.create();
@@ -329,14 +327,14 @@ SC.ObjectController = SC.Controller.extend(
329
327
  if (set.contains(item)) return ; // nothing to do
330
328
  set.add(item);
331
329
  if (item.isObservable) item.addObserver('*', this, func);
332
- }, this);
330
+ }, this);
333
331
  } else set = null;
334
-
332
+
335
333
  this._scoc_observableContentItems = set; // save for later cleanup
336
-
334
+
337
335
  // notify
338
336
  this.contentPropertyDidChange(cur, '*');
339
337
  return this ;
340
338
  }
341
-
339
+
342
340
  }) ;
@@ -9,76 +9,106 @@
9
9
  SC.mixin(SC.Object.prototype, /** @scope SC.Object.prototype */ {
10
10
 
11
11
  /**
12
- Invokes the named method after the specified period of time.
12
+ Invokes the named method after the specified period of time. This
13
+ uses SC.Timer, which works properly with the Run Loop.
13
14
 
14
- This is a convenience method that will create a single run timer to
15
- invoke a method after a period of time. The method should have the
16
- signature:
15
+ Any additional arguments given to invokeOnce will be passed to the
16
+ method.
17
17
 
18
- methodName: function(timer)
18
+ For example,
19
19
 
20
- If you would prefer to pass your own parameters instead, you can instead
21
- call invokeLater() directly on the function object itself.
20
+ var obj = SC.Object.create({
21
+ myMethod: function(a, b, c) {
22
+ alert('a: %@, b: %@, c: %@'.fmt(a, b, c));
23
+ }
24
+ });
22
25
 
23
- @param methodName {String} method name to perform.
26
+ obj.invokeLater('myMethod', 200, 'x', 'y', 'z');
27
+
28
+ // After 200 ms, alerts "a: x, b: y, c: z"
29
+
30
+ @param method {String} method name to perform.
24
31
  @param interval {Number} period from current time to schedule.
25
32
  @returns {SC.Timer} scheduled timer.
26
33
  */
27
- invokeLater: function(methodName, interval) {
34
+ invokeLater: function(method, interval) {
35
+ var f, args;
36
+
37
+ // Normalize the method and interval.
38
+ if (SC.typeOf(method) === SC.T_STRING) { method = this[method]; }
28
39
  if (interval === undefined) { interval = 1 ; }
29
- var f = methodName, args, func;
30
40
 
31
- // if extra arguments were passed - build a function binding.
41
+ // If extra arguments were passed - build a function binding.
32
42
  if (arguments.length > 2) {
33
43
  args = SC.$A(arguments).slice(2);
34
- if (SC.typeOf(f) === SC.T_STRING) { f = this[methodName] ; }
35
- func = f ;
36
- f = function() { return func.apply(this, args); } ;
44
+ f = function() { return method.apply(this, args); } ;
45
+ } else {
46
+ f = method;
37
47
  }
38
48
 
39
49
  // schedule the timer
40
50
  return SC.Timer.schedule({ target: this, action: f, interval: interval });
41
51
  },
42
-
52
+
43
53
  /**
44
- A convenience method which makes it easy to coalesce invocations to ensure
45
- that the method is only called once. This is useful if you need to schedule
46
- a call but only want it to trigger once after some defined interval has
47
- passed.
48
-
54
+ A convenience method which makes it easy to coalesce invocations to ensure
55
+ that the method is only called once after the given period of time. This is
56
+ useful if you need to schedule a call from multiple places, but only want
57
+ it to run at most once.
58
+
59
+ Any additional arguments given to invokeOnceLater will be passed to the
60
+ method.
61
+
62
+ For example,
63
+
64
+ var obj = SC.Object.create({
65
+ myMethod: function(a, b, c) {
66
+ alert('a: %@, b: %@, c: %@'.fmt(a, b, c));
67
+ }
68
+ });
69
+
70
+ obj.invokeOnceLater('myMethod', 200, 'x', 'y', 'z');
71
+
72
+ // After 200 ms, alerts "a: x, b: y, c: z"
73
+
49
74
  @param {Function|String} method reference or method name
50
75
  @param {Number} interval
51
76
  */
52
77
  invokeOnceLater: function(method, interval) {
53
- if (interval === undefined) { interval = 1 ; }
78
+ var args, f,
79
+ methodGuid,
80
+ timers = this._sc_invokeOnceLaterTimers,
81
+ existingTimer, newTimer;
54
82
 
55
- var timers = this._sc_invokeOnceLaterTimers,
56
- methodGuid, existingTimer, f, newTimer;
83
+ // Normalize the method, interval and timers cache.
84
+ if (SC.typeOf(method) === SC.T_STRING) { method = this[method]; }
85
+ if (interval === undefined) { interval = 1 ; }
86
+ if (!timers) { timers = this._sc_invokeOnceLaterTimers = {}; }
57
87
 
58
- // ensure we always deal with real functions
59
- if (SC.typeOf(method) === SC.T_STRING) {
60
- method = this[method];
61
- }
62
-
88
+ // If there's a timer outstanding for this method, invalidate it in favor of
89
+ // the new timer.
63
90
  methodGuid = SC.guidFor(method);
64
-
65
- if(!timers) {
66
- this._sc_invokeOnceLaterTimers = timers = {};
67
- }
68
-
69
91
  existingTimer = timers[methodGuid];
70
- if(existingTimer) existingTimer.invalidate();
71
-
92
+ if (existingTimer) existingTimer.invalidate();
93
+
94
+ // If extra arguments were passed - apply them to the method.
95
+ if (arguments.length > 2) {
96
+ args = SC.$A(arguments).slice(2);
97
+ } else {
98
+ args = arguments;
99
+ }
100
+
101
+ // Create a function binding every time, so that the timers cache is properly cleaned out.
72
102
  f = function() {
73
103
  // GC assistance for IE
74
104
  delete timers[methodGuid];
75
- return method.apply(this, arguments);
105
+ return method.apply(this, args);
76
106
  };
77
-
78
- // schedule the timer
107
+
108
+ // Schedule the new timer and track it.
79
109
  newTimer = SC.Timer.schedule({ target: this, action: f, interval: interval });
80
110
  timers[methodGuid] = newTimer;
81
-
111
+
82
112
  return newTimer;
83
113
  },
84
114