sproutcore 1.5.0.pre.3 → 1.5.0.pre.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. data/.rspec +1 -0
  2. data/CHANGELOG +42 -0
  3. data/README.txt +25 -0
  4. data/VERSION.yml +1 -1
  5. data/bin/sc-build +1 -1
  6. data/bin/sc-build-number +1 -1
  7. data/bin/sc-docs +1 -1
  8. data/bin/sc-gen +1 -1
  9. data/bin/sc-init +1 -1
  10. data/bin/sc-manifest +1 -1
  11. data/bin/sc-server +1 -1
  12. data/bin/sproutcore +1 -1
  13. data/lib/buildtasks/build.rake +5 -0
  14. data/lib/buildtasks/manifest.rake +20 -1
  15. data/lib/frameworks/sproutcore/Buildfile +12 -9
  16. data/lib/frameworks/sproutcore/CHANGELOG.md +48 -0
  17. data/lib/frameworks/sproutcore/apps/greenhouse/README +2 -9
  18. data/lib/frameworks/sproutcore/apps/greenhouse/TODO +11 -27
  19. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +3 -10
  20. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +4 -31
  21. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +5 -4
  22. data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +3 -3
  23. data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +2 -2
  24. data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +31 -14
  25. data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +2 -1
  26. data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +27 -1
  27. data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +1 -0
  28. data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
  29. data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +25 -0
  30. data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +161 -24
  31. data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +1 -1
  32. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +37 -25
  33. data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +135 -26
  34. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/array.js +0 -0
  35. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/controller.js +0 -0
  36. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/object.js +1 -1
  37. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/core.js +0 -0
  38. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/object.js +0 -0
  39. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/run_loop.js +1 -0
  40. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/delegate_support.js +0 -0
  41. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/responder_context.js +0 -0
  42. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/selection_support.js +0 -0
  43. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/string.js +0 -0
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
  46. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/main.js +2 -2
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
  48. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/pane.js +215 -505
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
  51. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/observable_protocol.js +0 -0
  52. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/sparse_array_delegate.js +0 -0
  53. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/core.css +0 -0
  54. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/view.css +0 -0
  55. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/application.js +0 -0
  56. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/browser.js +1 -0
  57. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/builder.js +0 -0
  58. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/core_query.js +1 -1
  59. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/cursor.js +0 -0
  60. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +210 -0
  61. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/event.js +5 -5
  62. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/json.js +0 -0
  63. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/locale.js +0 -0
  64. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/page.js +0 -0
  65. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/platform.js +31 -5
  66. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/ready.js +1 -1
  67. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/render_context.js +0 -0
  68. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/responder.js +0 -0
  69. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/root_responder.js +83 -110
  70. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/selection_set.js +7 -4
  71. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/sparse_array.js +0 -0
  72. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/theme.js +0 -0
  73. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/timer.js +0 -0
  74. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/utils/rect.js +0 -0
  75. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
  76. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/array_case.js +0 -0
  77. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/enum_case.js +0 -0
  78. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/null_case.js +0 -0
  79. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/selection_support.js +26 -0
  80. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/single_case.js +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/empty_case.js +0 -0
  82. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/multiple_case.js +0 -0
  83. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_case.js +0 -0
  84. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_enumerable_case.js +0 -0
  85. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/responder_context.js +0 -0
  86. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/string.js +0 -0
  87. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
  88. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/builder.js +0 -0
  89. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/core_query/within.js +0 -0
  90. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/json.js +0 -0
  91. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/locale.js +0 -0
  92. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/begin.js +0 -0
  93. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/element.js +0 -0
  94. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/end.js +0 -0
  95. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/get.js +0 -0
  96. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_attr.js +0 -0
  97. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_basic.js +0 -0
  98. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_className.js +0 -0
  99. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_style.js +0 -0
  100. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/init.js +0 -0
  101. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/join.js +0 -0
  102. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/push_text.js +0 -0
  103. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/tag.js +0 -0
  104. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/update.js +0 -0
  105. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeKeyPane.js +0 -0
  106. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMainPane.js +0 -0
  107. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMenuPane.js +0 -0
  108. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/root_responder.js +0 -0
  109. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/targetForAction.js +0 -0
  110. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/add.js +0 -0
  111. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/copy.js +0 -0
  112. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/indexSetForSource.js +0 -0
  113. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/isEqual.js +0 -0
  114. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/remove.js +0 -0
  115. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/sparse_array.js +0 -0
  116. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/theme.js +0 -0
  117. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invalidate.js +0 -0
  118. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invokeLater.js +0 -0
  119. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/isPaused.js +0 -0
  120. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/performAction.js +0 -0
  121. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/schedule.js +0 -0
  122. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/normalizeURL.js +0 -0
  123. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +268 -0
  124. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/rect.js +0 -0
  125. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
  126. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/append_remove.js +107 -18
  127. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
  128. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/firstResponder.js +0 -0
  129. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/keyPane.js +0 -0
  130. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/layout.js +0 -0
  131. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/sendEvent.js +0 -0
  132. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
  133. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
  134. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +65 -0
  135. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +67 -0
  136. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +295 -0
  137. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/animation.js +19 -18
  138. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build.js +0 -0
  139. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build_children.js +0 -0
  140. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/clippingFrame.js +0 -0
  141. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertFrames.js +0 -0
  142. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertLayouts.js +0 -0
  143. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createChildViews.js +18 -15
  144. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createLayer.js +0 -0
  145. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/destroyLayer.js +0 -0
  146. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/didAppendToDocument.js +11 -8
  147. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/findLayerInParentLayer.js +0 -0
  148. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/init.js +0 -0
  149. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/insertBefore.js +0 -0
  150. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisible.js +28 -0
  151. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisibleInWindow.js +0 -0
  152. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
  153. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layer.js +0 -0
  154. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layoutChildViews.js +0 -0
  155. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
  156. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +640 -0
  157. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/parentViewDidChange.js +0 -0
  158. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/prepareContext.js +0 -0
  159. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/removeChild.js +0 -0
  160. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
  161. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/render_delegate_support.js +0 -0
  162. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/replaceChild.js +0 -0
  163. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
  164. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/theme.js +0 -0
  165. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayer.js +0 -0
  166. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayerLocation.js +0 -0
  167. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/view.js +0 -0
  168. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/viewDidResize.js +0 -0
  169. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
  170. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +99 -0
  171. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
  172. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +77 -0
  173. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +187 -0
  174. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
  175. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +41 -0
  176. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
  177. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
  178. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1150 -0
  179. data/lib/frameworks/sproutcore/frameworks/{amber/views → core_foundation/views/view}/layout_style.js +93 -1
  180. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +489 -0
  181. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
  182. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
  183. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +113 -0
  184. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +1280 -0
  185. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +27 -53
  186. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +13 -19
  187. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +1 -0
  188. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +183 -71
  189. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -2
  190. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -46
  191. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +25 -4
  192. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +139 -21
  193. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +6 -1
  194. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +1 -1
  195. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/{parentless.js → data_store.js} +62 -16
  196. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +51 -17
  197. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +36 -10
  198. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +11 -11
  199. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +8 -8
  200. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +2 -2
  201. data/lib/frameworks/sproutcore/frameworks/{foundation/english.lproj → datetime/resources}/strings.js +1 -0
  202. data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/system/datetime.js +5 -37
  203. data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/tests/system/datetime.js +1 -0
  204. data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
  205. data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +1 -2
  206. data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +3 -3
  207. data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +3 -3
  208. data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +9 -3
  209. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +71 -70
  210. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +10 -2
  211. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -19
  212. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +33 -14
  213. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +25 -0
  214. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +1 -1
  215. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +25 -103
  216. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +102 -92
  217. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +22 -25
  218. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +38 -25
  219. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +1 -1
  220. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
  221. data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +42 -22
  222. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +513 -230
  223. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -2
  224. data/lib/frameworks/sproutcore/frameworks/experimental/README.md +23 -0
  225. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
  226. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
  227. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
  228. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
  229. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
  230. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
  231. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
  232. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -2
  233. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +151 -0
  234. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +27 -17
  235. data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +6 -3
  236. data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +163 -0
  237. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +6 -3
  238. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +1 -0
  239. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +44 -0
  240. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +200 -167
  241. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -1
  242. data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +52 -137
  243. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +7 -11
  244. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +138 -0
  245. data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1338 -0
  246. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +32 -26
  247. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +162 -3
  248. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +10 -5
  249. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +123 -3
  250. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +12 -5
  251. data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +50 -13
  252. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +163 -333
  253. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +58 -8
  254. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -0
  255. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +9 -6
  256. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +15 -1
  257. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +2 -0
  258. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +31 -0
  259. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +18 -0
  260. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +31 -143
  261. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
  262. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
  263. data/lib/frameworks/sproutcore/frameworks/table/views/table.js +5 -4
  264. data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +5 -3
  265. data/lib/frameworks/sproutcore/themes/ace/resources/button/button.js +8 -2
  266. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +2 -3
  267. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +1 -1
  268. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +1 -1
  269. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +1 -1
  270. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +1 -1
  271. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +2 -2
  272. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +62 -62
  273. data/lib/gen/html_app/Buildfile +36 -0
  274. data/lib/gen/html_app/README +1 -0
  275. data/lib/gen/html_app/USAGE +15 -0
  276. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +14 -0
  277. data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
  278. data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -0
  279. data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +1 -0
  280. data/lib/gen/html_project/Buildfile +45 -0
  281. data/lib/gen/html_project/INIT +3 -0
  282. data/lib/gen/html_project/README +1 -0
  283. data/lib/gen/html_project/USAGE +2 -0
  284. data/lib/gen/html_project/templates/@filename@/Buildfile +8 -0
  285. data/lib/gen/html_project/templates/@filename@/README +7 -0
  286. data/lib/sproutcore/builders/handlebars.rb +30 -0
  287. data/lib/sproutcore/builders.rb +1 -1
  288. data/lib/sproutcore/helpers/static_helper.rb +3 -3
  289. data/lib/sproutcore/tools/init.rb +25 -9
  290. data/spec/buildtasks/manifest/prepare_build_tasks/handlebars_spec.rb +39 -0
  291. data/spec/fixtures/builder_tests/apps/handlebars_test/template.handlebars +5 -0
  292. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/templates/demo.handlebars +4 -0
  293. data/spec/lib/builders/handlebars_spec.rb +29 -0
  294. data/vendor/chance/lib/chance/imagers/data_url.rb +20 -7
  295. data/vendor/chance/lib/chance/instance.rb +4 -1
  296. data/vendor/chance/lib/chance/parser.rb +31 -31
  297. data/vendor/chance/lib/chance/slicing.rb +38 -8
  298. metadata +195 -225
  299. data/lib/frameworks/sproutcore/frameworks/amber/system/device.js +0 -143
  300. data/lib/frameworks/sproutcore/frameworks/amber/system/utils.js +0 -174
  301. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/main_pane.js +0 -31
  302. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/pane/sendTouchEvent.js +0 -267
  303. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutDidChange.js +0 -149
  304. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutStyle.js +0 -602
  305. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/render.js +0 -115
  306. data/lib/frameworks/sproutcore/frameworks/amber/views/base.js +0 -1
  307. data/lib/frameworks/sproutcore/frameworks/amber/views/view.js +0 -4003
  308. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +0 -105
@@ -8,9 +8,9 @@
8
8
  /*global NodeList */
9
9
  // These commands are used by the build tools to control load order. On the
10
10
  // client side these are a no-op.
11
- var require = require || function require() { } ;
12
- var sc_require = sc_require || require;
13
- var sc_resource = sc_resource || function sc_resource() {};
11
+ if (!window.require) { window.require = function require(){}; }
12
+ if (!window.sc_require) { window.sc_require = require };
13
+ if (!window.sc_resource) {window.sc_resource = function sc_resource(){}; }
14
14
  sc_require('license') ;
15
15
 
16
16
  // ........................................
@@ -19,8 +19,8 @@ sc_require('license') ;
19
19
  // Most global constants should be defined inside of the SC namespace.
20
20
  // However the following two are useful enough and generally benign enough
21
21
  // to put into the global object.
22
- var YES = true ;
23
- var NO = false ;
22
+ window.YES = true ;
23
+ window.NO = false ;
24
24
 
25
25
  // prevent a console.log from blowing things up if we are on a browser that
26
26
  // does not support it
@@ -36,7 +36,7 @@ if (typeof console === 'undefined') {
36
36
  // rest of the methods go into the mixin defined below.
37
37
 
38
38
  /**
39
- @version 1.5.0.pre.3
39
+ @version 1.5.0.pre.4
40
40
  @namespace
41
41
 
42
42
  The SproutCore namespace. All SproutCore methods and functions are defined
@@ -54,10 +54,10 @@ if (typeof console === 'undefined') {
54
54
  The core Base framework is based on the jQuery API with a number of
55
55
  performance optimizations.
56
56
  */
57
- var SC = SC || {} ;
58
- var SproutCore = SproutCore || SC ;
57
+ window.SC = window.SC || {} ;
58
+ window.SproutCore = window.SproutCore || SC ;
59
59
 
60
- SC.VERSION = '1.5.0.pre.3';
60
+ SC.VERSION = '1.5.0.pre.4';
61
61
 
62
62
  /**
63
63
  @private
@@ -198,7 +198,7 @@ SC.mixin(/** @scope SC */ {
198
198
  var nativeType = jQuery.type(item);
199
199
 
200
200
  if (nativeType === "function") {
201
- return item.isClass ? SC.T_CLASS : SC.T_FUNCTION
201
+ return item.isClass ? SC.T_CLASS : SC.T_FUNCTION;
202
202
  } else if (nativeType === "object") {
203
203
  if (item.isError) {
204
204
  return SC.T_ERROR ;
@@ -255,8 +255,8 @@ SC.mixin(/** @scope SC */ {
255
255
  return false;
256
256
  } else if ( obj.objectAt ) {
257
257
  return true ;
258
- } else if ( obj.length && jQuery.type(obj) === "object" ) {
259
- return true
258
+ } else if ( obj.length !== undefined && jQuery.type(obj) === "object" ) {
259
+ return true;
260
260
  }
261
261
 
262
262
  return false;
@@ -309,7 +309,7 @@ SC.mixin(/** @scope SC */ {
309
309
  // GUIDS & HASHES
310
310
  //
311
311
 
312
- guidKey: jQuery.expando,
312
+ guidKey: jQuery.expando || ("SproutCore" + ( SC.VERSION + Math.random() ).replace( /\D/g, "" )),
313
313
 
314
314
  // Used for guid generation...
315
315
  _guidPrefixes: {"number": "nu", "string": "st"},
@@ -327,13 +327,13 @@ SC.mixin(/** @scope SC */ {
327
327
  @returns {String} the unique guid for this instance.
328
328
  */
329
329
  guidFor: function(obj) {
330
+ var cache, ret,
331
+ type = typeof obj;
330
332
 
331
333
  // special cases where we don't want to add a key to object
332
334
  if (obj === undefined) return "(undefined)";
333
335
  if (obj === null) return "(null)";
334
336
 
335
- var type = typeof obj;
336
-
337
337
  // Don't allow prototype changes to String etc. to change the guidFor
338
338
  if (type === SC.T_NUMBER || type === SC.T_STRING) {
339
339
  cache = this._guidCaches[type];
@@ -344,7 +344,7 @@ SC.mixin(/** @scope SC */ {
344
344
  }
345
345
  return ret;
346
346
  } else if (type === SC.T_BOOL) {
347
- return (obj) ? "(true)" : "(false)"
347
+ return (obj) ? "(true)" : "(false)";
348
348
  }
349
349
 
350
350
  var guidKey = this.guidKey;
@@ -355,9 +355,6 @@ SC.mixin(/** @scope SC */ {
355
355
  if (obj === Object) return '(Object)';
356
356
  if (obj === Array) return '(Array)';
357
357
 
358
- var cache, ret;
359
- var type = typeof obj;
360
-
361
358
  return SC.generateGuid(obj, "sc");
362
359
  },
363
360
 
@@ -615,8 +612,8 @@ SC.mixin(/** @scope SC */ {
615
612
  if ( deep ) {
616
613
  idx = ret.length;
617
614
  while ( idx-- ) { ret[idx] = SC.copy( ret[idx], true ); }
618
- break ;
619
615
  }
616
+ break ;
620
617
 
621
618
  case "object":
622
619
  ret = {} ;
@@ -815,6 +812,11 @@ SC.Function = {
815
812
  return fn ;
816
813
  },
817
814
 
815
+ enhance: function(fn) {
816
+ fn.isEnhancement = true;
817
+ return fn ;
818
+ },
819
+
818
820
  observes: function(fn, propertyPaths) {
819
821
  // sort property paths into local paths (i.e just a property name) and
820
822
  // full paths (i.e. those with a . or * in them)
@@ -835,7 +837,7 @@ SC.Function = {
835
837
  return fn ;
836
838
  }
837
839
 
838
- }
840
+ };
839
841
 
840
842
  SC.mixin(Function.prototype,
841
843
  /** @lends Function.prototype */ {
@@ -949,7 +951,7 @@ SC.mixin(Function.prototype,
949
951
  @returns {Function} the declared function instance
950
952
  */
951
953
  property: function() {
952
- return SC.Function.property(this, arguments)
954
+ return SC.Function.property(this, arguments);
953
955
  },
954
956
 
955
957
  /**
@@ -988,7 +990,11 @@ SC.mixin(Function.prototype,
988
990
  @returns {Function} receiver
989
991
  */
990
992
  idempotent: function(aFlag) {
991
- return SC.Function.idempotent(this, aFlag)
993
+ return SC.Function.idempotent(this, aFlag);
994
+ },
995
+
996
+ enhance: function() {
997
+ return SC.Function.enhance(this);
992
998
  },
993
999
 
994
1000
  /**
@@ -1014,8 +1020,8 @@ SC.CoreString = {
1014
1020
  }) ;
1015
1021
  },
1016
1022
  loc: function(str, formats) {
1017
- var str = SC.STRINGS[str] || str;
1018
- return SC.String.fmt(str, arguments) ;
1023
+ str = SC.STRINGS[str] || str;
1024
+ return SC.CoreString.fmt(str, arguments) ;
1019
1025
  },
1020
1026
  w: function(str) {
1021
1027
  var ary = [], ary2 = str.split(' '), len = ary2.length, string, idx=0;
@@ -1025,7 +1031,7 @@ SC.CoreString = {
1025
1031
  }
1026
1032
  return ary ;
1027
1033
  }
1028
- }
1034
+ };
1029
1035
 
1030
1036
  SC.mixin(String.prototype,
1031
1037
  /** @lends Function.prototype */ {
@@ -5,7 +5,7 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
- /*globals module test ok equals same CoreTest */
8
+ /*globals module test ok equals same SC */
9
9
 
10
10
  /**
11
11
  Adds a new module of unit tests to verify that the passed object implements
@@ -41,10 +41,169 @@
41
41
  });
42
42
  }
43
43
  }}}
44
+ */
45
+
46
+ SC.TestSuite = /** @scope SC.TestSuite.prototype */ {
47
+
48
+ /**
49
+ Call this method to define a new test suite. Pass one or more hashes of
50
+ properties you want added to the new suite.
51
+
52
+ @param {Hash} attrs one or more attribute hashes
53
+ @returns {SC.TestSuite} subclass of suite.
54
+ */
55
+ create: function(desc, attrs) {
56
+ var len = arguments.length,
57
+ ret = SC.beget(this),
58
+ idx;
59
+
60
+ // copy any attributes
61
+ for(idx=1;idx<len;idx++) SC.mixin(ret, arguments[idx]);
62
+
63
+ if (desc) ret.basedesc = desc;
64
+
65
+ // clone so that new definitions will be kept separate
66
+ ret.definitions = ret.definitions.slice();
67
+
68
+ return ret ;
69
+ },
70
+
71
+ /**
72
+ Generate a new test suite instance, adding the suite definitions to the
73
+ current test plan. Pass a description of the test suite as well as one or
74
+ more attribute hashes to apply to the test plan.
75
+
76
+ The description you add will be prefixed in front of the 'desc' property
77
+ on the test plan itself.
78
+
79
+ @param {String} desc suite description
80
+ @param {Hash} attrs one or more attribute hashes
81
+ @returns {SC.TestSuite} suite instance
82
+ */
83
+ generate: function(desc, attrs) {
84
+ var len = arguments.length,
85
+ ret = SC.beget(this),
86
+ idx, defs;
87
+
88
+ // apply attributes - skip first argument b/c it is a string
89
+ for(idx=1;idx<len;idx++) SC.mixin(ret, arguments[idx]);
90
+ ret.subdesc = desc ;
91
+
92
+ // invoke definitions
93
+ defs = ret.definitions ;
94
+ len = defs.length;
95
+ for(idx=0;idx<len;idx++) defs[idx].call(ret, ret);
96
+
97
+ return ret ;
98
+ },
99
+
100
+ /**
101
+ Adds the passed function to the array of definitions that will be invoked
102
+ when the suite is generated.
103
+
104
+ The passed function should expect to have the TestSuite instance passed
105
+ as the first and only parameter. The function should actually define
106
+ a module and tests, which will be added to the test suite.
107
+
108
+ @param {Function} func definition function
109
+ @returns {SC.TestSuite} receiver
110
+ */
111
+ define: function(func) {
112
+ this.definitions.push(func);
113
+ return this ;
114
+ },
44
115
 
116
+ /**
117
+ Definition functions. These are invoked in order when you generate a
118
+ suite to add unit tests and modules to the test plan.
119
+ */
120
+ definitions: [],
45
121
 
46
- */
47
- SC.ArraySuite = CoreTest.Suite.create("Verify SC.Array compliance: %@#%@", {
122
+ /**
123
+ Generates a module description by merging the based description, sub
124
+ description and the passed description. This is usually used inside of
125
+ a suite definition function.
126
+
127
+ @param {String} str detailed description for this module
128
+ @returns {String} generated description
129
+ */
130
+ desc: function(str) {
131
+ return this.basedesc.fmt(this.subdesc, str);
132
+ },
133
+
134
+ /**
135
+ The base description string. This should accept two formatting options,
136
+ a sub description and a detailed description. This is the description
137
+ set when you call extend()
138
+ */
139
+ basedesc: "%@ > %@",
140
+
141
+ /**
142
+ Default setup method for use with modules. This method will call the
143
+ newObject() method and set its return value on the object property of
144
+ the receiver.
145
+ */
146
+ setup: function() {
147
+ this.object = this.newObject();
148
+ },
149
+
150
+ /**
151
+ Default teardown method for use with modules. This method will call the
152
+ destroyObejct() method, passing the current object property on the
153
+ receiver. It will also clear the object property.
154
+ */
155
+ teardown: function() {
156
+ if (this.object) this.destroyObject(this.object);
157
+ this.object = null;
158
+ },
159
+
160
+ /**
161
+ Default method to create a new object instance. You will probably want
162
+ to override this method when you generate() a suite with a function that
163
+ can generate the type of object you want to test.
164
+
165
+ @returns {Object} generated object
166
+ */
167
+ newObject: function() { return null; },
168
+
169
+ /**
170
+ Default method to destroy a generated object instance after a test has
171
+ completed. If you override newObject() you can also overried this method
172
+ to cleanup the object you just created.
173
+
174
+ Default method does nothing.
175
+ */
176
+ destroyObject: function(obj) {
177
+ // do nothing.
178
+ },
179
+
180
+ /**
181
+ Generates a default module with the description you provide. This is
182
+ a convenience function for use inside of a definition function. You could
183
+ do the same thing by calling:
184
+
185
+ {{{
186
+ var T = this ;
187
+ module(T.desc(description), {
188
+ setup: function() { T.setup(); },
189
+ teardown: function() { T.teardown(); }
190
+ }
191
+ }}}
192
+
193
+ @param {String} desc detailed descrition
194
+ @returns {SC.TestSuite} receiver
195
+ */
196
+ module: function(desc) {
197
+ var T = this ;
198
+ module(T.desc(desc), {
199
+ setup: function() { T.setup(); },
200
+ teardown: function() { T.teardown(); }
201
+ });
202
+ }
203
+
204
+ };
205
+
206
+ SC.ArraySuite = SC.TestSuite.create("Verify SC.Array compliance: %@#%@", {
48
207
 
49
208
  /**
50
209
  Override to return a set of simple values such as numbers or strings.
@@ -367,7 +367,7 @@ SC.Array = {
367
367
  The callback for a range observer should have the signature:
368
368
 
369
369
  {{{
370
- function rangePropertyDidChange(array, objects, key, indexes, conext)
370
+ function rangePropertyDidChange(array, objects, key, indexes, context)
371
371
  }}}
372
372
 
373
373
  If the passed key is '[]' it means that the object itself changed.
@@ -448,9 +448,11 @@ SC.Array = {
448
448
  @param {Number} start the starting index of the change
449
449
  @param {Number} amt the final range of objects changed
450
450
  @param {Number} delta if you added or removed objects, the delta change
451
+ @param {Array} addedObjects the objects that were added
452
+ @param {Array} removedObjects the objects that were removed
451
453
  @returns {SC.Array} receiver
452
454
  */
453
- enumerableContentDidChange: function(start, amt, delta) {
455
+ enumerableContentDidChange: function(start, amt, delta, addedObjects, removedObjects) {
454
456
  var rangeob = this._array_rangeObservers,
455
457
  oldlen = this._array_oldLength,
456
458
  newlen, length, changes ;
@@ -482,6 +484,7 @@ SC.Array = {
482
484
  changes.add(start, length);
483
485
  }
484
486
 
487
+ this._setupEnumerableObservers(addedObjects, removedObjects);
485
488
  this.notifyPropertyChange('[]') ;
486
489
  this.endPropertyChanges();
487
490
 
@@ -588,19 +591,21 @@ if (!Array.prototype.lastIndexOf) {
588
591
 
589
592
  // primitive for array support.
590
593
  replace: function(idx, amt, objects) {
594
+ var removedObjects;
595
+
591
596
  if (this.isFrozen) throw SC.FROZEN_ERROR ;
592
597
  if (!objects || objects.length === 0) {
593
- this.splice(idx, amt) ;
598
+ removedObjects = this.splice(idx, amt) ;
594
599
  } else {
595
600
  var args = [idx, amt].concat(objects) ;
596
- this.splice.apply(this,args) ;
601
+ removedObjects = this.splice.apply(this,args) ;
597
602
  }
598
603
 
599
604
  // if we replaced exactly the same number of items, then pass only the
600
605
  // replaced range. Otherwise, pass the full remaining array length
601
606
  // since everything has shifted
602
607
  var len = objects ? (objects.get ? objects.get('length') : objects.length) : 0;
603
- this.enumerableContentDidChange(idx, amt, len - amt) ;
608
+ this.enumerableContentDidChange(idx, amt, len - amt, objects, removedObjects) ;
604
609
  return this ;
605
610
  },
606
611
 
@@ -5,8 +5,8 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
- require('core') ;
9
- require('system/enumerator');
8
+ sc_require('core') ;
9
+ sc_require('system/enumerator');
10
10
 
11
11
  /*globals Prototype */
12
12
 
@@ -815,13 +815,133 @@ SC.Reducers = /** @lends SC.Enumerable */ {
815
815
 
816
816
  @param {Number} start optional start offset for the content change
817
817
  @param {Number} length optional length of change
818
+ @param {Number} delta if you added or removed objects, the delta change
819
+ @param {Array} addedObjects the objects that were added
820
+ @param {Array} removedObjects the objects that were removed
818
821
  @returns {Object} receiver
819
822
  */
820
- enumerableContentDidChange: function(start, length) {
823
+ enumerableContentDidChange: function(start, length, delta, addedObjects, removedObjects) {
824
+ this._setupEnumerableObservers(addedObjects, removedObjects);
821
825
  this.notifyPropertyChange('[]') ;
826
+
822
827
  return this ;
823
828
  },
824
829
 
830
+ /**
831
+ @private
832
+
833
+ Clones a segment of an observer chain and applies it
834
+ to an element of this Enumerable.
835
+
836
+ @param {SC._ChainObserver} chainObserver the chain segment to begin from
837
+ */
838
+ _resumeChainObservingForItemWithChainObserver: function(item, chainObserver) {
839
+ var observer = SC.clone(chainObserver.next);
840
+ var key = observer.property;
841
+
842
+ // The chain observer should create new observers on the child object
843
+ observer.object = item;
844
+ item.addObserver(key, observer, observer.propertyDidChange);
845
+
846
+ // if we're in the initial chained observer setup phase, add the tail
847
+ // of the current observer segment to the list of tracked tails.
848
+ if(chainObserver.root.tails) {
849
+ chainObserver.root.tails.pushObject(observer.tail());
850
+ }
851
+
852
+ observer.propertyDidChange();
853
+
854
+ // Maintain a list of observers on the item so we can remove them
855
+ // if it is removed from the enumerable.
856
+ item._kvo_for(SC.keyFor('_kvo_enumerable_observers', key)).push(observer);
857
+ },
858
+
859
+ /**
860
+ @private
861
+
862
+ When enumerable content has changed, remove enumerable observers from
863
+ items that are no longer in the enumerable, and add observers to newly
864
+ added items.
865
+
866
+ @param {Array} addedObjects the array of objects that have been added
867
+ @param {Array} removedObjects the array of objects that have been removed
868
+ */
869
+ _setupEnumerableObservers: function(addedObjects, removedObjects) {
870
+ if (!addedObjects) { addedObjects = this; }
871
+ if (!removedObjects) { removedObjects = []; }
872
+
873
+ var observedKeys = this._kvo_for('_kvo_enumerable_observed_keys', SC.CoreSet);
874
+ var kvoKey;
875
+
876
+ // Only setup and teardown enumerable observers if we have keys to observe
877
+ if (observedKeys.get('length') > 0) {
878
+ // Loop through removed objects and remove any enumerable observers that
879
+ // belong to them.
880
+ removedObjects.forEach(function(item) {
881
+ item._kvo_for('_kvo_enumerable_observers').forEach(function(observer) {
882
+ // Remove the observer if it is pointing at this enumerable.
883
+ // If the observer belongs to another enumerable, just ignore it.
884
+ if (observer.object === this) {
885
+ item.removeObserver(observer.key, observer, observer.propertyDidChange);
886
+ }
887
+ });
888
+ });
889
+
890
+ // added and resume the chain observer.
891
+ observedKeys.forEach(function(key) {
892
+ kvoKey = SC.keyFor('_kvo_enumerable_observers', key);
893
+
894
+ var lastObserver;
895
+
896
+ // Get all original ChainObservers associated with the key
897
+ this._kvo_for(kvoKey).forEach(function(observer) {
898
+ // if there are no added objects or removed objects, this
899
+ // object is a proxy (like ArrayController), which does
900
+ // not currently receive the added or removed objects.
901
+ // As a result, walk down to the last element of the
902
+ // chain and trigger its propertyDidChange, which will
903
+ // invalidate anything listening.
904
+ if(!addedObjects.get('length') && !removedObjects.get('length')) {
905
+ lastObserver = observer;
906
+ while(lastObserver.next) { lastObserver = lastObserver.next; }
907
+ lastObserver.propertyDidChange();
908
+ } else {
909
+ addedObjects.forEach(function(item) {
910
+ this._resumeChainObservingForItemWithChainObserver(item, observer);
911
+ }, this);
912
+ }
913
+ }, this);
914
+ }, this);
915
+ }
916
+ },
917
+
918
+ /**
919
+ @private
920
+
921
+ Adds an enumerable observer. Enumerable observers are able to
922
+ propagate chain observers to each member item in the enumerable,
923
+ so that the observer is fired whenever a single item changes.
924
+
925
+ You should never call this method directly. Instead, you should
926
+ call addObserver() with the special '[]' property in the path.
927
+
928
+ For example, if you wanted to observe changes to each item's isDone
929
+ property, you could call:
930
+
931
+ arrayController.addObserver('[].isDone');
932
+ */
933
+ addEnumerableObserver: function(key, target, action) {
934
+ // Add the key to a set so we know what we are observing
935
+ this._kvo_for('_kvo_enumerable_observed_keys', SC.CoreSet).push(key);
936
+
937
+ // Add the passed ChainObserver to an ObserverSet for that key
938
+ var kvoKey = SC.keyFor('_kvo_enumerable_observers', key);
939
+ this._kvo_for(kvoKey).push(target);
940
+
941
+ // set up chained observers on the initial content
942
+ this._setupEnumerableObservers(this);
943
+ },
944
+
825
945
  /**
826
946
  Call this method from your unknownProperty() handler to implement
827
947
  automatic reduced properties. A reduced property is a property that
@@ -5,7 +5,8 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
- require('private/observer_set') ;
8
+ sc_require('private/observer_set');
9
+ sc_require('private/chain_observer');
9
10
 
10
11
  /*globals logChange */
11
12
 
@@ -523,10 +524,16 @@ SC.Observable = {
523
524
  while(--idx >= lim) {
524
525
  dep = keys[idx] ;
525
526
 
526
- // add dependent key to dependents array of key it depends on
527
- queue = dependents[dep] ;
528
- if (!queue) queue = dependents[dep] = [] ;
529
- queue.push(key) ;
527
+ if (dep.indexOf('.') >= 0) {
528
+ this.addObserver(dep, this, function() {
529
+ this.propertyDidChange(key);
530
+ });
531
+ } else {
532
+ // add dependent key to dependents array of key it depends on
533
+ queue = dependents[dep] ;
534
+ if (!queue) { queue = dependents[dep] = [] ; }
535
+ queue.push(key) ;
536
+ }
530
537
  }
531
538
  },
532
539