spade 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1990) hide show
  1. data/.gitignore +14 -0
  2. data/.gitmodules +15 -0
  3. data/.rspec +1 -0
  4. data/Buildfile +18 -0
  5. data/Gemfile +19 -0
  6. data/Gemfile.lock +34 -0
  7. data/README.md +148 -0
  8. data/Rakefile +9 -0
  9. data/bin/spade +7 -0
  10. data/examples/format-app/lib/hello.coffee +1 -0
  11. data/examples/format-app/lib/main.js +6 -0
  12. data/examples/format-app/package.json +10 -0
  13. data/examples/format-app/resources/README.txt +1 -0
  14. data/examples/format-app/resources/config.json +3 -0
  15. data/examples/path-test/lib/hello.js +1 -0
  16. data/examples/path-test/lib/main.js +1 -0
  17. data/examples/path-test/package.json +5 -0
  18. data/examples/sc-app/index.html +13 -0
  19. data/examples/sc-app/lib/main.js +24 -0
  20. data/examples/sc-app/package.json +8 -0
  21. data/examples/single-file.js +22 -0
  22. data/examples/todos/index.html +11 -0
  23. data/examples/todos/lib/main.js +10 -0
  24. data/examples/todos/lib/todos.js +93 -0
  25. data/examples/todos/package.json +10 -0
  26. data/examples/todos/resources/stylesheets/todos.css +162 -0
  27. data/examples/todos/resources/templates/todos.handlebars +31 -0
  28. data/examples/web-app/README.md +83 -0
  29. data/examples/web-app/index.html +12 -0
  30. data/examples/web-app/lib/main.js +3 -0
  31. data/examples/web-app/package.json +6 -0
  32. data/examples/web-app/tests.html +12 -0
  33. data/examples/web-app/tests/ct-example-test.js +39 -0
  34. data/examples/web-app/tests/qunit-test.js +23 -0
  35. data/lib/index.js +14 -0
  36. data/lib/node/loader.js +145 -0
  37. data/lib/node/sandbox.js +34 -0
  38. data/lib/spade.js +1099 -0
  39. data/lib/spade.rb +52 -0
  40. data/lib/spade/bundle.rb +156 -0
  41. data/lib/spade/cli.rb +14 -0
  42. data/lib/spade/cli/base.rb +325 -0
  43. data/lib/spade/cli/owner.rb +45 -0
  44. data/lib/spade/compiler.rb +34 -0
  45. data/lib/spade/console.rb +39 -0
  46. data/lib/spade/context.rb +116 -0
  47. data/lib/spade/credentials.rb +36 -0
  48. data/lib/spade/environment.rb +35 -0
  49. data/lib/spade/exports.rb +71 -0
  50. data/lib/spade/loader.rb +243 -0
  51. data/lib/spade/local.rb +53 -0
  52. data/lib/spade/package.rb +143 -0
  53. data/lib/spade/reactor.rb +159 -0
  54. data/lib/spade/remote.rb +75 -0
  55. data/lib/spade/repository.rb +18 -0
  56. data/lib/spade/server.rb +54 -0
  57. data/lib/spade/shell.rb +36 -0
  58. data/lib/spade/version.rb +3 -0
  59. data/package.json +27 -0
  60. data/packages/coffee-script/.gitignore +8 -0
  61. data/packages/coffee-script/.npmignore +11 -0
  62. data/packages/coffee-script/Cakefile +229 -0
  63. data/packages/coffee-script/LICENSE +22 -0
  64. data/packages/coffee-script/README +47 -0
  65. data/packages/coffee-script/Rakefile +78 -0
  66. data/packages/coffee-script/bin/cake +7 -0
  67. data/packages/coffee-script/bin/coffee +7 -0
  68. data/packages/coffee-script/documentation/coffee/aliases.coffee +11 -0
  69. data/packages/coffee-script/documentation/coffee/array_comprehensions.coffee +2 -0
  70. data/packages/coffee-script/documentation/coffee/block_comment.coffee +6 -0
  71. data/packages/coffee-script/documentation/coffee/cake_tasks.coffee +9 -0
  72. data/packages/coffee-script/documentation/coffee/classes.coffee +25 -0
  73. data/packages/coffee-script/documentation/coffee/comparisons.coffee +5 -0
  74. data/packages/coffee-script/documentation/coffee/conditionals.coffee +13 -0
  75. data/packages/coffee-script/documentation/coffee/default_args.coffee +8 -0
  76. data/packages/coffee-script/documentation/coffee/do.coffee +4 -0
  77. data/packages/coffee-script/documentation/coffee/embedded.coffee +5 -0
  78. data/packages/coffee-script/documentation/coffee/existence.coffee +10 -0
  79. data/packages/coffee-script/documentation/coffee/expressions.coffee +9 -0
  80. data/packages/coffee-script/documentation/coffee/expressions_assignment.coffee +3 -0
  81. data/packages/coffee-script/documentation/coffee/expressions_comprehension.coffee +3 -0
  82. data/packages/coffee-script/documentation/coffee/expressions_try.coffee +7 -0
  83. data/packages/coffee-script/documentation/coffee/fat_arrow.coffee +6 -0
  84. data/packages/coffee-script/documentation/coffee/functions.coffee +2 -0
  85. data/packages/coffee-script/documentation/coffee/heredocs.coffee +7 -0
  86. data/packages/coffee-script/documentation/coffee/heregexes.coffee +11 -0
  87. data/packages/coffee-script/documentation/coffee/interpolation.coffee +6 -0
  88. data/packages/coffee-script/documentation/coffee/multiple_return_values.coffee +7 -0
  89. data/packages/coffee-script/documentation/coffee/object_comprehensions.coffee +4 -0
  90. data/packages/coffee-script/documentation/coffee/object_extraction.coffee +13 -0
  91. data/packages/coffee-script/documentation/coffee/objects_and_arrays.coffee +19 -0
  92. data/packages/coffee-script/documentation/coffee/objects_reserved.coffee +5 -0
  93. data/packages/coffee-script/documentation/coffee/overview.coffee +28 -0
  94. data/packages/coffee-script/documentation/coffee/parallel_assignment.coffee +6 -0
  95. data/packages/coffee-script/documentation/coffee/patterns_and_splats.coffee +7 -0
  96. data/packages/coffee-script/documentation/coffee/prototypes.coffee +3 -0
  97. data/packages/coffee-script/documentation/coffee/range_comprehensions.coffee +2 -0
  98. data/packages/coffee-script/documentation/coffee/scope.coffee +5 -0
  99. data/packages/coffee-script/documentation/coffee/slices.coffee +7 -0
  100. data/packages/coffee-script/documentation/coffee/soaks.coffee +1 -0
  101. data/packages/coffee-script/documentation/coffee/splats.coffee +27 -0
  102. data/packages/coffee-script/documentation/coffee/splices.coffee +5 -0
  103. data/packages/coffee-script/documentation/coffee/strings.coffee +8 -0
  104. data/packages/coffee-script/documentation/coffee/switch.coffee +10 -0
  105. data/packages/coffee-script/documentation/coffee/try.coffee +8 -0
  106. data/packages/coffee-script/documentation/coffee/while.coffee +10 -0
  107. data/packages/coffee-script/documentation/css/docs.css +374 -0
  108. data/packages/coffee-script/documentation/css/idle.css +64 -0
  109. data/packages/coffee-script/documentation/docs/browser.html +25 -0
  110. data/packages/coffee-script/documentation/docs/cake.html +43 -0
  111. data/packages/coffee-script/documentation/docs/coffee-script.html +51 -0
  112. data/packages/coffee-script/documentation/docs/command.html +161 -0
  113. data/packages/coffee-script/documentation/docs/docco.css +186 -0
  114. data/packages/coffee-script/documentation/docs/grammar.html +399 -0
  115. data/packages/coffee-script/documentation/docs/helpers.html +31 -0
  116. data/packages/coffee-script/documentation/docs/index.html +3 -0
  117. data/packages/coffee-script/documentation/docs/lexer.html +490 -0
  118. data/packages/coffee-script/documentation/docs/nodes.html +1338 -0
  119. data/packages/coffee-script/documentation/docs/optparse.html +78 -0
  120. data/packages/coffee-script/documentation/docs/repl.html +24 -0
  121. data/packages/coffee-script/documentation/docs/rewriter.html +251 -0
  122. data/packages/coffee-script/documentation/docs/scope.html +54 -0
  123. data/packages/coffee-script/documentation/docs/underscore.html +295 -0
  124. data/packages/coffee-script/documentation/images/background.png +0 -0
  125. data/packages/coffee-script/documentation/images/banding.png +0 -0
  126. data/packages/coffee-script/documentation/images/button_bg.png +0 -0
  127. data/packages/coffee-script/documentation/images/button_bg_dark.gif +0 -0
  128. data/packages/coffee-script/documentation/images/button_bg_green.gif +0 -0
  129. data/packages/coffee-script/documentation/images/favicon.ico +0 -0
  130. data/packages/coffee-script/documentation/images/logo.png +0 -0
  131. data/packages/coffee-script/documentation/images/screenshadow.png +0 -0
  132. data/packages/coffee-script/documentation/index.html.erb +1607 -0
  133. data/packages/coffee-script/documentation/js/aliases.js +17 -0
  134. data/packages/coffee-script/documentation/js/array_comprehensions.js +6 -0
  135. data/packages/coffee-script/documentation/js/block_comment.js +4 -0
  136. data/packages/coffee-script/documentation/js/cake_tasks.js +10 -0
  137. data/packages/coffee-script/documentation/js/classes.js +44 -0
  138. data/packages/coffee-script/documentation/js/comparisons.js +3 -0
  139. data/packages/coffee-script/documentation/js/conditionals.js +12 -0
  140. data/packages/coffee-script/documentation/js/default_args.js +7 -0
  141. data/packages/coffee-script/documentation/js/do.js +10 -0
  142. data/packages/coffee-script/documentation/js/embedded.js +4 -0
  143. data/packages/coffee-script/documentation/js/existence.js +6 -0
  144. data/packages/coffee-script/documentation/js/expressions.js +15 -0
  145. data/packages/coffee-script/documentation/js/expressions_assignment.js +2 -0
  146. data/packages/coffee-script/documentation/js/expressions_comprehension.js +9 -0
  147. data/packages/coffee-script/documentation/js/expressions_try.js +7 -0
  148. data/packages/coffee-script/documentation/js/fat_arrow.js +9 -0
  149. data/packages/coffee-script/documentation/js/functions.js +7 -0
  150. data/packages/coffee-script/documentation/js/heredocs.js +2 -0
  151. data/packages/coffee-script/documentation/js/heregexes.js +2 -0
  152. data/packages/coffee-script/documentation/js/interpolation.js +4 -0
  153. data/packages/coffee-script/documentation/js/multiple_return_values.js +5 -0
  154. data/packages/coffee-script/documentation/js/object_comprehensions.js +15 -0
  155. data/packages/coffee-script/documentation/js/object_extraction.js +10 -0
  156. data/packages/coffee-script/documentation/js/objects_and_arrays.js +17 -0
  157. data/packages/coffee-script/documentation/js/objects_reserved.js +4 -0
  158. data/packages/coffee-script/documentation/js/overview.js +35 -0
  159. data/packages/coffee-script/documentation/js/parallel_assignment.js +4 -0
  160. data/packages/coffee-script/documentation/js/patterns_and_splats.js +4 -0
  161. data/packages/coffee-script/documentation/js/prototypes.js +3 -0
  162. data/packages/coffee-script/documentation/js/range_comprehensions.js +9 -0
  163. data/packages/coffee-script/documentation/js/scope.js +8 -0
  164. data/packages/coffee-script/documentation/js/slices.js +4 -0
  165. data/packages/coffee-script/documentation/js/soaks.js +2 -0
  166. data/packages/coffee-script/documentation/js/splats.js +15 -0
  167. data/packages/coffee-script/documentation/js/splices.js +3 -0
  168. data/packages/coffee-script/documentation/js/strings.js +2 -0
  169. data/packages/coffee-script/documentation/js/switch.js +23 -0
  170. data/packages/coffee-script/documentation/js/try.js +8 -0
  171. data/packages/coffee-script/documentation/js/while.js +18 -0
  172. data/packages/coffee-script/documentation/vendor/jquery-1.4.2.js +6240 -0
  173. data/packages/coffee-script/examples/beautiful_code/binary_search.coffee +16 -0
  174. data/packages/coffee-script/examples/beautiful_code/quicksort_runtime.coffee +13 -0
  175. data/packages/coffee-script/examples/beautiful_code/regular_expression_matcher.coffee +34 -0
  176. data/packages/coffee-script/examples/blocks.coffee +54 -0
  177. data/packages/coffee-script/examples/code.coffee +167 -0
  178. data/packages/coffee-script/examples/computer_science/README +4 -0
  179. data/packages/coffee-script/examples/computer_science/binary_search.coffee +25 -0
  180. data/packages/coffee-script/examples/computer_science/bubble_sort.coffee +11 -0
  181. data/packages/coffee-script/examples/computer_science/linked_list.coffee +108 -0
  182. data/packages/coffee-script/examples/computer_science/luhn_algorithm.coffee +36 -0
  183. data/packages/coffee-script/examples/computer_science/merge_sort.coffee +19 -0
  184. data/packages/coffee-script/examples/computer_science/selection_sort.coffee +23 -0
  185. data/packages/coffee-script/examples/poignant.coffee +181 -0
  186. data/packages/coffee-script/examples/potion.coffee +206 -0
  187. data/packages/coffee-script/examples/underscore.coffee +682 -0
  188. data/packages/coffee-script/examples/web_server.coffee +12 -0
  189. data/packages/coffee-script/extras/EXTRAS +7 -0
  190. data/packages/coffee-script/extras/coffee-script.js +8 -0
  191. data/packages/coffee-script/extras/jsl.conf +44 -0
  192. data/packages/coffee-script/index.html +2515 -0
  193. data/packages/coffee-script/lib/browser.js +52 -0
  194. data/packages/coffee-script/lib/cake.js +76 -0
  195. data/packages/coffee-script/lib/coffee-script.js +82 -0
  196. data/packages/coffee-script/lib/command.js +263 -0
  197. data/packages/coffee-script/lib/grammar.js +581 -0
  198. data/packages/coffee-script/lib/helpers.js +66 -0
  199. data/packages/coffee-script/lib/index.js +8 -0
  200. data/packages/coffee-script/lib/lexer.js +633 -0
  201. data/packages/coffee-script/lib/nodes.js +2165 -0
  202. data/packages/coffee-script/lib/optparse.js +111 -0
  203. data/packages/coffee-script/lib/parser.js +649 -0
  204. data/packages/coffee-script/lib/repl.js +42 -0
  205. data/packages/coffee-script/lib/rewriter.js +353 -0
  206. data/packages/coffee-script/lib/scope.js +120 -0
  207. data/packages/coffee-script/lib/spade-format.js +45 -0
  208. data/packages/coffee-script/package.json +26 -0
  209. data/packages/coffee-script/src/browser.coffee +43 -0
  210. data/packages/coffee-script/src/cake.coffee +69 -0
  211. data/packages/coffee-script/src/coffee-script.coffee +92 -0
  212. data/packages/coffee-script/src/command.coffee +214 -0
  213. data/packages/coffee-script/src/grammar.coffee +590 -0
  214. data/packages/coffee-script/src/helpers.coffee +56 -0
  215. data/packages/coffee-script/src/index.coffee +2 -0
  216. data/packages/coffee-script/src/lexer.coffee +653 -0
  217. data/packages/coffee-script/src/nodes.coffee +1754 -0
  218. data/packages/coffee-script/src/optparse.coffee +99 -0
  219. data/packages/coffee-script/src/repl.coffee +42 -0
  220. data/packages/coffee-script/src/rewriter.coffee +326 -0
  221. data/packages/coffee-script/src/scope.coffee +94 -0
  222. data/packages/coffee-script/test/arguments.coffee +127 -0
  223. data/packages/coffee-script/test/assignment.coffee +98 -0
  224. data/packages/coffee-script/test/break.coffee +18 -0
  225. data/packages/coffee-script/test/comments.coffee +201 -0
  226. data/packages/coffee-script/test/conditionals.coffee +181 -0
  227. data/packages/coffee-script/test/exception_handling.coffee +90 -0
  228. data/packages/coffee-script/test/helpers.coffee +96 -0
  229. data/packages/coffee-script/test/importing.coffee +18 -0
  230. data/packages/coffee-script/test/operators.coffee +225 -0
  231. data/packages/coffee-script/test/ranges_slices_and_splices.coffee +186 -0
  232. data/packages/coffee-script/test/regular_expressions.coffee +56 -0
  233. data/packages/coffee-script/test/test.html +123 -0
  234. data/packages/coffee-script/test/test_chaining.coffee +77 -0
  235. data/packages/coffee-script/test/test_classes.coffee +372 -0
  236. data/packages/coffee-script/test/test_compilation.coffee +26 -0
  237. data/packages/coffee-script/test/test_comprehensions.coffee +318 -0
  238. data/packages/coffee-script/test/test_existence.coffee +165 -0
  239. data/packages/coffee-script/test/test_functions.coffee +379 -0
  240. data/packages/coffee-script/test/test_heredocs.coffee +111 -0
  241. data/packages/coffee-script/test/test_literals.coffee +270 -0
  242. data/packages/coffee-script/test/test_option_parser.coffee +27 -0
  243. data/packages/coffee-script/test/test_pattern_matching.coffee +162 -0
  244. data/packages/coffee-script/test/test_returns.coffee +63 -0
  245. data/packages/coffee-script/test/test_splats.coffee +102 -0
  246. data/packages/coffee-script/test/test_strings.coffee +118 -0
  247. data/packages/coffee-script/test/test_switch.coffee +103 -0
  248. data/packages/coffee-script/test/test_while.coffee +71 -0
  249. data/packages/core-test/.gitignore +2 -0
  250. data/packages/core-test/Buildfile +15 -0
  251. data/packages/core-test/CHANGELOG.md +24 -0
  252. data/packages/core-test/__preamble__.js +34 -0
  253. data/packages/core-test/bin/cot +3 -0
  254. data/packages/core-test/lib/assert.js +306 -0
  255. data/packages/core-test/lib/cli.js +258 -0
  256. data/packages/core-test/lib/core.js +311 -0
  257. data/packages/core-test/lib/loggers/browser.js +390 -0
  258. data/packages/core-test/lib/loggers/console.js +235 -0
  259. data/packages/core-test/lib/loggers/default.js +272 -0
  260. data/packages/core-test/lib/loggers/dummy.js +168 -0
  261. data/packages/core-test/lib/main.js +22 -0
  262. data/packages/core-test/lib/private/jquery.js +6079 -0
  263. data/packages/core-test/lib/qunit.js +159 -0
  264. data/packages/core-test/lib/runner.js +65 -0
  265. data/packages/core-test/lib/spec.js +302 -0
  266. data/packages/core-test/lib/sync.js +64 -0
  267. data/packages/core-test/lib/system/dump.js +208 -0
  268. data/packages/core-test/lib/system/equiv.js +199 -0
  269. data/packages/core-test/lib/system/ext.js +62 -0
  270. data/packages/core-test/lib/system/module.js +162 -0
  271. data/packages/core-test/lib/system/plan.js +223 -0
  272. data/packages/core-test/lib/system/stub.js +98 -0
  273. data/packages/core-test/lib/system/test.js +373 -0
  274. data/packages/core-test/lib/test.js +69 -0
  275. data/packages/core-test/lib/utils.js +256 -0
  276. data/packages/core-test/package.json +10 -0
  277. data/packages/core-test/resources/additions.css +8 -0
  278. data/packages/core-test/resources/runner.css +177 -0
  279. data/packages/core-test/tests/apis/commonjs-test.js +102 -0
  280. data/packages/core-test/tests/apis/core-test.js +154 -0
  281. data/packages/core-test/tests/apis/qunit-test.js +244 -0
  282. data/packages/core-test/tests/apis/spec-test.js +344 -0
  283. data/packages/core-test/tests/system/equiv/qunit-test.js +1400 -0
  284. data/packages/core-test/tests/system/test/assert-test.js +86 -0
  285. data/packages/core-test/tests/system/test/error-test.js +62 -0
  286. data/packages/core-test/tests/system/test/schedule-test.js +210 -0
  287. data/packages/core-test/tests/utils/fmt-test.js +24 -0
  288. data/packages/handlebars/Gemfile +4 -0
  289. data/packages/handlebars/README.markdown +205 -0
  290. data/packages/handlebars/Rakefile +65 -0
  291. data/packages/handlebars/lib/handlebars.js +19 -0
  292. data/packages/handlebars/lib/handlebars/ast.js +88 -0
  293. data/packages/handlebars/lib/handlebars/compiler.js +116 -0
  294. data/packages/handlebars/lib/handlebars/debug.js +25 -0
  295. data/packages/handlebars/lib/handlebars/printer.js +114 -0
  296. data/packages/handlebars/lib/handlebars/runtime.js +280 -0
  297. data/packages/handlebars/lib/handlebars/utils.js +61 -0
  298. data/packages/handlebars/lib/handlebars/visitor.js +14 -0
  299. data/packages/handlebars/lib/handlebars/vm.js +634 -0
  300. data/packages/handlebars/spec/acceptance_spec.rb +100 -0
  301. data/packages/handlebars/spec/parser_spec.rb +181 -0
  302. data/packages/handlebars/spec/qunit_spec.js +497 -0
  303. data/packages/handlebars/spec/spec_helper.rb +107 -0
  304. data/packages/handlebars/spec/tokenizer_spec.rb +145 -0
  305. data/packages/handlebars/src/handlebars.l +27 -0
  306. data/packages/handlebars/src/handlebars.yy +79 -0
  307. data/packages/handlebars/test.js +56 -0
  308. data/packages/ivory/LICENSE.txt +1 -0
  309. data/packages/ivory/README.md +19 -0
  310. data/packages/ivory/lib/buffer.js +111 -0
  311. data/packages/ivory/lib/events.js +137 -0
  312. data/packages/ivory/lib/fs.js +266 -0
  313. data/packages/ivory/lib/main.js +13 -0
  314. data/packages/ivory/lib/path.js +158 -0
  315. data/packages/ivory/lib/ruby/buffer.rb +145 -0
  316. data/packages/ivory/lib/ruby/constants.rb +585 -0
  317. data/packages/ivory/lib/ruby/events.rb +32 -0
  318. data/packages/ivory/lib/ruby/fs.rb +245 -0
  319. data/packages/ivory/lib/ruby/process.rb +28 -0
  320. data/packages/ivory/lib/stream.js +115 -0
  321. data/packages/ivory/lib/util.js +414 -0
  322. data/packages/ivory/package.json +11 -0
  323. data/packages/jquery-core/lib/main.js +897 -0
  324. data/packages/jquery-core/package.json +9 -0
  325. data/packages/jquery/main.js +7179 -0
  326. data/packages/jquery/package.json +10 -0
  327. data/packages/json/lib/main.js +14 -0
  328. data/packages/json/package.json +8 -0
  329. data/packages/lproj/README.md +77 -0
  330. data/packages/lproj/examples/demo-app/en.lproj/localized.strings +2 -0
  331. data/packages/lproj/examples/demo-app/fr.lproj/localized.strings +3 -0
  332. data/packages/lproj/examples/demo-app/index.html +8 -0
  333. data/packages/lproj/examples/demo-app/lib/main.js +7 -0
  334. data/packages/lproj/examples/demo-app/package.json +9 -0
  335. data/packages/lproj/lib/main.js +78 -0
  336. data/packages/lproj/lib/strings-format.js +6 -0
  337. data/packages/lproj/package.json +9 -0
  338. data/packages/optparse/README.md +161 -0
  339. data/packages/optparse/TODO +1 -0
  340. data/packages/optparse/examples/browser-test.html +75 -0
  341. data/packages/optparse/examples/nodejs-test.js +90 -0
  342. data/packages/optparse/lib/optparse.js +309 -0
  343. data/packages/optparse/package.json +13 -0
  344. data/packages/optparse/seed.yml +5 -0
  345. data/packages/sproutcore-bootstrap/lib/main.js +11 -0
  346. data/packages/sproutcore-bootstrap/package.json +15 -0
  347. data/packages/sproutcore-corefoundation/lib/main.js +66 -0
  348. data/packages/sproutcore-corefoundation/lib/tests.js +74 -0
  349. data/packages/sproutcore-corefoundation/package.json +27 -0
  350. data/packages/sproutcore-corefoundation/tests.html +12 -0
  351. data/packages/sproutcore-datastore/lib/main.js +23 -0
  352. data/packages/sproutcore-datastore/package.json +16 -0
  353. data/packages/sproutcore-datetime/lib/main.js +6 -0
  354. data/packages/sproutcore-datetime/package.json +16 -0
  355. data/packages/sproutcore-handlebars/lib/handlebars.js +5 -0
  356. data/packages/sproutcore-handlebars/lib/main.js +15 -0
  357. data/packages/sproutcore-handlebars/package.json +17 -0
  358. data/packages/sproutcore-jquery/lib/main.js +10 -0
  359. data/packages/sproutcore-jquery/package.json +12 -0
  360. data/packages/sproutcore-preprocessor/bin/chance +64 -0
  361. data/packages/sproutcore-preprocessor/lib/css.js +21 -0
  362. data/packages/sproutcore-preprocessor/lib/main.js +1 -0
  363. data/packages/sproutcore-preprocessor/lib/preprocessor.js +12 -0
  364. data/packages/sproutcore-preprocessor/lib/sc_static.js +9 -0
  365. data/packages/sproutcore-preprocessor/package.json +18 -0
  366. data/packages/sproutcore-runtime/lib/main.js +37 -0
  367. data/packages/sproutcore-runtime/package.json +21 -0
  368. data/packages/text/lib/main.js +8 -0
  369. data/packages/text/package.json +9 -0
  370. data/packages/web-file/README.md +7 -0
  371. data/packages/web-file/lib/errors.js +32 -0
  372. data/packages/web-file/lib/file-reader.js +10 -0
  373. data/packages/web-file/lib/file-system.js +234 -0
  374. data/packages/web-file/lib/file-writer.js +10 -0
  375. data/packages/web-file/lib/file.js +9 -0
  376. data/packages/web-file/lib/main.js +34 -0
  377. data/packages/web-file/lib/platform.js +25 -0
  378. data/packages/web-file/lib/ruby/file.rb +252 -0
  379. data/packages/web-file/lib/ruby/file_reader.rb +69 -0
  380. data/packages/web-file/lib/ruby/file_system.rb +134 -0
  381. data/packages/web-file/lib/ruby/file_writer.rb +78 -0
  382. data/packages/web-file/package.json +12 -0
  383. data/packages/web-typed-array/README.md +7 -0
  384. data/packages/web-typed-array/lib/array-buffer-view.js +9 -0
  385. data/packages/web-typed-array/lib/array-buffer.js +7 -0
  386. data/packages/web-typed-array/lib/main.js +33 -0
  387. data/packages/web-typed-array/lib/platform.js +20 -0
  388. data/packages/web-typed-array/lib/ruby/array_buffer.rb +31 -0
  389. data/packages/web-typed-array/lib/ruby/array_buffer_view.rb +130 -0
  390. data/packages/web-typed-array/lib/ruby/typed_array.rb +133 -0
  391. data/packages/web-typed-array/lib/typed-array.js +26 -0
  392. data/packages/web-typed-array/package.json +9 -0
  393. data/spade.gemspec +30 -0
  394. data/spec/cli/build_spec.rb +59 -0
  395. data/spec/cli/install_spec.rb +106 -0
  396. data/spec/cli/installed_spec.rb +55 -0
  397. data/spec/cli/list_spec.rb +75 -0
  398. data/spec/cli/login_spec.rb +76 -0
  399. data/spec/cli/owner_spec.rb +115 -0
  400. data/spec/cli/push_spec.rb +74 -0
  401. data/spec/cli/uninstall_spec.rb +58 -0
  402. data/spec/cli/unpack_spec.rb +73 -0
  403. data/spec/credentials_spec.rb +24 -0
  404. data/spec/fixtures/coffee/bin/cake +0 -0
  405. data/spec/fixtures/coffee/bin/coffee +0 -0
  406. data/spec/fixtures/coffee/lib/coffee.js +0 -0
  407. data/spec/fixtures/coffee/lib/coffee.png +0 -0
  408. data/spec/fixtures/coffee/lib/coffee/base.js +0 -0
  409. data/spec/fixtures/coffee/lib/coffee/mocha/chai.js +0 -0
  410. data/spec/fixtures/coffee/qunit/coffee/test.js +0 -0
  411. data/spec/fixtures/coffee/qunit/test.js +0 -0
  412. data/spec/fixtures/coffee/qunit/test.log +0 -0
  413. data/spec/fixtures/package.json +25 -0
  414. data/spec/gauntlet_spec.rb +30 -0
  415. data/spec/javascript/async-test.js +123 -0
  416. data/spec/javascript/compiler/javascript.js +13 -0
  417. data/spec/javascript/compiler/ruby.js +14 -0
  418. data/spec/javascript/loader-test.js +64 -0
  419. data/spec/javascript/normalize-test.js +59 -0
  420. data/spec/javascript/packages-test.js +44 -0
  421. data/spec/javascript/relative-require-test.js +72 -0
  422. data/spec/javascript/require-test.js +56 -0
  423. data/spec/javascript/sandbox/compile.js +37 -0
  424. data/spec/javascript/sandbox/creation.js +44 -0
  425. data/spec/javascript/sandbox/format.js +79 -0
  426. data/spec/javascript/sandbox/misc.js +57 -0
  427. data/spec/javascript/sandbox/preprocessor.js +81 -0
  428. data/spec/javascript/sandbox/require.js +48 -0
  429. data/spec/javascript/sandbox/run-command.js +21 -0
  430. data/spec/javascript/spade/externs.js +14 -0
  431. data/spec/javascript/spade/load-factory.js +15 -0
  432. data/spec/javascript/spade/misc.js +23 -0
  433. data/spec/javascript/spade/ready.js +12 -0
  434. data/spec/javascript/spade/register.js +13 -0
  435. data/spec/javascript_spec.rb +7 -0
  436. data/spec/package_spec.rb +257 -0
  437. data/spec/spec_helper.rb +30 -0
  438. data/spec/support/cli.rb +94 -0
  439. data/spec/support/core_test.rb +52 -0
  440. data/spec/support/fake.rb +42 -0
  441. data/spec/support/fake_gem_server.rb +50 -0
  442. data/spec/support/fake_gemcutter.rb +29 -0
  443. data/spec/support/matchers.rb +31 -0
  444. data/spec/support/path.rb +54 -0
  445. data/sproutcore/.gitignore +13 -0
  446. data/sproutcore/Buildfile +112 -0
  447. data/sproutcore/CHANGELOG.md +232 -0
  448. data/sproutcore/README.md +68 -0
  449. data/sproutcore/apps/docs/core.js +27 -0
  450. data/sproutcore/apps/docs/design/Doc Viewer.graffle/QuickLook/Preview.pdf +0 -0
  451. data/sproutcore/apps/docs/design/Doc Viewer.graffle/QuickLook/Thumbnail.tiff +0 -0
  452. data/sproutcore/apps/docs/design/Doc Viewer.graffle/data.plist +14378 -0
  453. data/sproutcore/apps/docs/design/Doc Viewer.graffle/image10.png +0 -0
  454. data/sproutcore/apps/docs/design/Doc Viewer.graffle/image11.png +0 -0
  455. data/sproutcore/apps/docs/design/Doc Viewer.graffle/image13.png +0 -0
  456. data/sproutcore/apps/docs/design/Doc Viewer.graffle/image14.png +0 -0
  457. data/sproutcore/apps/docs/design/Doc Viewer.graffle/image8.png +0 -0
  458. data/sproutcore/apps/docs/design/Doc Viewer.graffle/image9.tiff +0 -0
  459. data/sproutcore/apps/docs/english.lproj/loading.rhtml +9 -0
  460. data/sproutcore/apps/docs/english.lproj/main_page.js +22 -0
  461. data/sproutcore/apps/docs/english.lproj/strings.js +15 -0
  462. data/sproutcore/apps/docs/main.js +30 -0
  463. data/sproutcore/apps/greenhouse/README +18 -0
  464. data/sproutcore/apps/greenhouse/TODO +56 -0
  465. data/sproutcore/apps/greenhouse/beautify.js +1058 -0
  466. data/sproutcore/apps/greenhouse/controllers/design.js +20 -0
  467. data/sproutcore/apps/greenhouse/controllers/file.js +35 -0
  468. data/sproutcore/apps/greenhouse/controllers/files.js +40 -0
  469. data/sproutcore/apps/greenhouse/controllers/layout.js +53 -0
  470. data/sproutcore/apps/greenhouse/controllers/library.js +194 -0
  471. data/sproutcore/apps/greenhouse/controllers/page.js +18 -0
  472. data/sproutcore/apps/greenhouse/controllers/property.js +19 -0
  473. data/sproutcore/apps/greenhouse/controllers/property_editor.js +17 -0
  474. data/sproutcore/apps/greenhouse/controllers/target.js +20 -0
  475. data/sproutcore/apps/greenhouse/controllers/targets.js +43 -0
  476. data/sproutcore/apps/greenhouse/controllers/view_configs.js +100 -0
  477. data/sproutcore/apps/greenhouse/core.js +65 -0
  478. data/sproutcore/apps/greenhouse/core_file.js +124 -0
  479. data/sproutcore/apps/greenhouse/data_source.js +250 -0
  480. data/sproutcore/apps/greenhouse/english.lproj/app_page.js +399 -0
  481. data/sproutcore/apps/greenhouse/english.lproj/css/app-selector.css +107 -0
  482. data/sproutcore/apps/greenhouse/english.lproj/css/button.css +314 -0
  483. data/sproutcore/apps/greenhouse/english.lproj/css/dock.css +90 -0
  484. data/sproutcore/apps/greenhouse/english.lproj/css/general.css +51 -0
  485. data/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +93 -0
  486. data/sproutcore/apps/greenhouse/english.lproj/css/menu.css +49 -0
  487. data/sproutcore/apps/greenhouse/english.lproj/css/modal.css +41 -0
  488. data/sproutcore/apps/greenhouse/english.lproj/css/picker.css +195 -0
  489. data/sproutcore/apps/greenhouse/english.lproj/css/search.css +60 -0
  490. data/sproutcore/apps/greenhouse/english.lproj/css/text-field.css +67 -0
  491. data/sproutcore/apps/greenhouse/english.lproj/dialogs.js +303 -0
  492. data/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500.eot +0 -0
  493. data/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500.otf +0 -0
  494. data/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500.woff +0 -0
  495. data/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500_italic.eot +0 -0
  496. data/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500_italic.otf +0 -0
  497. data/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500_italic.woff +0 -0
  498. data/sproutcore/apps/greenhouse/english.lproj/images/app-selector/choose-app.png +0 -0
  499. data/sproutcore/apps/greenhouse/english.lproj/images/app-selector/list-item-sel.png +0 -0
  500. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/active-l.png +0 -0
  501. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/active-m.png +0 -0
  502. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/active-r.png +0 -0
  503. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/regular-l.png +0 -0
  504. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/regular-m.png +0 -0
  505. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/regular-r.png +0 -0
  506. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/active-l.png +0 -0
  507. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/active-r.png +0 -0
  508. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/disabled-l.png +0 -0
  509. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/disabled-r.png +0 -0
  510. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/regular-l.png +0 -0
  511. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/regular-r.png +0 -0
  512. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-active-l.png +0 -0
  513. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-active-r.png +0 -0
  514. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-disabled-l.png +0 -0
  515. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-disabled-r.png +0 -0
  516. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-l.png +0 -0
  517. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-r.png +0 -0
  518. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/active-l.png +0 -0
  519. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/active-m.png +0 -0
  520. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/active-r.png +0 -0
  521. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-active-l.png +0 -0
  522. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-active-r.png +0 -0
  523. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-l.png +0 -0
  524. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-r.png +0 -0
  525. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-active-l.png +0 -0
  526. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-active-r.png +0 -0
  527. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-l.png +0 -0
  528. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-r.png +0 -0
  529. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/disabled-l.png +0 -0
  530. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/disabled-m.png +0 -0
  531. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/disabled-r.png +0 -0
  532. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/regular-l.png +0 -0
  533. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/regular-m.png +0 -0
  534. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/regular-r.png +0 -0
  535. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-active-l.png +0 -0
  536. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-active-m.png +0 -0
  537. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-active-r.png +0 -0
  538. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-disabled-l.png +0 -0
  539. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-disabled-m.png +0 -0
  540. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-disabled-r.png +0 -0
  541. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-l.png +0 -0
  542. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-m.png +0 -0
  543. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-r.png +0 -0
  544. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/active-m.png +0 -0
  545. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/disabled-m.png +0 -0
  546. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/regular-m.png +0 -0
  547. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/sel-active-m.png +0 -0
  548. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/sel-disabled-m.png +0 -0
  549. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/sel-m.png +0 -0
  550. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/active-l.png +0 -0
  551. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/active-r.png +0 -0
  552. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/disabled-l.png +0 -0
  553. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/disabled-r.png +0 -0
  554. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/regular-l.png +0 -0
  555. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/regular-r.png +0 -0
  556. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-active-l.png +0 -0
  557. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-active-r.png +0 -0
  558. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-disabled-l.png +0 -0
  559. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-disabled-r.png +0 -0
  560. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-l.png +0 -0
  561. data/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-r.png +0 -0
  562. data/sproutcore/apps/greenhouse/english.lproj/images/icons/actions-active.png +0 -0
  563. data/sproutcore/apps/greenhouse/english.lproj/images/icons/actions.png +0 -0
  564. data/sproutcore/apps/greenhouse/english.lproj/images/icons/inspector-active.png +0 -0
  565. data/sproutcore/apps/greenhouse/english.lproj/images/icons/inspector.png +0 -0
  566. data/sproutcore/apps/greenhouse/english.lproj/images/icons/library-active.png +0 -0
  567. data/sproutcore/apps/greenhouse/english.lproj/images/icons/library.png +0 -0
  568. data/sproutcore/apps/greenhouse/english.lproj/images/icons/projects-active.png +0 -0
  569. data/sproutcore/apps/greenhouse/english.lproj/images/icons/projects.png +0 -0
  570. data/sproutcore/apps/greenhouse/english.lproj/images/icons/run-active.png +0 -0
  571. data/sproutcore/apps/greenhouse/english.lproj/images/icons/run.png +0 -0
  572. data/sproutcore/apps/greenhouse/english.lproj/images/icons/save-active.png +0 -0
  573. data/sproutcore/apps/greenhouse/english.lproj/images/icons/save.png +0 -0
  574. data/sproutcore/apps/greenhouse/english.lproj/images/logos/greenhouse-l.png +0 -0
  575. data/sproutcore/apps/greenhouse/english.lproj/images/logos/greenhouse-s.png +0 -0
  576. data/sproutcore/apps/greenhouse/english.lproj/images/logos/sproutcore.png +0 -0
  577. data/sproutcore/apps/greenhouse/english.lproj/images/main-bg.png +0 -0
  578. data/sproutcore/apps/greenhouse/english.lproj/images/picker/bottom-left.png +0 -0
  579. data/sproutcore/apps/greenhouse/english.lproj/images/picker/bottom-right.png +0 -0
  580. data/sproutcore/apps/greenhouse/english.lproj/images/picker/bottom.png +0 -0
  581. data/sproutcore/apps/greenhouse/english.lproj/images/picker/close-active.png +0 -0
  582. data/sproutcore/apps/greenhouse/english.lproj/images/picker/close.png +0 -0
  583. data/sproutcore/apps/greenhouse/english.lproj/images/picker/left.png +0 -0
  584. data/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-bottom.png +0 -0
  585. data/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-left.png +0 -0
  586. data/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-right.png +0 -0
  587. data/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-top.png +0 -0
  588. data/sproutcore/apps/greenhouse/english.lproj/images/picker/right.png +0 -0
  589. data/sproutcore/apps/greenhouse/english.lproj/images/picker/search-active.png +0 -0
  590. data/sproutcore/apps/greenhouse/english.lproj/images/picker/search.png +0 -0
  591. data/sproutcore/apps/greenhouse/english.lproj/images/picker/top-left.png +0 -0
  592. data/sproutcore/apps/greenhouse/english.lproj/images/picker/top-right.png +0 -0
  593. data/sproutcore/apps/greenhouse/english.lproj/images/picker/top.png +0 -0
  594. data/sproutcore/apps/greenhouse/english.lproj/images/toolbar-bg.png +0 -0
  595. data/sproutcore/apps/greenhouse/english.lproj/inspectors.js +365 -0
  596. data/sproutcore/apps/greenhouse/english.lproj/loading.rhtml +9 -0
  597. data/sproutcore/apps/greenhouse/english.lproj/main_page.js +95 -0
  598. data/sproutcore/apps/greenhouse/english.lproj/strings.js +93 -0
  599. data/sproutcore/apps/greenhouse/fixtures/file.js +35 -0
  600. data/sproutcore/apps/greenhouse/main.js +28 -0
  601. data/sproutcore/apps/greenhouse/mixins/drop_down.js +97 -0
  602. data/sproutcore/apps/greenhouse/models/design.js +26 -0
  603. data/sproutcore/apps/greenhouse/models/dir.js +93 -0
  604. data/sproutcore/apps/greenhouse/models/file.js +51 -0
  605. data/sproutcore/apps/greenhouse/models/target.js +82 -0
  606. data/sproutcore/apps/greenhouse/models/view_config.js +49 -0
  607. data/sproutcore/apps/greenhouse/resources/test_page.js +37 -0
  608. data/sproutcore/apps/greenhouse/states/inspector.js +152 -0
  609. data/sproutcore/apps/greenhouse/states/library.js +142 -0
  610. data/sproutcore/apps/greenhouse/states/main.js +283 -0
  611. data/sproutcore/apps/greenhouse/states/modals.js +299 -0
  612. data/sproutcore/apps/greenhouse/states/ready.js +235 -0
  613. data/sproutcore/apps/greenhouse/tests/controllers/design.js +15 -0
  614. data/sproutcore/apps/greenhouse/tests/controllers/designs.js +15 -0
  615. data/sproutcore/apps/greenhouse/tests/controllers/file.js +15 -0
  616. data/sproutcore/apps/greenhouse/tests/controllers/files.js +15 -0
  617. data/sproutcore/apps/greenhouse/tests/models/file.js +15 -0
  618. data/sproutcore/apps/greenhouse/tests/models/view_config.js +15 -0
  619. data/sproutcore/apps/greenhouse/tests/views/list_item.js +16 -0
  620. data/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
  621. data/sproutcore/apps/greenhouse/theme.js +25 -0
  622. data/sproutcore/apps/greenhouse/views/anchor.js +277 -0
  623. data/sproutcore/apps/greenhouse/views/application_list_item.js +19 -0
  624. data/sproutcore/apps/greenhouse/views/event_blocker.js +32 -0
  625. data/sproutcore/apps/greenhouse/views/label_designer.js +16 -0
  626. data/sproutcore/apps/greenhouse/views/list_item.js +42 -0
  627. data/sproutcore/apps/greenhouse/views/plist_item.js +178 -0
  628. data/sproutcore/apps/greenhouse/views/simple_button.js +157 -0
  629. data/sproutcore/apps/greenhouse/views/tear_off_picker.js +56 -0
  630. data/sproutcore/apps/greenhouse/views/web.js +44 -0
  631. data/sproutcore/apps/test_controls/Buildfile +0 -0
  632. data/sproutcore/apps/test_controls/controllers/buttons.js +21 -0
  633. data/sproutcore/apps/test_controls/controllers/categories.js +108 -0
  634. data/sproutcore/apps/test_controls/controllers/category.js +36 -0
  635. data/sproutcore/apps/test_controls/core.js +29 -0
  636. data/sproutcore/apps/test_controls/main.js +14 -0
  637. data/sproutcore/apps/test_controls/resources/buttons_page.js +142 -0
  638. data/sproutcore/apps/test_controls/resources/checkboxes_page.js +45 -0
  639. data/sproutcore/apps/test_controls/resources/flow_layout_page.js +84 -0
  640. data/sproutcore/apps/test_controls/resources/list_page.js +40 -0
  641. data/sproutcore/apps/test_controls/resources/loading.rhtml +9 -0
  642. data/sproutcore/apps/test_controls/resources/main_page.css +60 -0
  643. data/sproutcore/apps/test_controls/resources/main_page.js +145 -0
  644. data/sproutcore/apps/test_controls/resources/progress_page.js +32 -0
  645. data/sproutcore/apps/test_controls/resources/radio_page.js +48 -0
  646. data/sproutcore/apps/test_controls/resources/scroll_page.js +76 -0
  647. data/sproutcore/apps/test_controls/resources/segmented_page.js +98 -0
  648. data/sproutcore/apps/test_controls/resources/select_page.js +60 -0
  649. data/sproutcore/apps/test_controls/resources/sliders_page.js +53 -0
  650. data/sproutcore/apps/test_controls/resources/strings.js +50 -0
  651. data/sproutcore/apps/test_controls/resources/tab_page.js +44 -0
  652. data/sproutcore/apps/test_controls/resources/text_field_page.js +41 -0
  653. data/sproutcore/apps/test_controls/theme.js +34 -0
  654. data/sproutcore/apps/tests/controllers/detail.js +25 -0
  655. data/sproutcore/apps/tests/controllers/source.js +29 -0
  656. data/sproutcore/apps/tests/controllers/target.js +26 -0
  657. data/sproutcore/apps/tests/controllers/targets.js +86 -0
  658. data/sproutcore/apps/tests/controllers/tests.js +33 -0
  659. data/sproutcore/apps/tests/core.js +133 -0
  660. data/sproutcore/apps/tests/english.lproj/loading.rhtml +9 -0
  661. data/sproutcore/apps/tests/english.lproj/main_page.css +48 -0
  662. data/sproutcore/apps/tests/english.lproj/main_page.js +233 -0
  663. data/sproutcore/apps/tests/english.lproj/strings.js +26 -0
  664. data/sproutcore/apps/tests/main.js +27 -0
  665. data/sproutcore/apps/tests/states/no_targets.js +26 -0
  666. data/sproutcore/apps/tests/states/ready.js +56 -0
  667. data/sproutcore/apps/tests/states/ready_detail.js +41 -0
  668. data/sproutcore/apps/tests/states/ready_empty.js +48 -0
  669. data/sproutcore/apps/tests/states/ready_list.js +41 -0
  670. data/sproutcore/apps/tests/states/ready_loading.js +44 -0
  671. data/sproutcore/apps/tests/states/ready_no_tests.js +31 -0
  672. data/sproutcore/apps/tests/states/start.js +39 -0
  673. data/sproutcore/apps/tests/tests/controllers/detail.js +15 -0
  674. data/sproutcore/apps/tests/tests/controllers/source.js +15 -0
  675. data/sproutcore/apps/tests/tests/controllers/target.js +15 -0
  676. data/sproutcore/apps/tests/tests/controllers/targets.js +15 -0
  677. data/sproutcore/apps/tests/tests/controllers/tests.js +15 -0
  678. data/sproutcore/apps/tests/tests/models/target.js +15 -0
  679. data/sproutcore/apps/tests/tests/models/test.js +15 -0
  680. data/sproutcore/apps/tests/tests/views/offset_checkbox.js +15 -0
  681. data/sproutcore/apps/tests/views/offset_checkbox.js +26 -0
  682. data/sproutcore/apps/welcome/controllers/targets.js +56 -0
  683. data/sproutcore/apps/welcome/core.js +30 -0
  684. data/sproutcore/apps/welcome/english.lproj/images/main-bg.png +0 -0
  685. data/sproutcore/apps/welcome/english.lproj/loading.rhtml +10 -0
  686. data/sproutcore/apps/welcome/english.lproj/main_page.css +25 -0
  687. data/sproutcore/apps/welcome/english.lproj/main_page.js +67 -0
  688. data/sproutcore/apps/welcome/english.lproj/strings.js +15 -0
  689. data/sproutcore/apps/welcome/main.js +19 -0
  690. data/sproutcore/apps/welcome/tests/controllers/targets.js +15 -0
  691. data/sproutcore/design/CollectionView State Charts.graffle +4848 -0
  692. data/sproutcore/design/Design Charts.graffle +16845 -0
  693. data/sproutcore/design/Record State Table.numbers +0 -0
  694. data/sproutcore/design/SproutCore Datastore Design.graffle/QuickLook/Preview.pdf +0 -0
  695. data/sproutcore/design/SproutCore Datastore Design.graffle/QuickLook/Thumbnail.tiff +0 -0
  696. data/sproutcore/design/SproutCore Datastore Design.graffle/data.plist +19588 -0
  697. data/sproutcore/design/SproutCore Datastore Design.graffle/image8.png +0 -0
  698. data/sproutcore/design/SproutCore Design Template.graffle/QuickLook/Preview.pdf +0 -0
  699. data/sproutcore/design/SproutCore Design Template.graffle/QuickLook/Thumbnail.tiff +0 -0
  700. data/sproutcore/design/SproutCore Design Template.graffle/data.plist +1452 -0
  701. data/sproutcore/design/SproutCore Design Template.graffle/image8.png +0 -0
  702. data/sproutcore/design/TestRunner Design.graffle/QuickLook/Preview.pdf +0 -0
  703. data/sproutcore/design/TestRunner Design.graffle/QuickLook/Thumbnail.tiff +0 -0
  704. data/sproutcore/design/TestRunner Design.graffle/data.plist +24187 -0
  705. data/sproutcore/design/TestRunner Design.graffle/image10.png +0 -0
  706. data/sproutcore/design/TestRunner Design.graffle/image11.png +0 -0
  707. data/sproutcore/design/TestRunner Design.graffle/image13.png +0 -0
  708. data/sproutcore/design/TestRunner Design.graffle/image15.png +0 -0
  709. data/sproutcore/design/TestRunner Design.graffle/image16.png +0 -0
  710. data/sproutcore/design/TestRunner Design.graffle/image17.png +0 -0
  711. data/sproutcore/design/TestRunner Design.graffle/image18.png +0 -0
  712. data/sproutcore/design/TestRunner Design.graffle/image19.png +0 -0
  713. data/sproutcore/design/TestRunner Design.graffle/image22.tiff +0 -0
  714. data/sproutcore/design/TestRunner Design.graffle/image23.png +0 -0
  715. data/sproutcore/design/TestRunner Design.graffle/image24.png +0 -0
  716. data/sproutcore/design/TestRunner Design.graffle/image25.png +0 -0
  717. data/sproutcore/design/TestRunner Design.graffle/image30.png +0 -0
  718. data/sproutcore/design/TestRunner Design.graffle/image31.png +0 -0
  719. data/sproutcore/design/TestRunner Design.graffle/image8.png +0 -0
  720. data/sproutcore/design/TestRunner Design.graffle/image9.png +0 -0
  721. data/sproutcore/design/greenhouse-statechart.graffle +9025 -0
  722. data/sproutcore/design/greenhouse-statechart.pdf +0 -0
  723. data/sproutcore/design/iphone-webapp-loading.psd +0 -0
  724. data/sproutcore/frameworks/animation/Buildfile +3 -0
  725. data/sproutcore/frameworks/animation/LICENSE +25 -0
  726. data/sproutcore/frameworks/animation/README.md +79 -0
  727. data/sproutcore/frameworks/animation/core.js +1206 -0
  728. data/sproutcore/frameworks/animation/tests/core.js +152 -0
  729. data/sproutcore/frameworks/bootstrap/README +9 -0
  730. data/sproutcore/frameworks/bootstrap/core.js +7 -0
  731. data/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
  732. data/sproutcore/frameworks/bootstrap/system/bench.js +14 -0
  733. data/sproutcore/frameworks/bootstrap/system/browser.js +65 -0
  734. data/sproutcore/frameworks/bootstrap/system/loader.js +50 -0
  735. data/sproutcore/frameworks/bootstrap/tests/system/browser.js +187 -0
  736. data/sproutcore/frameworks/core_foundation/.greenhouseconf +33 -0
  737. data/sproutcore/frameworks/core_foundation/controllers/array.js +498 -0
  738. data/sproutcore/frameworks/core_foundation/controllers/controller.js +44 -0
  739. data/sproutcore/frameworks/core_foundation/controllers/object.js +342 -0
  740. data/sproutcore/frameworks/core_foundation/core.js +201 -0
  741. data/sproutcore/frameworks/core_foundation/ext/object.js +83 -0
  742. data/sproutcore/frameworks/core_foundation/ext/run_loop.js +163 -0
  743. data/sproutcore/frameworks/core_foundation/mixins/delegate_support.js +110 -0
  744. data/sproutcore/frameworks/core_foundation/mixins/responder_context.js +269 -0
  745. data/sproutcore/frameworks/core_foundation/mixins/selection_support.js +250 -0
  746. data/sproutcore/frameworks/core_foundation/mixins/string.js +163 -0
  747. data/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
  748. data/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
  749. data/sproutcore/frameworks/core_foundation/panes/main.js +52 -0
  750. data/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
  751. data/sproutcore/frameworks/core_foundation/panes/pane.js +672 -0
  752. data/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
  753. data/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
  754. data/sproutcore/frameworks/core_foundation/protocols/observable_protocol.js +40 -0
  755. data/sproutcore/frameworks/core_foundation/protocols/sparse_array_delegate.js +131 -0
  756. data/sproutcore/frameworks/core_foundation/resources/core.css +371 -0
  757. data/sproutcore/frameworks/core_foundation/resources/view.css +57 -0
  758. data/sproutcore/frameworks/core_foundation/system/application.js +35 -0
  759. data/sproutcore/frameworks/core_foundation/system/browser.js +36 -0
  760. data/sproutcore/frameworks/core_foundation/system/builder.js +210 -0
  761. data/sproutcore/frameworks/core_foundation/system/core_query.js +141 -0
  762. data/sproutcore/frameworks/core_foundation/system/cursor.js +131 -0
  763. data/sproutcore/frameworks/core_foundation/system/device.js +210 -0
  764. data/sproutcore/frameworks/core_foundation/system/event.js +914 -0
  765. data/sproutcore/frameworks/core_foundation/system/json.js +515 -0
  766. data/sproutcore/frameworks/core_foundation/system/locale.js +293 -0
  767. data/sproutcore/frameworks/core_foundation/system/page.js +108 -0
  768. data/sproutcore/frameworks/core_foundation/system/platform.js +399 -0
  769. data/sproutcore/frameworks/core_foundation/system/ready.js +77 -0
  770. data/sproutcore/frameworks/core_foundation/system/render_context.js +1063 -0
  771. data/sproutcore/frameworks/core_foundation/system/responder.js +124 -0
  772. data/sproutcore/frameworks/core_foundation/system/root_responder.js +2173 -0
  773. data/sproutcore/frameworks/core_foundation/system/selection_set.js +695 -0
  774. data/sproutcore/frameworks/core_foundation/system/sparse_array.js +393 -0
  775. data/sproutcore/frameworks/core_foundation/system/theme.js +316 -0
  776. data/sproutcore/frameworks/core_foundation/system/timer.js +553 -0
  777. data/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
  778. data/sproutcore/frameworks/core_foundation/system/utils/rect.js +98 -0
  779. data/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +218 -0
  780. data/sproutcore/frameworks/core_foundation/tests/controllers/array/enum_case.js +206 -0
  781. data/sproutcore/frameworks/core_foundation/tests/controllers/array/null_case.js +64 -0
  782. data/sproutcore/frameworks/core_foundation/tests/controllers/array/selection_support.js +344 -0
  783. data/sproutcore/frameworks/core_foundation/tests/controllers/array/single_case.js +136 -0
  784. data/sproutcore/frameworks/core_foundation/tests/controllers/object/empty_case.js +82 -0
  785. data/sproutcore/frameworks/core_foundation/tests/controllers/object/multiple_case.js +111 -0
  786. data/sproutcore/frameworks/core_foundation/tests/controllers/object/single_case.js +193 -0
  787. data/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +265 -0
  788. data/sproutcore/frameworks/core_foundation/tests/mixins/responder_context.js +75 -0
  789. data/sproutcore/frameworks/core_foundation/tests/mixins/string.js +55 -0
  790. data/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
  791. data/sproutcore/frameworks/core_foundation/tests/system/builder.js +42 -0
  792. data/sproutcore/frameworks/core_foundation/tests/system/core_query/within.js +65 -0
  793. data/sproutcore/frameworks/core_foundation/tests/system/json.js +14 -0
  794. data/sproutcore/frameworks/core_foundation/tests/system/locale.js +134 -0
  795. data/sproutcore/frameworks/core_foundation/tests/system/ready/done.js +32 -0
  796. data/sproutcore/frameworks/core_foundation/tests/system/render_context/begin.js +47 -0
  797. data/sproutcore/frameworks/core_foundation/tests/system/render_context/element.js +44 -0
  798. data/sproutcore/frameworks/core_foundation/tests/system/render_context/end.js +124 -0
  799. data/sproutcore/frameworks/core_foundation/tests/system/render_context/get.js +51 -0
  800. data/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_attr.js +50 -0
  801. data/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_basic.js +28 -0
  802. data/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_className.js +177 -0
  803. data/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +109 -0
  804. data/sproutcore/frameworks/core_foundation/tests/system/render_context/init.js +55 -0
  805. data/sproutcore/frameworks/core_foundation/tests/system/render_context/join.js +28 -0
  806. data/sproutcore/frameworks/core_foundation/tests/system/render_context/push_text.js +74 -0
  807. data/sproutcore/frameworks/core_foundation/tests/system/render_context/tag.js +46 -0
  808. data/sproutcore/frameworks/core_foundation/tests/system/render_context/update.js +218 -0
  809. data/sproutcore/frameworks/core_foundation/tests/system/root_responder/makeKeyPane.js +124 -0
  810. data/sproutcore/frameworks/core_foundation/tests/system/root_responder/makeMainPane.js +68 -0
  811. data/sproutcore/frameworks/core_foundation/tests/system/root_responder/makeMenuPane.js +48 -0
  812. data/sproutcore/frameworks/core_foundation/tests/system/root_responder/root_responder.js +101 -0
  813. data/sproutcore/frameworks/core_foundation/tests/system/root_responder/targetForAction.js +288 -0
  814. data/sproutcore/frameworks/core_foundation/tests/system/selection_set/add.js +92 -0
  815. data/sproutcore/frameworks/core_foundation/tests/system/selection_set/copy.js +17 -0
  816. data/sproutcore/frameworks/core_foundation/tests/system/selection_set/indexSetForSource.js +98 -0
  817. data/sproutcore/frameworks/core_foundation/tests/system/selection_set/isEqual.js +60 -0
  818. data/sproutcore/frameworks/core_foundation/tests/system/selection_set/remove.js +111 -0
  819. data/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +194 -0
  820. data/sproutcore/frameworks/core_foundation/tests/system/theme.js +77 -0
  821. data/sproutcore/frameworks/core_foundation/tests/system/timer/invalidate.js +38 -0
  822. data/sproutcore/frameworks/core_foundation/tests/system/timer/invokeLater.js +203 -0
  823. data/sproutcore/frameworks/core_foundation/tests/system/timer/isPaused.js +71 -0
  824. data/sproutcore/frameworks/core_foundation/tests/system/timer/performAction.js +69 -0
  825. data/sproutcore/frameworks/core_foundation/tests/system/timer/schedule.js +170 -0
  826. data/sproutcore/frameworks/core_foundation/tests/system/utils/normalizeURL.js +18 -0
  827. data/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +271 -0
  828. data/sproutcore/frameworks/core_foundation/tests/system/utils/rect.js +99 -0
  829. data/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
  830. data/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +218 -0
  831. data/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
  832. data/sproutcore/frameworks/core_foundation/tests/views/pane/firstResponder.js +148 -0
  833. data/sproutcore/frameworks/core_foundation/tests/views/pane/keyPane.js +133 -0
  834. data/sproutcore/frameworks/core_foundation/tests/views/pane/layout.js +31 -0
  835. data/sproutcore/frameworks/core_foundation/tests/views/pane/sendEvent.js +206 -0
  836. data/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
  837. data/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
  838. data/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +111 -0
  839. data/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +100 -0
  840. data/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +580 -0
  841. data/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +376 -0
  842. data/sproutcore/frameworks/core_foundation/tests/views/view/build.js +85 -0
  843. data/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +89 -0
  844. data/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +117 -0
  845. data/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +248 -0
  846. data/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +145 -0
  847. data/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +132 -0
  848. data/sproutcore/frameworks/core_foundation/tests/views/view/createLayer.js +97 -0
  849. data/sproutcore/frameworks/core_foundation/tests/views/view/destroyLayer.js +83 -0
  850. data/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +51 -0
  851. data/sproutcore/frameworks/core_foundation/tests/views/view/findLayerInParentLayer.js +50 -0
  852. data/sproutcore/frameworks/core_foundation/tests/views/view/init.js +50 -0
  853. data/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +217 -0
  854. data/sproutcore/frameworks/core_foundation/tests/views/view/isVisible.js +79 -0
  855. data/sproutcore/frameworks/core_foundation/tests/views/view/isVisibleInWindow.js +116 -0
  856. data/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
  857. data/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +150 -0
  858. data/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +162 -0
  859. data/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
  860. data/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +735 -0
  861. data/sproutcore/frameworks/core_foundation/tests/views/view/parentViewDidChange.js +67 -0
  862. data/sproutcore/frameworks/core_foundation/tests/views/view/prepareContext.js +203 -0
  863. data/sproutcore/frameworks/core_foundation/tests/views/view/removeChild.js +189 -0
  864. data/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
  865. data/sproutcore/frameworks/core_foundation/tests/views/view/render_delegate_support.js +163 -0
  866. data/sproutcore/frameworks/core_foundation/tests/views/view/replaceChild.js +29 -0
  867. data/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
  868. data/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +43 -0
  869. data/sproutcore/frameworks/core_foundation/tests/views/view/updateLayer.js +148 -0
  870. data/sproutcore/frameworks/core_foundation/tests/views/view/updateLayerLocation.js +213 -0
  871. data/sproutcore/frameworks/core_foundation/tests/views/view/view.js +64 -0
  872. data/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +202 -0
  873. data/sproutcore/frameworks/core_foundation/views/template.js +77 -0
  874. data/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
  875. data/sproutcore/frameworks/core_foundation/views/template/collection.js +106 -0
  876. data/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
  877. data/sproutcore/frameworks/core_foundation/views/view.js +1458 -0
  878. data/sproutcore/frameworks/core_foundation/views/view/animation.js +181 -0
  879. data/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
  880. data/sproutcore/frameworks/core_foundation/views/view/cursor.js +48 -0
  881. data/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
  882. data/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
  883. data/sproutcore/frameworks/core_foundation/views/view/layout.js +1087 -0
  884. data/sproutcore/frameworks/core_foundation/views/view/layout_style.js +618 -0
  885. data/sproutcore/frameworks/core_foundation/views/view/manipulation.js +426 -0
  886. data/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
  887. data/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
  888. data/sproutcore/frameworks/core_foundation/views/view/visibility.js +118 -0
  889. data/sproutcore/frameworks/core_tools/core.js +20 -0
  890. data/sproutcore/frameworks/core_tools/data_source.js +99 -0
  891. data/sproutcore/frameworks/core_tools/english.lproj/strings.js +15 -0
  892. data/sproutcore/frameworks/core_tools/fixtures/target.js +87 -0
  893. data/sproutcore/frameworks/core_tools/fixtures/test.js +44 -0
  894. data/sproutcore/frameworks/core_tools/models/target.js +108 -0
  895. data/sproutcore/frameworks/core_tools/models/test.js +48 -0
  896. data/sproutcore/frameworks/datastore/core.js +8 -0
  897. data/sproutcore/frameworks/datastore/data_sources/cascade.js +180 -0
  898. data/sproutcore/frameworks/datastore/data_sources/data_source.js +583 -0
  899. data/sproutcore/frameworks/datastore/data_sources/fixtures.js +393 -0
  900. data/sproutcore/frameworks/datastore/debug/json.js +71 -0
  901. data/sproutcore/frameworks/datastore/debug/standard_setup.js +96 -0
  902. data/sproutcore/frameworks/datastore/fixtures/author_fixtures.js +2503 -0
  903. data/sproutcore/frameworks/datastore/fixtures/sample.js +17 -0
  904. data/sproutcore/frameworks/datastore/models/child_attribute.js +96 -0
  905. data/sproutcore/frameworks/datastore/models/children_attribute.js +75 -0
  906. data/sproutcore/frameworks/datastore/models/fetched_attribute.js +100 -0
  907. data/sproutcore/frameworks/datastore/models/many_attribute.js +154 -0
  908. data/sproutcore/frameworks/datastore/models/record.js +1318 -0
  909. data/sproutcore/frameworks/datastore/models/record_attribute.js +567 -0
  910. data/sproutcore/frameworks/datastore/models/single_attribute.js +159 -0
  911. data/sproutcore/frameworks/datastore/system/child_array.js +222 -0
  912. data/sproutcore/frameworks/datastore/system/many_array.js +418 -0
  913. data/sproutcore/frameworks/datastore/system/nested_store.js +609 -0
  914. data/sproutcore/frameworks/datastore/system/query.js +1599 -0
  915. data/sproutcore/frameworks/datastore/system/record_array.js +710 -0
  916. data/sproutcore/frameworks/datastore/system/store.js +2860 -0
  917. data/sproutcore/frameworks/datastore/tests/data_sources/cascade.js +133 -0
  918. data/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +122 -0
  919. data/sproutcore/frameworks/datastore/tests/integration/contact_model.js +131 -0
  920. data/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +119 -0
  921. data/sproutcore/frameworks/datastore/tests/integration/mail_model.js +91 -0
  922. data/sproutcore/frameworks/datastore/tests/integration/test_runner_model.js +56 -0
  923. data/sproutcore/frameworks/datastore/tests/models/datetime_recordattribute.js +73 -0
  924. data/sproutcore/frameworks/datastore/tests/models/many_attribute.js +423 -0
  925. data/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +180 -0
  926. data/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +309 -0
  927. data/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +363 -0
  928. data/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +421 -0
  929. data/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +304 -0
  930. data/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +55 -0
  931. data/sproutcore/frameworks/datastore/tests/models/record/destroy.js +92 -0
  932. data/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
  933. data/sproutcore/frameworks/datastore/tests/models/record/normalize.js +336 -0
  934. data/sproutcore/frameworks/datastore/tests/models/record/readAttribute.js +53 -0
  935. data/sproutcore/frameworks/datastore/tests/models/record/refresh.js +48 -0
  936. data/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +170 -0
  937. data/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +66 -0
  938. data/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +112 -0
  939. data/sproutcore/frameworks/datastore/tests/models/record_attribute.js +252 -0
  940. data/sproutcore/frameworks/datastore/tests/models/single_attribute.js +284 -0
  941. data/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +204 -0
  942. data/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +180 -0
  943. data/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +173 -0
  944. data/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +158 -0
  945. data/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
  946. data/sproutcore/frameworks/datastore/tests/system/nested_store/dataHashDidChange.js +113 -0
  947. data/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +102 -0
  948. data/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +180 -0
  949. data/sproutcore/frameworks/datastore/tests/system/nested_store/readEditableDataHash.js +126 -0
  950. data/sproutcore/frameworks/datastore/tests/system/nested_store/removeDataHash.js +163 -0
  951. data/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +166 -0
  952. data/sproutcore/frameworks/datastore/tests/system/query/builders.js +219 -0
  953. data/sproutcore/frameworks/datastore/tests/system/query/compare.js +144 -0
  954. data/sproutcore/frameworks/datastore/tests/system/query/contains.js +131 -0
  955. data/sproutcore/frameworks/datastore/tests/system/query/containsRecordTypes.js +81 -0
  956. data/sproutcore/frameworks/datastore/tests/system/query/copy.js +30 -0
  957. data/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +197 -0
  958. data/sproutcore/frameworks/datastore/tests/system/query/evaluation_of_records.js +92 -0
  959. data/sproutcore/frameworks/datastore/tests/system/query/expandedRecordTypes.js +64 -0
  960. data/sproutcore/frameworks/datastore/tests/system/query/parse.js +216 -0
  961. data/sproutcore/frameworks/datastore/tests/system/query/queryWithScope.js +57 -0
  962. data/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +47 -0
  963. data/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +70 -0
  964. data/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +71 -0
  965. data/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +177 -0
  966. data/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
  967. data/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +214 -0
  968. data/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +54 -0
  969. data/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +137 -0
  970. data/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +221 -0
  971. data/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +156 -0
  972. data/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +76 -0
  973. data/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +157 -0
  974. data/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +278 -0
  975. data/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +110 -0
  976. data/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
  977. data/sproutcore/frameworks/datastore/tests/system/store/find.js +530 -0
  978. data/sproutcore/frameworks/datastore/tests/system/store/init.js +23 -0
  979. data/sproutcore/frameworks/datastore/tests/system/store/loadRecord.js +64 -0
  980. data/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +61 -0
  981. data/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +74 -0
  982. data/sproutcore/frameworks/datastore/tests/system/store/readEditableDataHash.js +74 -0
  983. data/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +76 -0
  984. data/sproutcore/frameworks/datastore/tests/system/store/removeDataHash.js +144 -0
  985. data/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +200 -0
  986. data/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js +41 -0
  987. data/sproutcore/frameworks/datastore/tests/system/store/writeDataHash.js +125 -0
  988. data/sproutcore/frameworks/datetime/resources/strings.js +14 -0
  989. data/sproutcore/frameworks/datetime/system/datetime.js +1111 -0
  990. data/sproutcore/frameworks/datetime/tests/system/datetime.js +383 -0
  991. data/sproutcore/frameworks/debug/core.js +114 -0
  992. data/sproutcore/frameworks/debug/invoke_once_last_debugging.js +259 -0
  993. data/sproutcore/frameworks/designer/coders/design.js +20 -0
  994. data/sproutcore/frameworks/designer/coders/object.js +347 -0
  995. data/sproutcore/frameworks/designer/controllers/controllers.js +16 -0
  996. data/sproutcore/frameworks/designer/controllers/design.js +37 -0
  997. data/sproutcore/frameworks/designer/controllers/designs.js +133 -0
  998. data/sproutcore/frameworks/designer/controllers/page_design.js +170 -0
  999. data/sproutcore/frameworks/designer/controllers/page_files.js +22 -0
  1000. data/sproutcore/frameworks/designer/core.js +26 -0
  1001. data/sproutcore/frameworks/designer/css/css_rule.js +22 -0
  1002. data/sproutcore/frameworks/designer/css/css_style.js +29 -0
  1003. data/sproutcore/frameworks/designer/css/css_style_sheet.js +201 -0
  1004. data/sproutcore/frameworks/designer/designers/button.js +21 -0
  1005. data/sproutcore/frameworks/designer/designers/label.js +16 -0
  1006. data/sproutcore/frameworks/designer/designers/object_designer.js +296 -0
  1007. data/sproutcore/frameworks/designer/designers/tab.js +18 -0
  1008. data/sproutcore/frameworks/designer/designers/text_field.js +15 -0
  1009. data/sproutcore/frameworks/designer/designers/view_designer.js +1267 -0
  1010. data/sproutcore/frameworks/designer/english.lproj/css/designer.css +96 -0
  1011. data/sproutcore/frameworks/designer/english.lproj/design_page.js +55 -0
  1012. data/sproutcore/frameworks/designer/english.lproj/high_light.css +10 -0
  1013. data/sproutcore/frameworks/designer/english.lproj/images/controller.png +0 -0
  1014. data/sproutcore/frameworks/designer/english.lproj/images/dock-bg.png +0 -0
  1015. data/sproutcore/frameworks/designer/english.lproj/images/dock-item-bg.png +0 -0
  1016. data/sproutcore/frameworks/designer/english.lproj/images/dock-item-divider.png +0 -0
  1017. data/sproutcore/frameworks/designer/english.lproj/images/dock-item-sel-bg.png +0 -0
  1018. data/sproutcore/frameworks/designer/english.lproj/images/dock-item-sel-divider.png +0 -0
  1019. data/sproutcore/frameworks/designer/english.lproj/images/main-bg.png +0 -0
  1020. data/sproutcore/frameworks/designer/english.lproj/images/page.png +0 -0
  1021. data/sproutcore/frameworks/designer/english.lproj/images/pane.png +0 -0
  1022. data/sproutcore/frameworks/designer/english.lproj/images/view.png +0 -0
  1023. data/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
  1024. data/sproutcore/frameworks/designer/ext/binding.js +33 -0
  1025. data/sproutcore/frameworks/designer/ext/object.js +26 -0
  1026. data/sproutcore/frameworks/designer/ext/page.js +58 -0
  1027. data/sproutcore/frameworks/designer/ext/view.js +27 -0
  1028. data/sproutcore/frameworks/designer/mixins/button.js +11 -0
  1029. data/sproutcore/frameworks/designer/mixins/snap_lines.js +221 -0
  1030. data/sproutcore/frameworks/designer/tests/coders/page.js +54 -0
  1031. data/sproutcore/frameworks/designer/tests/designers/view_designer.js +47 -0
  1032. data/sproutcore/frameworks/designer/views/designer_drop_target.js +144 -0
  1033. data/sproutcore/frameworks/designer/views/drawing.js +219 -0
  1034. data/sproutcore/frameworks/designer/views/high_light.js +66 -0
  1035. data/sproutcore/frameworks/designer/views/page_item_view.js +130 -0
  1036. data/sproutcore/frameworks/designer/views/selection_handles.js +78 -0
  1037. data/sproutcore/frameworks/desktop/.greenhouseconf +218 -0
  1038. data/sproutcore/frameworks/desktop/core.js +18 -0
  1039. data/sproutcore/frameworks/desktop/debug/drag.js +41 -0
  1040. data/sproutcore/frameworks/desktop/english.lproj/alert.css +56 -0
  1041. data/sproutcore/frameworks/desktop/english.lproj/debug/a_sample_image.jpg +0 -0
  1042. data/sproutcore/frameworks/desktop/english.lproj/debug/apple-logo1.jpeg +0 -0
  1043. data/sproutcore/frameworks/desktop/english.lproj/debug/iframe.html +23 -0
  1044. data/sproutcore/frameworks/desktop/english.lproj/disclosure.css +74 -0
  1045. data/sproutcore/frameworks/desktop/english.lproj/drag.css +7 -0
  1046. data/sproutcore/frameworks/desktop/english.lproj/icons.css +943 -0
  1047. data/sproutcore/frameworks/desktop/english.lproj/images/cap.png +0 -0
  1048. data/sproutcore/frameworks/desktop/english.lproj/images/downbutton.png +0 -0
  1049. data/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  1050. data/sproutcore/frameworks/desktop/english.lproj/images/thumb-bottom.png +0 -0
  1051. data/sproutcore/frameworks/desktop/english.lproj/images/thumb-center.png +0 -0
  1052. data/sproutcore/frameworks/desktop/english.lproj/images/thumb-top.png +0 -0
  1053. data/sproutcore/frameworks/desktop/english.lproj/images/track.png +0 -0
  1054. data/sproutcore/frameworks/desktop/english.lproj/images/upbutton.png +0 -0
  1055. data/sproutcore/frameworks/desktop/english.lproj/list_item.css +185 -0
  1056. data/sproutcore/frameworks/desktop/english.lproj/menu.css +12 -0
  1057. data/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +109 -0
  1058. data/sproutcore/frameworks/desktop/english.lproj/modal.css +9 -0
  1059. data/sproutcore/frameworks/desktop/english.lproj/panel.css +91 -0
  1060. data/sproutcore/frameworks/desktop/english.lproj/picker.css +35 -0
  1061. data/sproutcore/frameworks/desktop/english.lproj/progress.css +33 -0
  1062. data/sproutcore/frameworks/desktop/english.lproj/radio.css +10 -0
  1063. data/sproutcore/frameworks/desktop/english.lproj/segmented.css +132 -0
  1064. data/sproutcore/frameworks/desktop/english.lproj/separator.css +19 -0
  1065. data/sproutcore/frameworks/desktop/english.lproj/slider.css +66 -0
  1066. data/sproutcore/frameworks/desktop/english.lproj/split.css +0 -0
  1067. data/sproutcore/frameworks/desktop/english.lproj/split_divider.css +6 -0
  1068. data/sproutcore/frameworks/desktop/english.lproj/strings.js +14 -0
  1069. data/sproutcore/frameworks/desktop/english.lproj/tab.css +7 -0
  1070. data/sproutcore/frameworks/desktop/english.lproj/toolbar.css +5 -0
  1071. data/sproutcore/frameworks/desktop/english.lproj/touch-scroller.css +196 -0
  1072. data/sproutcore/frameworks/desktop/english.lproj/well.css +71 -0
  1073. data/sproutcore/frameworks/desktop/mixins/border.js +151 -0
  1074. data/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +694 -0
  1075. data/sproutcore/frameworks/desktop/mixins/collection_group.js +22 -0
  1076. data/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +95 -0
  1077. data/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +295 -0
  1078. data/sproutcore/frameworks/desktop/mixins/navigation_builder.js +130 -0
  1079. data/sproutcore/frameworks/desktop/mixins/scrollable.js +253 -0
  1080. data/sproutcore/frameworks/desktop/panes/alert.js +457 -0
  1081. data/sproutcore/frameworks/desktop/panes/menu.js +1141 -0
  1082. data/sproutcore/frameworks/desktop/panes/modal.js +71 -0
  1083. data/sproutcore/frameworks/desktop/panes/palette.js +74 -0
  1084. data/sproutcore/frameworks/desktop/panes/panel.js +207 -0
  1085. data/sproutcore/frameworks/desktop/panes/picker.js +796 -0
  1086. data/sproutcore/frameworks/desktop/panes/select_button.js +895 -0
  1087. data/sproutcore/frameworks/desktop/panes/sheet.js +214 -0
  1088. data/sproutcore/frameworks/desktop/protocols/drag_data_source.js +39 -0
  1089. data/sproutcore/frameworks/desktop/protocols/drag_source.js +81 -0
  1090. data/sproutcore/frameworks/desktop/protocols/drop_target.js +175 -0
  1091. data/sproutcore/frameworks/desktop/protocols/responder.js +299 -0
  1092. data/sproutcore/frameworks/desktop/render_delegates/button.js +105 -0
  1093. data/sproutcore/frameworks/desktop/render_delegates/checkbox.js +100 -0
  1094. data/sproutcore/frameworks/desktop/render_delegates/collection.js +24 -0
  1095. data/sproutcore/frameworks/desktop/render_delegates/disclosure.js +69 -0
  1096. data/sproutcore/frameworks/desktop/render_delegates/helpers/slicing.js +34 -0
  1097. data/sproutcore/frameworks/desktop/render_delegates/image_button.js +30 -0
  1098. data/sproutcore/frameworks/desktop/render_delegates/master_detail.js +28 -0
  1099. data/sproutcore/frameworks/desktop/render_delegates/menu.js +47 -0
  1100. data/sproutcore/frameworks/desktop/render_delegates/panel.js +28 -0
  1101. data/sproutcore/frameworks/desktop/render_delegates/picker.js +43 -0
  1102. data/sproutcore/frameworks/desktop/render_delegates/progress.js +187 -0
  1103. data/sproutcore/frameworks/desktop/render_delegates/radio.js +95 -0
  1104. data/sproutcore/frameworks/desktop/render_delegates/radio_group.js +109 -0
  1105. data/sproutcore/frameworks/desktop/render_delegates/segment.js +55 -0
  1106. data/sproutcore/frameworks/desktop/render_delegates/segmented.js +77 -0
  1107. data/sproutcore/frameworks/desktop/render_delegates/slider.js +58 -0
  1108. data/sproutcore/frameworks/desktop/render_delegates/source_list.js +8 -0
  1109. data/sproutcore/frameworks/desktop/render_delegates/toolbar.js +18 -0
  1110. data/sproutcore/frameworks/desktop/render_delegates/well.js +27 -0
  1111. data/sproutcore/frameworks/desktop/render_delegates/workspace.js +18 -0
  1112. data/sproutcore/frameworks/desktop/system/drag.js +974 -0
  1113. data/sproutcore/frameworks/desktop/system/key_bindings.js +40 -0
  1114. data/sproutcore/frameworks/desktop/system/undo_manager.js +187 -0
  1115. data/sproutcore/frameworks/desktop/tests/integration/dialog.js +48 -0
  1116. data/sproutcore/frameworks/desktop/tests/mixins/border.js +97 -0
  1117. data/sproutcore/frameworks/desktop/tests/panes/alert/methods.js +10 -0
  1118. data/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +158 -0
  1119. data/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +135 -0
  1120. data/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +258 -0
  1121. data/sproutcore/frameworks/desktop/tests/panes/palette/methods.js +10 -0
  1122. data/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +35 -0
  1123. data/sproutcore/frameworks/desktop/tests/panes/pane_page.js +41 -0
  1124. data/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +10 -0
  1125. data/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +83 -0
  1126. data/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +10 -0
  1127. data/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +92 -0
  1128. data/sproutcore/frameworks/desktop/tests/panes/select_button/methods.js +194 -0
  1129. data/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +220 -0
  1130. data/sproutcore/frameworks/desktop/tests/panes/sheet/methods.js +10 -0
  1131. data/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +44 -0
  1132. data/sproutcore/frameworks/desktop/tests/views/button/methods.js +166 -0
  1133. data/sproutcore/frameworks/desktop/tests/views/button/ui.js +236 -0
  1134. data/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +126 -0
  1135. data/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +124 -0
  1136. data/sproutcore/frameworks/desktop/tests/views/collection/content.js +249 -0
  1137. data/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +82 -0
  1138. data/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +215 -0
  1139. data/sproutcore/frameworks/desktop/tests/views/collection/displayProperties.js +31 -0
  1140. data/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +300 -0
  1141. data/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +65 -0
  1142. data/sproutcore/frameworks/desktop/tests/views/collection/length.js +88 -0
  1143. data/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +240 -0
  1144. data/sproutcore/frameworks/desktop/tests/views/collection/nowShowing.js +121 -0
  1145. data/sproutcore/frameworks/desktop/tests/views/collection/reload.js +177 -0
  1146. data/sproutcore/frameworks/desktop/tests/views/collection/select.js +240 -0
  1147. data/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +205 -0
  1148. data/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +211 -0
  1149. data/sproutcore/frameworks/desktop/tests/views/collection/selection.js +141 -0
  1150. data/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +188 -0
  1151. data/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +76 -0
  1152. data/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +456 -0
  1153. data/sproutcore/frameworks/desktop/tests/views/disclosure/methods.js +10 -0
  1154. data/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +104 -0
  1155. data/sproutcore/frameworks/desktop/tests/views/grid/methods.js +10 -0
  1156. data/sproutcore/frameworks/desktop/tests/views/grid/ui.js +10 -0
  1157. data/sproutcore/frameworks/desktop/tests/views/image_button/ui.js +25 -0
  1158. data/sproutcore/frameworks/desktop/tests/views/list/render.js +92 -0
  1159. data/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +183 -0
  1160. data/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +133 -0
  1161. data/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +131 -0
  1162. data/sproutcore/frameworks/desktop/tests/views/list/ui_alternatingrows.js +130 -0
  1163. data/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +56 -0
  1164. data/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +205 -0
  1165. data/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +127 -0
  1166. data/sproutcore/frameworks/desktop/tests/views/list_item.js +396 -0
  1167. data/sproutcore/frameworks/desktop/tests/views/menu_item/methods.js +10 -0
  1168. data/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js +46 -0
  1169. data/sproutcore/frameworks/desktop/tests/views/progress/methods.js +128 -0
  1170. data/sproutcore/frameworks/desktop/tests/views/progress/ui.js +421 -0
  1171. data/sproutcore/frameworks/desktop/tests/views/radio/methods.js +119 -0
  1172. data/sproutcore/frameworks/desktop/tests/views/radio/ui.js +349 -0
  1173. data/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +143 -0
  1174. data/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +162 -0
  1175. data/sproutcore/frameworks/desktop/tests/views/scroller.js +118 -0
  1176. data/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +108 -0
  1177. data/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +457 -0
  1178. data/sproutcore/frameworks/desktop/tests/views/select/methods.js +144 -0
  1179. data/sproutcore/frameworks/desktop/tests/views/select/ui.js +224 -0
  1180. data/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +163 -0
  1181. data/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +117 -0
  1182. data/sproutcore/frameworks/desktop/tests/views/separator.js +44 -0
  1183. data/sproutcore/frameworks/desktop/tests/views/source_list/methods.js +10 -0
  1184. data/sproutcore/frameworks/desktop/tests/views/source_list/ui.js +10 -0
  1185. data/sproutcore/frameworks/desktop/tests/views/split/methods.js +60 -0
  1186. data/sproutcore/frameworks/desktop/tests/views/split/ui.js +59 -0
  1187. data/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +238 -0
  1188. data/sproutcore/frameworks/desktop/tests/views/static_content.js +46 -0
  1189. data/sproutcore/frameworks/desktop/tests/views/tab/methods.js +54 -0
  1190. data/sproutcore/frameworks/desktop/tests/views/tab/ui.js +92 -0
  1191. data/sproutcore/frameworks/desktop/tests/views/toolbar/method.js +33 -0
  1192. data/sproutcore/frameworks/desktop/tests/views/toolbar/ui.js +29 -0
  1193. data/sproutcore/frameworks/desktop/tests/views/web/methods.js +10 -0
  1194. data/sproutcore/frameworks/desktop/tests/views/web/ui.js +110 -0
  1195. data/sproutcore/frameworks/desktop/tests/views/well/ui.js +54 -0
  1196. data/sproutcore/frameworks/desktop/views/button.js +564 -0
  1197. data/sproutcore/frameworks/desktop/views/checkbox.js +110 -0
  1198. data/sproutcore/frameworks/desktop/views/collection.js +3090 -0
  1199. data/sproutcore/frameworks/desktop/views/date_field.js +319 -0
  1200. data/sproutcore/frameworks/desktop/views/disclosure.js +68 -0
  1201. data/sproutcore/frameworks/desktop/views/file.js +112 -0
  1202. data/sproutcore/frameworks/desktop/views/grid.js +207 -0
  1203. data/sproutcore/frameworks/desktop/views/image_button.js +74 -0
  1204. data/sproutcore/frameworks/desktop/views/list.js +637 -0
  1205. data/sproutcore/frameworks/desktop/views/list_item.js +923 -0
  1206. data/sproutcore/frameworks/desktop/views/master_detail.js +257 -0
  1207. data/sproutcore/frameworks/desktop/views/menu_item.js +704 -0
  1208. data/sproutcore/frameworks/desktop/views/menu_scroll.js +615 -0
  1209. data/sproutcore/frameworks/desktop/views/navigation.js +237 -0
  1210. data/sproutcore/frameworks/desktop/views/navigation_bar.js +181 -0
  1211. data/sproutcore/frameworks/desktop/views/popup_button.js +299 -0
  1212. data/sproutcore/frameworks/desktop/views/progress.js +197 -0
  1213. data/sproutcore/frameworks/desktop/views/radio.js +347 -0
  1214. data/sproutcore/frameworks/desktop/views/scene.js +204 -0
  1215. data/sproutcore/frameworks/desktop/views/scroll.js +1824 -0
  1216. data/sproutcore/frameworks/desktop/views/scroller.js +917 -0
  1217. data/sproutcore/frameworks/desktop/views/segment.js +104 -0
  1218. data/sproutcore/frameworks/desktop/views/segmented.js +1002 -0
  1219. data/sproutcore/frameworks/desktop/views/select.js +809 -0
  1220. data/sproutcore/frameworks/desktop/views/select_field.js +344 -0
  1221. data/sproutcore/frameworks/desktop/views/separator.js +36 -0
  1222. data/sproutcore/frameworks/desktop/views/slider.js +291 -0
  1223. data/sproutcore/frameworks/desktop/views/source_list.js +49 -0
  1224. data/sproutcore/frameworks/desktop/views/source_list_group.js +169 -0
  1225. data/sproutcore/frameworks/desktop/views/split.js +891 -0
  1226. data/sproutcore/frameworks/desktop/views/split_divider.js +52 -0
  1227. data/sproutcore/frameworks/desktop/views/stacked.js +110 -0
  1228. data/sproutcore/frameworks/desktop/views/static_content.js +134 -0
  1229. data/sproutcore/frameworks/desktop/views/tab.js +186 -0
  1230. data/sproutcore/frameworks/desktop/views/thumb.js +53 -0
  1231. data/sproutcore/frameworks/desktop/views/toolbar.js +88 -0
  1232. data/sproutcore/frameworks/desktop/views/web.js +87 -0
  1233. data/sproutcore/frameworks/desktop/views/well.js +65 -0
  1234. data/sproutcore/frameworks/desktop/views/workspace.js +251 -0
  1235. data/sproutcore/frameworks/documentation/core.js +0 -0
  1236. data/sproutcore/frameworks/experimental/README.md +23 -0
  1237. data/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
  1238. data/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
  1239. data/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
  1240. data/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
  1241. data/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
  1242. data/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
  1243. data/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
  1244. data/sproutcore/frameworks/forms/english.lproj/default_styles.css +5 -0
  1245. data/sproutcore/frameworks/forms/english.lproj/strings.js +15 -0
  1246. data/sproutcore/frameworks/forms/mixins/edit_mode.js +43 -0
  1247. data/sproutcore/frameworks/forms/mixins/emptiness.js +95 -0
  1248. data/sproutcore/frameworks/forms/renderer_delegates/form.js +22 -0
  1249. data/sproutcore/frameworks/forms/renderer_delegates/form_row.js +21 -0
  1250. data/sproutcore/frameworks/forms/tests/views/form.js +15 -0
  1251. data/sproutcore/frameworks/forms/tests/views/form_checkbox_field.js +15 -0
  1252. data/sproutcore/frameworks/forms/tests/views/form_field.js +15 -0
  1253. data/sproutcore/frameworks/forms/tests/views/form_label.js +15 -0
  1254. data/sproutcore/frameworks/forms/tests/views/form_radio_field.js +15 -0
  1255. data/sproutcore/frameworks/forms/tests/views/form_row.js +15 -0
  1256. data/sproutcore/frameworks/forms/tests/views/form_text_field.js +15 -0
  1257. data/sproutcore/frameworks/forms/views/form.js +282 -0
  1258. data/sproutcore/frameworks/forms/views/form_row.js +183 -0
  1259. data/sproutcore/frameworks/foundation/.greenhouseconf +35 -0
  1260. data/sproutcore/frameworks/foundation/TESTING +46 -0
  1261. data/sproutcore/frameworks/foundation/controllers/tree.js +127 -0
  1262. data/sproutcore/frameworks/foundation/core.js +0 -0
  1263. data/sproutcore/frameworks/foundation/debug/control_test_pane.js +191 -0
  1264. data/sproutcore/frameworks/foundation/english.lproj/benchmark.css +146 -0
  1265. data/sproutcore/frameworks/foundation/english.lproj/blank.gif +0 -0
  1266. data/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +67 -0
  1267. data/sproutcore/frameworks/foundation/english.lproj/button_view.css +40 -0
  1268. data/sproutcore/frameworks/foundation/english.lproj/debug/control-test-pane.css +9 -0
  1269. data/sproutcore/frameworks/foundation/english.lproj/images/favicon.ico +0 -0
  1270. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-logo.png +0 -0
  1271. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-landscape.jpg +0 -0
  1272. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-landscape.png +0 -0
  1273. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-portrait.jpg +0 -0
  1274. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-portrait.png +0 -0
  1275. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup.png +0 -0
  1276. data/sproutcore/frameworks/foundation/english.lproj/images/sproutcore.png +0 -0
  1277. data/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
  1278. data/sproutcore/frameworks/foundation/english.lproj/label.css +47 -0
  1279. data/sproutcore/frameworks/foundation/english.lproj/static_layout.css +5 -0
  1280. data/sproutcore/frameworks/foundation/english.lproj/text_field.css +146 -0
  1281. data/sproutcore/frameworks/foundation/fixtures/file_exists.json +1 -0
  1282. data/sproutcore/frameworks/foundation/fixtures/malformed.json +11 -0
  1283. data/sproutcore/frameworks/foundation/gestures/pinch.js +81 -0
  1284. data/sproutcore/frameworks/foundation/gestures/swipe.js +144 -0
  1285. data/sproutcore/frameworks/foundation/gestures/tap.js +113 -0
  1286. data/sproutcore/frameworks/foundation/license.js +28 -0
  1287. data/sproutcore/frameworks/foundation/mixins/auto_mixin.js +39 -0
  1288. data/sproutcore/frameworks/foundation/mixins/auto_resize.js +233 -0
  1289. data/sproutcore/frameworks/foundation/mixins/button.js +360 -0
  1290. data/sproutcore/frameworks/foundation/mixins/collection_content.js +178 -0
  1291. data/sproutcore/frameworks/foundation/mixins/content_display.js +114 -0
  1292. data/sproutcore/frameworks/foundation/mixins/control.js +422 -0
  1293. data/sproutcore/frameworks/foundation/mixins/editable.js +158 -0
  1294. data/sproutcore/frameworks/foundation/mixins/flowed_layout.js +628 -0
  1295. data/sproutcore/frameworks/foundation/mixins/gestureable.js +214 -0
  1296. data/sproutcore/frameworks/foundation/mixins/inline_editable.js +89 -0
  1297. data/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +139 -0
  1298. data/sproutcore/frameworks/foundation/mixins/inline_text_field.js +589 -0
  1299. data/sproutcore/frameworks/foundation/mixins/inner_frame.js +184 -0
  1300. data/sproutcore/frameworks/foundation/mixins/static_layout.js +77 -0
  1301. data/sproutcore/frameworks/foundation/mixins/string.js +391 -0
  1302. data/sproutcore/frameworks/foundation/mixins/tree_item_content.js +160 -0
  1303. data/sproutcore/frameworks/foundation/mixins/validatable.js +189 -0
  1304. data/sproutcore/frameworks/foundation/private/tree_item_observer.js +914 -0
  1305. data/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +110 -0
  1306. data/sproutcore/frameworks/foundation/render_delegates/container.js +18 -0
  1307. data/sproutcore/frameworks/foundation/render_delegates/image.js +97 -0
  1308. data/sproutcore/frameworks/foundation/render_delegates/label.js +139 -0
  1309. data/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +17 -0
  1310. data/sproutcore/frameworks/foundation/system/benchmark.js +718 -0
  1311. data/sproutcore/frameworks/foundation/system/chance.js +64 -0
  1312. data/sproutcore/frameworks/foundation/system/cookie.js +171 -0
  1313. data/sproutcore/frameworks/foundation/system/core_query.js +56 -0
  1314. data/sproutcore/frameworks/foundation/system/exception_handler.js +88 -0
  1315. data/sproutcore/frameworks/foundation/system/gesture.js +363 -0
  1316. data/sproutcore/frameworks/foundation/system/image_queue.js +433 -0
  1317. data/sproutcore/frameworks/foundation/system/math.js +57 -0
  1318. data/sproutcore/frameworks/foundation/system/module.js +583 -0
  1319. data/sproutcore/frameworks/foundation/system/request.js +596 -0
  1320. data/sproutcore/frameworks/foundation/system/response.js +550 -0
  1321. data/sproutcore/frameworks/foundation/system/routes.js +519 -0
  1322. data/sproutcore/frameworks/foundation/system/staticqueue.js +53 -0
  1323. data/sproutcore/frameworks/foundation/system/task_queue.js +153 -0
  1324. data/sproutcore/frameworks/foundation/system/text_selection.js +103 -0
  1325. data/sproutcore/frameworks/foundation/system/time.js +473 -0
  1326. data/sproutcore/frameworks/foundation/system/user_defaults.js +392 -0
  1327. data/sproutcore/frameworks/foundation/system/utils/colors.js +80 -0
  1328. data/sproutcore/frameworks/foundation/system/utils/misc.js +137 -0
  1329. data/sproutcore/frameworks/foundation/system/utils/range.js +64 -0
  1330. data/sproutcore/frameworks/foundation/system/utils/string_measurement.js +247 -0
  1331. data/sproutcore/frameworks/foundation/tasks/preload_bundle.js +41 -0
  1332. data/sproutcore/frameworks/foundation/tasks/task.js +17 -0
  1333. data/sproutcore/frameworks/foundation/tests/controllers/tree/outline_case.js +108 -0
  1334. data/sproutcore/frameworks/foundation/tests/controllers/tree/selection_support.js +340 -0
  1335. data/sproutcore/frameworks/foundation/tests/debug/control_test_pane/methods.js +10 -0
  1336. data/sproutcore/frameworks/foundation/tests/debug/control_test_pane/ui.js +113 -0
  1337. data/sproutcore/frameworks/foundation/tests/integration/creating_views.js +118 -0
  1338. data/sproutcore/frameworks/foundation/tests/mixins/button/content.js +195 -0
  1339. data/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js +89 -0
  1340. data/sproutcore/frameworks/foundation/tests/mixins/button/keyEquivalents.js +57 -0
  1341. data/sproutcore/frameworks/foundation/tests/mixins/button/ui.js +69 -0
  1342. data/sproutcore/frameworks/foundation/tests/mixins/content_display.js +51 -0
  1343. data/sproutcore/frameworks/foundation/tests/mixins/control/content.js +168 -0
  1344. data/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +89 -0
  1345. data/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +44 -0
  1346. data/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/api.js +52 -0
  1347. data/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +238 -0
  1348. data/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +64 -0
  1349. data/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +144 -0
  1350. data/sproutcore/frameworks/foundation/tests/mixins/string.js +28 -0
  1351. data/sproutcore/frameworks/foundation/tests/mixins/validatable/ui.js +74 -0
  1352. data/sproutcore/frameworks/foundation/tests/private/tree_item_observer/flat_case.js +325 -0
  1353. data/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +718 -0
  1354. data/sproutcore/frameworks/foundation/tests/private/tree_item_observer/outline_case.js +484 -0
  1355. data/sproutcore/frameworks/foundation/tests/system/cookie.js +179 -0
  1356. data/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js +59 -0
  1357. data/sproutcore/frameworks/foundation/tests/system/math.js +39 -0
  1358. data/sproutcore/frameworks/foundation/tests/system/request.js +273 -0
  1359. data/sproutcore/frameworks/foundation/tests/system/routes.js +356 -0
  1360. data/sproutcore/frameworks/foundation/tests/system/task_queue.js +43 -0
  1361. data/sproutcore/frameworks/foundation/tests/system/user_defaults.js +24 -0
  1362. data/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +235 -0
  1363. data/sproutcore/frameworks/foundation/tests/system/utils/range.js +62 -0
  1364. data/sproutcore/frameworks/foundation/tests/validators/credit_card.js +35 -0
  1365. data/sproutcore/frameworks/foundation/tests/validators/date.js +26 -0
  1366. data/sproutcore/frameworks/foundation/tests/validators/not_empty.js +56 -0
  1367. data/sproutcore/frameworks/foundation/tests/validators/number.js +47 -0
  1368. data/sproutcore/frameworks/foundation/tests/validators/password.js +13 -0
  1369. data/sproutcore/frameworks/foundation/tests/validators/validator.js +20 -0
  1370. data/sproutcore/frameworks/foundation/tests/views/container/methods.js +18 -0
  1371. data/sproutcore/frameworks/foundation/tests/views/container/ui.js +145 -0
  1372. data/sproutcore/frameworks/foundation/tests/views/image/ui.js +492 -0
  1373. data/sproutcore/frameworks/foundation/tests/views/label/ui.js +179 -0
  1374. data/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +87 -0
  1375. data/sproutcore/frameworks/foundation/tests/views/text_field/nextValidKeyView.js +110 -0
  1376. data/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +577 -0
  1377. data/sproutcore/frameworks/foundation/validators/credit_card.js +125 -0
  1378. data/sproutcore/frameworks/foundation/validators/date.js +52 -0
  1379. data/sproutcore/frameworks/foundation/validators/date_time.js +48 -0
  1380. data/sproutcore/frameworks/foundation/validators/email.js +45 -0
  1381. data/sproutcore/frameworks/foundation/validators/not_empty.js +37 -0
  1382. data/sproutcore/frameworks/foundation/validators/number.js +99 -0
  1383. data/sproutcore/frameworks/foundation/validators/password.js +86 -0
  1384. data/sproutcore/frameworks/foundation/validators/positive_integer.js +84 -0
  1385. data/sproutcore/frameworks/foundation/validators/validator.js +326 -0
  1386. data/sproutcore/frameworks/foundation/views/container.js +140 -0
  1387. data/sproutcore/frameworks/foundation/views/field.js +337 -0
  1388. data/sproutcore/frameworks/foundation/views/image.js +381 -0
  1389. data/sproutcore/frameworks/foundation/views/label.js +219 -0
  1390. data/sproutcore/frameworks/foundation/views/text_field.js +1073 -0
  1391. data/sproutcore/frameworks/handlebars/extensions.js +44 -0
  1392. data/sproutcore/frameworks/handlebars/extensions/bind.js +156 -0
  1393. data/sproutcore/frameworks/handlebars/extensions/collection.js +75 -0
  1394. data/sproutcore/frameworks/handlebars/extensions/localization.js +5 -0
  1395. data/sproutcore/frameworks/handlebars/extensions/view.js +115 -0
  1396. data/sproutcore/frameworks/handlebars/handlebars.js +1401 -0
  1397. data/sproutcore/frameworks/jquery/jquery-buffer.js +376 -0
  1398. data/sproutcore/frameworks/jquery/jquery-buffered.js +205 -0
  1399. data/sproutcore/frameworks/jquery/jquery-sc.js +7 -0
  1400. data/sproutcore/frameworks/jquery/jquery.js +7179 -0
  1401. data/sproutcore/frameworks/media/.greenhouseconf +29 -0
  1402. data/sproutcore/frameworks/media/resources/controls.png +0 -0
  1403. data/sproutcore/frameworks/media/resources/playeras3.fla +0 -0
  1404. data/sproutcore/frameworks/media/resources/video.css +124 -0
  1405. data/sproutcore/frameworks/media/resources/videoCanvas.swf +0 -0
  1406. data/sproutcore/frameworks/media/views/audio.js +741 -0
  1407. data/sproutcore/frameworks/media/views/controls.js +88 -0
  1408. data/sproutcore/frameworks/media/views/media_slider.js +243 -0
  1409. data/sproutcore/frameworks/media/views/mini_controls.js +63 -0
  1410. data/sproutcore/frameworks/media/views/simple_controls.js +54 -0
  1411. data/sproutcore/frameworks/media/views/video.js +832 -0
  1412. data/sproutcore/frameworks/mini/license.js +29 -0
  1413. data/sproutcore/frameworks/runtime/README +12 -0
  1414. data/sproutcore/frameworks/runtime/core.js +1102 -0
  1415. data/sproutcore/frameworks/runtime/debug/test_suites/array.js +14 -0
  1416. data/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +397 -0
  1417. data/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js +33 -0
  1418. data/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +121 -0
  1419. data/sproutcore/frameworks/runtime/debug/test_suites/array/objectAt.js +34 -0
  1420. data/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js +50 -0
  1421. data/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js +46 -0
  1422. data/sproutcore/frameworks/runtime/debug/test_suites/array/rangeObserver.js +371 -0
  1423. data/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +100 -0
  1424. data/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js +49 -0
  1425. data/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +94 -0
  1426. data/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js +50 -0
  1427. data/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js +47 -0
  1428. data/sproutcore/frameworks/runtime/license.js +29 -0
  1429. data/sproutcore/frameworks/runtime/mixins/array.js +658 -0
  1430. data/sproutcore/frameworks/runtime/mixins/comparable.js +45 -0
  1431. data/sproutcore/frameworks/runtime/mixins/copyable.js +72 -0
  1432. data/sproutcore/frameworks/runtime/mixins/enumerable.js +1426 -0
  1433. data/sproutcore/frameworks/runtime/mixins/freezable.js +110 -0
  1434. data/sproutcore/frameworks/runtime/mixins/observable.js +1408 -0
  1435. data/sproutcore/frameworks/runtime/private/chain_observer.js +178 -0
  1436. data/sproutcore/frameworks/runtime/private/observer_queue.js +178 -0
  1437. data/sproutcore/frameworks/runtime/private/observer_set.js +123 -0
  1438. data/sproutcore/frameworks/runtime/system/binding.js +1000 -0
  1439. data/sproutcore/frameworks/runtime/system/enumerator.js +107 -0
  1440. data/sproutcore/frameworks/runtime/system/error.js +157 -0
  1441. data/sproutcore/frameworks/runtime/system/index_set.js +1199 -0
  1442. data/sproutcore/frameworks/runtime/system/logger.js +1582 -0
  1443. data/sproutcore/frameworks/runtime/system/object.js +947 -0
  1444. data/sproutcore/frameworks/runtime/system/range_observer.js +270 -0
  1445. data/sproutcore/frameworks/runtime/system/run_loop.js +308 -0
  1446. data/sproutcore/frameworks/runtime/system/set.js +536 -0
  1447. data/sproutcore/frameworks/runtime/tests/core/IsEqual.js +30 -0
  1448. data/sproutcore/frameworks/runtime/tests/core/beget.js +23 -0
  1449. data/sproutcore/frameworks/runtime/tests/core/clone.js +108 -0
  1450. data/sproutcore/frameworks/runtime/tests/core/compare.js +44 -0
  1451. data/sproutcore/frameworks/runtime/tests/core/console.js +16 -0
  1452. data/sproutcore/frameworks/runtime/tests/core/guidFor.js +109 -0
  1453. data/sproutcore/frameworks/runtime/tests/core/inspect.js +27 -0
  1454. data/sproutcore/frameworks/runtime/tests/core/itemType.js +71 -0
  1455. data/sproutcore/frameworks/runtime/tests/core/keys.js +20 -0
  1456. data/sproutcore/frameworks/runtime/tests/core/makeArray.js +44 -0
  1457. data/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +19 -0
  1458. data/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +37 -0
  1459. data/sproutcore/frameworks/runtime/tests/mixins/array.js +59 -0
  1460. data/sproutcore/frameworks/runtime/tests/mixins/comparable.js +44 -0
  1461. data/sproutcore/frameworks/runtime/tests/mixins/enumerable.js +658 -0
  1462. data/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +37 -0
  1463. data/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +733 -0
  1464. data/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +155 -0
  1465. data/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +79 -0
  1466. data/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +81 -0
  1467. data/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +55 -0
  1468. data/sproutcore/frameworks/runtime/tests/system/binding.js +395 -0
  1469. data/sproutcore/frameworks/runtime/tests/system/error.js +53 -0
  1470. data/sproutcore/frameworks/runtime/tests/system/index_set/add.js +212 -0
  1471. data/sproutcore/frameworks/runtime/tests/system/index_set/addEach.js +49 -0
  1472. data/sproutcore/frameworks/runtime/tests/system/index_set/clone.js +43 -0
  1473. data/sproutcore/frameworks/runtime/tests/system/index_set/contains.js +74 -0
  1474. data/sproutcore/frameworks/runtime/tests/system/index_set/create.js +42 -0
  1475. data/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js +38 -0
  1476. data/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js +38 -0
  1477. data/sproutcore/frameworks/runtime/tests/system/index_set/intersects.js +74 -0
  1478. data/sproutcore/frameworks/runtime/tests/system/index_set/max.js +40 -0
  1479. data/sproutcore/frameworks/runtime/tests/system/index_set/min.js +50 -0
  1480. data/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js +36 -0
  1481. data/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +189 -0
  1482. data/sproutcore/frameworks/runtime/tests/system/index_set/removeEach.js +49 -0
  1483. data/sproutcore/frameworks/runtime/tests/system/index_set/without.js +89 -0
  1484. data/sproutcore/frameworks/runtime/tests/system/logger.js +260 -0
  1485. data/sproutcore/frameworks/runtime/tests/system/object/base.js +195 -0
  1486. data/sproutcore/frameworks/runtime/tests/system/object/bindings.js +374 -0
  1487. data/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
  1488. data/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
  1489. data/sproutcore/frameworks/runtime/tests/system/observer_set.js +50 -0
  1490. data/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +59 -0
  1491. data/sproutcore/frameworks/runtime/tests/system/range_observer/destroy.js +75 -0
  1492. data/sproutcore/frameworks/runtime/tests/system/range_observer/objectPropertyDidChange.js +117 -0
  1493. data/sproutcore/frameworks/runtime/tests/system/range_observer/rangeDidChange.js +110 -0
  1494. data/sproutcore/frameworks/runtime/tests/system/range_observer/update.js +65 -0
  1495. data/sproutcore/frameworks/runtime/tests/system/run_loop.js +120 -0
  1496. data/sproutcore/frameworks/runtime/tests/system/set.js +318 -0
  1497. data/sproutcore/frameworks/statechart/core.js +5 -0
  1498. data/sproutcore/frameworks/statechart/debug/monitor.js +136 -0
  1499. data/sproutcore/frameworks/statechart/system/state.js +713 -0
  1500. data/sproutcore/frameworks/statechart/system/statechart.js +951 -0
  1501. data/sproutcore/frameworks/statechart/tests/async.js +94 -0
  1502. data/sproutcore/frameworks/statechart/tests/event_handling/advanced_event_handling.js +310 -0
  1503. data/sproutcore/frameworks/statechart/tests/namespace/access_substates.js +252 -0
  1504. data/sproutcore/frameworks/statechart/tests/state/is_current_state.js +64 -0
  1505. data/sproutcore/frameworks/statechart/tests/with_concurrent_states/goto_history_state.js +88 -0
  1506. data/sproutcore/frameworks/statechart/tests/with_concurrent_states/goto_state_advanced.js +234 -0
  1507. data/sproutcore/frameworks/statechart/tests/with_concurrent_states/goto_state_async.js +123 -0
  1508. data/sproutcore/frameworks/statechart/tests/with_concurrent_states/goto_state_basic.js +139 -0
  1509. data/sproutcore/frameworks/statechart/tests/with_concurrent_states/goto_state_intermediate.js +119 -0
  1510. data/sproutcore/frameworks/statechart/tests/with_concurrent_states/send_event.js +183 -0
  1511. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/default_responder.js +90 -0
  1512. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/goto_history_state.js +200 -0
  1513. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/goto_state.js +256 -0
  1514. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/goto_state_async.js +187 -0
  1515. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/send_event.js +122 -0
  1516. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/state_plugin.js +99 -0
  1517. data/sproutcore/frameworks/statechart/tests/without_concurrent_states/transient.js +162 -0
  1518. data/sproutcore/frameworks/table/mixins/table_delegate.js +41 -0
  1519. data/sproutcore/frameworks/table/system/table_column.js +125 -0
  1520. data/sproutcore/frameworks/table/views/table.js +440 -0
  1521. data/sproutcore/frameworks/table/views/table_cell.js +63 -0
  1522. data/sproutcore/frameworks/table/views/table_head.js +158 -0
  1523. data/sproutcore/frameworks/table/views/table_header.js +214 -0
  1524. data/sproutcore/frameworks/table/views/table_row.js +155 -0
  1525. data/sproutcore/frameworks/testing/core.js +196 -0
  1526. data/sproutcore/frameworks/testing/english.lproj/additions.css +8 -0
  1527. data/sproutcore/frameworks/testing/english.lproj/runner.css +128 -0
  1528. data/sproutcore/frameworks/testing/english.lproj/testsuite.css +136 -0
  1529. data/sproutcore/frameworks/testing/extras.js +17 -0
  1530. data/sproutcore/frameworks/testing/jquery.js +3559 -0
  1531. data/sproutcore/frameworks/testing/qunit.js +827 -0
  1532. data/sproutcore/frameworks/testing/system/dump.js +205 -0
  1533. data/sproutcore/frameworks/testing/system/equiv.js +201 -0
  1534. data/sproutcore/frameworks/testing/system/plan.js +703 -0
  1535. data/sproutcore/frameworks/testing/system/runner.js +220 -0
  1536. data/sproutcore/frameworks/testing/system/suite.js +228 -0
  1537. data/sproutcore/frameworks/testing/utils.js +62 -0
  1538. data/sproutcore/lib/index.rhtml +164 -0
  1539. data/sproutcore/license.js +31 -0
  1540. data/sproutcore/themes/ace/designs/dark.png +0 -0
  1541. data/sproutcore/themes/ace/designs/dark.psd +0 -0
  1542. data/sproutcore/themes/ace/designs/light.png +0 -0
  1543. data/sproutcore/themes/ace/designs/light.psd +0 -0
  1544. data/sproutcore/themes/ace/designs/psds/button/ace/18px/active_button.psd +0 -0
  1545. data/sproutcore/themes/ace/designs/psds/button/ace/18px/normal_button.psd +0 -0
  1546. data/sproutcore/themes/ace/designs/psds/button/ace/18px/selected_active_button.psd +0 -0
  1547. data/sproutcore/themes/ace/designs/psds/button/ace/18px/selected_button.psd +0 -0
  1548. data/sproutcore/themes/ace/designs/psds/button/ace/24px/active_button.psd +0 -0
  1549. data/sproutcore/themes/ace/designs/psds/button/ace/24px/active_button_capsule.psd +0 -0
  1550. data/sproutcore/themes/ace/designs/psds/button/ace/24px/active_button_pointer.psd +0 -0
  1551. data/sproutcore/themes/ace/designs/psds/button/ace/24px/normal_button.psd +0 -0
  1552. data/sproutcore/themes/ace/designs/psds/button/ace/24px/normal_button_capsule.psd +0 -0
  1553. data/sproutcore/themes/ace/designs/psds/button/ace/24px/normal_button_pointer.psd +0 -0
  1554. data/sproutcore/themes/ace/designs/psds/button/ace/24px/selected_active_button.psd +0 -0
  1555. data/sproutcore/themes/ace/designs/psds/button/ace/24px/selected_active_button_capsule.psd +0 -0
  1556. data/sproutcore/themes/ace/designs/psds/button/ace/24px/selected_active_button_pointer.psd +0 -0
  1557. data/sproutcore/themes/ace/designs/psds/button/ace/24px/selected_button.psd +0 -0
  1558. data/sproutcore/themes/ace/designs/psds/button/ace/24px/selected_button_capsule.psd +0 -0
  1559. data/sproutcore/themes/ace/designs/psds/button/ace/24px/selected_button_pointer.psd +0 -0
  1560. data/sproutcore/themes/ace/designs/psds/button/ace/30px/active_button.psd +0 -0
  1561. data/sproutcore/themes/ace/designs/psds/button/ace/30px/active_button_pointer.psd +0 -0
  1562. data/sproutcore/themes/ace/designs/psds/button/ace/30px/normal_button.psd +0 -0
  1563. data/sproutcore/themes/ace/designs/psds/button/ace/30px/normal_button_pointer.psd +0 -0
  1564. data/sproutcore/themes/ace/designs/psds/button/ace/30px/selected_active_button.psd +0 -0
  1565. data/sproutcore/themes/ace/designs/psds/button/ace/30px/selected_active_button_pointer.psd +0 -0
  1566. data/sproutcore/themes/ace/designs/psds/button/ace/30px/selected_button.psd +0 -0
  1567. data/sproutcore/themes/ace/designs/psds/button/ace/30px/selected_button_pointer.psd +0 -0
  1568. data/sproutcore/themes/ace/designs/psds/button/ace/44px/active_button.psd +0 -0
  1569. data/sproutcore/themes/ace/designs/psds/button/ace/44px/normal_button.psd +0 -0
  1570. data/sproutcore/themes/ace/designs/psds/button/ace/44px/selected_active_button.psd +0 -0
  1571. data/sproutcore/themes/ace/designs/psds/button/ace/44px/selected_button.psd +0 -0
  1572. data/sproutcore/themes/ace/designs/psds/button/dark/24px/active_button.psd +0 -0
  1573. data/sproutcore/themes/ace/designs/psds/button/dark/24px/active_button_capsule.psd +0 -0
  1574. data/sproutcore/themes/ace/designs/psds/button/dark/24px/active_button_pointer.psd +0 -0
  1575. data/sproutcore/themes/ace/designs/psds/button/dark/24px/normal_button.psd +0 -0
  1576. data/sproutcore/themes/ace/designs/psds/button/dark/24px/normal_button_capsule.psd +0 -0
  1577. data/sproutcore/themes/ace/designs/psds/button/dark/24px/normal_button_pointer.psd +0 -0
  1578. data/sproutcore/themes/ace/designs/psds/button/dark/24px/selected_active_button.psd +0 -0
  1579. data/sproutcore/themes/ace/designs/psds/button/dark/24px/selected_active_button_capsule.psd +0 -0
  1580. data/sproutcore/themes/ace/designs/psds/button/dark/24px/selected_active_button_pointer.psd +0 -0
  1581. data/sproutcore/themes/ace/designs/psds/button/dark/24px/selected_button.psd +0 -0
  1582. data/sproutcore/themes/ace/designs/psds/button/dark/24px/selected_button_capsule.psd +0 -0
  1583. data/sproutcore/themes/ace/designs/psds/button/dark/24px/selected_button_pointer.psd +0 -0
  1584. data/sproutcore/themes/ace/designs/psds/button/dark/30px/active_button.psd +0 -0
  1585. data/sproutcore/themes/ace/designs/psds/button/dark/30px/active_button_pointer.psd +0 -0
  1586. data/sproutcore/themes/ace/designs/psds/button/dark/30px/normal_button.psd +0 -0
  1587. data/sproutcore/themes/ace/designs/psds/button/dark/30px/normal_button_pointer.psd +0 -0
  1588. data/sproutcore/themes/ace/designs/psds/button/dark/30px/selected_active_button.psd +0 -0
  1589. data/sproutcore/themes/ace/designs/psds/button/dark/30px/selected_active_button_pointer.psd +0 -0
  1590. data/sproutcore/themes/ace/designs/psds/button/dark/30px/selected_button.psd +0 -0
  1591. data/sproutcore/themes/ace/designs/psds/button/dark/30px/selected_button_pointer.psd +0 -0
  1592. data/sproutcore/themes/ace/designs/psds/button/popup/active_select.psd +0 -0
  1593. data/sproutcore/themes/ace/designs/psds/button/popup/normal_select.psd +0 -0
  1594. data/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_checked.psd +0 -0
  1595. data/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_checked_active.psd +0 -0
  1596. data/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_mixed.psd +0 -0
  1597. data/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_mixed_active.psd +0 -0
  1598. data/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_unchecked.psd +0 -0
  1599. data/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_unchecked_active.psd +0 -0
  1600. data/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_checked.psd +0 -0
  1601. data/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_checked_active.psd +0 -0
  1602. data/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_mixed.psd +0 -0
  1603. data/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_mixed_active.psd +0 -0
  1604. data/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_unchecked.psd +0 -0
  1605. data/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_unchecked_active.psd +0 -0
  1606. data/sproutcore/themes/ace/designs/psds/collection/source-list/selection.psd +0 -0
  1607. data/sproutcore/themes/ace/designs/psds/disclosure/ace/disclosure_closed.psd +0 -0
  1608. data/sproutcore/themes/ace/designs/psds/disclosure/ace/disclosure_closed_active.psd +0 -0
  1609. data/sproutcore/themes/ace/designs/psds/disclosure/ace/disclosure_open.psd +0 -0
  1610. data/sproutcore/themes/ace/designs/psds/disclosure/ace/disclosure_open_active.psd +0 -0
  1611. data/sproutcore/themes/ace/designs/psds/menu/checkmark.psd +0 -0
  1612. data/sproutcore/themes/ace/designs/psds/menu/checkmark_active.psd +0 -0
  1613. data/sproutcore/themes/ace/designs/psds/menu/down.psd +0 -0
  1614. data/sproutcore/themes/ace/designs/psds/menu/menu.psd +0 -0
  1615. data/sproutcore/themes/ace/designs/psds/menu/menu_item.psd +0 -0
  1616. data/sproutcore/themes/ace/designs/psds/menu/up.psd +0 -0
  1617. data/sproutcore/themes/ace/designs/psds/panel/panel.psd +0 -0
  1618. data/sproutcore/themes/ace/designs/psds/panel/pointers.psd +0 -0
  1619. data/sproutcore/themes/ace/designs/psds/picker/popover/popover.psd +0 -0
  1620. data/sproutcore/themes/ace/designs/psds/picker/popover/popover_empty.psd +0 -0
  1621. data/sproutcore/themes/ace/designs/psds/picker/popover/popover_notoolbar.psd +0 -0
  1622. data/sproutcore/themes/ace/designs/psds/picker/popover/popover_pointers.psd +0 -0
  1623. data/sproutcore/themes/ace/designs/psds/picker/popover/popover_pointers_notoolbar.psd +0 -0
  1624. data/sproutcore/themes/ace/designs/psds/progress/ace/progress_view_content.psd +0 -0
  1625. data/sproutcore/themes/ace/designs/psds/progress/ace/progress_view_indeterminate_content.psd +0 -0
  1626. data/sproutcore/themes/ace/designs/psds/progress/ace/progress_view_track.psd +0 -0
  1627. data/sproutcore/themes/ace/designs/psds/radio/radio_active.psd +0 -0
  1628. data/sproutcore/themes/ace/designs/psds/radio/radio_mixed.psd +0 -0
  1629. data/sproutcore/themes/ace/designs/psds/radio/radio_mixed_active.psd +0 -0
  1630. data/sproutcore/themes/ace/designs/psds/radio/radio_selected.psd +0 -0
  1631. data/sproutcore/themes/ace/designs/psds/radio/radio_selected_active.psd +0 -0
  1632. data/sproutcore/themes/ace/designs/psds/radio/radio_unselected.psd +0 -0
  1633. data/sproutcore/themes/ace/designs/psds/scroller/horizontal/thumb.psd +0 -0
  1634. data/sproutcore/themes/ace/designs/psds/scroller/horizontal/track_and_arrows.psd +0 -0
  1635. data/sproutcore/themes/ace/designs/psds/scroller/horizontal/track_and_arrows_active.psd +0 -0
  1636. data/sproutcore/themes/ace/designs/psds/scroller/vertical/thumb.psd +0 -0
  1637. data/sproutcore/themes/ace/designs/psds/scroller/vertical/track_and_arrows.psd +0 -0
  1638. data/sproutcore/themes/ace/designs/psds/scroller/vertical/track_and_arrows_active.psd +0 -0
  1639. data/sproutcore/themes/ace/designs/psds/segmented/18px/segmented_active.psd +0 -0
  1640. data/sproutcore/themes/ace/designs/psds/segmented/18px/segmented_normal.psd +0 -0
  1641. data/sproutcore/themes/ace/designs/psds/segmented/18px/segmented_selected.psd +0 -0
  1642. data/sproutcore/themes/ace/designs/psds/segmented/18px/segmented_selected_active.psd +0 -0
  1643. data/sproutcore/themes/ace/designs/psds/segmented/24px/segmented_active.psd +0 -0
  1644. data/sproutcore/themes/ace/designs/psds/segmented/24px/segmented_normal.psd +0 -0
  1645. data/sproutcore/themes/ace/designs/psds/segmented/24px/segmented_selected.psd +0 -0
  1646. data/sproutcore/themes/ace/designs/psds/segmented/24px/segmented_selected_active.psd +0 -0
  1647. data/sproutcore/themes/ace/designs/psds/segmented/30px/segmented_active.psd +0 -0
  1648. data/sproutcore/themes/ace/designs/psds/segmented/30px/segmented_normal.psd +0 -0
  1649. data/sproutcore/themes/ace/designs/psds/segmented/30px/segmented_selected.psd +0 -0
  1650. data/sproutcore/themes/ace/designs/psds/segmented/30px/segmented_selected_active.psd +0 -0
  1651. data/sproutcore/themes/ace/designs/psds/segmented/44px/segmented_active.psd +0 -0
  1652. data/sproutcore/themes/ace/designs/psds/segmented/44px/segmented_normal.psd +0 -0
  1653. data/sproutcore/themes/ace/designs/psds/segmented/44px/segmented_selected.psd +0 -0
  1654. data/sproutcore/themes/ace/designs/psds/segmented/44px/segmented_selected_active.psd +0 -0
  1655. data/sproutcore/themes/ace/designs/psds/slider/ace/14px/knob.psd +0 -0
  1656. data/sproutcore/themes/ace/designs/psds/slider/ace/14px/knob_active.psd +0 -0
  1657. data/sproutcore/themes/ace/designs/psds/slider/ace/16px/knob.psd +0 -0
  1658. data/sproutcore/themes/ace/designs/psds/slider/ace/16px/knob_active.psd +0 -0
  1659. data/sproutcore/themes/ace/designs/psds/slider/ace/22px/knob.psd +0 -0
  1660. data/sproutcore/themes/ace/designs/psds/slider/ace/22px/knob_active.psd +0 -0
  1661. data/sproutcore/themes/ace/designs/psds/slider/ace/22px/track.psd +0 -0
  1662. data/sproutcore/themes/ace/designs/psds/slider/ace/track.psd +0 -0
  1663. data/sproutcore/themes/ace/designs/psds/toolbar/toolbar.psd +0 -0
  1664. data/sproutcore/themes/ace/designs/switch/switch.psd +0 -0
  1665. data/sproutcore/themes/ace/designs/switch/switch_handle.png +0 -0
  1666. data/sproutcore/themes/ace/designs/switch/switch_handle.psd +0 -0
  1667. data/sproutcore/themes/ace/designs/switch/switch_off.png +0 -0
  1668. data/sproutcore/themes/ace/designs/switch/switch_off.psd +0 -0
  1669. data/sproutcore/themes/ace/designs/switch/switch_on.png +0 -0
  1670. data/sproutcore/themes/ace/designs/switch/switch_on.psd +0 -0
  1671. data/sproutcore/themes/ace/resources/body.css +13 -0
  1672. data/sproutcore/themes/ace/resources/button/ace/18px/active_button.png +0 -0
  1673. data/sproutcore/themes/ace/resources/button/ace/18px/button.css +33 -0
  1674. data/sproutcore/themes/ace/resources/button/ace/18px/normal_button.png +0 -0
  1675. data/sproutcore/themes/ace/resources/button/ace/18px/selected_active_button.png +0 -0
  1676. data/sproutcore/themes/ace/resources/button/ace/18px/selected_button.png +0 -0
  1677. data/sproutcore/themes/ace/resources/button/ace/24px/active_button.png +0 -0
  1678. data/sproutcore/themes/ace/resources/button/ace/24px/active_button_capsule.png +0 -0
  1679. data/sproutcore/themes/ace/resources/button/ace/24px/active_button_pointer.png +0 -0
  1680. data/sproutcore/themes/ace/resources/button/ace/24px/button.css +98 -0
  1681. data/sproutcore/themes/ace/resources/button/ace/24px/normal_button.png +0 -0
  1682. data/sproutcore/themes/ace/resources/button/ace/24px/normal_button_capsule.png +0 -0
  1683. data/sproutcore/themes/ace/resources/button/ace/24px/normal_button_pointer.png +0 -0
  1684. data/sproutcore/themes/ace/resources/button/ace/24px/selected_active_button.png +0 -0
  1685. data/sproutcore/themes/ace/resources/button/ace/24px/selected_active_button_capsule.png +0 -0
  1686. data/sproutcore/themes/ace/resources/button/ace/24px/selected_active_button_pointer.png +0 -0
  1687. data/sproutcore/themes/ace/resources/button/ace/24px/selected_button.png +0 -0
  1688. data/sproutcore/themes/ace/resources/button/ace/24px/selected_button_capsule.png +0 -0
  1689. data/sproutcore/themes/ace/resources/button/ace/24px/selected_button_pointer.png +0 -0
  1690. data/sproutcore/themes/ace/resources/button/ace/30px/active_button.png +0 -0
  1691. data/sproutcore/themes/ace/resources/button/ace/30px/active_button_pointer.png +0 -0
  1692. data/sproutcore/themes/ace/resources/button/ace/30px/button.css +78 -0
  1693. data/sproutcore/themes/ace/resources/button/ace/30px/normal_button.png +0 -0
  1694. data/sproutcore/themes/ace/resources/button/ace/30px/normal_button_pointer.png +0 -0
  1695. data/sproutcore/themes/ace/resources/button/ace/30px/selected_active_button.png +0 -0
  1696. data/sproutcore/themes/ace/resources/button/ace/30px/selected_active_button_pointer.png +0 -0
  1697. data/sproutcore/themes/ace/resources/button/ace/30px/selected_button.png +0 -0
  1698. data/sproutcore/themes/ace/resources/button/ace/30px/selected_button_pointer.png +0 -0
  1699. data/sproutcore/themes/ace/resources/button/ace/44px/active_button.png +0 -0
  1700. data/sproutcore/themes/ace/resources/button/ace/44px/button.css +39 -0
  1701. data/sproutcore/themes/ace/resources/button/ace/44px/normal_button.png +0 -0
  1702. data/sproutcore/themes/ace/resources/button/ace/44px/selected_active_button.png +0 -0
  1703. data/sproutcore/themes/ace/resources/button/ace/44px/selected_button.png +0 -0
  1704. data/sproutcore/themes/ace/resources/button/ace/button.css +36 -0
  1705. data/sproutcore/themes/ace/resources/button/button.js +75 -0
  1706. data/sproutcore/themes/ace/resources/button/dark/24px/active_button.png +0 -0
  1707. data/sproutcore/themes/ace/resources/button/dark/24px/active_button_capsule.png +0 -0
  1708. data/sproutcore/themes/ace/resources/button/dark/24px/active_button_pointer.png +0 -0
  1709. data/sproutcore/themes/ace/resources/button/dark/24px/button.css +93 -0
  1710. data/sproutcore/themes/ace/resources/button/dark/24px/normal_button.png +0 -0
  1711. data/sproutcore/themes/ace/resources/button/dark/24px/normal_button_capsule.png +0 -0
  1712. data/sproutcore/themes/ace/resources/button/dark/24px/normal_button_pointer.png +0 -0
  1713. data/sproutcore/themes/ace/resources/button/dark/24px/selected_active_button.png +0 -0
  1714. data/sproutcore/themes/ace/resources/button/dark/24px/selected_active_button_capsule.png +0 -0
  1715. data/sproutcore/themes/ace/resources/button/dark/24px/selected_active_button_pointer.png +0 -0
  1716. data/sproutcore/themes/ace/resources/button/dark/24px/selected_button.png +0 -0
  1717. data/sproutcore/themes/ace/resources/button/dark/24px/selected_button_capsule.png +0 -0
  1718. data/sproutcore/themes/ace/resources/button/dark/24px/selected_button_pointer.png +0 -0
  1719. data/sproutcore/themes/ace/resources/button/dark/30px/active_button.png +0 -0
  1720. data/sproutcore/themes/ace/resources/button/dark/30px/active_button_pointer.png +0 -0
  1721. data/sproutcore/themes/ace/resources/button/dark/30px/button.css +72 -0
  1722. data/sproutcore/themes/ace/resources/button/dark/30px/normal_button.png +0 -0
  1723. data/sproutcore/themes/ace/resources/button/dark/30px/normal_button_pointer.png +0 -0
  1724. data/sproutcore/themes/ace/resources/button/dark/30px/selected_active_button.png +0 -0
  1725. data/sproutcore/themes/ace/resources/button/dark/30px/selected_active_button_pointer.png +0 -0
  1726. data/sproutcore/themes/ace/resources/button/dark/30px/selected_button.png +0 -0
  1727. data/sproutcore/themes/ace/resources/button/dark/30px/selected_button_pointer.png +0 -0
  1728. data/sproutcore/themes/ace/resources/button/dark/button.css +17 -0
  1729. data/sproutcore/themes/ace/resources/button/dark/button.js +3 -0
  1730. data/sproutcore/themes/ace/resources/button/popup/active_select.png +0 -0
  1731. data/sproutcore/themes/ace/resources/button/popup/normal_select.png +0 -0
  1732. data/sproutcore/themes/ace/resources/button/popup/select.css +20 -0
  1733. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox.css +40 -0
  1734. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
  1735. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
  1736. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
  1737. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
  1738. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
  1739. data/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
  1740. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox.css +40 -0
  1741. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
  1742. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
  1743. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
  1744. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
  1745. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
  1746. data/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
  1747. data/sproutcore/themes/ace/resources/checkbox/ace/checkbox.css +7 -0
  1748. data/sproutcore/themes/ace/resources/collection/normal/list.css +4 -0
  1749. data/sproutcore/themes/ace/resources/collection/normal/list_item.css +17 -0
  1750. data/sproutcore/themes/ace/resources/collection/source-list/selection.png +0 -0
  1751. data/sproutcore/themes/ace/resources/collection/source-list/source-list.js +3 -0
  1752. data/sproutcore/themes/ace/resources/collection/source-list/source_list_view.css +36 -0
  1753. data/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +24 -0
  1754. data/sproutcore/themes/ace/resources/disclosure/ace/disclosure_closed.png +0 -0
  1755. data/sproutcore/themes/ace/resources/disclosure/ace/disclosure_closed_active.png +0 -0
  1756. data/sproutcore/themes/ace/resources/disclosure/ace/disclosure_open.png +0 -0
  1757. data/sproutcore/themes/ace/resources/disclosure/ace/disclosure_open_active.png +0 -0
  1758. data/sproutcore/themes/ace/resources/imagebutton/ace/imagebutton.css +11 -0
  1759. data/sproutcore/themes/ace/resources/loading.css +50 -0
  1760. data/sproutcore/themes/ace/resources/master-detail/master-detail.css +27 -0
  1761. data/sproutcore/themes/ace/resources/menu/checkmark.png +0 -0
  1762. data/sproutcore/themes/ace/resources/menu/checkmark_active.png +0 -0
  1763. data/sproutcore/themes/ace/resources/menu/down.png +0 -0
  1764. data/sproutcore/themes/ace/resources/menu/menu.css +75 -0
  1765. data/sproutcore/themes/ace/resources/menu/menu.png +0 -0
  1766. data/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
  1767. data/sproutcore/themes/ace/resources/menu/up.png +0 -0
  1768. data/sproutcore/themes/ace/resources/pane/pane.css +3 -0
  1769. data/sproutcore/themes/ace/resources/panel/panel.css +13 -0
  1770. data/sproutcore/themes/ace/resources/panel/panel.js +20 -0
  1771. data/sproutcore/themes/ace/resources/panel/panel.png +0 -0
  1772. data/sproutcore/themes/ace/resources/picker/ace/panel.png +0 -0
  1773. data/sproutcore/themes/ace/resources/picker/ace/picker.css +41 -0
  1774. data/sproutcore/themes/ace/resources/picker/ace/picker.js +0 -0
  1775. data/sproutcore/themes/ace/resources/picker/ace/pointers.png +0 -0
  1776. data/sproutcore/themes/ace/resources/picker/popover/picker.js +32 -0
  1777. data/sproutcore/themes/ace/resources/picker/popover/popover.css +111 -0
  1778. data/sproutcore/themes/ace/resources/picker/popover/popover.js +12 -0
  1779. data/sproutcore/themes/ace/resources/picker/popover/popover.png +0 -0
  1780. data/sproutcore/themes/ace/resources/picker/popover/popover_empty.png +0 -0
  1781. data/sproutcore/themes/ace/resources/picker/popover/popover_notoolbar.png +0 -0
  1782. data/sproutcore/themes/ace/resources/picker/popover/popover_pointers.png +0 -0
  1783. data/sproutcore/themes/ace/resources/picker/popover/popover_pointers_notoolbar.png +0 -0
  1784. data/sproutcore/themes/ace/resources/picker/popover/workspace.js +28 -0
  1785. data/sproutcore/themes/ace/resources/progress/ace/progress.css +27 -0
  1786. data/sproutcore/themes/ace/resources/progress/ace/progress_view_content.png +0 -0
  1787. data/sproutcore/themes/ace/resources/progress/ace/progress_view_track.png +0 -0
  1788. data/sproutcore/themes/ace/resources/progress/progress.js +78 -0
  1789. data/sproutcore/themes/ace/resources/radio/radio.css +63 -0
  1790. data/sproutcore/themes/ace/resources/radio/radio_active.png +0 -0
  1791. data/sproutcore/themes/ace/resources/radio/radio_mixed.png +0 -0
  1792. data/sproutcore/themes/ace/resources/radio/radio_mixed_active.png +0 -0
  1793. data/sproutcore/themes/ace/resources/radio/radio_selected.png +0 -0
  1794. data/sproutcore/themes/ace/resources/radio/radio_selected_active.png +0 -0
  1795. data/sproutcore/themes/ace/resources/radio/radio_unselected.png +0 -0
  1796. data/sproutcore/themes/ace/resources/scroller/horizontal/horizontal.css +78 -0
  1797. data/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_touch.css +91 -0
  1798. data/sproutcore/themes/ace/resources/scroller/horizontal/thumb.png +0 -0
  1799. data/sproutcore/themes/ace/resources/scroller/horizontal/track_and_arrows.png +0 -0
  1800. data/sproutcore/themes/ace/resources/scroller/horizontal/track_and_arrows_active.png +0 -0
  1801. data/sproutcore/themes/ace/resources/scroller/vertical/thumb.png +0 -0
  1802. data/sproutcore/themes/ace/resources/scroller/vertical/track_and_arrows.png +0 -0
  1803. data/sproutcore/themes/ace/resources/scroller/vertical/track_and_arrows_active.png +0 -0
  1804. data/sproutcore/themes/ace/resources/scroller/vertical/vertical.css +80 -0
  1805. data/sproutcore/themes/ace/resources/scroller/vertical/vertical_touch.css +92 -0
  1806. data/sproutcore/themes/ace/resources/segmented/18px/segmented.css +91 -0
  1807. data/sproutcore/themes/ace/resources/segmented/18px/segmented_active.png +0 -0
  1808. data/sproutcore/themes/ace/resources/segmented/18px/segmented_normal.png +0 -0
  1809. data/sproutcore/themes/ace/resources/segmented/18px/segmented_selected.png +0 -0
  1810. data/sproutcore/themes/ace/resources/segmented/18px/segmented_selected_active.png +0 -0
  1811. data/sproutcore/themes/ace/resources/segmented/24px/segmented.css +91 -0
  1812. data/sproutcore/themes/ace/resources/segmented/24px/segmented_active.png +0 -0
  1813. data/sproutcore/themes/ace/resources/segmented/24px/segmented_normal.png +0 -0
  1814. data/sproutcore/themes/ace/resources/segmented/24px/segmented_selected.png +0 -0
  1815. data/sproutcore/themes/ace/resources/segmented/24px/segmented_selected_active.png +0 -0
  1816. data/sproutcore/themes/ace/resources/segmented/30px/segmented.css +91 -0
  1817. data/sproutcore/themes/ace/resources/segmented/30px/segmented_active.png +0 -0
  1818. data/sproutcore/themes/ace/resources/segmented/30px/segmented_normal.png +0 -0
  1819. data/sproutcore/themes/ace/resources/segmented/30px/segmented_selected.png +0 -0
  1820. data/sproutcore/themes/ace/resources/segmented/30px/segmented_selected_active.png +0 -0
  1821. data/sproutcore/themes/ace/resources/segmented/44px/segmented.css +95 -0
  1822. data/sproutcore/themes/ace/resources/segmented/44px/segmented_active.png +0 -0
  1823. data/sproutcore/themes/ace/resources/segmented/44px/segmented_normal.png +0 -0
  1824. data/sproutcore/themes/ace/resources/segmented/44px/segmented_selected.png +0 -0
  1825. data/sproutcore/themes/ace/resources/segmented/44px/segmented_selected_active.png +0 -0
  1826. data/sproutcore/themes/ace/resources/segmented/segmented.css +83 -0
  1827. data/sproutcore/themes/ace/resources/slider/ace/14px/knob.png +0 -0
  1828. data/sproutcore/themes/ace/resources/slider/ace/14px/knob_active.png +0 -0
  1829. data/sproutcore/themes/ace/resources/slider/ace/14px/slider.css +27 -0
  1830. data/sproutcore/themes/ace/resources/slider/ace/16px/knob.png +0 -0
  1831. data/sproutcore/themes/ace/resources/slider/ace/16px/knob_active.png +0 -0
  1832. data/sproutcore/themes/ace/resources/slider/ace/16px/slider.css +27 -0
  1833. data/sproutcore/themes/ace/resources/slider/ace/22px/knob.png +0 -0
  1834. data/sproutcore/themes/ace/resources/slider/ace/22px/knob_active.png +0 -0
  1835. data/sproutcore/themes/ace/resources/slider/ace/22px/slider.css +27 -0
  1836. data/sproutcore/themes/ace/resources/slider/ace/22px/track.png +0 -0
  1837. data/sproutcore/themes/ace/resources/slider/ace/slider.css +7 -0
  1838. data/sproutcore/themes/ace/resources/slider/ace/slider.js +56 -0
  1839. data/sproutcore/themes/ace/resources/slider/ace/track.png +0 -0
  1840. data/sproutcore/themes/ace/resources/split/split.css +5 -0
  1841. data/sproutcore/themes/ace/resources/tab/tab.css +3 -0
  1842. data/sproutcore/themes/ace/resources/toolbar/toolbar.css +8 -0
  1843. data/sproutcore/themes/ace/resources/toolbar/toolbar.png +0 -0
  1844. data/sproutcore/themes/ace/resources/well/well.css +7 -0
  1845. data/sproutcore/themes/ace/resources/well/well.js +17 -0
  1846. data/sproutcore/themes/ace/theme.js +14 -0
  1847. data/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +69 -0
  1848. data/sproutcore/themes/empty_theme/theme.js +16 -0
  1849. data/sproutcore/themes/iphone_theme/english.lproj/button.css +41 -0
  1850. data/sproutcore/themes/iphone_theme/english.lproj/core.css +8 -0
  1851. data/sproutcore/themes/iphone_theme/english.lproj/images/backButton.png +0 -0
  1852. data/sproutcore/themes/iphone_theme/english.lproj/images/blueButton.png +0 -0
  1853. data/sproutcore/themes/iphone_theme/english.lproj/images/cancel.png +0 -0
  1854. data/sproutcore/themes/iphone_theme/english.lproj/images/grayButton.png +0 -0
  1855. data/sproutcore/themes/iphone_theme/english.lproj/images/leftButton.png +0 -0
  1856. data/sproutcore/themes/iphone_theme/english.lproj/images/listArrow.png +0 -0
  1857. data/sproutcore/themes/iphone_theme/english.lproj/images/listArrowSel.png +0 -0
  1858. data/sproutcore/themes/iphone_theme/english.lproj/images/listGroup.png +0 -0
  1859. data/sproutcore/themes/iphone_theme/english.lproj/images/loading.gif +0 -0
  1860. data/sproutcore/themes/iphone_theme/english.lproj/images/pinstripes.png +0 -0
  1861. data/sproutcore/themes/iphone_theme/english.lproj/images/rightButton.png +0 -0
  1862. data/sproutcore/themes/iphone_theme/english.lproj/images/selection.png +0 -0
  1863. data/sproutcore/themes/iphone_theme/english.lproj/images/thumb.png +0 -0
  1864. data/sproutcore/themes/iphone_theme/english.lproj/images/toggle.png +0 -0
  1865. data/sproutcore/themes/iphone_theme/english.lproj/images/toggleOn.png +0 -0
  1866. data/sproutcore/themes/iphone_theme/english.lproj/images/toolButton.png +0 -0
  1867. data/sproutcore/themes/iphone_theme/english.lproj/images/toolbar.png +0 -0
  1868. data/sproutcore/themes/iphone_theme/english.lproj/images/whiteButton.png +0 -0
  1869. data/sproutcore/themes/iphone_theme/english.lproj/strings.js +15 -0
  1870. data/sproutcore/themes/standard_theme/Source/Panel.drawit/Data +0 -0
  1871. data/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Preview.jpg +0 -0
  1872. data/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Thumbnail.jpg +0 -0
  1873. data/sproutcore/themes/standard_theme/Source/SproutCore Theme Buttons.psd +0 -0
  1874. data/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/Data +0 -0
  1875. data/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Preview.jpg +0 -0
  1876. data/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Thumbnail.jpg +0 -0
  1877. data/sproutcore/themes/standard_theme/Source/icons/16/10.png +0 -0
  1878. data/sproutcore/themes/standard_theme/Source/icons/16/100.png +0 -0
  1879. data/sproutcore/themes/standard_theme/Source/icons/16/102.png +0 -0
  1880. data/sproutcore/themes/standard_theme/Source/icons/16/110.png +0 -0
  1881. data/sproutcore/themes/standard_theme/Source/icons/16/120.png +0 -0
  1882. data/sproutcore/themes/standard_theme/Source/icons/16/127.png +0 -0
  1883. data/sproutcore/themes/standard_theme/Source/icons/16/18.png +0 -0
  1884. data/sproutcore/themes/standard_theme/Source/icons/16/19.png +0 -0
  1885. data/sproutcore/themes/standard_theme/Source/icons/16/2.png +0 -0
  1886. data/sproutcore/themes/standard_theme/Source/icons/16/24.png +0 -0
  1887. data/sproutcore/themes/standard_theme/Source/icons/16/26.png +0 -0
  1888. data/sproutcore/themes/standard_theme/Source/icons/16/27.png +0 -0
  1889. data/sproutcore/themes/standard_theme/Source/icons/16/28.png +0 -0
  1890. data/sproutcore/themes/standard_theme/Source/icons/16/29.png +0 -0
  1891. data/sproutcore/themes/standard_theme/Source/icons/16/30.png +0 -0
  1892. data/sproutcore/themes/standard_theme/Source/icons/16/31.png +0 -0
  1893. data/sproutcore/themes/standard_theme/Source/icons/16/33.png +0 -0
  1894. data/sproutcore/themes/standard_theme/Source/icons/16/37.png +0 -0
  1895. data/sproutcore/themes/standard_theme/Source/icons/16/41.png +0 -0
  1896. data/sproutcore/themes/standard_theme/Source/icons/16/99.png +0 -0
  1897. data/sproutcore/themes/standard_theme/Source/icons/24/10.png +0 -0
  1898. data/sproutcore/themes/standard_theme/Source/icons/24/100.png +0 -0
  1899. data/sproutcore/themes/standard_theme/Source/icons/24/102.png +0 -0
  1900. data/sproutcore/themes/standard_theme/Source/icons/24/110.png +0 -0
  1901. data/sproutcore/themes/standard_theme/Source/icons/24/120.png +0 -0
  1902. data/sproutcore/themes/standard_theme/Source/icons/24/127.png +0 -0
  1903. data/sproutcore/themes/standard_theme/Source/icons/24/18.png +0 -0
  1904. data/sproutcore/themes/standard_theme/Source/icons/24/19.png +0 -0
  1905. data/sproutcore/themes/standard_theme/Source/icons/24/2.png +0 -0
  1906. data/sproutcore/themes/standard_theme/Source/icons/24/24.png +0 -0
  1907. data/sproutcore/themes/standard_theme/Source/icons/24/26.png +0 -0
  1908. data/sproutcore/themes/standard_theme/Source/icons/24/27.png +0 -0
  1909. data/sproutcore/themes/standard_theme/Source/icons/24/28.png +0 -0
  1910. data/sproutcore/themes/standard_theme/Source/icons/24/29.png +0 -0
  1911. data/sproutcore/themes/standard_theme/Source/icons/24/30.png +0 -0
  1912. data/sproutcore/themes/standard_theme/Source/icons/24/31.png +0 -0
  1913. data/sproutcore/themes/standard_theme/Source/icons/24/33.png +0 -0
  1914. data/sproutcore/themes/standard_theme/Source/icons/24/37.png +0 -0
  1915. data/sproutcore/themes/standard_theme/Source/icons/24/41.png +0 -0
  1916. data/sproutcore/themes/standard_theme/Source/icons/24/99.png +0 -0
  1917. data/sproutcore/themes/standard_theme/Source/icons/32/10.png +0 -0
  1918. data/sproutcore/themes/standard_theme/Source/icons/32/100.png +0 -0
  1919. data/sproutcore/themes/standard_theme/Source/icons/32/102.png +0 -0
  1920. data/sproutcore/themes/standard_theme/Source/icons/32/110.png +0 -0
  1921. data/sproutcore/themes/standard_theme/Source/icons/32/120.png +0 -0
  1922. data/sproutcore/themes/standard_theme/Source/icons/32/127.png +0 -0
  1923. data/sproutcore/themes/standard_theme/Source/icons/32/18.png +0 -0
  1924. data/sproutcore/themes/standard_theme/Source/icons/32/19.png +0 -0
  1925. data/sproutcore/themes/standard_theme/Source/icons/32/2.png +0 -0
  1926. data/sproutcore/themes/standard_theme/Source/icons/32/24.png +0 -0
  1927. data/sproutcore/themes/standard_theme/Source/icons/32/26.png +0 -0
  1928. data/sproutcore/themes/standard_theme/Source/icons/32/27.png +0 -0
  1929. data/sproutcore/themes/standard_theme/Source/icons/32/28.png +0 -0
  1930. data/sproutcore/themes/standard_theme/Source/icons/32/29.png +0 -0
  1931. data/sproutcore/themes/standard_theme/Source/icons/32/30.png +0 -0
  1932. data/sproutcore/themes/standard_theme/Source/icons/32/31.png +0 -0
  1933. data/sproutcore/themes/standard_theme/Source/icons/32/33.png +0 -0
  1934. data/sproutcore/themes/standard_theme/Source/icons/32/37.png +0 -0
  1935. data/sproutcore/themes/standard_theme/Source/icons/32/41.png +0 -0
  1936. data/sproutcore/themes/standard_theme/Source/icons/32/99.png +0 -0
  1937. data/sproutcore/themes/standard_theme/Source/icons/48/10.png +0 -0
  1938. data/sproutcore/themes/standard_theme/Source/icons/48/18.png +0 -0
  1939. data/sproutcore/themes/standard_theme/Source/icons/48/19.png +0 -0
  1940. data/sproutcore/themes/standard_theme/Source/icons/48/2.png +0 -0
  1941. data/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/Data +0 -0
  1942. data/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Preview.jpg +0 -0
  1943. data/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Thumbnail.jpg +0 -0
  1944. data/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/Data +0 -0
  1945. data/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Preview.jpg +0 -0
  1946. data/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Thumbnail.jpg +0 -0
  1947. data/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x-2.psd +0 -0
  1948. data/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  1949. data/sproutcore/themes/standard_theme/Source/sc-theme-sprite.psd +0 -0
  1950. data/sproutcore/themes/standard_theme/Source/sc-theme-ysprite.psd +0 -0
  1951. data/sproutcore/themes/standard_theme/Source/shared-icons.psd +0 -0
  1952. data/sproutcore/themes/standard_theme/Source/sproutcore-logo.psd +0 -0
  1953. data/sproutcore/themes/standard_theme/Source/sticky-note.psd +0 -0
  1954. data/sproutcore/themes/standard_theme/english.lproj/button.css +399 -0
  1955. data/sproutcore/themes/standard_theme/english.lproj/checkbox.css +78 -0
  1956. data/sproutcore/themes/standard_theme/english.lproj/collection.css +135 -0
  1957. data/sproutcore/themes/standard_theme/english.lproj/core.css +76 -0
  1958. data/sproutcore/themes/standard_theme/english.lproj/disclosure.css +57 -0
  1959. data/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_222222.png +0 -0
  1960. data/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_454545.png +0 -0
  1961. data/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_888888.png +0 -0
  1962. data/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_ffffff.png +0 -0
  1963. data/sproutcore/themes/standard_theme/english.lproj/images/panels/sprite-x.png +0 -0
  1964. data/sproutcore/themes/standard_theme/english.lproj/images/panels/sprite-y.png +0 -0
  1965. data/sproutcore/themes/standard_theme/english.lproj/images/sc-scroller-repeat-x.png +0 -0
  1966. data/sproutcore/themes/standard_theme/english.lproj/images/sc-scroller-repeat-y.png +0 -0
  1967. data/sproutcore/themes/standard_theme/english.lproj/images/sc-scroller-sprite.png +0 -0
  1968. data/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  1969. data/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
  1970. data/sproutcore/themes/standard_theme/english.lproj/images/sc-toolbar-view.png +0 -0
  1971. data/sproutcore/themes/standard_theme/english.lproj/label.css +11 -0
  1972. data/sproutcore/themes/standard_theme/english.lproj/list_item.css +82 -0
  1973. data/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
  1974. data/sproutcore/themes/standard_theme/english.lproj/menu_item_view.css +36 -0
  1975. data/sproutcore/themes/standard_theme/english.lproj/pane.css +18 -0
  1976. data/sproutcore/themes/standard_theme/english.lproj/panel.css +33 -0
  1977. data/sproutcore/themes/standard_theme/english.lproj/picker.css +17 -0
  1978. data/sproutcore/themes/standard_theme/english.lproj/progress.css +27 -0
  1979. data/sproutcore/themes/standard_theme/english.lproj/radio.css +125 -0
  1980. data/sproutcore/themes/standard_theme/english.lproj/scroller.css +159 -0
  1981. data/sproutcore/themes/standard_theme/english.lproj/segmented.css +270 -0
  1982. data/sproutcore/themes/standard_theme/english.lproj/slider.css +94 -0
  1983. data/sproutcore/themes/standard_theme/english.lproj/split_view.css +11 -0
  1984. data/sproutcore/themes/standard_theme/english.lproj/tab.css +14 -0
  1985. data/sproutcore/themes/standard_theme/english.lproj/table.css +14 -0
  1986. data/sproutcore/themes/standard_theme/english.lproj/text_field.css +5 -0
  1987. data/sproutcore/themes/standard_theme/english.lproj/toolbar.css +7 -0
  1988. data/sproutcore/themes/standard_theme/english.lproj/well.css +36 -0
  1989. data/test-spade.html +8 -0
  1990. metadata +2111 -0
@@ -0,0 +1,2860 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2011 Strobe Inc. and contributors.
4
+ // Portions ©2008-2010 Apple Inc. All rights reserved.
5
+ // License: Licensed under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ sc_require('models/record');
9
+
10
+ /**
11
+ @class
12
+
13
+
14
+ The Store is where you can find all of your dataHashes. Stores can be
15
+ chained for editing purposes and committed back one chain level at a time
16
+ all the way back to a persistent data source.
17
+
18
+ Every application you create should generally have its own store objects.
19
+ Once you create the store, you will rarely need to work with the store
20
+ directly except to retrieve records and collections.
21
+
22
+ Internally, the store will keep track of changes to your json data hashes
23
+ and manage syncing those changes with your data source. A data source may
24
+ be a server, local storage, or any other persistent code.
25
+
26
+ @extends SC.Object
27
+ @since SproutCore 1.0
28
+ */
29
+ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
30
+
31
+ /**
32
+ An (optional) name of the store, which can be useful during debugging,
33
+ especially if you have multiple nested stores.
34
+
35
+ @property {String}
36
+ */
37
+ name: null,
38
+
39
+ /**
40
+ An array of all the chained stores that current rely on the receiver
41
+ store.
42
+
43
+ @property {Array}
44
+ */
45
+ nestedStores: null,
46
+
47
+ /**
48
+ The data source is the persistent storage that will provide data to the
49
+ store and save changes. You normally will set your data source when you
50
+ first create your store in your application.
51
+
52
+ @property {SC.DataSource}
53
+ */
54
+ dataSource: null,
55
+
56
+ /**
57
+ This type of store is not nested.
58
+
59
+ @property {Boolean}
60
+ */
61
+ isNested: NO,
62
+
63
+ /**
64
+ This type of store is not nested.
65
+
66
+ @property {Boolean}
67
+ */
68
+ commitRecordsAutomatically: NO,
69
+
70
+ // ..........................................................
71
+ // DATA SOURCE SUPPORT
72
+ //
73
+
74
+ /**
75
+ Convenience method. Sets the current data source to the passed property.
76
+ This will also set the store property on the dataSource to the receiver.
77
+
78
+ If you are using this from the core.js method of your app, you may need to
79
+ just pass a string naming your data source class. If this is the case,
80
+ then your data source will be instantiated the first time it is requested.
81
+
82
+ @param {SC.DataSource|String} dataSource the data source
83
+ @returns {SC.Store} receiver
84
+ */
85
+ from: function(dataSource) {
86
+ this.set('dataSource', dataSource);
87
+ return this ;
88
+ },
89
+
90
+ // lazily convert data source to real object
91
+ _getDataSource: function() {
92
+ var ret = this.get('dataSource');
93
+ if (typeof ret === SC.T_STRING) {
94
+ ret = SC.objectForPropertyPath(ret);
95
+ if (ret && ret.isClass) ret = ret.create();
96
+ if (ret) this.set('dataSource', ret);
97
+ }
98
+ return ret;
99
+ },
100
+
101
+ /**
102
+ Convenience method. Creates a CascadeDataSource with the passed
103
+ data source arguments and sets the CascadeDataSource as the data source
104
+ for the receiver.
105
+
106
+ @param {SC.DataSource...} dataSource one or more data source arguments
107
+ @returns {SC.Store} reciever
108
+ */
109
+ cascade: function(dataSource) {
110
+ var dataSources = SC.A(arguments) ;
111
+ dataSource = SC.CascadeDataSource.create({
112
+ dataSources: dataSources
113
+ });
114
+ return this.from(dataSource);
115
+ },
116
+
117
+ // ..........................................................
118
+ // STORE CHAINING
119
+ //
120
+
121
+ /**
122
+ Returns a new nested store instance that can be used to buffer changes
123
+ until you are ready to commit them. When you are ready to commit your
124
+ changes, call commitChanges() or destroyChanges() and then destroy() when
125
+ you are finished with the chained store altogether.
126
+
127
+ {{{
128
+ store = MyApp.store.chain();
129
+ .. edit edit edit
130
+ store.commitChanges().destroy();
131
+ }}}
132
+
133
+ @param {Hash} attrs optional attributes to set on new store
134
+ @param {Class} newStoreClass optional the class of the newly-created nested store (defaults to SC.NestedStore)
135
+ @returns {SC.NestedStore} new nested store chained to receiver
136
+ */
137
+ chain: function(attrs, newStoreClass) {
138
+ if (!attrs) attrs = {};
139
+ attrs.parentStore = this;
140
+
141
+ if (newStoreClass) {
142
+ // Ensure the passed-in class is a type of nested store.
143
+ if (SC.typeOf(newStoreClass) !== 'class') throw new Error("%@ is not a valid class".fmt(newStoreClass));
144
+ if (!SC.kindOf(newStoreClass, SC.NestedStore)) throw new Error("%@ is not a type of SC.NestedStore".fmt(newStoreClass));
145
+ }
146
+ else {
147
+ newStoreClass = SC.NestedStore;
148
+ }
149
+
150
+ // Replicate parent records references
151
+ attrs.childRecords = this.childRecords ? SC.clone(this.childRecords) : {};
152
+ attrs.parentRecords = this.parentRecords ? SC.clone(this.parentRecords) : {};
153
+
154
+ var ret = newStoreClass.create(attrs),
155
+ nested = this.nestedStores;
156
+
157
+ if (!nested) nested = this.nestedStores = [];
158
+ nested.push(ret);
159
+ return ret ;
160
+ },
161
+
162
+ /** @private
163
+
164
+ Called by a nested store just before it is destroyed so that the parent
165
+ can remove the store from its list of nested stores.
166
+
167
+ @returns {SC.Store} receiver
168
+ */
169
+ willDestroyNestedStore: function(nestedStore) {
170
+ if (this.nestedStores) {
171
+ this.nestedStores.removeObject(nestedStore);
172
+ }
173
+ return this ;
174
+ },
175
+
176
+ /**
177
+ Used to determine if a nested store belongs directly or indirectly to the
178
+ receiver.
179
+
180
+ @param {SC.Store} store store instance
181
+ @returns {Boolean} YES if belongs
182
+ */
183
+ hasNestedStore: function(store) {
184
+ while(store && (store !== this)) store = store.get('parentStore');
185
+ return store === this ;
186
+ },
187
+
188
+ // ..........................................................
189
+ // SHARED DATA STRUCTURES
190
+ //
191
+
192
+ /** @private
193
+ JSON data hashes indexed by store key.
194
+
195
+ *IMPORTANT: Property is not observable*
196
+
197
+ Shared by a store and its child stores until you make edits to it.
198
+
199
+ @property {Hash}
200
+ */
201
+ dataHashes: null,
202
+
203
+ /** @private
204
+ The current status of a data hash indexed by store key.
205
+
206
+ *IMPORTANT: Property is not observable*
207
+
208
+ Shared by a store and its child stores until you make edits to it.
209
+
210
+ @property {Hash}
211
+ */
212
+ statuses: null,
213
+
214
+ /** @private
215
+ This array contains the revisions for the attributes indexed by the
216
+ storeKey.
217
+
218
+ *IMPORTANT: Property is not observable*
219
+
220
+ Revisions are used to keep track of when an attribute hash has been
221
+ changed. A store shares the revisions data with its parent until it
222
+ starts to make changes to it.
223
+
224
+ @property {Hash}
225
+ */
226
+ revisions: null,
227
+
228
+ /**
229
+ Array indicates whether a data hash is possibly in use by an external
230
+ record for editing. If a data hash is editable then it may be modified
231
+ at any time and therefore chained stores may need to clone the
232
+ attributes before keeping a copy of them.
233
+
234
+ Note that this is kept as an array because it will be stored as a dense
235
+ array on some browsers, making it faster.
236
+
237
+ @property {Array}
238
+ */
239
+ editables: null,
240
+
241
+ /**
242
+ A set of storeKeys that need to be committed back to the data source. If
243
+ you call commitRecords() without passing any other parameters, the keys
244
+ in this set will be committed instead.
245
+
246
+ @property {SC.Set}
247
+ */
248
+ changelog: null,
249
+
250
+ /**
251
+ An array of SC.Error objects associated with individual records in the
252
+ store (indexed by store keys).
253
+
254
+ Errors passed form the data source in the call to dataSourceDidError() are
255
+ stored here.
256
+
257
+ @property {Array}
258
+ */
259
+ recordErrors: null,
260
+
261
+ /**
262
+ A hash of SC.Error objects associated with queries (indexed by the GUID
263
+ of the query).
264
+
265
+ Errors passed from the data source in the call to dataSourceDidErrorQuery()
266
+ are stored here.
267
+
268
+ @property {Hash}
269
+ */
270
+ queryErrors: null,
271
+
272
+ /**
273
+ A hash of child Records and there immediate parents
274
+ */
275
+ childRecords: null,
276
+
277
+ /**
278
+ A hash of parent records with registered children
279
+ */
280
+ parentRecords: null,
281
+
282
+ // ..........................................................
283
+ // CORE ATTRIBUTE API
284
+ //
285
+ // The methods in this layer work on data hashes in the store. They do not
286
+ // perform any changes that can impact records. Usually you will not need
287
+ // to use these methods.
288
+
289
+ /**
290
+ Returns the current edit status of a storekey. May be one of EDITABLE or
291
+ LOCKED. Used mostly for unit testing.
292
+
293
+ @param {Number} storeKey the store key
294
+ @returns {Number} edit status
295
+ */
296
+ storeKeyEditState: function(storeKey) {
297
+ var editables = this.editables, locks = this.locks;
298
+ return (editables && editables[storeKey]) ? SC.Store.EDITABLE : SC.Store.LOCKED ;
299
+ },
300
+
301
+ /**
302
+ Returns the data hash for the given storeKey. This will also 'lock'
303
+ the hash so that further edits to the parent store will no
304
+ longer be reflected in this store until you reset.
305
+
306
+ @param {Number} storeKey key to retrieve
307
+ @returns {Hash} data hash or null
308
+ */
309
+ readDataHash: function(storeKey) {
310
+ return this.dataHashes[storeKey];
311
+ },
312
+
313
+ /**
314
+ Returns the data hash for the storeKey, cloned so that you can edit
315
+ the contents of the attributes if you like. This will do the extra work
316
+ to make sure that you only clone the attributes one time.
317
+
318
+ If you use this method to modify data hash, be sure to call
319
+ dataHashDidChange() when you make edits to record the change.
320
+
321
+ @param {Number} storeKey the store key to retrieve
322
+ @returns {Hash} the attributes hash
323
+ */
324
+ readEditableDataHash: function(storeKey) {
325
+ // read the value - if there is no hash just return; nothing to do
326
+ var ret = this.dataHashes[storeKey];
327
+ if (!ret) return ret ; // nothing to do.
328
+
329
+ // clone data hash if not editable
330
+ var editables = this.editables;
331
+ if (!editables) editables = this.editables = [];
332
+ if (!editables[storeKey]) {
333
+ editables[storeKey] = 1 ; // use number to store as dense array
334
+ ret = this.dataHashes[storeKey] = SC.clone(ret, YES);
335
+ }
336
+ return ret;
337
+ },
338
+
339
+ /**
340
+ Reads a property from the hash - cloning it if needed so you can modify
341
+ it independently of any parent store. This method is really only well
342
+ tested for use with toMany relationships. Although it is public you
343
+ generally should not call it directly.
344
+
345
+ @param {Number} storeKey storeKey of data hash
346
+ @param {String} propertyName property to read
347
+ @returns {Object} editable property value
348
+ */
349
+ readEditableProperty: function(storeKey, propertyName) {
350
+ var hash = this.readEditableDataHash(storeKey),
351
+ editables = this.editables[storeKey], // get editable info...
352
+ ret = hash[propertyName];
353
+
354
+ // editables must be made into a hash so that we can keep track of which
355
+ // properties have already been made editable
356
+ if (editables === 1) editables = this.editables[storeKey] = {};
357
+
358
+ // clone if needed
359
+ if (!editables[propertyName]) {
360
+ ret = hash[propertyName];
361
+ if (ret && ret.isCopyable) ret = hash[propertyName] = ret.copy(YES);
362
+ editables[propertyName] = YES ;
363
+ }
364
+
365
+ return ret ;
366
+ },
367
+
368
+ /**
369
+ Replaces the data hash for the storeKey. This will lock the data hash and
370
+ mark them as cloned. This will also call dataHashDidChange() for you.
371
+
372
+ Note that the hash you set here must be a different object from the
373
+ original data hash. Once you make a change here, you must also call
374
+ dataHashDidChange() to register the changes.
375
+
376
+ If the data hash does not yet exist in the store, this method will add it.
377
+ Pass the optional status to edit the status as well.
378
+
379
+ @param {Number} storeKey the store key to write
380
+ @param {Hash} hash the new hash
381
+ @param {String} status the new hash status
382
+ @returns {SC.Store} receiver
383
+ */
384
+ writeDataHash: function(storeKey, hash, status) {
385
+
386
+ // update dataHashes and optionally status.
387
+ if (hash) this.dataHashes[storeKey] = hash;
388
+ if (status) this.statuses[storeKey] = status ;
389
+
390
+ // also note that this hash is now editable
391
+ var editables = this.editables;
392
+ if (!editables) editables = this.editables = [];
393
+ editables[storeKey] = 1 ; // use number for dense array support
394
+
395
+ var that = this;
396
+ this._propagateToChildren(storeKey, function(storeKey){
397
+ that.writeDataHash(storeKey, null, status);
398
+ });
399
+
400
+ return this ;
401
+ },
402
+
403
+ /**
404
+ Removes the data hash from the store. This does not imply a deletion of
405
+ the record. You could be simply unloading the record. Eitherway,
406
+ removing the dataHash will be synced back to the parent store but not to
407
+ the server.
408
+
409
+ Note that you can optionally pass a new status to go along with this. If
410
+ you do not pass a status, it will change the status to SC.RECORD_EMPTY
411
+ (assuming you just unloaded the record). If you are deleting the record
412
+ you may set it to SC.Record.DESTROYED_CLEAN.
413
+
414
+ Be sure to also call dataHashDidChange() to register this change.
415
+
416
+ @param {Number} storeKey
417
+ @param {String} status optional new status
418
+ @returns {SC.Store} reciever
419
+ */
420
+ removeDataHash: function(storeKey, status) {
421
+ // don't use delete -- that will allow parent dataHash to come through
422
+ this.dataHashes[storeKey] = null;
423
+ this.statuses[storeKey] = status || SC.Record.EMPTY;
424
+
425
+ // hash is gone and therefore no longer editable
426
+ var editables = this.editables;
427
+ if (editables) editables[storeKey] = 0 ;
428
+
429
+ return this ;
430
+ },
431
+
432
+ /**
433
+ Reads the current status for a storeKey. This will also lock the data
434
+ hash. If no status is found, returns SC.RECORD_EMPTY.
435
+
436
+ @param {Number} storeKey the store key
437
+ @returns {Number} status
438
+ */
439
+ readStatus: function(storeKey) {
440
+ // use readDataHash to handle optimistic locking. this could be inlined
441
+ // but for now this minimized copy-and-paste code.
442
+ this.readDataHash(storeKey);
443
+ return this.statuses[storeKey] || SC.Record.EMPTY;
444
+ },
445
+
446
+ /**
447
+ Reads the current status for the storeKey without actually locking the
448
+ record. Usually you won't need to use this method. It is mostly used
449
+ internally.
450
+
451
+ @param {Number} storeKey the store key
452
+ @returns {Number} status
453
+ */
454
+ peekStatus: function(storeKey) {
455
+ return this.statuses[storeKey] || SC.Record.EMPTY;
456
+ },
457
+
458
+ /**
459
+ Writes the current status for a storeKey. If the new status is
460
+ SC.Record.ERROR, you may also pass an optional error object. Otherwise
461
+ this param is ignored.
462
+
463
+ @param {Number} storeKey the store key
464
+ @param {String} newStatus the new status
465
+ @param {SC.Error} error optional error object
466
+ @returns {SC.Store} receiver
467
+ */
468
+ writeStatus: function(storeKey, newStatus) {
469
+ // use writeDataHash for now to handle optimistic lock. maximize code
470
+ // reuse.
471
+ return this.writeDataHash(storeKey, null, newStatus);
472
+ },
473
+
474
+ /**
475
+ Call this method whenever you modify some editable data hash to register
476
+ with the Store that the attribute values have actually changed. This will
477
+ do the book-keeping necessary to track the change across stores including
478
+ managing locks.
479
+
480
+ @param {Number|Array} storeKeys one or more store keys that changed
481
+ @param {Number} rev optional new revision number. normally leave null
482
+ @param {Boolean} statusOnly (optional) YES if only status changed
483
+ @param {String} key that changed (optional)
484
+ @returns {SC.Store} receiver
485
+ */
486
+ dataHashDidChange: function(storeKeys, rev, statusOnly, key) {
487
+
488
+ // update the revision for storeKey. Use generateStoreKey() because that
489
+ // gaurantees a universally (to this store hierarchy anyway) unique
490
+ // key value.
491
+ if (!rev) rev = SC.Store.generateStoreKey();
492
+ var isArray, len, idx, storeKey;
493
+
494
+ isArray = SC.typeOf(storeKeys) === SC.T_ARRAY;
495
+ if (isArray) {
496
+ len = storeKeys.length;
497
+ } else {
498
+ len = 1;
499
+ storeKey = storeKeys;
500
+ }
501
+
502
+ var that = this;
503
+ for(idx=0;idx<len;idx++) {
504
+ if (isArray) storeKey = storeKeys[idx];
505
+ this.revisions[storeKey] = rev;
506
+ this._notifyRecordPropertyChange(storeKey, statusOnly, key);
507
+
508
+ this._propagateToChildren(storeKey, function(storeKey){
509
+ that.dataHashDidChange(storeKey, null, statusOnly, key);
510
+ });
511
+ }
512
+
513
+ return this ;
514
+ },
515
+
516
+ /** @private
517
+ Will push all changes to a the recordPropertyChanges property
518
+ and execute flush() once at the end of the runloop.
519
+ */
520
+ _notifyRecordPropertyChange: function(storeKey, statusOnly, key) {
521
+
522
+ var records = this.records,
523
+ nestedStores = this.get('nestedStores'),
524
+ K = SC.Store,
525
+ rec, editState, len, idx, store, status, keys;
526
+
527
+ // pass along to nested stores
528
+ len = nestedStores ? nestedStores.length : 0 ;
529
+ for(idx=0;idx<len;idx++) {
530
+ store = nestedStores[idx];
531
+ status = store.peekStatus(storeKey); // important: peek avoids read-lock
532
+ editState = store.storeKeyEditState(storeKey);
533
+
534
+ // when store needs to propagate out changes in the parent store
535
+ // to nested stores
536
+ if (editState === K.INHERITED) {
537
+ store._notifyRecordPropertyChange(storeKey, statusOnly, key);
538
+
539
+ } else if (status & SC.Record.BUSY) {
540
+ // make sure nested store does not have any changes before resetting
541
+ if(store.get('hasChanges')) throw K.CHAIN_CONFLICT_ERROR;
542
+ store.reset();
543
+ }
544
+ }
545
+
546
+ // store info in changes hash and schedule notification if needed.
547
+ var changes = this.recordPropertyChanges;
548
+ if (!changes) {
549
+ changes = this.recordPropertyChanges =
550
+ { storeKeys: SC.CoreSet.create(),
551
+ records: SC.CoreSet.create(),
552
+ hasDataChanges: SC.CoreSet.create(),
553
+ propertyForStoreKeys: {} };
554
+ }
555
+
556
+ changes.storeKeys.add(storeKey);
557
+
558
+ if (records && (rec=records[storeKey])) {
559
+ changes.records.push(storeKey);
560
+
561
+ // If there are changes other than just the status we need to record
562
+ // that information so we do the right thing during the next flush.
563
+ // Note that if we're called multiple times before flush and one call
564
+ // has statusOnly=true and another has statusOnly=false, the flush will
565
+ // (correctly) operate in statusOnly=false mode.
566
+ if (!statusOnly) changes.hasDataChanges.push(storeKey);
567
+
568
+ // If this is a key specific change, make sure that only those
569
+ // properties/keys are notified. However, if a previous invocation of
570
+ // _notifyRecordPropertyChange specified that all keys have changed, we
571
+ // need to respect that.
572
+ if (key) {
573
+ if (!(keys = changes.propertyForStoreKeys[storeKey])) {
574
+ keys = changes.propertyForStoreKeys[storeKey] = SC.CoreSet.create();
575
+ }
576
+
577
+ // If it's '*' instead of a set, then that means there was a previous
578
+ // invocation that said all keys have changed.
579
+ if (keys !== '*') {
580
+ keys.add(key);
581
+ }
582
+ }
583
+ else {
584
+ // Mark that all properties have changed.
585
+ changes.propertyForStoreKeys[storeKey] = '*';
586
+ }
587
+ }
588
+
589
+ this.invokeOnce(this.flush);
590
+ return this;
591
+ },
592
+
593
+ /**
594
+ Delivers any pending changes to materialized records. Normally this
595
+ happens once, automatically, at the end of the RunLoop. If you have
596
+ updated some records and need to update records immediately, however,
597
+ you may call this manually.
598
+
599
+ @returns {SC.Store} receiver
600
+ */
601
+ flush: function() {
602
+ if (!this.recordPropertyChanges) return this;
603
+
604
+ var changes = this.recordPropertyChanges,
605
+ storeKeys = changes.storeKeys,
606
+ hasDataChanges = changes.hasDataChanges,
607
+ records = changes.records,
608
+ propertyForStoreKeys = changes.propertyForStoreKeys,
609
+ recordTypes = SC.CoreSet.create(),
610
+ rec, recordType, statusOnly, idx, len, storeKey, keys;
611
+
612
+ storeKeys.forEach(function(storeKey) {
613
+ if (records.contains(storeKey)) {
614
+ statusOnly = hasDataChanges.contains(storeKey) ? NO : YES;
615
+ rec = this.records[storeKey];
616
+ keys = propertyForStoreKeys ? propertyForStoreKeys[storeKey] : null;
617
+
618
+ // Are we invalidating all keys? If so, don't pass any to
619
+ // storeDidChangeProperties.
620
+ if (keys === '*') keys = null;
621
+
622
+ // remove it so we don't trigger this twice
623
+ records.remove(storeKey);
624
+
625
+ if (rec) rec.storeDidChangeProperties(statusOnly, keys);
626
+ }
627
+
628
+ recordType = SC.Store.recordTypeFor(storeKey);
629
+ recordTypes.add(recordType);
630
+
631
+ }, this);
632
+
633
+ if (storeKeys.get('length') > 0) this._notifyRecordArrays(storeKeys, recordTypes);
634
+
635
+ storeKeys.clear();
636
+ hasDataChanges.clear();
637
+ records.clear();
638
+ // Provide full reference to overwrite
639
+ this.recordPropertyChanges.propertyForStoreKeys = {};
640
+
641
+ return this;
642
+ },
643
+
644
+ /**
645
+ Resets the store content. This will clear all internal data for all
646
+ records, resetting them to an EMPTY state. You generally do not want
647
+ to call this method yourself, though you may override it.
648
+
649
+ @returns {SC.Store} receiver
650
+ */
651
+ reset: function() {
652
+
653
+ // create a new empty data store
654
+ this.dataHashes = {} ;
655
+ this.revisions = {} ;
656
+ this.statuses = {} ;
657
+
658
+ // also reset temporary objects and errors
659
+ this.chainedChanges = this.locks = this.editables = null;
660
+ this.changelog = null ;
661
+ this.recordErrors = null;
662
+ this.queryErrors = null;
663
+
664
+ var records = this.records, storeKey;
665
+ if (records) {
666
+ for(storeKey in records) {
667
+ if (!records.hasOwnProperty(storeKey)) continue ;
668
+ this._notifyRecordPropertyChange(parseInt(storeKey, 10), NO);
669
+ }
670
+ }
671
+
672
+ this.set('hasChanges', NO);
673
+ },
674
+
675
+ /** @private
676
+ Called by a nested store on a parent store to commit any changes from the
677
+ store. This will copy any changed dataHashes as well as any persistant
678
+ change logs.
679
+
680
+ If the parentStore detects a conflict with the optimistic locking, it will
681
+ raise an exception before it makes any changes. If you pass the
682
+ force flag then this detection phase will be skipped and the changes will
683
+ be applied even if another resource has modified the store in the mean
684
+ time.
685
+
686
+ @param {SC.Store} nestedStore the child store
687
+ @param {SC.Set} changes the set of changed store keys
688
+ @param {Boolean} force
689
+ @returns {SC.Store} receiver
690
+ */
691
+ commitChangesFromNestedStore: function(nestedStore, changes, force) {
692
+ // first, check for optimistic locking problems
693
+ if (!force) this._verifyLockRevisions(changes, nestedStore.locks);
694
+
695
+ // OK, no locking issues. So let's just copy them changes.
696
+ // get local reference to values.
697
+ var len = changes.length, i, storeKey, myDataHashes, myStatuses,
698
+ myEditables, myRevisions, myParentRecords, myChildRecords,
699
+ chDataHashes, chStatuses, chRevisions, chParentRecords, chChildRecords;
700
+
701
+ myRevisions = this.revisions ;
702
+ myDataHashes = this.dataHashes;
703
+ myStatuses = this.statuses;
704
+ myEditables = this.editables ;
705
+ myParentRecords = this.parentRecords ? this.parentRecords : this.parentRecords ={} ;
706
+ myChildRecords = this.childRecords ? this.childRecords : this.childRecords = {} ;
707
+
708
+ // setup some arrays if needed
709
+ if (!myEditables) myEditables = this.editables = [] ;
710
+ chDataHashes = nestedStore.dataHashes;
711
+ chRevisions = nestedStore.revisions ;
712
+ chStatuses = nestedStore.statuses;
713
+ chParentRecords = nestedStore.parentRecords || {};
714
+ chChildRecords = nestedStore.childRecords || {};
715
+
716
+ for(i=0;i<len;i++) {
717
+ storeKey = changes[i];
718
+
719
+ // now copy changes
720
+ myDataHashes[storeKey] = chDataHashes[storeKey];
721
+ myStatuses[storeKey] = chStatuses[storeKey];
722
+ myRevisions[storeKey] = chRevisions[storeKey];
723
+ myParentRecords[storeKey] = chParentRecords[storeKey];
724
+ myChildRecords[storeKey] = chChildRecords[storeKey];
725
+
726
+ myEditables[storeKey] = 0 ; // always make dataHash no longer editable
727
+
728
+ this._notifyRecordPropertyChange(storeKey, NO);
729
+ }
730
+
731
+ // add any records to the changelog for commit handling
732
+ var myChangelog = this.changelog, chChangelog = nestedStore.changelog;
733
+ if (chChangelog) {
734
+ if (!myChangelog) myChangelog = this.changelog = SC.CoreSet.create();
735
+ myChangelog.addEach(chChangelog);
736
+ }
737
+ this.changelog = myChangelog;
738
+
739
+ // immediately flush changes to notify records - nested stores will flush
740
+ // later on.
741
+ if (!this.get('parentStore')) this.flush();
742
+
743
+ return this ;
744
+ },
745
+
746
+ /** @private
747
+ Verifies that the passed lock revisions match the current revisions
748
+ in the receiver store. If the lock revisions do not match, then the
749
+ store is in a conflict and an exception will be raised.
750
+
751
+ @param {Array} changes set of changes we are trying to apply
752
+ @param {SC.Set} locks the locks to verify
753
+ @returns {SC.Store} receiver
754
+ */
755
+ _verifyLockRevisions: function(changes, locks) {
756
+ var len = changes.length, revs = this.revisions, i, storeKey, lock, rev ;
757
+ if (locks && revs) {
758
+ for(i=0;i<len;i++) {
759
+ storeKey = changes[i];
760
+ lock = locks[storeKey] || 1;
761
+ rev = revs[storeKey] || 1;
762
+
763
+ // if the save revision for the item does not match the current rev
764
+ // the someone has changed the data hash in this store and we have
765
+ // a conflict.
766
+ if (lock < rev) throw SC.Store.CHAIN_CONFLICT_ERROR;
767
+ }
768
+ }
769
+ return this ;
770
+ },
771
+
772
+ // ..........................................................
773
+ // HIGH-LEVEL RECORD API
774
+ //
775
+
776
+ /**
777
+ Finds a single record instance with the specified recordType and id or an
778
+ array of records matching some query conditions.
779
+
780
+ h2. Finding a Single Record
781
+
782
+ If you pass a single recordType and id, this method will return an actual
783
+ record instance. If the record has not been loaded into the store yet,
784
+ this method will ask the data source to retrieve it. If no data source
785
+ indicates that it can retrieve the record, then this method will return
786
+ null.
787
+
788
+ Note that if the record needs to be retrieved from the server, then the
789
+ record instance returned from this method will not have any data yet.
790
+ Instead it will have a status of SC.Record.READY_LOADING. You can monitor
791
+ the status property to be notified when the record data is available for
792
+ you to use it.
793
+
794
+ h2. Find a Collection of Records
795
+
796
+ If you pass only a record type or a query object, you can instead find
797
+ all records matching a specified set of conditions. When you call find()
798
+ in this way, it will create a query if needed and pass it to the data
799
+ source to fetch the results.
800
+
801
+ If this is the first time you have fetched the query, then the store will
802
+ automatically ask the data source to fetch any records related to it as
803
+ well. Otherwise you can refresh the query results at anytime by calling
804
+ refresh() on the returned RecordArray.
805
+
806
+ You can detect whether a RecordArray is fetching from the server by
807
+ checking its status.
808
+
809
+ h2. Examples
810
+
811
+ Finding a single record:
812
+
813
+ {{{
814
+ MyApp.store.find(MyApp.Contact, "23"); // returns MyApp.Contact
815
+ }}}
816
+
817
+ Finding all records of a particular type:
818
+
819
+ {{{
820
+ MyApp.store.find(MyApp.Contact); // returns SC.RecordArray of contacts
821
+ }}}
822
+
823
+ Finding all contacts with first name John:
824
+
825
+ {{{
826
+ var query = SC.Query.local(MyApp.Contact, "firstName = %@", "John");
827
+ MyApp.store.find(query); // returns SC.RecordArray of contacts
828
+ }}}
829
+
830
+ Finding all contacts using a remote query:
831
+
832
+ {{{
833
+ var query = SC.Query.remote(MyApp.Contact);
834
+ MyApp.store.find(query); // returns SC.RecordArray filled by server
835
+ }}}
836
+
837
+ @param {SC.Record|String} recordType the expected record type
838
+ @param {String} id the id to load
839
+ @returns {SC.Record} record instance or null
840
+ */
841
+ find: function(recordType, id) {
842
+
843
+ // if recordType is passed as string, find object
844
+ if (SC.typeOf(recordType)===SC.T_STRING) {
845
+ recordType = SC.objectForPropertyPath(recordType);
846
+ }
847
+
848
+ // handle passing a query...
849
+ if ((arguments.length === 1) && !(recordType && recordType.get && recordType.get('isRecord'))) {
850
+ if (!recordType) throw new Error("SC.Store#find() must pass recordType or query");
851
+ if (!recordType.isQuery) {
852
+ recordType = SC.Query.local(recordType);
853
+ }
854
+ return this._findQuery(recordType, YES, YES);
855
+
856
+ // handle finding a single record
857
+ } else {
858
+ return this._findRecord(recordType, id);
859
+ }
860
+ },
861
+
862
+ /** @private
863
+ DEPRECATED used find() instead.
864
+
865
+ This method will accept a record type or query and return a record array
866
+ matching the results. This method was commonly used prior to SproutCore
867
+ 1.0. It has been deprecated in favor of a single find() method instead.
868
+
869
+ For compatibility, this method will continue to work in SproutCore 1.0 but
870
+ it will raise a warning. It will be removed in a future version of
871
+ SproutCore.
872
+ */
873
+ findAll: function(recordType, conditions, params) {
874
+ SC.Logger.warn("SC.Store#findAll() will be removed in a future version of SproutCore. Use SC.Store#find() instead");
875
+
876
+
877
+ if (!recordType || !recordType.isQuery) {
878
+ recordType = SC.Query.local(recordType, conditions, params);
879
+ }
880
+
881
+ return this._findQuery(recordType, YES, YES);
882
+ },
883
+
884
+
885
+ _findQuery: function(query, createIfNeeded, refreshIfNew) {
886
+
887
+ // lookup the local RecordArray for this query.
888
+ var cache = this._scst_recordArraysByQuery,
889
+ key = SC.guidFor(query),
890
+ ret, ra ;
891
+ if (!cache) cache = this._scst_recordArraysByQuery = {};
892
+ ret = cache[key];
893
+
894
+ // if a RecordArray was not found, then create one and also add it to the
895
+ // list of record arrays to update.
896
+ if (!ret && createIfNeeded) {
897
+ cache[key] = ret = SC.RecordArray.create({ store: this, query: query });
898
+
899
+ ra = this.get('recordArrays');
900
+ if (!ra) this.set('recordArrays', ra = SC.Set.create());
901
+ ra.add(ret);
902
+
903
+ if (refreshIfNew) this.refreshQuery(query);
904
+ }
905
+
906
+ this.flush();
907
+ return ret ;
908
+ },
909
+
910
+ _findRecord: function(recordType, id) {
911
+
912
+ var storeKey ;
913
+
914
+ // if a record instance is passed, simply use the storeKey. This allows
915
+ // you to pass a record from a chained store to get the same record in the
916
+ // current store.
917
+ if (recordType && recordType.get && recordType.get('isRecord')) {
918
+ storeKey = recordType.get('storeKey');
919
+
920
+ // otherwise, lookup the storeKey for the passed id. look in subclasses
921
+ // as well.
922
+ } else storeKey = id ? recordType.storeKeyFor(id) : null;
923
+
924
+ if (storeKey && (this.readStatus(storeKey) === SC.Record.EMPTY)) {
925
+ storeKey = this.retrieveRecord(recordType, id);
926
+ }
927
+
928
+ // now we have the storeKey, materialize the record and return it.
929
+ return storeKey ? this.materializeRecord(storeKey) : null ;
930
+ },
931
+
932
+ // ..........................................................
933
+ // RECORD ARRAY OPERATIONS
934
+ //
935
+
936
+ /**
937
+ Called by the record array just before it is destroyed. This will
938
+ de-register it from receiving future notifications.
939
+
940
+ You should never call this method yourself. Instead call destroy() on the
941
+ RecordArray directly.
942
+
943
+ @param {SC.RecordArray} recordArray the record array
944
+ @returns {SC.Store} receiver
945
+ */
946
+ recordArrayWillDestroy: function(recordArray) {
947
+ var cache = this._scst_recordArraysByQuery,
948
+ set = this.get('recordArrays');
949
+
950
+ if (cache) delete cache[SC.guidFor(recordArray.get('query'))];
951
+ if (set) set.remove(recordArray);
952
+ return this ;
953
+ },
954
+
955
+ /**
956
+ Called by the record array whenever it needs the data source to refresh
957
+ its contents. Nested stores will actually just pass this along to the
958
+ parent store. The parent store will call fetch() on the data source.
959
+
960
+ You should never call this method yourself. Instead call refresh() on the
961
+ RecordArray directly.
962
+
963
+ @param {SC.Query} query the record array query to refresh
964
+ @returns {SC.Store} receiver
965
+ */
966
+ refreshQuery: function(query) {
967
+ if (!query) throw new Error("refreshQuery() requires a query");
968
+
969
+ var cache = this._scst_recordArraysByQuery,
970
+ recArray = cache ? cache[SC.guidFor(query)] : null,
971
+ source = this._getDataSource();
972
+
973
+ if (source && source.fetch) {
974
+ if (recArray) recArray.storeWillFetchQuery(query);
975
+ source.fetch.call(source, this, query);
976
+ }
977
+
978
+ return this ;
979
+ },
980
+
981
+ /** @private
982
+ Will ask all record arrays that have been returned from findAll
983
+ with an SC.Query to check their arrays with the new storeKeys
984
+
985
+ @param {SC.IndexSet} storeKeys set of storeKeys that changed
986
+ @param {SC.Set} recordTypes
987
+ @returns {SC.Store} receiver
988
+ */
989
+ _notifyRecordArrays: function(storeKeys, recordTypes) {
990
+ var recordArrays = this.get('recordArrays');
991
+ if (!recordArrays) return this;
992
+
993
+ recordArrays.forEach(function(recArray) {
994
+ if (recArray) recArray.storeDidChangeStoreKeys(storeKeys, recordTypes);
995
+ }, this);
996
+
997
+ return this ;
998
+ },
999
+
1000
+
1001
+ // ..........................................................
1002
+ // LOW-LEVEL HELPERS
1003
+ //
1004
+
1005
+ /**
1006
+ Array of all records currently in the store with the specified
1007
+ type. This method only reflects the actual records loaded into memory and
1008
+ therefore is not usually needed at runtime. However you will often use
1009
+ this method for testing.
1010
+
1011
+ @param {SC.Record} recordType the record type
1012
+ @returns {SC.Array} array instance - usually SC.RecordArray
1013
+ */
1014
+ recordsFor: function(recordType) {
1015
+ var storeKeys = [],
1016
+ storeKeysById = recordType.storeKeysById(),
1017
+ id, storeKey, ret;
1018
+
1019
+ // collect all non-empty store keys
1020
+ for(id in storeKeysById) {
1021
+ storeKey = storeKeysById[id]; // get the storeKey
1022
+ if (this.readStatus(storeKey) !== SC.RECORD_EMPTY) {
1023
+ storeKeys.push(storeKey);
1024
+ }
1025
+ }
1026
+
1027
+ if (storeKeys.length>0) {
1028
+ ret = SC.RecordArray.create({ store: this, storeKeys: storeKeys });
1029
+ } else ret = storeKeys; // empty array
1030
+ return ret ;
1031
+ },
1032
+
1033
+ _TMP_REC_ATTRS: {},
1034
+
1035
+ /**
1036
+ Given a storeKey, return a materialized record. You will not usually
1037
+ call this method yourself. Instead it will used by other methods when
1038
+ you find records by id or perform other searches.
1039
+
1040
+ If a recordType has been mapped to the storeKey, then a record instance
1041
+ will be returned even if the data hash has not been requested yet.
1042
+
1043
+ Each Store instance returns unique record instances for each storeKey.
1044
+
1045
+ @param {Number} storeKey The storeKey for the dataHash.
1046
+ @returns {SC.Record} Returns a record instance.
1047
+ */
1048
+ materializeRecord: function(storeKey) {
1049
+ var records = this.records, ret, recordType, attrs;
1050
+
1051
+ // look up in cached records
1052
+ if (!records) records = this.records = {}; // load cached records
1053
+ ret = records[storeKey];
1054
+ if (ret) return ret;
1055
+
1056
+ // not found -- OK, create one then.
1057
+ recordType = SC.Store.recordTypeFor(storeKey);
1058
+ if (!recordType) return null; // not recordType registered, nothing to do
1059
+
1060
+ attrs = this._TMP_REC_ATTRS ;
1061
+ attrs.storeKey = storeKey ;
1062
+ attrs.store = this ;
1063
+ ret = records[storeKey] = recordType.create(attrs);
1064
+
1065
+ return ret ;
1066
+ },
1067
+
1068
+ // ..........................................................
1069
+ // CORE RECORDS API
1070
+ //
1071
+ // The methods in this section can be used to manipulate records without
1072
+ // actually creating record instances.
1073
+
1074
+ /**
1075
+ Creates a new record instance with the passed recordType and dataHash.
1076
+ You can also optionally specify an id or else it will be pulled from the
1077
+ data hash.
1078
+
1079
+ Note that the record will not yet be saved back to the server. To save
1080
+ a record to the server, call commitChanges() on the store.
1081
+
1082
+ @param {SC.Record} recordType the record class to use on creation
1083
+ @param {Hash} dataHash the JSON attributes to assign to the hash.
1084
+ @param {String} id (optional) id to assign to record
1085
+
1086
+ @returns {SC.Record} Returns the created record
1087
+ */
1088
+ createRecord: function(recordType, dataHash, id) {
1089
+ var primaryKey, storeKey, status, K = SC.Record, changelog, defaultVal,
1090
+ ret;
1091
+
1092
+ // First, try to get an id. If no id is passed, look it up in the
1093
+ // dataHash.
1094
+ if (!id && (primaryKey = recordType.prototype.primaryKey)) {
1095
+ id = dataHash[primaryKey];
1096
+ // if still no id, check if there is a defaultValue function for
1097
+ // the primaryKey attribute and assign that
1098
+ defaultVal = recordType.prototype[primaryKey] ? recordType.prototype[primaryKey].defaultValue : null;
1099
+ if(!id && SC.typeOf(defaultVal)===SC.T_FUNCTION) {
1100
+ id = dataHash[primaryKey] = defaultVal();
1101
+ }
1102
+ }
1103
+
1104
+ // Next get the storeKey - base on id if available
1105
+ storeKey = id ? recordType.storeKeyFor(id) : SC.Store.generateStoreKey();
1106
+
1107
+ // now, check the state and do the right thing.
1108
+ status = this.readStatus(storeKey);
1109
+
1110
+ // check state
1111
+ // any busy or ready state or destroyed dirty state is not allowed
1112
+ if ((status & K.BUSY) ||
1113
+ (status & K.READY) ||
1114
+ (status === K.DESTROYED_DIRTY)) {
1115
+ throw id ? K.RECORD_EXISTS_ERROR : K.BAD_STATE_ERROR;
1116
+
1117
+ // allow error or destroyed state only with id
1118
+ } else if (!id && (status===SC.DESTROYED_CLEAN || status===SC.ERROR)) {
1119
+ throw K.BAD_STATE_ERROR;
1120
+ }
1121
+
1122
+ // add dataHash and setup initial status -- also save recordType
1123
+ this.writeDataHash(storeKey, (dataHash ? dataHash : {}), K.READY_NEW);
1124
+
1125
+ SC.Store.replaceRecordTypeFor(storeKey, recordType);
1126
+ this.dataHashDidChange(storeKey);
1127
+
1128
+ // Record is now in a committable state -- add storeKey to changelog
1129
+ changelog = this.changelog;
1130
+ if (!changelog) changelog = SC.Set.create();
1131
+ changelog.add(storeKey);
1132
+ this.changelog = changelog;
1133
+
1134
+ // if commit records is enabled
1135
+ if(this.get('commitRecordsAutomatically')){
1136
+ this.invokeLast(this.commitRecords);
1137
+ }
1138
+
1139
+ // Finally return materialized record, after we propagate the status to
1140
+ // any aggregrate records.
1141
+ ret = this.materializeRecord(storeKey);
1142
+ if (ret) ret.propagateToAggregates();
1143
+ return ret;
1144
+ },
1145
+
1146
+ /**
1147
+ Creates an array of new records. You must pass an array of dataHashes
1148
+ plus a recordType and, optionally, an array of ids. This will create an
1149
+ array of record instances with the same record type.
1150
+
1151
+ If you need to instead create a bunch of records with different data types
1152
+ you can instead pass an array of recordTypes, one for each data hash.
1153
+
1154
+ @param {SC.Record|Array} recordTypes class or array of classes
1155
+ @param {Array} dataHashes array of data hashes
1156
+ @param {Array} ids (optional) ids to assign to records
1157
+ @returns {Array} array of materialized record instances.
1158
+ */
1159
+ createRecords: function(recordTypes, dataHashes, ids) {
1160
+ var ret = [], recordType, id, isArray, len = dataHashes.length, idx ;
1161
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1162
+ if (!isArray) recordType = recordTypes;
1163
+ for(idx=0;idx<len;idx++) {
1164
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1165
+ id = ids ? ids[idx] : undefined ;
1166
+ ret.push(this.createRecord(recordType, dataHashes[idx], id));
1167
+ }
1168
+ return ret ;
1169
+ },
1170
+
1171
+
1172
+ /**
1173
+ Unloads a record, removing the data hash from the store. If you try to
1174
+ unload a record that is already destroyed then this method will have no effect.
1175
+ If you unload a record that does not exist or an error then an exception
1176
+ will be raised.
1177
+
1178
+ @param {SC.Record} recordType the recordType
1179
+ @param {String} id the record id
1180
+ @param {Number} storeKey (optional) if passed, ignores recordType and id
1181
+ @returns {SC.Store} receiver
1182
+ */
1183
+ unloadRecord: function(recordType, id, storeKey, newStatus) {
1184
+ if (storeKey === undefined) storeKey = recordType.storeKeyFor(id);
1185
+ var status = this.readStatus(storeKey), K = SC.Record;
1186
+ newStatus = newStatus || K.EMPTY;
1187
+ // handle status - ignore if destroying or destroyed
1188
+ if ((status === K.BUSY_DESTROYING) || (status & K.DESTROYED)) {
1189
+ return this; // nothing to do
1190
+
1191
+ // error out if empty
1192
+ } else if (status & K.BUSY) {
1193
+ throw K.BUSY_ERROR ;
1194
+
1195
+ // otherwise, destroy in dirty state
1196
+ } else status = newStatus ;
1197
+
1198
+ // remove the data hash, set new status
1199
+ this.removeDataHash(storeKey, status);
1200
+ this.dataHashDidChange(storeKey);
1201
+
1202
+ // Handle all the child Records
1203
+ var that = this;
1204
+ this._propagateToChildren(storeKey, function(storeKey){
1205
+ that.unloadRecord(null, null, storeKey, newStatus);
1206
+ });
1207
+
1208
+ return this ;
1209
+ },
1210
+
1211
+ /**
1212
+ Unloads a group of records. If you have a set of record ids, unloading
1213
+ them this way can be faster than retrieving each record and unloading
1214
+ it individually.
1215
+
1216
+ You can pass either a single recordType or an array of recordTypes. If
1217
+ you pass a single recordType, then the record type will be used for each
1218
+ record. If you pass an array, then each id must have a matching record
1219
+ type in the array.
1220
+
1221
+ You can optionally pass an array of storeKeys instead of the recordType
1222
+ and ids. In this case the first two parameters will be ignored. This
1223
+ is usually only used by low-level internal methods. You will not usually
1224
+ unload records this way.
1225
+
1226
+ @param {SC.Record|Array} recordTypes class or array of classes
1227
+ @param {Array} ids (optional) ids to unload
1228
+ @param {Array} storeKeys (optional) store keys to unload
1229
+ @returns {SC.Store} receiver
1230
+ */
1231
+ unloadRecords: function(recordTypes, ids, storeKeys, newStatus) {
1232
+ var len, isArray, idx, id, recordType, storeKey;
1233
+
1234
+ if (storeKeys === undefined) {
1235
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1236
+ if (!isArray) recordType = recordTypes;
1237
+ if (ids === undefined) {
1238
+ len = isArray ? recordTypes.length : 1;
1239
+ for (idx = 0; idx < len; idx++) {
1240
+ if (isArray) recordType = recordTypes[idx];
1241
+ storeKeys = this.storeKeysFor(recordType);
1242
+ this.unloadRecords(undefined, undefined, storeKeys, newStatus);
1243
+ }
1244
+ } else {
1245
+ len = ids.length;
1246
+ for (idx = 0; idx < len; idx++) {
1247
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1248
+ id = ids ? ids[idx] : undefined;
1249
+ this.unloadRecord(recordType, id, undefined, newStatus);
1250
+ }
1251
+ }
1252
+ } else {
1253
+ len = storeKeys.length;
1254
+ for (idx = 0; idx < len; idx++) {
1255
+ storeKey = storeKeys ? storeKeys[idx] : undefined;
1256
+ this.unloadRecord(undefined, undefined, storeKey, newStatus);
1257
+ }
1258
+ }
1259
+
1260
+ return this;
1261
+ },
1262
+
1263
+ /**
1264
+ Destroys a record, removing the data hash from the store and adding the
1265
+ record to the destroyed changelog. If you try to destroy a record that is
1266
+ already destroyed then this method will have no effect. If you destroy a
1267
+ record that does not exist or an error then an exception will be raised.
1268
+
1269
+ @param {SC.Record} recordType the recordType
1270
+ @param {String} id the record id
1271
+ @param {Number} storeKey (optional) if passed, ignores recordType and id
1272
+ @returns {SC.Store} receiver
1273
+ */
1274
+ destroyRecord: function(recordType, id, storeKey) {
1275
+ if (storeKey === undefined) storeKey = recordType.storeKeyFor(id);
1276
+ var status = this.readStatus(storeKey), changelog, K = SC.Record;
1277
+
1278
+ // handle status - ignore if destroying or destroyed
1279
+ if ((status === K.BUSY_DESTROYING) || (status & K.DESTROYED)) {
1280
+ return this; // nothing to do
1281
+
1282
+ // error out if empty
1283
+ } else if (status === K.EMPTY) {
1284
+ throw K.NOT_FOUND_ERROR ;
1285
+
1286
+ // error out if busy
1287
+ } else if (status & K.BUSY) {
1288
+ throw K.BUSY_ERROR ;
1289
+
1290
+ // if new status, destroy but leave in clean state
1291
+ } else if (status === K.READY_NEW) {
1292
+ status = K.DESTROYED_CLEAN ;
1293
+
1294
+ // otherwise, destroy in dirty state
1295
+ } else status = K.DESTROYED_DIRTY ;
1296
+
1297
+ // remove the data hash, set new status
1298
+ this.writeStatus(storeKey, status);
1299
+ this.dataHashDidChange(storeKey);
1300
+
1301
+ // add/remove change log
1302
+ changelog = this.changelog;
1303
+ if (!changelog) changelog = this.changelog = SC.Set.create();
1304
+
1305
+ ((status & K.DIRTY) ? changelog.add(storeKey) : changelog.remove(storeKey));
1306
+ this.changelog=changelog;
1307
+
1308
+ // if commit records is enabled
1309
+ if(this.get('commitRecordsAutomatically')){
1310
+ this.invokeLast(this.commitRecords);
1311
+ }
1312
+
1313
+ var that = this;
1314
+ this._propagateToChildren(storeKey, function(storeKey){
1315
+ that.destroyRecord(null, null, storeKey);
1316
+ });
1317
+
1318
+ return this ;
1319
+ },
1320
+
1321
+ /**
1322
+ Destroys a group of records. If you have a set of record ids, destroying
1323
+ them this way can be faster than retrieving each record and destroying
1324
+ it individually.
1325
+
1326
+ You can pass either a single recordType or an array of recordTypes. If
1327
+ you pass a single recordType, then the record type will be used for each
1328
+ record. If you pass an array, then each id must have a matching record
1329
+ type in the array.
1330
+
1331
+ You can optionally pass an array of storeKeys instead of the recordType
1332
+ and ids. In this case the first two parameters will be ignored. This
1333
+ is usually only used by low-level internal methods. You will not usually
1334
+ destroy records this way.
1335
+
1336
+ @param {SC.Record|Array} recordTypes class or array of classes
1337
+ @param {Array} ids ids to destroy
1338
+ @param {Array} storeKeys (optional) store keys to destroy
1339
+ @returns {SC.Store} receiver
1340
+ */
1341
+ destroyRecords: function(recordTypes, ids, storeKeys) {
1342
+ var len, isArray, idx, id, recordType, storeKey;
1343
+ if(storeKeys===undefined){
1344
+ len = ids.length;
1345
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1346
+ if (!isArray) recordType = recordTypes;
1347
+ for(idx=0;idx<len;idx++) {
1348
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1349
+ id = ids ? ids[idx] : undefined ;
1350
+ this.destroyRecord(recordType, id, undefined);
1351
+ }
1352
+ }else{
1353
+ len = storeKeys.length;
1354
+ for(idx=0;idx<len;idx++) {
1355
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1356
+ this.destroyRecord(undefined, undefined, storeKey);
1357
+ }
1358
+ }
1359
+ return this ;
1360
+ },
1361
+
1362
+ /**
1363
+ register a Child Record to the parent
1364
+ */
1365
+ registerChildToParent: function(parentStoreKey, childStoreKey, path){
1366
+ var prs, crs, oldPk, oldChildren, pkRef;
1367
+ // Check the child to see if it has a parent
1368
+ crs = this.childRecords || {};
1369
+ prs = this.parentRecords || {};
1370
+ // first rid of the old parent
1371
+ oldPk = crs[childStoreKey];
1372
+ if (oldPk){
1373
+ oldChildren = prs[oldPk];
1374
+ delete oldChildren[childStoreKey];
1375
+ // this.recordDidChange(null, null, oldPk, key);
1376
+ }
1377
+ pkRef = prs[parentStoreKey] || {};
1378
+ pkRef[childStoreKey] = path || YES;
1379
+ prs[parentStoreKey] = pkRef;
1380
+ crs[childStoreKey] = parentStoreKey;
1381
+ // sync the status of the child
1382
+ this.writeStatus(childStoreKey, this.statuses[parentStoreKey]);
1383
+ this.childRecords = crs;
1384
+ this.parentRecords = prs;
1385
+ },
1386
+
1387
+ /**
1388
+ materialize the parent when passing in a store key for the child
1389
+ */
1390
+ materializeParentRecord: function(childStoreKey){
1391
+ var pk, crs;
1392
+ if (SC.none(childStoreKey)) return null;
1393
+ crs = this.childRecords;
1394
+ pk = crs ? this.childRecords[childStoreKey] : null ;
1395
+ if (SC.none(pk)) return null;
1396
+
1397
+ return this.materializeRecord(pk);
1398
+ },
1399
+
1400
+ /**
1401
+ function for retrieving a parent record key
1402
+ */
1403
+ parentStoreKeyExists: function(storeKey){
1404
+ if (SC.none(storeKey)) return ;
1405
+ var crs = this.childRecords || {};
1406
+ return crs[storeKey];
1407
+ },
1408
+
1409
+ /**
1410
+ function that propigates a function all to all children
1411
+ */
1412
+ _propagateToChildren: function(storeKey, func){
1413
+ // Handle all the child Records
1414
+ if ( SC.none(this.parentRecords) ) return;
1415
+ var children = this.parentRecords[storeKey] || {};
1416
+ if (SC.none(func)) return;
1417
+ for (var key in children) {
1418
+ if (children.hasOwnProperty(key)) func(key);
1419
+ }
1420
+ },
1421
+
1422
+ /**
1423
+ Notes that the data for the given record id has changed. The record will
1424
+ be committed to the server the next time you commit the root store. Only
1425
+ call this method on a record in a READY state of some type.
1426
+
1427
+ @param {SC.Record} recordType the recordType
1428
+ @param {String} id the record id
1429
+ @param {Number} storeKey (optional) if passed, ignores recordType and id
1430
+ @param {String} key that changed (optional)
1431
+ @param {Boolean} if the change is to statusOnly (optional)
1432
+ @returns {SC.Store} receiver
1433
+ */
1434
+ recordDidChange: function(recordType, id, storeKey, key, statusOnly) {
1435
+ if (storeKey === undefined) storeKey = recordType.storeKeyFor(id);
1436
+ var status = this.readStatus(storeKey), changelog, K = SC.Record;
1437
+
1438
+ // BUSY_LOADING, BUSY_CREATING, BUSY_COMMITTING, BUSY_REFRESH_CLEAN
1439
+ // BUSY_REFRESH_DIRTY, BUSY_DESTROYING
1440
+ if (status & K.BUSY) {
1441
+ throw K.BUSY_ERROR ;
1442
+
1443
+ // if record is not in ready state, then it is not found.
1444
+ // ERROR, EMPTY, DESTROYED_CLEAN, DESTROYED_DIRTY
1445
+ } else if (!(status & K.READY)) {
1446
+ throw K.NOT_FOUND_ERROR ;
1447
+
1448
+ // otherwise, make new status READY_DIRTY unless new.
1449
+ // K.READY_CLEAN, K.READY_DIRTY, ignore K.READY_NEW
1450
+ } else {
1451
+ if (status != K.READY_NEW) this.writeStatus(storeKey, K.READY_DIRTY);
1452
+ }
1453
+
1454
+ // record data hash change
1455
+ this.dataHashDidChange(storeKey, null, statusOnly, key);
1456
+
1457
+ // record in changelog
1458
+ changelog = this.changelog ;
1459
+ if (!changelog) changelog = this.changelog = SC.Set.create() ;
1460
+ changelog.add(storeKey);
1461
+ this.changelog = changelog;
1462
+
1463
+ // if commit records is enabled
1464
+ if(this.get('commitRecordsAutomatically')){
1465
+ this.invokeLast(this.commitRecords);
1466
+ }
1467
+
1468
+ return this ;
1469
+ },
1470
+
1471
+ /**
1472
+ Mark a group of records as dirty. The records will be committed to the
1473
+ server the next time you commit changes on the root store. If you have a
1474
+ set of record ids, marking them dirty this way can be faster than
1475
+ retrieving each record and destroying it individually.
1476
+
1477
+ You can pass either a single recordType or an array of recordTypes. If
1478
+ you pass a single recordType, then the record type will be used for each
1479
+ record. If you pass an array, then each id must have a matching record
1480
+ type in the array.
1481
+
1482
+ You can optionally pass an array of storeKeys instead of the recordType
1483
+ and ids. In this case the first two parameters will be ignored. This
1484
+ is usually only used by low-level internal methods.
1485
+
1486
+ @param {SC.Record|Array} recordTypes class or array of classes
1487
+ @param {Array} ids ids to destroy
1488
+ @param {Array} storeKeys (optional) store keys to destroy
1489
+ @returns {SC.Store} receiver
1490
+ */
1491
+ recordsDidChange: function(recordTypes, ids, storeKeys) {
1492
+ var len, isArray, idx, id, recordType, storeKey;
1493
+ if(storeKeys===undefined){
1494
+ len = ids.length;
1495
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1496
+ if (!isArray) recordType = recordTypes;
1497
+ for(idx=0;idx<len;idx++) {
1498
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1499
+ id = ids ? ids[idx] : undefined ;
1500
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1501
+ this.recordDidChange(recordType, id, storeKey);
1502
+ }
1503
+ }else{
1504
+ len = storeKeys.length;
1505
+ for(idx=0;idx<len;idx++) {
1506
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1507
+ this.recordDidChange(undefined, undefined, storeKey);
1508
+ }
1509
+ }
1510
+ return this ;
1511
+ },
1512
+
1513
+ /**
1514
+ Retrieves a set of records from the server. If the records has
1515
+ already been loaded in the store, then this method will simply return.
1516
+ Otherwise if your store has a dataSource, this will call the
1517
+ dataSource to retrieve the record. Generally you will not need to
1518
+ call this method yourself. Instead you can just use find().
1519
+
1520
+ This will not actually create a record instance but it will initiate a
1521
+ load of the record from the server. You can subsequently get a record
1522
+ instance itself using materializeRecord()
1523
+
1524
+ @param {SC.Record|Array} recordTypes class or array of classes
1525
+ @param {Array} ids ids to retrieve
1526
+ @param {Array} storeKeys (optional) store keys to retrieve
1527
+ @param {Boolean} isRefresh
1528
+ @param {Function|Array} callback function or array of functions
1529
+ @returns {Array} storeKeys to be retrieved
1530
+ */
1531
+ retrieveRecords: function(recordTypes, ids, storeKeys, isRefresh, callbacks) {
1532
+
1533
+ var source = this._getDataSource(),
1534
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1535
+ hasCallbackArray = SC.typeOf(callbacks) === SC.T_ARRAY,
1536
+ len = (!storeKeys) ? ids.length : storeKeys.length,
1537
+ ret = [],
1538
+ rev = SC.Store.generateStoreKey(),
1539
+ K = SC.Record,
1540
+ recordType, idx, storeKey, status, ok, callback;
1541
+
1542
+ if (!isArray) recordType = recordTypes;
1543
+
1544
+ // if no storeKeys were passed, map recordTypes + ids
1545
+ for(idx=0;idx<len;idx++) {
1546
+
1547
+ // collect store key
1548
+ if (storeKeys) {
1549
+ storeKey = storeKeys[idx];
1550
+ } else {
1551
+ if (isArray) recordType = recordTypes[idx];
1552
+ storeKey = recordType.storeKeyFor(ids[idx]);
1553
+ }
1554
+ //collect the callback
1555
+ callback = hasCallbackArray ? callbacks[idx] : callbacks;
1556
+
1557
+ // collect status and process
1558
+ status = this.readStatus(storeKey);
1559
+
1560
+ // K.EMPTY, K.ERROR, K.DESTROYED_CLEAN - initial retrieval
1561
+ if ((status == K.EMPTY) || (status == K.ERROR) || (status == K.DESTROYED_CLEAN)) {
1562
+ this.writeStatus(storeKey, K.BUSY_LOADING);
1563
+ this.dataHashDidChange(storeKey, rev, YES);
1564
+ ret.push(storeKey);
1565
+ this._setCallbackForStoreKey(storeKey, callback, hasCallbackArray, storeKeys);
1566
+ // otherwise, ignore record unless isRefresh is YES.
1567
+ } else if (isRefresh) {
1568
+ // K.READY_CLEAN, K.READY_DIRTY, ignore K.READY_NEW
1569
+ if (status & K.READY) {
1570
+ this.writeStatus(storeKey, K.BUSY_REFRESH | (status & 0x03)) ;
1571
+ this.dataHashDidChange(storeKey, rev, YES);
1572
+ ret.push(storeKey);
1573
+ this._setCallbackForStoreKey(storeKey, callback, hasCallbackArray, storeKeys);
1574
+ // K.BUSY_DESTROYING, K.BUSY_COMMITTING, K.BUSY_CREATING
1575
+ } else if ((status == K.BUSY_DESTROYING) || (status == K.BUSY_CREATING) || (status == K.BUSY_COMMITTING)) {
1576
+ throw K.BUSY_ERROR ;
1577
+
1578
+ // K.DESTROY_DIRTY, bad state...
1579
+ } else if (status == K.DESTROYED_DIRTY) {
1580
+ throw K.BAD_STATE_ERROR ;
1581
+
1582
+ // ignore K.BUSY_LOADING, K.BUSY_REFRESH_CLEAN, K.BUSY_REFRESH_DIRTY
1583
+ }
1584
+ }
1585
+ }
1586
+
1587
+ // now retrieve storekeys from dataSource. if there is no dataSource,
1588
+ // then act as if we couldn't retrieve.
1589
+ ok = NO;
1590
+ if (source) ok = source.retrieveRecords.call(source, this, ret, ids);
1591
+
1592
+ // if the data source could not retrieve or if there is no source, then
1593
+ // simulate the data source calling dataSourceDidError on those we are
1594
+ // loading for the first time or dataSourceDidComplete on refreshes.
1595
+ if (!ok) {
1596
+ len = ret.length;
1597
+ rev = SC.Store.generateStoreKey();
1598
+ for(idx=0;idx<len;idx++) {
1599
+ storeKey = ret[idx];
1600
+ status = this.readStatus(storeKey);
1601
+ if (status === K.BUSY_LOADING) {
1602
+ this.writeStatus(storeKey, K.ERROR);
1603
+ this.dataHashDidChange(storeKey, rev, YES);
1604
+
1605
+ } else if (status & K.BUSY_REFRESH) {
1606
+ this.writeStatus(storeKey, K.READY | (status & 0x03));
1607
+ this.dataHashDidChange(storeKey, rev, YES);
1608
+ }
1609
+ }
1610
+ ret.length = 0 ; // truncate to indicate that none could refresh
1611
+ }
1612
+ return ret ;
1613
+ },
1614
+
1615
+ _TMP_RETRIEVE_ARRAY: [],
1616
+
1617
+ _callback_queue: {},
1618
+
1619
+ /**
1620
+ @private
1621
+ stores the callbacks for the storeKeys that are inflight
1622
+ **/
1623
+ _setCallbackForStoreKey: function(storeKey, callback, hasCallbackArray, storeKeys){
1624
+ var queue = this._callback_queue;
1625
+ if(hasCallbackArray) queue[storeKey] = {callback: callback, otherKeys: storeKeys};
1626
+ else queue[storeKey] = callback;
1627
+ },
1628
+ /**
1629
+ @private
1630
+ retreives and calls callback for storkey if exists
1631
+ also handles if a single callback is need for one key
1632
+ **/
1633
+ _retreiveCallbackForStoreKey: function(storeKey){
1634
+ var queue = this._callback_queue,
1635
+ callback = queue[storeKey],
1636
+ allFinished, keys;
1637
+ if(callback){
1638
+ if(SC.typeOf(callback) === SC.T_FUNCTION){
1639
+ callback.call(); //args?
1640
+ delete queue[storeKey]; //cleanup
1641
+ }
1642
+ else if(SC.typeOf(callback) == SC.T_HASH){
1643
+ callback.completed = YES;
1644
+ keys = callback.storeKeys;
1645
+ keys.forEach(function(key){
1646
+ if(!queue[key].completed) allFinished = YES;
1647
+ });
1648
+ if(allFinished){
1649
+ callback.callback.call(); // args?
1650
+ //cleanup
1651
+ keys.forEach(function(key){
1652
+ delete queue[key];
1653
+ });
1654
+ }
1655
+
1656
+ }
1657
+ }
1658
+ },
1659
+
1660
+ /*
1661
+ @private
1662
+
1663
+ */
1664
+ _cancelCallback: function(storeKey){
1665
+ var queue = this._callback_queue;
1666
+ if(queue[storeKey]){
1667
+ delete queue[storeKey];
1668
+ }
1669
+ },
1670
+
1671
+
1672
+ /**
1673
+ Retrieves a record from the server. If the record has already been loaded
1674
+ in the store, then this method will simply return. Otherwise if your
1675
+ store has a dataSource, this will call the dataSource to retrieve the
1676
+ record. Generally you will not need to call this method yourself.
1677
+ Instead you can just use find().
1678
+
1679
+ This will not actually create a record instance but it will initiate a
1680
+ load of the record from the server. You can subsequently get a record
1681
+ instance itself using materializeRecord()
1682
+
1683
+ @param {SC.Record} recordType class
1684
+ @param {String} id id to retrieve
1685
+ @param {Number} storeKey (optional) store key
1686
+ @param {Boolean} isRefresh
1687
+ @param {Function} callback (optional)
1688
+ @returns {Number} storeKey that was retrieved
1689
+ */
1690
+ retrieveRecord: function(recordType, id, storeKey, isRefresh, callback) {
1691
+ var array = this._TMP_RETRIEVE_ARRAY,
1692
+ ret;
1693
+
1694
+ if (storeKey) {
1695
+ array[0] = storeKey;
1696
+ storeKey = array;
1697
+ id = null ;
1698
+ } else {
1699
+ array[0] = id;
1700
+ id = array;
1701
+ }
1702
+
1703
+ ret = this.retrieveRecords(recordType, id, storeKey, isRefresh, callback);
1704
+ array.length = 0 ;
1705
+ return ret[0];
1706
+ },
1707
+
1708
+ /**
1709
+ Refreshes a record from the server. If the record has already been loaded
1710
+ in the store, then this method will request a refresh from the dataSource.
1711
+ Otherwise it will attempt to retrieve the record.
1712
+
1713
+ @param {String} id to id of the record to load
1714
+ @param {SC.Record} recordType the expected record type
1715
+ @param {Number} storeKey (optional) optional store key
1716
+ @param {Function} callback (optional) when refresh complets
1717
+ @returns {Boolean} YES if the retrieval was a success.
1718
+ */
1719
+ refreshRecord: function(recordType, id, storeKey, callback) {
1720
+ return !!this.retrieveRecord(recordType, id, storeKey, YES, callback);
1721
+ },
1722
+
1723
+ /**
1724
+ Refreshes a set of records from the server. If the records has already been loaded
1725
+ in the store, then this method will request a refresh from the dataSource.
1726
+ Otherwise it will attempt to retrieve them.
1727
+
1728
+ @param {SC.Record|Array} recordTypes class or array of classes
1729
+ @param {Array} ids ids to destroy
1730
+ @param {Array} storeKeys (optional) store keys to destroy
1731
+ @param {Function} callback (optional) when refresh complets
1732
+ @returns {Boolean} YES if the retrieval was a success.
1733
+ */
1734
+ refreshRecords: function(recordTypes, ids, storeKeys, callback) {
1735
+ var ret = this.retrieveRecords(recordTypes, ids, storeKeys, YES, callback);
1736
+ return ret && ret.length>0;
1737
+ },
1738
+
1739
+ /**
1740
+ Commits the passed store keys or ids. If no storeKeys are given
1741
+ it will commit any records in the changelog.
1742
+
1743
+ Based on the current state of the record, this will ask the data
1744
+ source to perform the appropriate actions
1745
+ on the store keys.
1746
+
1747
+ @param {Array} recordTypes the expected record types (SC.Record)
1748
+ @param {Array} ids to commit
1749
+ @param {SC.Set} storeKeys to commit
1750
+ @param {Hash} params optional additional parameters to pass along to the
1751
+ data source
1752
+ @param {Function|Array} callback function or array of functions
1753
+
1754
+ @returns {Boolean} if the action was succesful.
1755
+ */
1756
+ commitRecords: function(recordTypes, ids, storeKeys, params, callbacks) {
1757
+ var source = this._getDataSource(),
1758
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1759
+ hasCallbackArray = SC.typeOf(callbacks) === SC.T_ARRAY,
1760
+ retCreate= [], retUpdate= [], retDestroy = [],
1761
+ rev = SC.Store.generateStoreKey(),
1762
+ K = SC.Record,
1763
+ recordType, idx, storeKey, status, key, ret, len, callback;
1764
+
1765
+ // If no params are passed, look up storeKeys in the changelog property.
1766
+ // Remove any committed records from changelog property.
1767
+
1768
+ if(!recordTypes && !ids && !storeKeys){
1769
+ storeKeys = this.changelog;
1770
+ }
1771
+
1772
+ len = storeKeys ? storeKeys.get('length') : (ids ? ids.get('length') : 0);
1773
+
1774
+ for(idx=0;idx<len;idx++) {
1775
+
1776
+ // collect store key
1777
+ if (storeKeys) {
1778
+ storeKey = storeKeys[idx];
1779
+ } else {
1780
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1781
+ else recordType = recordTypes;
1782
+ storeKey = recordType.storeKeyFor(ids[idx]);
1783
+ }
1784
+
1785
+ //collect the callback
1786
+ callback = hasCallbackArray ? callbacks[idx] : callbacks;
1787
+
1788
+ // collect status and process
1789
+ status = this.readStatus(storeKey);
1790
+
1791
+ if ((status == K.EMPTY) || (status == K.ERROR)) {
1792
+ throw K.NOT_FOUND_ERROR ;
1793
+ }
1794
+ else {
1795
+ if(status==K.READY_NEW) {
1796
+ this.writeStatus(storeKey, K.BUSY_CREATING);
1797
+ this.dataHashDidChange(storeKey, rev, YES);
1798
+ retCreate.push(storeKey);
1799
+ this._setCallbackForStoreKey(storeKey, callback, hasCallbackArray, storeKeys);
1800
+ } else if (status==K.READY_DIRTY) {
1801
+ this.writeStatus(storeKey, K.BUSY_COMMITTING);
1802
+ this.dataHashDidChange(storeKey, rev, YES);
1803
+ retUpdate.push(storeKey);
1804
+ this._setCallbackForStoreKey(storeKey, callback, hasCallbackArray, storeKeys);
1805
+ } else if (status==K.DESTROYED_DIRTY) {
1806
+ this.writeStatus(storeKey, K.BUSY_DESTROYING);
1807
+ this.dataHashDidChange(storeKey, rev, YES);
1808
+ retDestroy.push(storeKey);
1809
+ this._setCallbackForStoreKey(storeKey, callback, hasCallbackArray, storeKeys);
1810
+ } else if (status==K.DESTROYED_CLEAN) {
1811
+ this.dataHashDidChange(storeKey, rev, YES);
1812
+ }
1813
+ // ignore K.READY_CLEAN, K.BUSY_LOADING, K.BUSY_CREATING, K.BUSY_COMMITTING,
1814
+ // K.BUSY_REFRESH_CLEAN, K_BUSY_REFRESH_DIRTY, KBUSY_DESTROYING
1815
+ }
1816
+ }
1817
+
1818
+ // now commit storekeys to dataSource
1819
+ if (source && (len>0 || params)) {
1820
+ ret = source.commitRecords.call(source, this, retCreate, retUpdate, retDestroy, params);
1821
+ }
1822
+
1823
+ //remove all commited changes from changelog
1824
+ if (ret && !recordTypes && !ids) {
1825
+ if (storeKeys === this.changelog) {
1826
+ this.changelog = null;
1827
+ }
1828
+ else {
1829
+ this.changelog.removeEach(storeKeys);
1830
+ }
1831
+ }
1832
+ return ret ;
1833
+ },
1834
+
1835
+ /**
1836
+ Commits the passed store key or id. Based on the current state of the
1837
+ record, this will ask the data source to perform the appropriate action
1838
+ on the store key.
1839
+
1840
+ You have to pass either the id or the storeKey otherwise it will return
1841
+ NO.
1842
+
1843
+ @param {SC.Record} recordType the expected record type
1844
+ @param {String} id the id of the record to commit
1845
+ @param {Number} storeKey the storeKey of the record to commit
1846
+ @param {Hash} params optional additonal params that will passed down
1847
+ to the data source
1848
+ @returns {Boolean} if the action was successful.
1849
+ */
1850
+ commitRecord: function(recordType, id, storeKey, params, callback) {
1851
+ var array = this._TMP_RETRIEVE_ARRAY,
1852
+ ret ;
1853
+ if (id === undefined && storeKey === undefined ) return NO;
1854
+ if (storeKey !== undefined) {
1855
+ array[0] = storeKey;
1856
+ storeKey = array;
1857
+ id = null ;
1858
+ } else {
1859
+ array[0] = id;
1860
+ id = array;
1861
+ }
1862
+
1863
+ ret = this.commitRecords(recordType, id, storeKey, params, callback);
1864
+ array.length = 0 ;
1865
+ return ret;
1866
+ },
1867
+
1868
+ /**
1869
+ Cancels an inflight request for the passed records. Depending on the
1870
+ server implementation, this could cancel an entire request, causing
1871
+ other records to also transition their current state.
1872
+
1873
+ @param {SC.Record|Array} recordTypes class or array of classes
1874
+ @param {Array} ids ids to destroy
1875
+ @param {Array} storeKeys (optional) store keys to destroy
1876
+ @returns {SC.Store} the store.
1877
+ */
1878
+ cancelRecords: function(recordTypes, ids, storeKeys) {
1879
+ var source = this._getDataSource(),
1880
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1881
+ K = SC.Record,
1882
+ ret = [],
1883
+ status, len, idx, id, recordType, storeKey;
1884
+
1885
+ len = (storeKeys === undefined) ? ids.length : storeKeys.length;
1886
+ for(idx=0;idx<len;idx++) {
1887
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1888
+ else recordType = recordTypes || SC.Record;
1889
+
1890
+ id = ids ? ids[idx] : undefined ;
1891
+
1892
+ if(storeKeys===undefined){
1893
+ storeKey = recordType.storeKeyFor(id);
1894
+ }else{
1895
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1896
+ }
1897
+ if(storeKey) {
1898
+ status = this.readStatus(storeKey);
1899
+
1900
+ if ((status == K.EMPTY) || (status == K.ERROR)) {
1901
+ throw K.NOT_FOUND_ERROR ;
1902
+ }
1903
+ ret.push(storeKey);
1904
+ this._cancelCallback(storeKey);
1905
+ }
1906
+ }
1907
+
1908
+ if (source) source.cancel.call(source, this, ret);
1909
+
1910
+ return this ;
1911
+ },
1912
+
1913
+ /**
1914
+ Cancels an inflight request for the passed record. Depending on the
1915
+ server implementation, this could cancel an entire request, causing
1916
+ other records to also transition their current state.
1917
+
1918
+ @param {SC.Record|Array} recordTypes class or array of classes
1919
+ @param {Array} ids ids to destroy
1920
+ @param {Array} storeKeys (optional) store keys to destroy
1921
+ @returns {SC.Store} the store.
1922
+ */
1923
+ cancelRecord: function(recordType, id, storeKey) {
1924
+ var array = this._TMP_RETRIEVE_ARRAY,
1925
+ ret ;
1926
+
1927
+ if (storeKey !== undefined) {
1928
+ array[0] = storeKey;
1929
+ storeKey = array;
1930
+ id = null ;
1931
+ } else {
1932
+ array[0] = id;
1933
+ id = array;
1934
+ }
1935
+
1936
+ ret = this.cancelRecords(recordType, id, storeKey);
1937
+ array.length = 0 ;
1938
+ return this;
1939
+ },
1940
+
1941
+ /**
1942
+ Convenience method can be called by the store or other parts of your
1943
+ application to load a record into the store. This method will take a
1944
+ recordType and a data hashes and either add or update the
1945
+ record in the store.
1946
+
1947
+ The loaded records will be in an SC.Record.READY_CLEAN state, indicating
1948
+ they were loaded from the data source and do not need to be committed
1949
+ back before changing.
1950
+
1951
+ This method will check the state of the storeKey and call either
1952
+ pushRetrieve() or dataSourceDidComplete(). The standard state constraints
1953
+ for these methods apply here.
1954
+
1955
+ The return value will be the storeKey used for the push. This is often
1956
+ convenient to pass into loadQuery(), if you are fetching a remote query.
1957
+
1958
+ If you are upgrading from a pre SproutCore 1.0 application, this method
1959
+ is the closest to the old updateRecord().
1960
+
1961
+ @param {SC.Record} recordType the record type
1962
+ @param {Array} dataHash to update
1963
+ @param {Array} id optional. if not passed lookup on the hash
1964
+ @returns {String} store keys assigned to these id
1965
+ */
1966
+ loadRecord: function(recordType, dataHash, id) {
1967
+ var K = SC.Record,
1968
+ ret, primaryKey, storeKey;
1969
+
1970
+ // save lookup info
1971
+ recordType = recordType || SC.Record;
1972
+ primaryKey = recordType.prototype.primaryKey;
1973
+
1974
+
1975
+ // push each record
1976
+ id = id || dataHash[primaryKey];
1977
+ ret = storeKey = recordType.storeKeyFor(id); // needed to cache
1978
+
1979
+ if (this.readStatus(storeKey) & K.BUSY) {
1980
+ this.dataSourceDidComplete(storeKey, dataHash, id);
1981
+ } else this.pushRetrieve(recordType, id, dataHash, storeKey);
1982
+
1983
+ // return storeKey
1984
+ return ret ;
1985
+ },
1986
+
1987
+ /**
1988
+ Convenience method can be called by the store or other parts of your
1989
+ application to load records into the store. This method will take a
1990
+ recordType and an array of data hashes and either add or update the
1991
+ record in the store.
1992
+
1993
+ The loaded records will be in an SC.Record.READY_CLEAN state, indicating
1994
+ they were loaded from the data source and do not need to be committed
1995
+ back before changing.
1996
+
1997
+ This method will check the state of each storeKey and call either
1998
+ pushRetrieve() or dataSourceDidComplete(). The standard state constraints
1999
+ for these methods apply here.
2000
+
2001
+ The return value will be the storeKeys used for each push. This is often
2002
+ convenient to pass into loadQuery(), if you are fetching a remote query.
2003
+
2004
+ If you are upgrading from a pre SproutCore 1.0 application, this method
2005
+ is the closest to the old updateRecords().
2006
+
2007
+ @param {SC.Record} recordTypes the record type or array of record types
2008
+ @param {Array} dataHashes array of data hashes to update
2009
+ @param {Array} ids optional array of ids. if not passed lookup on hashes
2010
+ @returns {Array} store keys assigned to these ids
2011
+ */
2012
+ loadRecords: function(recordTypes, dataHashes, ids) {
2013
+ var isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
2014
+ len = dataHashes.get('length'),
2015
+ ret = [],
2016
+ K = SC.Record,
2017
+ recordType, id, primaryKey, idx, dataHash, storeKey;
2018
+
2019
+ // save lookup info
2020
+ if (!isArray) {
2021
+ recordType = recordTypes || SC.Record;
2022
+ primaryKey = recordType.prototype.primaryKey ;
2023
+ }
2024
+
2025
+ // push each record
2026
+ for(idx=0;idx<len;idx++) {
2027
+ dataHash = dataHashes.objectAt(idx);
2028
+ if (isArray) {
2029
+ recordType = recordTypes.objectAt(idx) || SC.Record;
2030
+ primaryKey = recordType.prototype.primaryKey ;
2031
+ }
2032
+ id = (ids) ? ids.objectAt(idx) : dataHash[primaryKey];
2033
+ ret[idx] = this.loadRecord(recordType, dataHash, id);
2034
+
2035
+ }
2036
+
2037
+ // return storeKeys
2038
+ return ret ;
2039
+ },
2040
+
2041
+ /**
2042
+ Returns the SC.Error object associated with a specific record.
2043
+
2044
+ @param {Number} storeKey The store key of the record.
2045
+
2046
+ @returns {SC.Error} SC.Error or undefined if no error associated with the record.
2047
+ */
2048
+ readError: function(storeKey) {
2049
+ var errors = this.recordErrors ;
2050
+ return errors ? errors[storeKey] : undefined ;
2051
+ },
2052
+
2053
+ /**
2054
+ Returns the SC.Error object associated with a specific query.
2055
+
2056
+ @param {SC.Query} query The SC.Query with which the error is associated.
2057
+
2058
+ @returns {SC.Error} SC.Error or undefined if no error associated with the query.
2059
+ */
2060
+ readQueryError: function(query) {
2061
+ var errors = this.queryErrors ;
2062
+ return errors ? errors[SC.guidFor(query)] : undefined ;
2063
+ },
2064
+
2065
+ // ..........................................................
2066
+ // DATA SOURCE CALLBACKS
2067
+ //
2068
+ // Mathods called by the data source on the store
2069
+
2070
+ /**
2071
+ Called by a dataSource when it cancels an inflight operation on a
2072
+ record. This will transition the record back to it non-inflight state.
2073
+
2074
+ @param {Number} storeKey record store key to cancel
2075
+ @returns {SC.Store} reciever
2076
+ */
2077
+ dataSourceDidCancel: function(storeKey) {
2078
+ var status = this.readStatus(storeKey),
2079
+ K = SC.Record;
2080
+
2081
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
2082
+ // DESTROYED_DIRTY
2083
+ if (!(status & K.BUSY)) {
2084
+ throw K.BAD_STATE_ERROR; // should never be called in this state
2085
+ }
2086
+
2087
+ // otherwise, determine proper state transition
2088
+ switch(status) {
2089
+ case K.BUSY_LOADING:
2090
+ status = K.EMPTY;
2091
+ break ;
2092
+
2093
+ case K.BUSY_CREATING:
2094
+ status = K.READY_NEW;
2095
+ break;
2096
+
2097
+ case K.BUSY_COMMITTING:
2098
+ status = K.READY_DIRTY ;
2099
+ break;
2100
+
2101
+ case K.BUSY_REFRESH_CLEAN:
2102
+ status = K.READY_CLEAN;
2103
+ break;
2104
+
2105
+ case K.BUSY_REFRESH_DIRTY:
2106
+ status = K.READY_DIRTY ;
2107
+ break ;
2108
+
2109
+ case K.BUSY_DESTROYING:
2110
+ status = K.DESTROYED_DIRTY ;
2111
+ break;
2112
+
2113
+ default:
2114
+ throw K.BAD_STATE_ERROR ;
2115
+ }
2116
+ this.writeStatus(storeKey, status) ;
2117
+ this.dataHashDidChange(storeKey, null, YES);
2118
+ this._cancelCallback(storeKey);
2119
+
2120
+ return this ;
2121
+ },
2122
+
2123
+ /**
2124
+ Called by a data source when it creates or commits a record. Passing an
2125
+ optional id will remap the storeKey to the new record id. This is
2126
+ required when you commit a record that does not have an id yet.
2127
+
2128
+ @param {Number} storeKey record store key to change to READY_CLEAN state
2129
+ @param {Hash} dataHash optional data hash to replace current hash
2130
+ @param {Object} newId optional new id to replace the old one
2131
+ @returns {SC.Store} reciever
2132
+ */
2133
+ dataSourceDidComplete: function(storeKey, dataHash, newId) {
2134
+ var status = this.readStatus(storeKey), K = SC.Record, statusOnly;
2135
+
2136
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
2137
+ // DESTROYED_DIRTY
2138
+ if (!(status & K.BUSY)) {
2139
+ throw K.BAD_STATE_ERROR; // should never be called in this state
2140
+ }
2141
+
2142
+ // otherwise, determine proper state transition
2143
+ if(status===K.BUSY_DESTROYING) {
2144
+ throw K.BAD_STATE_ERROR ;
2145
+ } else status = K.READY_CLEAN ;
2146
+
2147
+ this.writeStatus(storeKey, status) ;
2148
+ if (dataHash) this.writeDataHash(storeKey, dataHash, status) ;
2149
+ if (newId) SC.Store.replaceIdFor(storeKey, newId);
2150
+
2151
+ statusOnly = dataHash || newId ? NO : YES;
2152
+ this.dataHashDidChange(storeKey, null, statusOnly);
2153
+
2154
+ // Force record to refresh its cached properties based on store key
2155
+ var record = this.materializeRecord(storeKey);
2156
+ if (record != null) {
2157
+ record.notifyPropertyChange('status');
2158
+ }
2159
+ //update callbacks
2160
+ this._retreiveCallbackForStoreKey(storeKey);
2161
+
2162
+ return this ;
2163
+ },
2164
+
2165
+ /**
2166
+ Called by a data source when it has destroyed a record. This will
2167
+ transition the record to the proper state.
2168
+
2169
+ @param {Number} storeKey record store key to cancel
2170
+ @returns {SC.Store} reciever
2171
+ */
2172
+ dataSourceDidDestroy: function(storeKey) {
2173
+ var status = this.readStatus(storeKey), K = SC.Record;
2174
+
2175
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
2176
+ // DESTROYED_DIRTY
2177
+ if (!(status & K.BUSY)) {
2178
+ throw K.BAD_STATE_ERROR; // should never be called in this state
2179
+ }
2180
+ // otherwise, determine proper state transition
2181
+ else{
2182
+ status = K.DESTROYED_CLEAN ;
2183
+ }
2184
+ this.removeDataHash(storeKey, status) ;
2185
+ this.dataHashDidChange(storeKey);
2186
+
2187
+ // Force record to refresh its cached properties based on store key
2188
+ var record = this.materializeRecord(storeKey);
2189
+ if (record != null) {
2190
+ record.notifyPropertyChange('status');
2191
+ }
2192
+
2193
+ this._retreiveCallbackForStoreKey(storeKey);
2194
+
2195
+ return this ;
2196
+ },
2197
+
2198
+ /**
2199
+ Converts the passed record into an error object.
2200
+
2201
+ @param {Number} storeKey record store key to error
2202
+ @param {SC.Error} error [optional] an SC.Error instance to associate with storeKey
2203
+ @returns {SC.Store} reciever
2204
+ */
2205
+ dataSourceDidError: function(storeKey, error) {
2206
+ var status = this.readStatus(storeKey), errors = this.recordErrors, K = SC.Record;
2207
+
2208
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
2209
+ // DESTROYED_DIRTY
2210
+ if (!(status & K.BUSY)) { throw K.BAD_STATE_ERROR; }
2211
+
2212
+ // otherwise, determine proper state transition
2213
+ else status = K.ERROR ;
2214
+
2215
+ // Add the error to the array of record errors (for lookup later on if necessary).
2216
+ if (error && error.isError) {
2217
+ if (!errors) errors = this.recordErrors = [];
2218
+ errors[storeKey] = error;
2219
+ }
2220
+
2221
+ this.writeStatus(storeKey, status) ;
2222
+ this.dataHashDidChange(storeKey, null, YES);
2223
+
2224
+ // Force record to refresh its cached properties based on store key
2225
+ var record = this.materializeRecord(storeKey);
2226
+ if (record != null) {
2227
+ record.notifyPropertyChange('status');
2228
+ }
2229
+
2230
+ this._retreiveCallbackForStoreKey(storeKey);
2231
+ return this ;
2232
+ },
2233
+
2234
+ // ..........................................................
2235
+ // PUSH CHANGES FROM DATA SOURCE
2236
+ //
2237
+
2238
+ /**
2239
+ Call by the data source whenever you want to push new data out of band
2240
+ into the store.
2241
+
2242
+ @param {Class} recordType the SC.Record subclass
2243
+ @param {Object} id the record id or null
2244
+ @param {Hash} dataHash data hash to load
2245
+ @param {Number} storeKey optional store key.
2246
+ @returns {Number|Boolean} storeKey if push was allowed, NO if not
2247
+ */
2248
+ pushRetrieve: function(recordType, id, dataHash, storeKey) {
2249
+ var K = SC.Record, status;
2250
+
2251
+ if(storeKey===undefined) storeKey = recordType.storeKeyFor(id);
2252
+ status = this.readStatus(storeKey);
2253
+ if(status==K.EMPTY || status==K.ERROR || status==K.READY_CLEAN || status==K.DESTROYED_CLEAN) {
2254
+
2255
+ status = K.READY_CLEAN;
2256
+ if(dataHash===undefined) this.writeStatus(storeKey, status) ;
2257
+ else this.writeDataHash(storeKey, dataHash, status) ;
2258
+
2259
+ this.dataHashDidChange(storeKey);
2260
+
2261
+ return storeKey;
2262
+ }
2263
+ //conflicted (ready)
2264
+ return NO;
2265
+ },
2266
+
2267
+ /**
2268
+ Call by the data source whenever you want to push a deletion into the
2269
+ store.
2270
+
2271
+ @param {Class} recordType the SC.Record subclass
2272
+ @param {Object} id the record id or null
2273
+ @param {Number} storeKey optional store key.
2274
+ @returns {Number|Boolean} storeKey if push was allowed, NO if not
2275
+ */
2276
+ pushDestroy: function(recordType, id, storeKey) {
2277
+ var K = SC.Record, status;
2278
+
2279
+ if(storeKey===undefined){
2280
+ storeKey = recordType.storeKeyFor(id);
2281
+ }
2282
+ status = this.readStatus(storeKey);
2283
+ if(status==K.EMPTY || status==K.ERROR || status==K.READY_CLEAN || status==K.DESTROYED_CLEAN){
2284
+ status = K.DESTROYED_CLEAN;
2285
+ this.removeDataHash(storeKey, status) ;
2286
+ this.dataHashDidChange(storeKey);
2287
+ return storeKey;
2288
+ }
2289
+ //conflicted (destroy)
2290
+ return NO;
2291
+ },
2292
+
2293
+ /**
2294
+ Call by the data source whenever you want to push an error into the
2295
+ store.
2296
+
2297
+ @param {Class} recordType the SC.Record subclass
2298
+ @param {Object} id the record id or null
2299
+ @param {SC.Error} error [optional] an SC.Error instance to associate with id or storeKey
2300
+ @param {Number} storeKey optional store key.
2301
+ @returns {Number|Boolean} storeKey if push was allowed, NO if not
2302
+ */
2303
+ pushError: function(recordType, id, error, storeKey) {
2304
+ var K = SC.Record, status, errors = this.recordErrors;
2305
+
2306
+ if(storeKey===undefined) storeKey = recordType.storeKeyFor(id);
2307
+ status = this.readStatus(storeKey);
2308
+
2309
+ if(status==K.EMPTY || status==K.ERROR || status==K.READY_CLEAN || status==K.DESTROYED_CLEAN){
2310
+ status = K.ERROR;
2311
+
2312
+ // Add the error to the array of record errors (for lookup later on if necessary).
2313
+ if (error && error.isError) {
2314
+ if (!errors) errors = this.recordErrors = [];
2315
+ errors[storeKey] = error;
2316
+ }
2317
+
2318
+ this.writeStatus(storeKey, status) ;
2319
+ this.dataHashDidChange(storeKey, null, YES);
2320
+ return storeKey;
2321
+ }
2322
+ //conflicted (error)
2323
+ return NO;
2324
+ },
2325
+
2326
+ // ..........................................................
2327
+ // FETCH CALLBACKS
2328
+ //
2329
+
2330
+ // NOTE: although these method works on RecordArray instances right now.
2331
+ // They could be optimized to actually share query results between nested
2332
+ // stores. This is why these methods are implemented here instead of
2333
+ // directly on Query or RecordArray objects.
2334
+
2335
+ /**
2336
+ Sets the passed array of storeKeys as the new data for the query. You
2337
+ can call this at any time for a remote query to update its content. If
2338
+ you want to use incremental loading, then pass a SparseArray object.
2339
+
2340
+ If the query you pass is not a REMOTE query, then this method will raise
2341
+ an exception. This will also implicitly transition the query state to
2342
+ SC.Record.READY.
2343
+
2344
+ If you called loadRecords() before to load the actual content, you can
2345
+ call this method with the return value of that method to actually set the
2346
+ storeKeys on the result.
2347
+
2348
+ @param {SC.Query} query the query you are loading. must be remote.
2349
+ @param {SC.Array} storeKeys array of store keys
2350
+ @returns {SC.Store} receiver
2351
+ */
2352
+ loadQueryResults: function(query, storeKeys) {
2353
+ if (query.get('location') === SC.Query.LOCAL) {
2354
+ throw new Error("Cannot load query results for a local query");
2355
+ }
2356
+
2357
+ var recArray = this._findQuery(query, YES, NO);
2358
+ if (recArray) recArray.set('storeKeys', storeKeys);
2359
+ this.dataSourceDidFetchQuery(query);
2360
+
2361
+ return this ;
2362
+ },
2363
+
2364
+ /**
2365
+ Called by your data source whenever you finish fetching the results of a
2366
+ query. This will put the query into a READY state if it was loading.
2367
+
2368
+ Note that if the query is a REMOTE query, then you must separately load
2369
+ the results into the query using loadQueryResults(). If the query is
2370
+ LOCAL, then the query will update automatically with any new records you
2371
+ added to the store.
2372
+
2373
+ @param {SC.Query} query the query you fetched
2374
+ @returns {SC.Store} receiver
2375
+ */
2376
+ dataSourceDidFetchQuery: function(query) {
2377
+ return this._scstore_dataSourceDidFetchQuery(query, YES);
2378
+ },
2379
+
2380
+ _scstore_dataSourceDidFetchQuery: function(query, createIfNeeded) {
2381
+ var recArray = this._findQuery(query, createIfNeeded, NO),
2382
+ nestedStores = this.get('nestedStores'),
2383
+ loc = nestedStores ? nestedStores.get('length') : 0;
2384
+
2385
+ // fix query if needed
2386
+ if (recArray) recArray.storeDidFetchQuery(query);
2387
+
2388
+ // notify nested stores
2389
+ while(--loc >= 0) {
2390
+ nestedStores[loc]._scstore_dataSourceDidFetchQuery(query, NO);
2391
+ }
2392
+
2393
+ return this ;
2394
+ },
2395
+
2396
+ /**
2397
+ Called by your data source if it cancels fetching the results of a query.
2398
+ This will put any RecordArray's back into its original state (READY or
2399
+ EMPTY).
2400
+
2401
+ @param {SC.Query} query the query you cancelled
2402
+ @returns {SC.Store} receiver
2403
+ */
2404
+ dataSourceDidCancelQuery: function(query) {
2405
+ return this._scstore_dataSourceDidCancelQuery(query, YES);
2406
+ },
2407
+
2408
+ _scstore_dataSourceDidCancelQuery: function(query, createIfNeeded) {
2409
+ var recArray = this._findQuery(query, createIfNeeded, NO),
2410
+ nestedStores = this.get('nestedStores'),
2411
+ loc = nestedStores ? nestedStores.get('length') : 0;
2412
+
2413
+ // fix query if needed
2414
+ if (recArray) recArray.storeDidCancelQuery(query);
2415
+
2416
+ // notify nested stores
2417
+ while(--loc >= 0) {
2418
+ nestedStores[loc]._scstore_dataSourceDidCancelQuery(query, NO);
2419
+ }
2420
+
2421
+ return this ;
2422
+ },
2423
+
2424
+ /**
2425
+ Called by your data source if it encountered an error loading the query.
2426
+ This will put the query into an error state until you try to refresh it
2427
+ again.
2428
+
2429
+ @param {SC.Query} query the query with the error
2430
+ @param {SC.Error} error [optional] an SC.Error instance to associate with query
2431
+ @returns {SC.Store} receiver
2432
+ */
2433
+ dataSourceDidErrorQuery: function(query, error) {
2434
+ var errors = this.queryErrors;
2435
+
2436
+ // Add the error to the array of query errors (for lookup later on if necessary).
2437
+ if (error && error.isError) {
2438
+ if (!errors) errors = this.queryErrors = {};
2439
+ errors[SC.guidFor(query)] = error;
2440
+ }
2441
+
2442
+ return this._scstore_dataSourceDidErrorQuery(query, YES);
2443
+ },
2444
+
2445
+ _scstore_dataSourceDidErrorQuery: function(query, createIfNeeded) {
2446
+ var recArray = this._findQuery(query, createIfNeeded, NO),
2447
+ nestedStores = this.get('nestedStores'),
2448
+ loc = nestedStores ? nestedStores.get('length') : 0;
2449
+
2450
+ // fix query if needed
2451
+ if (recArray) recArray.storeDidErrorQuery(query);
2452
+
2453
+ // notify nested stores
2454
+ while(--loc >= 0) {
2455
+ nestedStores[loc]._scstore_dataSourceDidErrorQuery(query, NO);
2456
+ }
2457
+
2458
+ return this ;
2459
+ },
2460
+
2461
+ // ..........................................................
2462
+ // INTERNAL SUPPORT
2463
+ //
2464
+
2465
+ /** @private */
2466
+ init: function() {
2467
+ sc_super();
2468
+ this.reset();
2469
+ },
2470
+
2471
+
2472
+ toString: function() {
2473
+ // Include the name if the client has specified one.
2474
+ var name = this.get('name');
2475
+ if (!name) {
2476
+ return sc_super();
2477
+ }
2478
+ else {
2479
+ var ret = sc_super();
2480
+ return "%@ (%@)".fmt(name, ret);
2481
+ }
2482
+ },
2483
+
2484
+
2485
+ // ..........................................................
2486
+ // PRIMARY KEY CONVENIENCE METHODS
2487
+ //
2488
+
2489
+ /**
2490
+ Given a storeKey, return the primaryKey.
2491
+
2492
+ @param {Number} storeKey the store key
2493
+ @returns {String} primaryKey value
2494
+ */
2495
+ idFor: function(storeKey) {
2496
+ return SC.Store.idFor(storeKey);
2497
+ },
2498
+
2499
+ /**
2500
+ Given a storeKey, return the recordType.
2501
+
2502
+ @param {Number} storeKey the store key
2503
+ @returns {SC.Record} record instance
2504
+ */
2505
+ recordTypeFor: function(storeKey) {
2506
+ return SC.Store.recordTypeFor(storeKey) ;
2507
+ },
2508
+
2509
+ /**
2510
+ Given a recordType and primaryKey, find the storeKey. If the primaryKey
2511
+ has not been assigned a storeKey yet, it will be added.
2512
+
2513
+ @param {SC.Record} recordType the record type
2514
+ @param {String} primaryKey the primary key
2515
+ @returns {Number} storeKey
2516
+ */
2517
+ storeKeyFor: function(recordType, primaryKey) {
2518
+ return recordType.storeKeyFor(primaryKey);
2519
+ },
2520
+
2521
+ /**
2522
+ Given a primaryKey value for the record, returns the associated
2523
+ storeKey. As opposed to storeKeyFor() however, this method
2524
+ will NOT generate a new storeKey but returned undefined.
2525
+
2526
+ @param {SC.Record} recordType the record type
2527
+ @param {String} primaryKey the primary key
2528
+ @returns {Number} a storeKey.
2529
+ */
2530
+ storeKeyExists: function(recordType, primaryKey) {
2531
+ return recordType.storeKeyExists(primaryKey);
2532
+ },
2533
+
2534
+ /**
2535
+ Finds all storeKeys of a certain record type in this store
2536
+ and returns an array.
2537
+
2538
+ @param {SC.Record} recordType
2539
+ @returns {Array} set of storeKeys
2540
+ */
2541
+ storeKeysFor: function(recordType) {
2542
+ var ret = [],
2543
+ isEnum = recordType && recordType.isEnumerable,
2544
+ recType, storeKey, isMatch ;
2545
+
2546
+ if (!this.statuses) return ret;
2547
+ for(storeKey in SC.Store.recordTypesByStoreKey) {
2548
+ recType = SC.Store.recordTypesByStoreKey[storeKey];
2549
+
2550
+ // if same record type and this store has it
2551
+ if (isEnum) isMatch = recordType.contains(recType);
2552
+ else isMatch = recType === recordType;
2553
+
2554
+ if(isMatch && this.statuses[storeKey]) ret.push(parseInt(storeKey, 10));
2555
+ }
2556
+
2557
+ return ret;
2558
+ },
2559
+
2560
+ /**
2561
+ Finds all storeKeys in this store
2562
+ and returns an array.
2563
+
2564
+ @returns {Array} set of storeKeys
2565
+ */
2566
+ storeKeys: function() {
2567
+ var ret = [], storeKey;
2568
+ if(!this.statuses) return ret;
2569
+
2570
+ for(storeKey in this.statuses) {
2571
+ // if status is not empty
2572
+ if(this.statuses[storeKey] != SC.Record.EMPTY) {
2573
+ ret.push(parseInt(storeKey, 10));
2574
+ }
2575
+ }
2576
+
2577
+ return ret;
2578
+ },
2579
+
2580
+ /**
2581
+ Returns string representation of a storeKey, with status.
2582
+
2583
+ @param {Number} storeKey
2584
+ @returns {String}
2585
+ */
2586
+ statusString: function(storeKey) {
2587
+ var rec = this.materializeRecord(storeKey);
2588
+ return rec.statusString();
2589
+ }
2590
+
2591
+ }) ;
2592
+
2593
+ SC.Store.mixin({
2594
+
2595
+ /**
2596
+ Standard error raised if you try to commit changes from a nested store
2597
+ and there is a conflict.
2598
+
2599
+ @property {Error}
2600
+ */
2601
+ CHAIN_CONFLICT_ERROR: new Error("Nested Store Conflict"),
2602
+
2603
+ /**
2604
+ Standard error if you try to perform an operation on a nested store
2605
+ without a parent.
2606
+
2607
+ @property {Error}
2608
+ */
2609
+ NO_PARENT_STORE_ERROR: new Error("Parent Store Required"),
2610
+
2611
+ /**
2612
+ Standard error if you try to perform an operation on a nested store that
2613
+ is only supported in root stores.
2614
+
2615
+ @property {Error}
2616
+ */
2617
+ NESTED_STORE_UNSUPPORTED_ERROR: new Error("Unsupported In Nested Store"),
2618
+
2619
+ /**
2620
+ Standard error if you try to retrieve a record in a nested store that is
2621
+ dirty. (This is allowed on the main store, but not in nested stores.)
2622
+
2623
+ @property {Error}
2624
+ */
2625
+ NESTED_STORE_RETRIEVE_DIRTY_ERROR: new Error("Cannot Retrieve Dirty Record in Nested Store"),
2626
+
2627
+ /**
2628
+ Data hash state indicates the data hash is currently editable
2629
+
2630
+ @property {String}
2631
+ */
2632
+ EDITABLE: 'editable',
2633
+
2634
+ /**
2635
+ Data hash state indicates the hash no longer tracks changes from a
2636
+ parent store, but it is not editable.
2637
+
2638
+ @property {String}
2639
+ */
2640
+ LOCKED: 'locked',
2641
+
2642
+ /**
2643
+ Data hash state indicates the hash is tracking changes from the parent
2644
+ store and is not editable.
2645
+
2646
+ @property {String}
2647
+ */
2648
+ INHERITED: 'inherited',
2649
+
2650
+ /** @private
2651
+ This array maps all storeKeys to primary keys. You will not normally
2652
+ access this method directly. Instead use the idFor() and
2653
+ storeKeyFor() methods on SC.Record.
2654
+ */
2655
+ idsByStoreKey: [],
2656
+
2657
+ /** @private
2658
+ Maps all storeKeys to a recordType. Once a storeKey is associated with
2659
+ a primaryKey and recordType that remains constant throughout the lifetime
2660
+ of the application.
2661
+ */
2662
+ recordTypesByStoreKey: {},
2663
+
2664
+ /** @private
2665
+ Maps some storeKeys to query instance. Once a storeKey is associated with
2666
+ a query instance, that remains constant through the lifetime of the
2667
+ application. If a Query is destroyed, it will remove itself from this
2668
+ list.
2669
+
2670
+ Don't access this directly. Use queryFor().
2671
+ */
2672
+ queriesByStoreKey: [],
2673
+
2674
+ /** @private
2675
+ The next store key to allocate. A storeKey must always be greater than 0
2676
+ */
2677
+ nextStoreKey: 1,
2678
+
2679
+ /**
2680
+ Generates a new store key for use.
2681
+
2682
+ @property {Number}
2683
+ */
2684
+ generateStoreKey: function() { return this.nextStoreKey++; },
2685
+
2686
+ /**
2687
+ Given a storeKey returns the primaryKey associated with the key.
2688
+ If not primaryKey is associated with the storeKey, returns null.
2689
+
2690
+ @param {Number} storeKey the store key
2691
+ @returns {String} the primary key or null
2692
+ */
2693
+ idFor: function(storeKey) {
2694
+ return this.idsByStoreKey[storeKey] ;
2695
+ },
2696
+
2697
+ /**
2698
+ Given a storeKey, returns the query object associated with the key. If
2699
+ no query is associated with the storeKey, returns null.
2700
+
2701
+ @param {Number} storeKey the store key
2702
+ @returns {SC.Query} query query object
2703
+ */
2704
+ queryFor: function(storeKey) {
2705
+ return this.queriesByStoreKey[storeKey];
2706
+ },
2707
+
2708
+ /**
2709
+ Given a storeKey returns the SC.Record class associated with the key.
2710
+ If no record type is associated with the store key, returns null.
2711
+
2712
+ The SC.Record class will only be found if you have already called
2713
+ storeKeyFor() on the record.
2714
+
2715
+ @param {Number} storeKey the store key
2716
+ @returns {SC.Record} the record type
2717
+ */
2718
+ recordTypeFor: function(storeKey) {
2719
+ return this.recordTypesByStoreKey[storeKey];
2720
+ },
2721
+
2722
+ /**
2723
+ Swaps the primaryKey mapped to the given storeKey with the new
2724
+ primaryKey. If the storeKey is not currently associated with a record
2725
+ this will raise an exception.
2726
+
2727
+ @param {Number} storeKey the existing store key
2728
+ @param {String} newPrimaryKey the new primary key
2729
+ @returns {SC.Store} receiver
2730
+ */
2731
+ replaceIdFor: function(storeKey, newId) {
2732
+ var oldId = this.idsByStoreKey[storeKey],
2733
+ recordType, storeKeys;
2734
+
2735
+ if (oldId !== newId) { // skip if id isn't changing
2736
+
2737
+ recordType = this.recordTypeFor(storeKey);
2738
+ if (!recordType) {
2739
+ throw new Error("replaceIdFor: storeKey %@ does not exist".fmt(storeKey));
2740
+ }
2741
+
2742
+ // map one direction...
2743
+ this.idsByStoreKey[storeKey] = newId;
2744
+
2745
+ // then the other...
2746
+ storeKeys = recordType.storeKeysById() ;
2747
+ delete storeKeys[oldId];
2748
+ storeKeys[newId] = storeKey;
2749
+ }
2750
+
2751
+ return this ;
2752
+ },
2753
+
2754
+ /**
2755
+ Swaps the recordType recorded for a given storeKey. Normally you should
2756
+ not call this method directly as it can damage the store behavior. This
2757
+ method is used by other store methods to set the recordType for a
2758
+ storeKey.
2759
+
2760
+ @param {Integer} storeKey the store key
2761
+ @param {SC.Record} recordType a record class
2762
+ @returns {SC.Store} reciever
2763
+ */
2764
+ replaceRecordTypeFor: function(storeKey, recordType) {
2765
+ this.recordTypesByStoreKey[storeKey] = recordType;
2766
+ return this ;
2767
+ }
2768
+
2769
+ });
2770
+
2771
+
2772
+ /** @private */
2773
+ SC.Store.prototype.nextStoreIndex = 1;
2774
+
2775
+ // ..........................................................
2776
+ // COMPATIBILITY
2777
+ //
2778
+
2779
+ /** @private
2780
+ global store is used only for deprecated compatibility methods. Don't use
2781
+ this in real code.
2782
+ */
2783
+ SC.Store._getDefaultStore = function() {
2784
+ var store = this._store;
2785
+ if(!store) this._store = store = SC.Store.create();
2786
+ return store;
2787
+ };
2788
+
2789
+ /** @private
2790
+
2791
+ DEPRECATED
2792
+
2793
+ Included for compatibility, loads data hashes with the named recordType.
2794
+ If no recordType is passed, expects to find a recordType property in the
2795
+ data hashes. dataSource and isLoaded params are ignored.
2796
+
2797
+ Calls SC.Store#loadRecords() on the default store. Do not use this method in
2798
+ new code.
2799
+
2800
+ @param {Array} dataHashes data hashes to import
2801
+ @param {Object} dataSource ignored
2802
+ @param {SC.Record} recordType default record type
2803
+ @param {Boolean} isLoaded ignored
2804
+ @returns {Array} SC.Record instances for loaded data hashes
2805
+ */
2806
+ SC.Store.updateRecords = function(dataHashes, dataSource, recordType, isLoaded) {
2807
+
2808
+ SC.Logger.warn("SC.Store.updateRecords() is deprecated. Use loadRecords() instead");
2809
+
2810
+ var store = this._getDefaultStore(),
2811
+ len = dataHashes.length,
2812
+ idx, ret;
2813
+
2814
+ // if no recordType was passed, build an array of recordTypes from hashes
2815
+ if (!recordType) {
2816
+ recordType = [];
2817
+ for(idx=0;idx<len;idx++) recordType[idx] = dataHashes[idx].recordType;
2818
+ }
2819
+
2820
+ // call new API. Returns storeKeys
2821
+ ret = store.loadRecords(recordType, dataHashes);
2822
+
2823
+ // map to SC.Record instances
2824
+ len = ret.length;
2825
+ for(idx=0;idx<len;idx++) ret[idx] = store.materializeRecord(ret[idx]);
2826
+
2827
+ return ret ;
2828
+ };
2829
+
2830
+ /** @private
2831
+
2832
+ DEPRECATED
2833
+
2834
+ Finds a record with the passed guid on the default store. This is included
2835
+ only for compatibility. You should use the newer find() method defined on
2836
+ SC.Store instead.
2837
+
2838
+ @param {String} guid the guid
2839
+ @param {SC.Record} recordType expected record type
2840
+ @returns {SC.Record} found record
2841
+ */
2842
+ SC.Store.find = function(guid, recordType) {
2843
+ return this._getDefaultStore().find(recordType, guid);
2844
+ };
2845
+
2846
+ /** @private
2847
+
2848
+ DEPRECATED
2849
+
2850
+ Passes through to findAll on default store. This is included only for
2851
+ compatibility. You should use the newer findAll() defined on SC.Store
2852
+ instead.
2853
+
2854
+ @param {Hash} filter search parameters
2855
+ @param {SC.Record} recordType type of record to find
2856
+ @returns {SC.RecordArray} result set
2857
+ */
2858
+ SC.Store.findAll = function(filter, recordType) {
2859
+ return this._getDefaultStore().findAll(filter, recordType);
2860
+ };