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,110 @@
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
+ /** @class
9
+
10
+ Represents a Checkbox Button.
11
+
12
+ The view is an SC.ButtonView put into toggle mode and with the 'theme' property
13
+ set to "checkbox".
14
+
15
+ Rendering
16
+ ----------------------------
17
+ SC.ButtonView delegates its rendering to its theme. As the theme is set
18
+ to "checkbox", the way the checkbox renders (including DOM) will actually
19
+ be different than SC.ButtonView's.
20
+
21
+ @extends SC.FieldView
22
+ @since SproutCore 1.0
23
+ */
24
+ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout, SC.Button,
25
+ /** @scope SC.CheckboxView.prototype */ {
26
+
27
+ classNames: ['sc-checkbox-view', 'sc-checkbox-control'],
28
+ tagName: 'label',
29
+
30
+ /**
31
+ The WAI-ARIA role of checkbox. This property's value should not be
32
+ changed.
33
+
34
+ @property {String}
35
+ */
36
+ ariaRole: 'checkbox',
37
+
38
+ /**
39
+ The WAI-ARIA attribute for the checkbox. This property is assigned to
40
+ 'aria-labelledby' attribute, which defines a string value that labels the
41
+ checkbox element. Used to support voiceover.It should be assigned a non-empty
42
+ string, if the 'aria-labelledby' attribute has to be set for the element.
43
+
44
+ @property {String}
45
+ */
46
+ ariaLabeledBy: null,
47
+
48
+ /**
49
+ The WAI-ARIA attribute for the checkbox. This property is assigned to
50
+ 'aria-label' attribute, which defines a string value that labels the
51
+ checkbox element. Used to support voiceover. It is used when it is not
52
+ possible to have a visible label on the screen. It should be assigned a non-empty
53
+ string, if the 'aria-label' attribute has to be set for the element.
54
+
55
+ @property {String}
56
+ */
57
+ ariaLabel: null,
58
+
59
+ // no special theme for Checkbox; button defaults to 'square', so we have to stop that.
60
+ themeName: null,
61
+ renderDelegateName: 'checkboxRenderDelegate',
62
+
63
+ /* Ellipsis is disabled by default to allow multiline text */
64
+ needsEllipsis: NO,
65
+
66
+ acceptsFirstResponder: function() {
67
+ if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
68
+ else return NO;
69
+ }.property('isEnabled'),
70
+
71
+
72
+ mouseDown: function(evt) {
73
+ if(!this.get('isEnabled')) return YES;
74
+ this.set('isActive', YES);
75
+ this._isMouseDown = YES;
76
+ // even if radiobuttons are not set to get firstResponder, allow default
77
+ // action, that way textfields loose focus as expected.
78
+ if (evt) evt.allowDefault();
79
+ return YES;
80
+ },
81
+
82
+ mouseUp: function(evt) {
83
+ this.set('isActive', NO);
84
+ this._isMouseDown = NO;
85
+
86
+ if(!this.get('isEnabled') ||
87
+ (evt && evt.target && !this.$().within(evt.target))) {
88
+ return YES;
89
+ }
90
+ var val = this.get('value');
91
+ if (val === this.get('toggleOnValue')) {
92
+
93
+ this.set('value', this.get('toggleOffValue'));
94
+ }
95
+ else {
96
+ this.set('value', this.get('toggleOnValue'));
97
+ }
98
+ return YES;
99
+ },
100
+
101
+
102
+ touchStart: function(evt) {
103
+ return this.mouseDown(evt);
104
+ },
105
+
106
+ touchEnd: function(evt) {
107
+ return this.mouseUp(evt);
108
+ }
109
+
110
+ }) ;
@@ -0,0 +1,3090 @@
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('mixins/collection_view_delegate') ;
9
+ sc_require('views/list_item');
10
+
11
+ /**
12
+ Special drag operation passed to delegate if the collection view proposes
13
+ to perform a reorder event.
14
+ */
15
+ SC.DRAG_REORDER = 0x0010 ;
16
+
17
+ /** Indicates that selection points should be selected using horizontal
18
+ orientation.
19
+ */
20
+ SC.HORIZONTAL_ORIENTATION = 'horizontal';
21
+
22
+ /** Selection points should be selected using vertical orientation. */
23
+ SC.VERTICAL_ORIENTATION = 'vertical' ;
24
+
25
+ SC.BENCHMARK_RELOAD = NO ;
26
+
27
+ /**
28
+ @class
29
+
30
+ TODO: Document SC.CollectionView
31
+
32
+ Renders a collection of views from a source array of model objects.
33
+
34
+ The CollectionView is the root view class for rendering collections of
35
+ views based on a source array of objects. It can automatically create the
36
+ and layout the views, including displaying them in groups. It also
37
+ handles event input for the entire collection.
38
+
39
+ To use CollectionView, just create the view and set the 'content' property
40
+ to an array of objects. (Note that if you setup a binding, it will
41
+ always transform content to an array.) The view will create instances of
42
+ exampleView to render the array. You can also bind to the selection
43
+ property if you want to monitor selection. (be sure to set the isEnabled
44
+ property to allow selection.)
45
+
46
+ @extends SC.View
47
+ @extends SC.CollectionViewDelegate
48
+ @extends SC.CollectionContent
49
+ @since SproutCore 0.9
50
+ */
51
+ SC.CollectionView = SC.View.extend(
52
+ SC.CollectionViewDelegate,
53
+ SC.CollectionContent,
54
+ /** @scope SC.CollectionView.prototype */ {
55
+
56
+ classNames: ['sc-collection-view'],
57
+
58
+ ACTION_DELAY: 200,
59
+
60
+ // ......................................
61
+ // PROPERTIES
62
+ //
63
+
64
+ /**
65
+ If YES, uses the VERY EXPERIMENTAL fast CollectionView path.
66
+ */
67
+ useFastPath: NO,
68
+
69
+ /**
70
+ An array of content objects
71
+
72
+ This array should contain the content objects you want the collection view
73
+ to display. An item view (based on the exampleView view class) will be
74
+ created for each content object, in the order the content objects appear
75
+ in this array.
76
+
77
+ If you make the collection editable, the collection view will also modify
78
+ this array using the observable array methods of SC.Array.
79
+
80
+ Usually you will want to bind this property to a controller property
81
+ that actually contains the array of objects you to display.
82
+
83
+ @type {SC.Array}
84
+ */
85
+ content: null,
86
+
87
+ /** @private */
88
+ contentBindingDefault: SC.Binding.multiple(),
89
+
90
+ /**
91
+ The current length of the content.
92
+
93
+ @property
94
+ @type {Numer}
95
+ */
96
+ length: 0,
97
+
98
+ /**
99
+ The set of indexes that are currently tracked by the collection view.
100
+ This property is used to determine the range of items the collection view
101
+ should monitor for changes.
102
+
103
+ The default implementation of this property returns an index set covering
104
+ the entire range of the content. It changes automatically whenever the
105
+ length changes.
106
+
107
+ Note that the returned index set for this property will always be frozen.
108
+ To change the nowShowing index set, you must create a new index set and
109
+ apply it.
110
+
111
+ @property
112
+ @type {SC.IndexSet}
113
+ */
114
+ nowShowing: function() {
115
+ return this.computeNowShowing();
116
+ }.property('length', 'clippingFrame').cacheable(),
117
+
118
+ /**
119
+ Indexes of selected content objects. This SC.SelectionSet is modified
120
+ automatically by the collection view when the user changes the selection
121
+ on the collection.
122
+
123
+ Any item views representing content objects in this set will have their
124
+ isSelected property set to YES automatically.
125
+
126
+ @type {SC.SelectionSet}
127
+ */
128
+ selection: null,
129
+
130
+ /**
131
+ Allow user to select content using the mouse and keyboard.
132
+
133
+ Set this property to NO to disallow the user from selecting items. If you
134
+ have items in your selectedIndexes property, they will still be reflected
135
+ visually.
136
+
137
+ @type {Boolean}
138
+ */
139
+ isSelectable: YES,
140
+
141
+ /** @private */
142
+ isSelectableBindingDefault: SC.Binding.bool(),
143
+
144
+ /**
145
+ Enable or disable the view.
146
+
147
+ The collection view will set the isEnabled property of its item views to
148
+ reflect the same view of this property. Whenever isEnabled is false,
149
+ the collection view will also be not selectable or editable, regardless of
150
+ the settings for isEditable & isSelectable.
151
+
152
+ @type {Boolean}
153
+ */
154
+ isEnabled: YES,
155
+
156
+ /** @private */
157
+ isEnabledBindingDefault: SC.Binding.bool(),
158
+
159
+ /**
160
+ Allow user to edit content views.
161
+
162
+ The collection view will set the isEditable property on its item views to
163
+ reflect the same value of this property. Whenever isEditable is false,
164
+ the user will not be able to reorder, add, or delete items regardless of
165
+ the canReorderContent and canDeleteContent and isDropTarget properties.
166
+
167
+ @type {Boolean}
168
+ */
169
+ isEditable: YES,
170
+
171
+ /** @private */
172
+ isEditableBindingDefault: SC.Binding.bool(),
173
+
174
+ /**
175
+ Allow user to reorder items using drag and drop.
176
+
177
+ If true, the user will can use drag and drop to reorder items in the list.
178
+ If you also accept drops, this will allow the user to drop items into
179
+ specific points in the list. Otherwise items will be added to the end.
180
+
181
+ @type {Boolean}
182
+ */
183
+ canReorderContent: NO,
184
+
185
+ /** @private */
186
+ canReorderContentBindingDefault: SC.Binding.bool(),
187
+
188
+ /**
189
+ Allow the user to delete items using the delete key
190
+
191
+ If true the user will be allowed to delete selected items using the delete
192
+ key. Otherwise deletes will not be permitted.
193
+
194
+ @type {Boolean}
195
+ */
196
+ canDeleteContent: NO,
197
+
198
+ /** @private */
199
+ canDeleteContentBindingDefault: SC.Binding.bool(),
200
+
201
+ /**
202
+ Allow user to edit the content by double clicking on it or hitting return.
203
+ This will only work if isEditable is YES and the item view implements
204
+ the beginEditing() method.
205
+
206
+ @type {Boolean}
207
+ */
208
+ canEditContent: NO,
209
+
210
+ /** @private */
211
+ canEditContentBindingDefault: SC.Binding.bool(),
212
+
213
+ /**
214
+ Accept drops for data other than reordering.
215
+
216
+ Setting this property to return true when the view is instantiated will
217
+ cause it to be registered as a drop target, activating the other drop
218
+ machinery.
219
+
220
+ @type {Boolean}
221
+ */
222
+ isDropTarget: NO,
223
+
224
+ /**
225
+ Use toggle selection instead of normal click behavior.
226
+
227
+ If set to true, then selection will use a toggle instead of the normal
228
+ click behavior. Command modifiers will be ignored and instead clicking
229
+ once will select an item and clicking on it again will deselect it.
230
+
231
+ @type {Boolean}
232
+ */
233
+ useToggleSelection: NO,
234
+
235
+ /**
236
+ Trigger the action method on a single click.
237
+
238
+ Normally, clicking on an item view in a collection will select the content
239
+ object and double clicking will trigger the action method on the
240
+ collection view.
241
+
242
+ If you set this property to YES, then clicking on a view will both select
243
+ it (if isSelected is true) and trigger the action method.
244
+
245
+ Use this if you are using the collection view as a menu of items.
246
+
247
+ @property {Boolean}
248
+ */
249
+ actOnSelect: NO,
250
+
251
+
252
+ /**
253
+ Select an item immediately on mouse down
254
+
255
+ Normally as soon as you begin a click the item will be selected.
256
+
257
+ In some UI scenarios, you might want to prevent selection until
258
+ the mouse is released, so you can perform, for instance, a drag operation
259
+ without actually selecting the target item.
260
+
261
+ @property {Boolean}
262
+ */
263
+ selectOnMouseDown: YES,
264
+
265
+ /**
266
+ The view class to use when creating new item views.
267
+
268
+ The collection view will automatically create an instance of the view
269
+ class you set here for each item in its content array. You should provide
270
+ your own subclass for this property to display the type of content you
271
+ want.
272
+
273
+ For best results, the view you set here should understand the following
274
+ properties:
275
+
276
+ - *content* The content object from the content array your view should display
277
+ - *isEnabled* True if the view should appear enabled
278
+ - *isSelected* True if the view should appear selected
279
+
280
+ In general you do not want your child views to actually respond to mouse
281
+ and keyboard events themselves. It is better to let the collection view
282
+ do that.
283
+
284
+ If you do implement your own event handlers such as mouseDown or mouseUp,
285
+ you should be sure to actually call the same method on the collection view
286
+ to give it the chance to perform its own selection housekeeping.
287
+
288
+ @property {SC.View}
289
+ */
290
+ exampleView: SC.ListItemView,
291
+
292
+ /**
293
+ If set, this key will be used to get the example view for a given
294
+ content object. The exampleView property will be ignored.
295
+
296
+ @property {String}
297
+ */
298
+ contentExampleViewKey: null,
299
+
300
+ /**
301
+ The view class to use when creating new group item views.
302
+
303
+ The collection view will automatically create an instance of the view
304
+ class you set here for each item in its content array. You should provide
305
+ your own subclass for this property to display the type of content you
306
+ want.
307
+
308
+ If you leave this set to null then the regular example view will be used
309
+ with the isGroupView property set to YES on the item view.
310
+
311
+ @property {SC.View}
312
+ */
313
+ groupExampleView: null,
314
+
315
+ /**
316
+ If set, this key will be used to get the example view for a given
317
+ content object. The groupExampleView property will be ignored.
318
+
319
+ @property {String}
320
+ */
321
+ contentGroupExampleViewKey: null,
322
+
323
+ /**
324
+ Invoked when the user double clicks on an item (or single clicks of
325
+ actOnSelect is true)
326
+
327
+ Set this to the name of the action you want to send down the
328
+ responder chain when the user double clicks on an item (or single clicks
329
+ if actOnSelect is true). You can optionally specify a specific target as
330
+ well using the target property.
331
+
332
+ If you do not specify an action, then the collection view will also try to
333
+ invoke the action named on the target item view.
334
+
335
+ Older versions of SproutCore expected the action property to contain an
336
+ actual function that would be run. This format is still supported but is
337
+ deprecated for future use. You should generally use the responder chain
338
+ to handle your action for you.
339
+
340
+ @property {String}
341
+ */
342
+ action: null,
343
+
344
+ /**
345
+ Optional target to send the action to when the user double clicks.
346
+
347
+ If you set the action property to the name of an action, you can
348
+ optionally specify the target object you want the action to be sent to.
349
+ This can be either an actual object or a property path that will resolve
350
+ to an object at the time that the action is invoked.
351
+
352
+ This property is ignored if you use the deprecated approach of making the
353
+ action property a function.
354
+
355
+ @property {String|Object}
356
+ */
357
+ target: null,
358
+
359
+ /**
360
+ Property on content items to use for display.
361
+
362
+ Built-in item views such as the LabelViews and ImageViews will use the
363
+ value of this property as a key on the content object to determine the
364
+ value they should display.
365
+
366
+ For example, if you set contentValueKey to 'name' and set the
367
+ exampleView to an SC.LabelView, then the label views created by the
368
+ colleciton view will display the value of the content.name.
369
+
370
+ If you are writing your own custom item view for a collection, you can
371
+ get this behavior automatically by including the SC.Control mixin on your
372
+ view. You can also ignore this property if you like. The collection view
373
+ itself does not use this property to impact rendering.
374
+
375
+ @property {String}
376
+ */
377
+ contentValueKey: null,
378
+
379
+ /**
380
+ Enables keyboard-based navigate, deletion, etc. if set to true.
381
+ */
382
+ acceptsFirstResponder: NO,
383
+
384
+ /**
385
+ Changing this property value by default will cause the CollectionView to
386
+ add/remove an 'active' class name to the root element.
387
+
388
+ @type Boolean
389
+ */
390
+ isActive: NO,
391
+
392
+
393
+ /**
394
+ This property is used to store the calculated height to have
395
+ a consistent scrolling behavior due to the issues generated by using top
396
+ instead of scrollTop. We could look at the min-height set in the view, but
397
+ to avoid perf hits we simply store it and the scrollView will use it if
398
+ different than 0.
399
+
400
+ @type Number
401
+ */
402
+ calculatedHeight: 0,
403
+
404
+ /**
405
+ This property is used to store the calculated width to have
406
+ a consistent scrolling behavior due to the issues generated by using left
407
+ instead of scrollLeft. We could look at the min-width set in the view, but
408
+ to avoid perf hits we simply store it and the scrollView will use it if
409
+ different than 0.
410
+
411
+ @type Number
412
+ */
413
+ calculatedWidth: 0,
414
+
415
+
416
+ // ..........................................................
417
+ // SUBCLASS METHODS
418
+ //
419
+
420
+ /**
421
+ Override to return the computed layout dimensions of the collection view.
422
+ You can omit any dimensions you don't care about setting in your
423
+ computed value.
424
+
425
+ This layout is automatically applied whenever the content changes.
426
+
427
+ If you don't care about computing the layout at all, you can return null.
428
+
429
+ @returns {Hash} layout properties
430
+ */
431
+ computeLayout: function() { return null; },
432
+
433
+ /**
434
+ Override to compute the layout of the itemView for the content at the
435
+ specified index. This layout will be applied to the view just before it
436
+ is rendered.
437
+
438
+ @param {Number} contentIndex the index of content being rendered by
439
+ itemView
440
+ @returns {Hash} a view layout
441
+ */
442
+ layoutForContentIndex: function(contentIndex) {
443
+ return null ;
444
+ },
445
+
446
+ /**
447
+ This computed property returns an index set selecting all content indexes.
448
+ It will recompute anytime the length of the collection view changes.
449
+
450
+ This is used by the default contentIndexesInRect() implementation.
451
+
452
+ @property {SC.Range}
453
+ */
454
+ allContentIndexes: function() {
455
+ return SC.IndexSet.create(0, this.get('length')).freeze();
456
+ }.property('length').cacheable(),
457
+
458
+ /**
459
+ Override to return an IndexSet with the indexes that are at least
460
+ partially visible in the passed rectangle. This method is used by the
461
+ default implementation of computeNowShowing() to determine the new
462
+ nowShowing range after a scroll.
463
+
464
+ Override this method to implement incremental rendering.
465
+
466
+ The default simply returns the current content length.
467
+
468
+ @param {Rect} rect the visible rect
469
+ @returns {SC.IndexSet} now showing indexes
470
+ */
471
+ contentIndexesInRect: function(rect) {
472
+ return null; // select all
473
+ },
474
+
475
+ /**
476
+ Compute the nowShowing index set. The default implementation simply
477
+ returns the full range. Override to implement incremental rendering.
478
+
479
+ You should not normally call this method yourself. Instead get the
480
+ nowShowing property.
481
+
482
+ @returns {SC.IndexSet} new now showing range
483
+ */
484
+ computeNowShowing: function() {
485
+ var r = this.contentIndexesInRect(this.get('clippingFrame'));
486
+ if (!r) r = this.get('allContentIndexes'); // default show all
487
+
488
+ // make sure the index set doesn't contain any indexes greater than the
489
+ // actual content.
490
+ else {
491
+ var len = this.get('length'),
492
+ max = r.get('max');
493
+ if (max > len) r = r.copy().remove(len, max-len).freeze();
494
+ }
495
+
496
+ return r ;
497
+ },
498
+
499
+ /**
500
+ Override to show the insertion point during a drag.
501
+
502
+ Called during a drag to show the insertion point. Passed value is the
503
+ item view that you should display the insertion point before. If the
504
+ passed value is null, then you should show the insertion point AFTER that
505
+ last item view returned by the itemViews property.
506
+
507
+ Once this method is called, you are guaranteed to also recieve a call to
508
+ hideInsertionPoint() at some point in the future.
509
+
510
+ The default implementation of this method does nothing.
511
+
512
+ @param itemView {SC.ClassicView} view the insertion point should appear directly before. If null, show insertion point at end.
513
+ @param dropOperation {Number} the drop operation. will be SC.DROP_BEFORE, SC.DROP_AFTER, or SC.DROP_ON
514
+
515
+ @returns {void}
516
+ */
517
+ showInsertionPoint: function(itemView, dropOperation) {
518
+ },
519
+
520
+ /**
521
+ Override to hide the insertion point when a drag ends.
522
+
523
+ Called during a drag to hide the insertion point. This will be called
524
+ when the user exits the view, cancels the drag or completes the drag. It
525
+ will not be called when the insertion point changes during a drag.
526
+
527
+ You should expect to receive one or more calls to
528
+ showInsertionPointBefore() during a drag followed by at least one call to
529
+ this method at the end. Your method should not raise an error if it is
530
+ called more than once.
531
+
532
+ @returns {void}
533
+ */
534
+ hideInsertionPoint: function() {
535
+ },
536
+
537
+ // ..........................................................
538
+ // DELEGATE SUPPORT
539
+ //
540
+
541
+
542
+ /**
543
+ Delegate used to implement fine-grained control over collection view
544
+ behaviors.
545
+
546
+ You can assign a delegate object to this property that will be consulted
547
+ for various decisions regarding drag and drop, selection behavior, and
548
+ even rendering. The object you place here must implement some or all of
549
+ the SC.CollectionViewDelegate mixin.
550
+
551
+ If you do not supply a delegate but the content object you set implements
552
+ the SC.CollectionViewDelegate mixin, then the content will be
553
+ automatically set as the delegate. Usually you will work with a
554
+ CollectionView in this way rather than setting a delegate explicitly.
555
+
556
+ @type {SC.CollectionViewDelegate}
557
+ */
558
+ delegate: null,
559
+
560
+ /**
561
+ The delegate responsible for handling selection changes. This property
562
+ will be either the delegate, content, or the collection view itself,
563
+ whichever implements the SC.CollectionViewDelegate mixin.
564
+
565
+ @property
566
+ @type {Object}
567
+ */
568
+ selectionDelegate: function() {
569
+ var del = this.get('delegate'), content = this.get('content');
570
+ return this.delegateFor('isCollectionViewDelegate', del, content);
571
+ }.property('delegate', 'content').cacheable(),
572
+
573
+ /**
574
+ The delegate responsible for providing additional display information
575
+ about the content. If you bind a collection view to a controller, this
576
+ the content will usually also be the content delegate, though you
577
+ could implement your own delegate if you prefer.
578
+
579
+ @property
580
+ @type {Object}
581
+ */
582
+ contentDelegate: function() {
583
+ var del = this.get('delegate'), content = this.get('content');
584
+ return this.delegateFor('isCollectionContent', del, content);
585
+ }.property('delegate', 'content').cacheable(),
586
+
587
+
588
+ /** @private
589
+ A cache of the contentGroupIndexes value returned by the delegate. This
590
+ is frequently accessed and usually involves creating an SC.IndexSet
591
+ object, so it's worthwhile to cache.
592
+ */
593
+ _contentGroupIndexes: function() {
594
+ return this.get('contentDelegate').contentGroupIndexes(this, this.get('content'));
595
+ }.property('contentDelegate', 'content').cacheable(),
596
+
597
+ // ..........................................................
598
+ // CONTENT CHANGES
599
+ //
600
+
601
+ /**
602
+ Called whenever the content array or an item in the content array or a
603
+ property on an item in the content array changes. Reloads the appropriate
604
+ item view when the content array itself changes or calls
605
+ contentPropertyDidChange() if a property changes.
606
+
607
+ Normally you will not call this method directly though you may override
608
+ it if you need to change the way changes to observed ranges are handled.
609
+
610
+ @param {SC.Array} content the content array generating the change
611
+ @param {Object} object the changed object
612
+ @param {String} key the changed property or '[]' or an array change
613
+ @param {SC.IndexSet} indexes affected indexes or null for all items
614
+ @returns {void}
615
+ */
616
+ contentRangeDidChange: function(content, object, key, indexes) {
617
+ if (!object && (key === '[]')) {
618
+ this.notifyPropertyChange('_contentGroupIndexes');
619
+ this.reload(indexes); // note: if indexes == null, reloads all
620
+ } else {
621
+ this.contentPropertyDidChange(object, key, indexes);
622
+ }
623
+ },
624
+
625
+ /**
626
+ Called whenever a property on an item in the content array changes. This
627
+ is only called if you have set observesContentProperties to YES.
628
+
629
+ Override this property if you want to do some custom work whenever a
630
+ property on a content object changes.
631
+
632
+ The default implementation does nothing.
633
+
634
+ @param {Object} target the object that changed
635
+ @param {String} key the property that changed value
636
+ @param {SC.IndexSet} indexes the indexes in the content array affected
637
+ @returns {void}
638
+ */
639
+ contentPropertyDidChange: function(target, key, indexes) {
640
+ // Default Does Nothing
641
+ },
642
+
643
+ /**
644
+ Called whenever the view needs to updates it's contentRangeObserver to
645
+ reflect the current nowShowing index set. You will not usually call this
646
+ method yourself but you may override it if you need to provide some
647
+ custom range observer behavior.
648
+
649
+ Note that if you do implement this method, you are expected to maintain
650
+ the range observer object yourself. If a range observer has not been
651
+ created yet, this method should create it. If an observer already exists
652
+ this method should udpate it.
653
+
654
+ When you create a new range observer, the oberver must eventually call
655
+ contentRangeDidChange() for the collection view to function properly.
656
+
657
+ If you override this method you probably also need to override
658
+ destroyRangeObserver() to cleanup any existing range observer.
659
+
660
+ @returns {void}
661
+ */
662
+ updateContentRangeObserver: function() {
663
+ var nowShowing = this.get('nowShowing'),
664
+ observer = this._cv_contentRangeObserver,
665
+ content = this.get('content');
666
+
667
+ if (!content) return ; // nothing to do
668
+
669
+ if (observer) {
670
+ content.updateRangeObserver(observer, nowShowing);
671
+ } else {
672
+ var func = this.contentRangeDidChange;
673
+ observer = content.addRangeObserver(nowShowing, this, func, null);
674
+ this._cv_contentRangeObserver = observer ;
675
+ }
676
+
677
+ },
678
+
679
+ /**
680
+ Called whever the view needs to invalidate the current content range
681
+ observer. This is called whenever the content array changes. You will
682
+ not usually call this method yourself but you may override it if you
683
+ provide your own range observer behavior.
684
+
685
+ Note that if you override this method you should probably also override
686
+ updateRangeObserver() to create or update a range oberver as needed.
687
+
688
+ @returns {void}
689
+ */
690
+ removeContentRangeObserver: function() {
691
+ var content = this.get('content'),
692
+ observer = this._cv_contentRangeObserver ;
693
+
694
+ if (observer) {
695
+ if (content) content.removeRangeObserver(observer);
696
+ this._cv_contentRangeObserver = null ;
697
+ }
698
+ },
699
+
700
+ /**
701
+ Called whenever the content length changes. This will invalidate the
702
+ length property of the view itself causing the nowShowing to recompute
703
+ which will in turn update the UI accordingly.
704
+
705
+ @returns {void}
706
+ */
707
+ contentLengthDidChange: function() {
708
+ var content = this.get('content');
709
+ this.set('length', content ? content.get('length') : 0);
710
+ },
711
+
712
+ /** @private
713
+ Whenever content property changes to a new value:
714
+
715
+ - remove any old observers
716
+ - setup new observers (maybe wait until end of runloop to do this?)
717
+ - recalc height/reload content
718
+ - set content as delegate if delegate was old content
719
+ - reset selection
720
+
721
+ Whenever content array mutates:
722
+
723
+ - possibly stop observing property changes on objects, observe new objs
724
+ - reload effected item views
725
+ - update layout for receiver
726
+ */
727
+ _cv_contentDidChange: function() {
728
+ var content = this.get('content'),
729
+ lfunc = this.contentLengthDidChange ;
730
+
731
+ if (content === this._content) return; // nothing to do
732
+
733
+ // cleanup old content
734
+ this.removeContentRangeObserver();
735
+ if (this._content) {
736
+ this._content.removeObserver('length', this, lfunc);
737
+ }
738
+
739
+ // cache
740
+ this._content = content;
741
+
742
+ // add new observers - range observer will be added lazily
743
+ if (content) {
744
+ content.addObserver('length', this, lfunc);
745
+ }
746
+
747
+ // notify all items changed
748
+ this.contentLengthDidChange();
749
+ this.contentRangeDidChange(content, null, '[]', null);
750
+
751
+ }.observes('content'),
752
+
753
+ // ..........................................................
754
+ // ITEM VIEWS
755
+ //
756
+
757
+ /** @private
758
+
759
+ The indexes that need to be reloaded. Must be one of YES, NO, or an
760
+ SC.IndexSet.
761
+
762
+ */
763
+ _invalidIndexes: NO,
764
+
765
+ /**
766
+ Regenerates the item views for the content items at the specified indexes.
767
+ If you pass null instead of an index set, regenerates all item views.
768
+
769
+ This method is called automatically whenever the content array changes in
770
+ an observable way, but you can call its yourself also if you need to
771
+ refresh the collection view for some reason.
772
+
773
+ Note that if the length of the content is shorter than the child views
774
+ and you call this method, then the child views will be removed no matter
775
+ what the index.
776
+
777
+ @param {SC.IndexSet} indexes
778
+ @returns {SC.CollectionView} receiver
779
+ */
780
+ reload: function(indexes) {
781
+ var invalid = this._invalidIndexes ;
782
+ if (indexes && invalid !== YES) {
783
+ if (invalid) invalid.add(indexes);
784
+ else invalid = this._invalidIndexes = indexes.clone();
785
+
786
+ }
787
+ else {
788
+ this._invalidIndexes = YES ; // force a total reload
789
+ }
790
+
791
+ if (this.get('isVisibleInWindow')) this.invokeOnce(this.reloadIfNeeded);
792
+
793
+ return this ;
794
+ },
795
+
796
+ /**
797
+ Invoked once per runloop to actually reload any needed item views.
798
+ You can call this method at any time to actually force the reload to
799
+ happen immediately if any item views need to be reloaded.
800
+
801
+ Note that this method will also invoke two other callback methods if you
802
+ define them on your subclass:
803
+
804
+ - *willReload()* is called just before the items are reloaded
805
+ - *didReload()* is called jsut after items are reloaded
806
+
807
+ You can use these two methods to setup and teardown caching, which may
808
+ reduce overall cost of a reload. Each method will be passed an index set
809
+ of items that are reloaded or null if all items are reloaded.
810
+
811
+ @returns {SC.CollectionView} receiver
812
+ */
813
+ reloadIfNeeded: function() {
814
+ var invalid = this._invalidIndexes;
815
+ if (!invalid || !this.get('isVisibleInWindow')) return this ; // delay
816
+ this._invalidIndexes = NO ;
817
+
818
+ var content = this.get('content'),
819
+ i, len, existing,
820
+ layout = this.computeLayout(),
821
+ bench = SC.BENCHMARK_RELOAD,
822
+ nowShowing = this.get('nowShowing'),
823
+ itemViews = this._sc_itemViews,
824
+ containerView = this.get('containerView') || this,
825
+ exampleView, groupExampleView,
826
+ shouldReuseViews, shouldReuseGroupViews, shouldReuse,
827
+ viewsToRemove, viewsToRedraw, viewsToCreate,
828
+ views, idx, view, layer, parentNode, viewPool,
829
+ del, groupIndexes, isGroupView;
830
+
831
+ // if the set is defined but it contains the entire nowShowing range, just
832
+ // replace
833
+ if (invalid.isIndexSet && invalid.contains(nowShowing)) invalid = YES ;
834
+ if (this.willReload) this.willReload(invalid === YES ? null : invalid);
835
+
836
+
837
+ // Up-front, figure out whether the view class (and, if applicable,
838
+ // group view class) is re-usable. If so, it's beneficial for us to
839
+ // first return all no-longer-needed views to the pool before allocating
840
+ // new ones, because that will maximize the potential for re-use.
841
+ exampleView = this.get('exampleView');
842
+ shouldReuseViews = exampleView ? exampleView.isReusableInCollections : NO;
843
+ groupExampleView = this.get('groupExampleView');
844
+ shouldReuseGroupViews = groupExampleView ? groupExampleView.isReusableInCollections : NO;
845
+
846
+ // if an index set, just update indexes
847
+ if (invalid.isIndexSet) {
848
+ if (bench) {
849
+ SC.Benchmark.start(bench="%@#reloadIfNeeded (Partial)".fmt(this),YES);
850
+ }
851
+
852
+ // Each of these arrays holds indexes.
853
+ viewsToRemove = [];
854
+ viewsToRedraw = [];
855
+ viewsToCreate = [];
856
+
857
+ invalid.forEach(function(idx) {
858
+ // get the existing item view, if there is one
859
+ existing = itemViews ? itemViews[idx] : null;
860
+
861
+ // if nowShowing, then reload the item view.
862
+ if (nowShowing.contains(idx)) {
863
+ if (existing && existing.parentView === containerView) {
864
+ viewsToRedraw.push(idx);
865
+
866
+ } else {
867
+ viewsToCreate.push(idx);
868
+ }
869
+
870
+ // if not nowShowing, then remove the item view if needed
871
+ } else if (existing && existing.parentView === containerView) {
872
+ viewsToRemove.push(idx);
873
+ }
874
+ },this);
875
+
876
+
877
+ // Now that we know what operations we need to perform, let's perform
878
+ // all the removals first…
879
+ for (i = 0, len = viewsToRemove.length; i < len; ++i) {
880
+ idx = viewsToRemove[i];
881
+ existing = itemViews ? itemViews[idx] : null;
882
+ delete itemViews[idx];
883
+
884
+ // If this view class is reusable, then add it back to the pool.
885
+ del = this.get('contentDelegate');
886
+ groupIndexes = this.get('_contentGroupIndexes');
887
+ isGroupView = groupIndexes && groupIndexes.contains(idx);
888
+ if (isGroupView) isGroupView = del.contentIndexIsGroup(this, content, idx);
889
+ shouldReuse = isGroupView ? shouldReuseGroupViews : shouldReuseViews;
890
+ if (shouldReuse) {
891
+ viewPool = isGroupView ? this._GROUP_VIEW_POOL : this._VIEW_POOL;
892
+
893
+ viewPool.push(existing);
894
+
895
+ // Because it's possible that we'll return this view to the pool
896
+ // and then immediately re-use it, there's the potential that the
897
+ // layer will not be correctly destroyed, because that support
898
+ // (built into removeChild) is coalesced at the runloop, and we
899
+ // will likely change the layerId when re-using the view. So
900
+ // we'll destroy the layer now.
901
+ existing.destroyLayer();
902
+ }
903
+
904
+ // We don't want the old layer hanging around, even if we are going
905
+ // to reuse it.
906
+ // (Charles Jolley personally guarantees this code)
907
+ layer = existing.get('layer');
908
+ if (layer && layer.parentNode) layer.parentNode.removeChild(layer);
909
+
910
+ containerView.removeChild(existing);
911
+ if (!shouldReuse) existing.destroy();
912
+ }
913
+
914
+ // …then the redraws…
915
+ for (i = 0, len = viewsToRedraw.length; i < len; ++i) {
916
+ idx = viewsToRedraw[i];
917
+ existing = itemViews ? itemViews[idx] : null;
918
+ view = this.itemViewForContentIndex(idx, YES);
919
+
920
+ // if the existing view has a layer, remove it immediately from
921
+ // the parent. This is necessary because the old and new views
922
+ // will use the same layerId
923
+ existing.destroyLayer();
924
+ containerView.replaceChild(view, existing);
925
+ }
926
+
927
+ // …and finally the creations.
928
+ for (i = 0, len = viewsToCreate.length; i < len; ++i) {
929
+ idx = viewsToCreate[i];
930
+ view = this.itemViewForContentIndex(idx, YES);
931
+ containerView.insertBefore(view, null); // Equivalent to 'append()', but avoids one more function call
932
+ }
933
+
934
+
935
+ if (bench) SC.Benchmark.end(bench);
936
+
937
+ // if set is NOT defined, replace entire content with nowShowing
938
+ } else {
939
+ if (bench) {
940
+ SC.Benchmark.start(bench="%@#reloadIfNeeded (Full)".fmt(this),YES);
941
+ }
942
+
943
+ // truncate cached item views since they will all be removed from the
944
+ // container anyway.
945
+ if (itemViews) itemViews.length = 0 ;
946
+
947
+ views = containerView.get('childViews');
948
+ if (views) views = views.copy();
949
+
950
+ // below is an optimized version of:
951
+ //this.replaceAllChildren(views);
952
+ containerView.beginPropertyChanges();
953
+ // views = containerView.get('views');
954
+ if (this.willRemoveAllChildren) this.willRemoveAllChildren() ;
955
+ containerView.destroyLayer().removeAllChildren();
956
+
957
+ // For all previous views that can be re-used, return them to the pool.
958
+ if (views) {
959
+ for (i = 0, len = views.length; i < len; ++i) {
960
+ view = views[i];
961
+ isGroupView = view.get('isGroupView');
962
+ shouldReuse = isGroupView ? shouldReuseGroupViews : shouldReuseViews;
963
+ if (shouldReuse) {
964
+ viewPool = isGroupView ? this._GROUP_VIEW_POOL : this._VIEW_POOL;
965
+
966
+ viewPool.push(view);
967
+
968
+ // Because it's possible that we'll return this view to the pool
969
+ // and then immediately re-use it, there's the potential that the
970
+ // layer will not be correctly destroyed, because that support
971
+ // (built into removeChild) is coalesced at the runloop, and we
972
+ // will likely change the layerId when re-using the view. So
973
+ // we'll destroy the layer now.
974
+ view.destroyLayer();
975
+ } else {
976
+ view.destroy();
977
+ }
978
+ }
979
+ }
980
+
981
+
982
+ // Only after the children are removed should we create the new views.
983
+ // We do this in order to maximize the change of re-use should the view
984
+ // be marked as such.
985
+ views = [];
986
+ nowShowing.forEach(function(idx) {
987
+ views.push(this.itemViewForContentIndex(idx, YES));
988
+ }, this);
989
+
990
+
991
+ containerView.set('childViews', views); // quick swap
992
+ containerView.replaceLayer();
993
+ containerView.endPropertyChanges();
994
+
995
+ if (bench) SC.Benchmark.end(bench);
996
+
997
+ }
998
+
999
+ // adjust my own layout if computed
1000
+ if (layout) this.adjust(layout);
1001
+ if (this.didReload) this.didReload(invalid === YES ? null : invalid);
1002
+
1003
+ return this ;
1004
+ },
1005
+
1006
+ displayProperties: 'isFirstResponder isEnabled isActive'.w(),
1007
+ renderDelegateName: 'collectionRenderDelegate',
1008
+
1009
+
1010
+ _TMP_ATTRS: {},
1011
+ _COLLECTION_CLASS_NAMES: 'sc-collection-item'.w(),
1012
+ _GROUP_COLLECTION_CLASS_NAMES: 'sc-collection-item sc-group-item'.w(),
1013
+ _VIEW_POOL: null,
1014
+ _GROUP_VIEW_POOL: null,
1015
+
1016
+ /**
1017
+ Returns the item view for the content object at the specified index. Call
1018
+ this method instead of accessing child views directly whenever you need
1019
+ to get the view associated with a content index.
1020
+
1021
+ Although this method take two parameters, you should almost always call
1022
+ it with just the content index. The other two parameters are used
1023
+ internally by the CollectionView.
1024
+
1025
+ If you need to change the way the collection view manages item views
1026
+ you can override this method as well. If you just want to change the
1027
+ default options used when creating item views, override createItemView()
1028
+ instead.
1029
+
1030
+ Note that if you override this method, then be sure to implement this
1031
+ method so that it uses a cache to return the same item view for a given
1032
+ index unless "force" is YES. In that case, generate a new item view and
1033
+ replace the old item view in your cache with the new item view.
1034
+
1035
+ @param {Number} idx the content index
1036
+ @param {Boolean} rebuild internal use only
1037
+ @returns {SC.View} instantiated view
1038
+ */
1039
+ itemViewForContentIndex: function(idx, rebuild) {
1040
+ var ret;
1041
+
1042
+ // Use the cached view for this index, if we have it. We'll do this up-
1043
+ // front to avoid
1044
+ var itemViews = this._sc_itemViews;
1045
+ if (!itemViews) {
1046
+ itemViews = this._sc_itemViews = [] ;
1047
+ }
1048
+ else if (!rebuild && (ret = itemViews[idx])) {
1049
+ return ret ;
1050
+ }
1051
+
1052
+ // return from cache if possible
1053
+ var content = this.get('content'),
1054
+ item = content.objectAt(idx),
1055
+ del = this.get('contentDelegate'),
1056
+ groupIndexes = this.get('_contentGroupIndexes'),
1057
+ isGroupView = NO,
1058
+ key, E, layout, layerId,
1059
+ viewPoolKey, viewPool, reuseFunc, parentView, isEnabled, isSelected,
1060
+ outlineLevel, disclosureState, isVisibleInWindow;
1061
+
1062
+ // otherwise generate...
1063
+
1064
+ // first, determine the class to use
1065
+ isGroupView = groupIndexes && groupIndexes.contains(idx);
1066
+ if (isGroupView) isGroupView = del.contentIndexIsGroup(this, content,idx);
1067
+ if (isGroupView) {
1068
+ key = this.get('contentGroupExampleViewKey');
1069
+ if (key && item) E = item.get(key);
1070
+ if (!E) E = this.get('groupExampleView') || this.get('exampleView');
1071
+ viewPoolKey = '_GROUP_VIEW_POOL';
1072
+ } else {
1073
+ key = this.get('contentExampleViewKey');
1074
+ if (key && item) E = item.get(key);
1075
+ if (!E) E = this.get('exampleView');
1076
+ viewPoolKey = '_VIEW_POOL';
1077
+ }
1078
+
1079
+
1080
+ // Collect other state that we'll need whether we're re-using a previous
1081
+ // view or creating a new view.
1082
+ parentView = this.get('containerView') || this;
1083
+ layerId = this.layerIdFor(idx);
1084
+ isEnabled = del.contentIndexIsEnabled(this, content, idx);
1085
+ isSelected = del.contentIndexIsSelected(this, content, idx);
1086
+ outlineLevel = del.contentIndexOutlineLevel(this, content, idx);
1087
+ disclosureState = del.contentIndexDisclosureState(this, content, idx);
1088
+ isVisibleInWindow = this.isVisibleInWindow;
1089
+ layout = this.layoutForContentIndex(idx);
1090
+
1091
+
1092
+ // If the view is reusable and there is an appropriate view inside the
1093
+ // pool, simply reuse it to avoid having to create a new view.
1094
+ if (E && E.isReusableInCollections) {
1095
+ // Lazily create the view pool.
1096
+ viewPool = this[viewPoolKey];
1097
+ if (!viewPool) viewPool = this[viewPoolKey] = [];
1098
+
1099
+ // Is there a view we can re-use?
1100
+ if (viewPool.length > 0) {
1101
+ ret = viewPool.pop();
1102
+
1103
+ // Tell the view it's about to be re-used.
1104
+ reuseFunc = ret.prepareForReuse;
1105
+ if (reuseFunc) reuseFunc.call(ret);
1106
+
1107
+ // Set the new state. We'll set content last, because it's the most
1108
+ // likely to have observers.
1109
+ ret.beginPropertyChanges();
1110
+ ret.set('contentIndex', idx);
1111
+ ret.set('layerId', layerId);
1112
+ ret.set('isEnabled', isEnabled);
1113
+ ret.set('isSelected', isSelected);
1114
+ ret.set('outlineLevel', outlineLevel);
1115
+ ret.set('disclosureState', disclosureState);
1116
+ ret.set('isVisibleInWindow', isVisibleInWindow);
1117
+
1118
+ // TODO: In theory this shouldn't be needed, but without it, we
1119
+ // sometimes get errors when doing a full reload, because
1120
+ // 'childViews' contains the view but the parent is not set.
1121
+ // This implies a timing issue with the general flow of
1122
+ // collection view.
1123
+ ret.set('parentView', parentView);
1124
+
1125
+ // Since we re-use layerIds, we need to reset SproutCore's internal
1126
+ // mapping table.
1127
+ SC.View.views[layerId] = ret;
1128
+
1129
+ if (layout) {
1130
+ ret.set('layout', layout);
1131
+ }
1132
+ else {
1133
+ ret.set('layout', E.prototype.layout);
1134
+ }
1135
+ ret.set('content', item);
1136
+ ret.endPropertyChanges();
1137
+ }
1138
+ }
1139
+
1140
+ // If we weren't able to re-use a view, then create a new one.
1141
+ if (!ret) {
1142
+ // collect some other state
1143
+ var attrs = this._TMP_ATTRS;
1144
+ attrs.contentIndex = idx;
1145
+ attrs.content = item;
1146
+ attrs.owner = attrs.displayDelegate = this;
1147
+ attrs.parentView = parentView; // Same here; shouldn't be needed
1148
+ attrs.page = this.page;
1149
+ attrs.layerId = layerId;
1150
+ attrs.isEnabled = isEnabled;
1151
+ attrs.isSelected = isSelected;
1152
+ attrs.outlineLevel = outlineLevel;
1153
+ attrs.disclosureState = disclosureState;
1154
+ attrs.isGroupView = isGroupView;
1155
+ attrs.isVisibleInWindow = isVisibleInWindow;
1156
+ if (isGroupView) attrs.classNames = this._GROUP_COLLECTION_CLASS_NAMES;
1157
+ else attrs.classNames = this._COLLECTION_CLASS_NAMES;
1158
+
1159
+ if (layout) {
1160
+ attrs.layout = layout;
1161
+ } else {
1162
+ delete attrs.layout ;
1163
+ }
1164
+
1165
+ ret = this.createItemView(E, idx, attrs);
1166
+ }
1167
+
1168
+ itemViews[idx] = ret ;
1169
+ return ret ;
1170
+ },
1171
+
1172
+ /**
1173
+ Helper method for getting the item view of a specific content object
1174
+
1175
+ @param {Object} object
1176
+ */
1177
+ itemViewForContentObject: function(object) {
1178
+ return this.itemViewForContentIndex(this.get('content').indexOf(object));
1179
+ },
1180
+
1181
+ _TMP_LAYERID: [],
1182
+
1183
+ /**
1184
+ Primitive to instantiate an item view. You will be passed the class
1185
+ and a content index. You can override this method to perform any other
1186
+ one time setup.
1187
+
1188
+ Note that item views may be created somewhat frequently so keep this fast.
1189
+
1190
+ *IMPORTANT:* The attrs hash passed is reused each time this method is
1191
+ called. If you add properties to this hash be sure to delete them before
1192
+ returning from this method.
1193
+
1194
+ @param {Class} exampleClass example view class
1195
+ @param {Number} idx the content index
1196
+ @param {Hash} attrs expected attributes
1197
+ @returns {SC.View} item view instance
1198
+ */
1199
+ createItemView: function(exampleClass, idx, attrs) {
1200
+ return exampleClass.create(attrs);
1201
+ },
1202
+
1203
+ /**
1204
+ Generates a layerId for the passed index and item. Usually the default
1205
+ implementation is suitable.
1206
+
1207
+ @param {Number} idx the content index
1208
+ @returns {String} layer id, must be suitable for use in HTML id attribute
1209
+ */
1210
+ layerIdFor: function(idx) {
1211
+ var ret = this._TMP_LAYERID;
1212
+ ret[0] = SC.guidFor(this);
1213
+ ret[1] = idx;
1214
+ return ret.join('-');
1215
+ },
1216
+
1217
+ /**
1218
+ Extracts the content index from the passed layerID. If the layer id does
1219
+ not belong to the receiver or if no value could be extracted, returns NO.
1220
+
1221
+ @param {String} id the layer id
1222
+ */
1223
+ contentIndexForLayerId: function(id) {
1224
+ if (!id || !(id = id.toString())) return null ; // nothing to do
1225
+
1226
+ var base = this._baseLayerId;
1227
+ if (!base) base = this._baseLayerId = SC.guidFor(this)+"-";
1228
+
1229
+ // no match
1230
+ if ((id.length <= base.length) || (id.indexOf(base) !== 0)) return null ;
1231
+ var ret = Number(id.slice(id.lastIndexOf('-')+1));
1232
+ return isNaN(ret) ? null : ret ;
1233
+ },
1234
+
1235
+
1236
+ /**
1237
+ Find the first content item view for the passed event.
1238
+
1239
+ This method will go up the view chain, starting with the view that was the
1240
+ target of the passed event, looking for a child item. This will become
1241
+ the view that is selected by the mouse event.
1242
+
1243
+ This method only works for mouseDown & mouseUp events. mouseMoved events
1244
+ do not have a target.
1245
+
1246
+ @param {SC.Event} evt An event
1247
+ @returns {SC.View} the item view or null
1248
+ */
1249
+ itemViewForEvent: function(evt) {
1250
+ var responder = this.getPath('pane.rootResponder') ;
1251
+ if (!responder) return null ; // fast path
1252
+
1253
+ var base = SC.guidFor(this) + '-',
1254
+ baseLen = base.length,
1255
+ element = evt.target,
1256
+ layer = this.get('layer'),
1257
+ contentIndex = null,
1258
+ id, itemView, ret ;
1259
+
1260
+ // walk up the element hierarchy until we find this or an element with an
1261
+ // id matching the base guid (i.e. a collection item)
1262
+ while (element && element !== document && element !== layer) {
1263
+ id = element ? SC.$(element).attr('id') : null ;
1264
+ if (id && (contentIndex = this.contentIndexForLayerId(id)) !== null) {
1265
+ break;
1266
+ }
1267
+ element = element.parentNode ;
1268
+ }
1269
+
1270
+ // no matching element found?
1271
+ if (contentIndex===null || (element === layer)) {
1272
+ element = layer = null; // avoid memory leaks
1273
+ return null;
1274
+ }
1275
+
1276
+ // okay, found the DOM node for the view, go ahead and create it
1277
+ // first, find the contentIndex
1278
+ if (contentIndex >= this.get('length')) {
1279
+ throw "layout for item view %@ was found when item view does not exist (%@)".fmt(id, this);
1280
+ }
1281
+
1282
+ return this.itemViewForContentIndex(contentIndex);
1283
+ },
1284
+
1285
+ // ..........................................................
1286
+ // DISCLOSURE SUPPORT
1287
+ //
1288
+
1289
+ /**
1290
+ Expands any items in the passed selection array that have a disclosure
1291
+ state.
1292
+
1293
+ @param {SC.IndexSet} indexes the indexes to expand
1294
+ @returns {SC.CollectionView} receiver
1295
+ */
1296
+ expand: function(indexes) {
1297
+ if (!indexes) return this; // nothing to do
1298
+ var del = this.get('contentDelegate'),
1299
+ content = this.get('content');
1300
+
1301
+ indexes.forEach(function(i) {
1302
+ var state = del.contentIndexDisclosureState(this, content, i);
1303
+ if (state === SC.BRANCH_CLOSED) del.contentIndexExpand(this,content,i);
1304
+ }, this);
1305
+ return this;
1306
+ },
1307
+
1308
+ /**
1309
+ Collapses any items in the passed selection array that have a disclosure
1310
+ state.
1311
+
1312
+ @param {SC.IndexSet} indexes the indexes to expand
1313
+ @returns {SC.CollectionView} receiver
1314
+ */
1315
+ collapse: function(indexes) {
1316
+ if (!indexes) return this; // nothing to do
1317
+ var del = this.get('contentDelegate'),
1318
+ content = this.get('content');
1319
+
1320
+ indexes.forEach(function(i) {
1321
+ var state = del.contentIndexDisclosureState(this, content, i);
1322
+ if (state === SC.BRANCH_OPEN) del.contentIndexCollapse(this,content,i);
1323
+ }, this);
1324
+ return this;
1325
+ },
1326
+
1327
+ // ..........................................................
1328
+ // SELECTION SUPPORT
1329
+ //
1330
+
1331
+ /** @private
1332
+
1333
+ Called whenever the selection object is changed to a new value. Begins
1334
+ observing the selection for changes.
1335
+
1336
+ */
1337
+ _cv_selectionDidChange: function() {
1338
+ var sel = this.get('selection'),
1339
+ last = this._cv_selection,
1340
+ func = this._cv_selectionContentDidChange;
1341
+
1342
+ if (sel === last) return; // nothing to do
1343
+ if (last) last.removeObserver('[]', this, func);
1344
+ if (sel) sel.addObserver('[]', this, func);
1345
+
1346
+ this._cv_selection = sel ;
1347
+ this._cv_selectionContentDidChange();
1348
+ }.observes('selection'),
1349
+
1350
+ /** @private
1351
+
1352
+ Called whenever the selection object or its content changes. This will
1353
+ repaint any items that changed their selection state.
1354
+
1355
+ */
1356
+ _cv_selectionContentDidChange: function() {
1357
+ var sel = this.get('selection'),
1358
+ last = this._cv_selindexes, // clone of last known indexes
1359
+ content = this.get('content'),
1360
+ diff ;
1361
+
1362
+ // save new last
1363
+ this._cv_selindexes = sel ? sel.frozenCopy() : null;
1364
+
1365
+ // determine which indexes are now invalid
1366
+ if (last) last = last.indexSetForSource(content);
1367
+ if (sel) sel = sel.indexSetForSource(content);
1368
+
1369
+ if (sel && last) diff = sel.without(last).add(last.without(sel));
1370
+ else diff = sel || last;
1371
+
1372
+ if (diff && diff.get('length')>0) this.reloadSelectionIndexes(diff);
1373
+ },
1374
+
1375
+ /** @private
1376
+ Contains the current item views that need their selection to be repainted.
1377
+ This may be either NO, YES, or an IndexSet.
1378
+ */
1379
+ _invalidSelection: NO,
1380
+
1381
+ /**
1382
+ Called whenever the selection changes. The passed index set will contain
1383
+ any affected indexes including those indexes that were previously
1384
+ selected and now should be deselected.
1385
+
1386
+ Pass null to reload the selection state for all items.
1387
+
1388
+ @param {SC.IndexSet} indexes affected indexes
1389
+ @returns {SC.CollectionView} reciever
1390
+ */
1391
+ reloadSelectionIndexes: function(indexes) {
1392
+ var invalid = this._invalidSelection ;
1393
+ if (indexes && (invalid !== YES)) {
1394
+ if (invalid) { invalid.add(indexes) ; }
1395
+ else { invalid = this._invalidSelection = indexes.copy(); }
1396
+
1397
+ } else this._invalidSelection = YES ; // force a total reload
1398
+
1399
+ if (this.get('isVisibleInWindow')) {
1400
+ this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
1401
+ }
1402
+
1403
+ return this ;
1404
+ },
1405
+
1406
+ /**
1407
+ Reloads the selection state if needed on any dirty indexes. Normally this
1408
+ will run once at the end of the runloop, but you can force the item views
1409
+ to reload their selection immediately by calling this method.
1410
+
1411
+ You can also override this method if needed to change the way the
1412
+ selection is reloaded on item views. The default behavior will simply
1413
+ find any item views in the nowShowing range that are affected and
1414
+ modify them.
1415
+
1416
+ @returns {SC.CollectionView} receiver
1417
+ */
1418
+ reloadSelectionIndexesIfNeeded: function() {
1419
+ var invalid = this._invalidSelection;
1420
+ if (!invalid || !this.get('isVisibleInWindow')) return this ;
1421
+
1422
+ var nowShowing = this.get('nowShowing'),
1423
+ reload = this._invalidIndexes,
1424
+ content = this.get('content'),
1425
+ sel = this.get('selection');
1426
+
1427
+ this._invalidSelection = NO; // reset invalid
1428
+
1429
+ // fast path. if we are going to reload everything anyway, just forget
1430
+ // about it. Also if we don't have a nowShowing, nothing to do.
1431
+ if (reload === YES || !nowShowing) return this ;
1432
+
1433
+ // if invalid is YES instead of index set, just reload everything
1434
+ if (invalid === YES) invalid = nowShowing;
1435
+
1436
+ // if we will reload some items anyway, don't bother
1437
+ if (reload && reload.isIndexSet) invalid = invalid.without(reload);
1438
+
1439
+ // iterate through each item and set the isSelected state.
1440
+ invalid.forEach(function(idx) {
1441
+ if (!nowShowing.contains(idx)) return; // not showing
1442
+ var view = this.itemViewForContentIndex(idx, NO);
1443
+ if (view) view.set('isSelected', sel ? sel.contains(content, idx) : NO);
1444
+ },this);
1445
+
1446
+ return this ;
1447
+ },
1448
+
1449
+ /**
1450
+ Selection primitive. Selects the passed IndexSet of items, optionally
1451
+ extending the current selection. If extend is NO or not passed then this
1452
+ will replace the selection with the passed value. Otherwise the indexes
1453
+ will be added to the current selection.
1454
+
1455
+ @param {Number|SC.IndexSet} indexes index or indexes to select
1456
+ @param extend {Boolean} optionally extend the selection
1457
+ @returns {SC.CollectionView} receiver
1458
+ */
1459
+ select: function(indexes, extend) {
1460
+
1461
+ var content = this.get('content'),
1462
+ del = this.get('selectionDelegate'),
1463
+ groupIndexes = this.get('_contentGroupIndexes'),
1464
+ sel;
1465
+
1466
+ if(!this.get('isSelectable')) return this;
1467
+
1468
+ // normalize
1469
+ if (SC.typeOf(indexes) === SC.T_NUMBER) {
1470
+ indexes = SC.IndexSet.create(indexes, 1);
1471
+ }
1472
+
1473
+ // if we are passed an empty index set or null, clear the selection.
1474
+ if (indexes && indexes.get('length')>0) {
1475
+
1476
+ // first remove any group indexes - these can never be selected
1477
+ if (groupIndexes && groupIndexes.get('length')>0) {
1478
+ indexes = indexes.copy().remove(groupIndexes);
1479
+ }
1480
+
1481
+ // give the delegate a chance to alter the items
1482
+ indexes = del.collectionViewShouldSelectIndexes(this, indexes, extend);
1483
+ if (!indexes || indexes.get('length')===0) return this; // nothing to do
1484
+
1485
+ } else indexes = null;
1486
+
1487
+ // build the selection object, merging if needed
1488
+ if (extend && (sel = this.get('selection'))) sel = sel.copy();
1489
+ else sel = SC.SelectionSet.create();
1490
+
1491
+ if (indexes && indexes.get('length')>0) {
1492
+
1493
+ // when selecting only one item, always select by content
1494
+ if (indexes.get('length')===1) {
1495
+ sel.addObject(content.objectAt(indexes.get('firstObject')));
1496
+
1497
+ // otherwise select an index range
1498
+ } else sel.add(content, indexes);
1499
+
1500
+ }
1501
+
1502
+ // give delegate one last chance
1503
+ sel = del.collectionViewSelectionForProposedSelection(this, sel);
1504
+ if (!sel) sel = SC.SelectionSet.create(); // empty
1505
+
1506
+ // if we're not extending the selection, clear the selection anchor
1507
+ this._selectionAnchor = null ;
1508
+ this.set('selection', sel.freeze()) ;
1509
+ return this;
1510
+ },
1511
+
1512
+ /**
1513
+ Primtive to remove the indexes from the selection.
1514
+
1515
+ @param {Number|SC.IndexSet} indexes index or indexes to select
1516
+ @returns {SC.CollectionView} receiver
1517
+ */
1518
+ deselect: function(indexes) {
1519
+
1520
+ var sel = this.get('selection'),
1521
+ content = this.get('content'),
1522
+ del = this.get('selectionDelegate');
1523
+
1524
+ if(!this.get('isSelectable')) return this;
1525
+ if (!sel || sel.get('length')===0) return this; // nothing to do
1526
+
1527
+ // normalize
1528
+ if (SC.typeOf(indexes) === SC.T_NUMBER) {
1529
+ indexes = SC.IndexSet.create(indexes, 1);
1530
+ }
1531
+
1532
+ // give the delegate a chance to alter the items
1533
+ indexes = del.collectionViewShouldDeselectIndexes(this, indexes) ;
1534
+ if (!indexes || indexes.get('length')===0) return this; // nothing to do
1535
+
1536
+ // now merge change - note we expect sel && indexes to not be null
1537
+ sel = sel.copy().remove(content, indexes);
1538
+ sel = del.collectionViewSelectionForProposedSelection(this, sel);
1539
+ if (!sel) sel = SC.SelectionSet.create(); // empty
1540
+
1541
+ this.set('selection', sel.freeze()) ;
1542
+ return this ;
1543
+ },
1544
+
1545
+ /** @private
1546
+ Finds the next selectable item, up to content length, by asking the
1547
+ delegate. If a non-selectable item is found, the index is skipped. If
1548
+ no item is found, selection index is returned unmodified.
1549
+
1550
+ Return value will always be in the range of the bottom of the current
1551
+ selection index and the proposed index.
1552
+
1553
+ @param {Number} proposedIndex the desired index to select
1554
+ @param {Number} bottom optional bottom of selection use as fallback
1555
+ @returns {Number} next selectable index.
1556
+ */
1557
+ _findNextSelectableItemFromIndex: function(proposedIndex, bottom) {
1558
+
1559
+ var lim = this.get('length'),
1560
+ range = SC.IndexSet.create(),
1561
+ content = this.get('content'),
1562
+ del = this.get('selectionDelegate'),
1563
+ groupIndexes = this.get('_contentGroupIndexes'),
1564
+ ret, sel ;
1565
+
1566
+ // fast path
1567
+ if (!groupIndexes && (del.collectionViewShouldSelectIndexes === this.collectionViewShouldSelectIndexes)) {
1568
+ return proposedIndex;
1569
+ }
1570
+
1571
+ // loop forwards looking for an index that is allowed by delegate
1572
+ // we could alternatively just pass the whole range but this might be
1573
+ // slow for the delegate
1574
+ while (proposedIndex < lim) {
1575
+ if (!groupIndexes || !groupIndexes.contains(proposedIndex)) {
1576
+ range.add(proposedIndex);
1577
+ ret = del.collectionViewShouldSelectIndexes(this, range);
1578
+ if (ret && ret.get('length') >= 1) return proposedIndex ;
1579
+ range.remove(proposedIndex);
1580
+ }
1581
+ proposedIndex++;
1582
+ }
1583
+
1584
+ // if nothing was found, return top of selection
1585
+ if (bottom === undefined) {
1586
+ sel = this.get('selection');
1587
+ bottom = sel ? sel.get('max') : -1 ;
1588
+ }
1589
+ return bottom ;
1590
+ },
1591
+
1592
+ /** @private
1593
+ Finds the previous selectable item, up to the first item, by asking the
1594
+ delegate. If a non-selectable item is found, the index is skipped. If
1595
+ no item is found, selection index is returned unmodified.
1596
+
1597
+ @param {Integer} proposedIndex the desired index to select
1598
+ @returns {Integer} the previous selectable index. This will always be in the range of the top of the current selection index and the proposed index.
1599
+ @private
1600
+ */
1601
+ _findPreviousSelectableItemFromIndex: function(proposedIndex, top) {
1602
+ var range = SC.IndexSet.create(),
1603
+ content = this.get('content'),
1604
+ del = this.get('selectionDelegate'),
1605
+ groupIndexes = this.get('_contentGroupIndexes'),
1606
+ ret ;
1607
+
1608
+ if (SC.none(proposedIndex)) proposedIndex = -1;
1609
+
1610
+ // fast path
1611
+ if (!groupIndexes && (del.collectionViewShouldSelectIndexes === this.collectionViewShouldSelectIndexes)) {
1612
+ return proposedIndex;
1613
+ }
1614
+
1615
+ // loop backwards looking for an index that is allowed by delegate
1616
+ // we could alternatively just pass the whole range but this might be
1617
+ // slow for the delegate
1618
+ while (proposedIndex >= 0) {
1619
+ if (!groupIndexes || !groupIndexes.contains(proposedIndex)) {
1620
+ range.add(proposedIndex);
1621
+ ret = del.collectionViewShouldSelectIndexes(this, range);
1622
+ if (ret && ret.get('length') >= 1) return proposedIndex ;
1623
+ range.remove(proposedIndex);
1624
+ }
1625
+ proposedIndex--;
1626
+ }
1627
+
1628
+ // if nothing was found, return top of selection
1629
+ if (top === undefined) {
1630
+ var sel = this.get('selection');
1631
+ top = sel ? sel.get('min') : -1 ;
1632
+ }
1633
+ if (SC.none(top)) top = -1;
1634
+ return top ;
1635
+ },
1636
+
1637
+ /**
1638
+ Select one or more items before the current selection, optionally
1639
+ extending the current selection. Also scrolls the selected item into
1640
+ view.
1641
+
1642
+ Selection does not wrap around.
1643
+
1644
+ @param extend {Boolean} (Optional) If true, the selection will be extended
1645
+ instead of replaced. Defaults to false.
1646
+ @param numberOfItems {Integer} (Optional) The number of previous to be
1647
+ selected. Defaults to 1
1648
+ @returns {SC.CollectionView} receiver
1649
+ */
1650
+ selectPreviousItem: function(extend, numberOfItems) {
1651
+ if (SC.none(numberOfItems)) numberOfItems = 1 ;
1652
+ if (SC.none(extend)) extend = false ;
1653
+
1654
+ var sel = this.get('selection'),
1655
+ content = this.get('content');
1656
+ if (sel) sel = sel.indexSetForSource(content);
1657
+
1658
+ var selTop = sel ? sel.get('min') : -1,
1659
+ selBottom = sel ? sel.get('max')-1 : -1,
1660
+ anchor = this._selectionAnchor;
1661
+ if (SC.none(anchor)) anchor = selTop;
1662
+
1663
+ // if extending, then we need to do some fun stuff to build the array
1664
+ if (extend) {
1665
+
1666
+ // If the selBottom is after the anchor, then reduce the selection
1667
+ if (selBottom > anchor) {
1668
+ selBottom = selBottom - numberOfItems ;
1669
+
1670
+ // otherwise, select the previous item from the top
1671
+ } else {
1672
+ selTop = this._findPreviousSelectableItemFromIndex(selTop - numberOfItems);
1673
+ }
1674
+
1675
+ // Ensure we are not out of bounds
1676
+ if (SC.none(selTop) || (selTop < 0)) selTop = 0 ;
1677
+ if (!content.objectAt(selTop)) selTop = sel ? sel.get('min') : -1;
1678
+ if (selBottom < selTop) selBottom = selTop ;
1679
+
1680
+ // if not extending, just select the item previous to the selTop
1681
+ } else {
1682
+ selTop = this._findPreviousSelectableItemFromIndex(selTop - numberOfItems);
1683
+ if (SC.none(selTop) || (selTop < 0)) selTop = 0 ;
1684
+ if (!content.objectAt(selTop)) selTop = sel ? sel.get('min') : -1;
1685
+ selBottom = selTop ;
1686
+ anchor = null ;
1687
+ }
1688
+
1689
+ var scrollToIndex = selTop ;
1690
+
1691
+ // now build new selection
1692
+ sel = SC.IndexSet.create(selTop, selBottom+1-selTop);
1693
+
1694
+ // ensure that the item is visible and set the selection
1695
+ this.scrollToContentIndex(scrollToIndex) ;
1696
+ this.select(sel) ;
1697
+ this._selectionAnchor = anchor ;
1698
+ return this ;
1699
+ },
1700
+
1701
+ /**
1702
+ Select one or more items following the current selection, optionally
1703
+ extending the current selection. Also scrolls to selected item.
1704
+
1705
+ Selection does not wrap around.
1706
+
1707
+ @param extend {Boolean} (Optional) If true, the selection will be extended
1708
+ instead of replaced. Defaults to false.
1709
+ @param numberOfItems {Integer} (Optional) The number of items to be
1710
+ selected. Defaults to 1.
1711
+ @returns {SC.CollectionView} receiver
1712
+ */
1713
+ selectNextItem: function(extend, numberOfItems) {
1714
+ if (SC.none(numberOfItems)) numberOfItems = 1 ;
1715
+ if (SC.none(extend)) extend = false ;
1716
+
1717
+ var sel = this.get('selection'),
1718
+ content = this.get('content');
1719
+ if (sel) sel = sel.indexSetForSource(content);
1720
+
1721
+ var selTop = sel ? sel.get('min') : -1,
1722
+ selBottom = sel ? sel.get('max')-1 : -1,
1723
+ anchor = this._selectionAnchor,
1724
+ lim = this.get('length');
1725
+
1726
+ if (SC.none(anchor)) anchor = selTop;
1727
+
1728
+ // if extending, then we need to do some fun stuff to build the array
1729
+ if (extend) {
1730
+
1731
+ // If the selTop is before the anchor, then reduce the selection
1732
+ if (selTop < anchor) {
1733
+ selTop = selTop + numberOfItems ;
1734
+
1735
+ // otherwise, select the next item after the bottom
1736
+ } else {
1737
+ selBottom = this._findNextSelectableItemFromIndex(selBottom + numberOfItems, selBottom);
1738
+ }
1739
+
1740
+ // Ensure we are not out of bounds
1741
+ if (selBottom >= lim) selBottom = lim-1;
1742
+
1743
+ // we also need to check that the item exists
1744
+ if (!content.objectAt(selBottom)) selBottom = sel ? sel.get('max') - 1 : -1;
1745
+
1746
+ // and if top has eclipsed bottom, handle that too.
1747
+ if (selTop > selBottom) selTop = selBottom ;
1748
+
1749
+ // if not extending, just select the item next to the selBottom
1750
+ } else {
1751
+ selBottom = this._findNextSelectableItemFromIndex(selBottom + numberOfItems, selBottom);
1752
+
1753
+ if (selBottom >= lim) selBottom = lim-1;
1754
+ if (!content.objectAt(selBottom)) selBottom = sel ? sel.get('max') - 1 : -1;
1755
+ selTop = selBottom ;
1756
+ anchor = null ;
1757
+ }
1758
+
1759
+ var scrollToIndex = selBottom ;
1760
+
1761
+ // now build new selection
1762
+ sel = SC.IndexSet.create(selTop, selBottom-selTop+1);
1763
+
1764
+ // ensure that the item is visible and set the selection
1765
+ this.scrollToContentIndex(scrollToIndex) ;
1766
+ this.select(sel) ;
1767
+ this._selectionAnchor = anchor ;
1768
+ return this ;
1769
+ },
1770
+
1771
+ /**
1772
+ Deletes the selected content if canDeleteContent is YES. This will invoke
1773
+ delegate methods to provide fine-grained control. Returns YES if the
1774
+ deletion was possible, even if none actually occurred.
1775
+
1776
+ @returns {Boolean} YES if deletion is possible.
1777
+ */
1778
+ deleteSelection: function() {
1779
+ // perform some basic checks...
1780
+ if (!this.get('canDeleteContent')) return NO;
1781
+
1782
+ var sel = this.get('selection'),
1783
+ content = this.get('content'),
1784
+ del = this.get('selectionDelegate'),
1785
+ indexes = sel&&content ? sel.indexSetForSource(content) : null;
1786
+
1787
+ if (!content || !indexes || indexes.get('length') === 0) return NO ;
1788
+
1789
+ // let the delegate decide what to actually delete. If this returns an
1790
+ // empty index set or null, just do nothing.
1791
+ indexes = del.collectionViewShouldDeleteIndexes(this, indexes);
1792
+ if (!indexes || indexes.get('length') === 0) return NO ;
1793
+
1794
+ // now have the delegate (or us) perform the deletion. The default
1795
+ // delegate implementation just uses standard SC.Array methods to do the
1796
+ // right thing.
1797
+ del.collectionViewDeleteContent(this, this.get('content'), indexes);
1798
+
1799
+ return YES ;
1800
+ },
1801
+
1802
+ // ..........................................................
1803
+ // SCROLLING
1804
+ //
1805
+
1806
+ /**
1807
+ Scroll the rootElement (if needed) to ensure that the item is visible.
1808
+
1809
+ @param {Number} contentIndex The index of the item to scroll to
1810
+ @returns {SC.CollectionView} receiver
1811
+ */
1812
+ scrollToContentIndex: function(contentIndex) {
1813
+ var itemView = this.itemViewForContentIndex(contentIndex) ;
1814
+ if (itemView) this.scrollToItemView(itemView) ;
1815
+ return this;
1816
+ },
1817
+
1818
+ /**
1819
+ Scroll to the passed item view. If the item view is not visible on screen
1820
+ this method will not work.
1821
+
1822
+ @param {SC.View} view The item view to scroll to
1823
+ @returns {SC.CollectionView} receiver
1824
+ */
1825
+ scrollToItemView: function(view) {
1826
+ if (view) view.scrollToVisible();
1827
+ return this ;
1828
+ },
1829
+
1830
+ // ..........................................................
1831
+ // KEYBOARD EVENTS
1832
+ //
1833
+
1834
+ /** @private */
1835
+ keyDown: function(evt) {
1836
+ var ret = this.interpretKeyEvents(evt) ;
1837
+ return !ret ? NO : ret ;
1838
+ },
1839
+
1840
+ /** @private */
1841
+ keyUp: function() { return true; },
1842
+
1843
+ /** @private
1844
+ Handle space key event. Do action
1845
+ */
1846
+ insertText: function(chr, evt) {
1847
+ if (chr === ' ') {
1848
+ var sel = this.get('selection');
1849
+ if (sel && sel.get('length')>0) {
1850
+ this.invokeLater(this._cv_action, 0, null, evt);
1851
+ }
1852
+ return YES ;
1853
+ } else return NO ;
1854
+ },
1855
+
1856
+ /** @private
1857
+ Handle select all keyboard event.
1858
+ */
1859
+ selectAll: function(evt) {
1860
+ var content = this.get('content'),
1861
+ sel = content ? SC.IndexSet.create(0, content.get('length')) : null;
1862
+ this.select(sel, NO) ;
1863
+ return YES ;
1864
+ },
1865
+
1866
+ /** @private
1867
+ Handle delete keyboard event.
1868
+ */
1869
+ deleteBackward: function(evt) {
1870
+ return this.deleteSelection() ;
1871
+ },
1872
+
1873
+ /** @private
1874
+ Handle delete keyboard event.
1875
+ */
1876
+ deleteForward: function(evt) {
1877
+ return this.deleteSelection() ;
1878
+ },
1879
+
1880
+ /** @private
1881
+ Selects the same item on the next row or moves down one if itemsPerRow = 1
1882
+ */
1883
+ moveDown: function(sender, evt) {
1884
+ this.selectNextItem(false, this.get('itemsPerRow') || 1) ;
1885
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1886
+ return true ;
1887
+ },
1888
+
1889
+ /** @private
1890
+ Selects the same item on the next row or moves up one if itemsPerRow = 1
1891
+ */
1892
+ moveUp: function(sender, evt) {
1893
+ this.selectPreviousItem(false, this.get('itemsPerRow') || 1) ;
1894
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1895
+ return true ;
1896
+ },
1897
+
1898
+ /** @private
1899
+ Selects the previous item if itemsPerRow > 1. Otherwise does nothing.
1900
+ If item is expandable, will collapse.
1901
+ */
1902
+ moveLeft: function(evt) {
1903
+ // If the control key is down, this may be a browser shortcut and
1904
+ // we should not handle the arrow key.
1905
+ if (evt.ctrlKey || evt.metaKey) return NO;
1906
+
1907
+ if ((this.get('itemsPerRow') || 1) > 1) {
1908
+ this.selectPreviousItem(false, 1);
1909
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1910
+
1911
+ } else {
1912
+ var sel = this.get('selection'),
1913
+ content = this.get('content'),
1914
+ indexes = sel ? sel.indexSetForSource(content) : null;
1915
+
1916
+ // Collapse the element if it is expanded. However, if there is exactly
1917
+ // one item selected and the item is already collapsed or is a leaf
1918
+ // node, then select the (expanded) parent element instead as a
1919
+ // convenience to the user.
1920
+ if ( indexes ) {
1921
+ var del = undefined, // We'll load it lazily
1922
+ selectParent = false,
1923
+ index = undefined;
1924
+
1925
+ if ( indexes.get('length') === 1 ) {
1926
+ index = indexes.get('firstObject');
1927
+ del = this.get('contentDelegate');
1928
+ var state = del.contentIndexDisclosureState(this, content, index);
1929
+ if (state !== SC.BRANCH_OPEN) selectParent = true;
1930
+ }
1931
+
1932
+ if ( selectParent ) {
1933
+ // TODO: PERFORMANCE: It would be great to have a function like
1934
+ // SC.CollectionView.selectParentItem() or something similar
1935
+ // for performance reasons. But since we don't currently
1936
+ // have such a function, let's just iterate through the
1937
+ // previous items until we find the first one with a outline
1938
+ // level of one less than the selected item.
1939
+ var desiredOutlineLevel = del.contentIndexOutlineLevel(this, content, index) - 1;
1940
+ if ( desiredOutlineLevel >= 0 ) {
1941
+ var parentIndex = -1;
1942
+ while ( parentIndex < 0 ) {
1943
+ var previousItemIndex = this._findPreviousSelectableItemFromIndex(index - 1);
1944
+ if (previousItemIndex < 0 ) return false; // Sanity-check.
1945
+ index = previousItemIndex;
1946
+ var outlineLevel = del.contentIndexOutlineLevel(this, content, index);
1947
+ if ( outlineLevel === desiredOutlineLevel ) {
1948
+ parentIndex = previousItemIndex;
1949
+ }
1950
+ }
1951
+
1952
+ // If we found the parent, select it now.
1953
+ if ( parentIndex !== -1 ) {
1954
+ this.select(index);
1955
+ }
1956
+ }
1957
+ }
1958
+ else {
1959
+ this.collapse(indexes);
1960
+ }
1961
+ }
1962
+ }
1963
+
1964
+ return true ;
1965
+ },
1966
+
1967
+ /** @private
1968
+ Selects the next item if itemsPerRow > 1. Otherwise does nothing.
1969
+ */
1970
+ moveRight: function(evt) {
1971
+ // If the control key is down, this may be a browser shortcut and
1972
+ // we should not handle the arrow key.
1973
+ if (evt.ctrlKey || evt.metaKey) return NO;
1974
+
1975
+ if ((this.get('itemsPerRow') || 1) > 1) {
1976
+ this.selectNextItem(false, 1) ;
1977
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1978
+ } else {
1979
+ var sel = this.get('selection'),
1980
+ content = this.get('content'),
1981
+ indexes = sel ? sel.indexSetForSource(content) : null;
1982
+ if (indexes) this.expand(indexes);
1983
+ }
1984
+
1985
+ return true ;
1986
+ },
1987
+
1988
+ /** @private */
1989
+ moveDownAndModifySelection: function(sender, evt) {
1990
+ this.selectNextItem(true, this.get('itemsPerRow') || 1) ;
1991
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1992
+ return true ;
1993
+ },
1994
+
1995
+ /** @private */
1996
+ moveUpAndModifySelection: function(sender, evt) {
1997
+ this.selectPreviousItem(true, this.get('itemsPerRow') || 1) ;
1998
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1999
+ return true ;
2000
+ },
2001
+
2002
+ /** @private
2003
+ Selects the previous item if itemsPerRow > 1. Otherwise does nothing.
2004
+ */
2005
+ moveLeftAndModifySelection: function(sender, evt) {
2006
+ if ((this.get('itemsPerRow') || 1) > 1) {
2007
+ this.selectPreviousItem(true, 1) ;
2008
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
2009
+ }
2010
+ return true ;
2011
+ },
2012
+
2013
+ /** @private
2014
+ Selects the next item if itemsPerRow > 1. Otherwise does nothing.
2015
+ */
2016
+ moveRightAndModifySelection: function(sender, evt) {
2017
+ if ((this.get('itemsPerRow') || 1) > 1) {
2018
+ this.selectNextItem(true, 1) ;
2019
+ this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
2020
+ }
2021
+ return true ;
2022
+ },
2023
+
2024
+
2025
+
2026
+ /** @private
2027
+ if content value is editable and we have one item selected, then edit.
2028
+ otherwise, invoke action.
2029
+ */
2030
+ insertNewline: function(sender, evt) {
2031
+ var canEdit = this.get('isEditable') && this.get('canEditContent'),
2032
+ sel, content, set, idx, itemView;
2033
+
2034
+ // first make sure we have a single item selected; get idx
2035
+ if (canEdit) {
2036
+ sel = this.get('selection') ;
2037
+ content = this.get('content');
2038
+ if (sel && sel.get('length') === 1) {
2039
+ set = sel.indexSetForSource(content);
2040
+ idx = set ? set.get('min') : -1;
2041
+ canEdit = idx>=0;
2042
+ }
2043
+ }
2044
+
2045
+ // next find itemView and ensure it supports editing
2046
+ if (canEdit) {
2047
+ itemView = this.itemViewForContentIndex(idx);
2048
+ canEdit = itemView && SC.typeOf(itemView.beginEditing)===SC.T_FUNCTION;
2049
+ }
2050
+
2051
+ // ok, we can edit..
2052
+ if (canEdit) {
2053
+ this.scrollToContentIndex(idx);
2054
+ itemView = this.itemViewForContentIndex(idx); // just in case
2055
+ itemView.beginEditing();
2056
+
2057
+ // invoke action
2058
+ } else {
2059
+ this.invokeLater(this._cv_action, 0, itemView, null) ;
2060
+ }
2061
+
2062
+ return YES ; // always handle
2063
+ },
2064
+
2065
+ // ..........................................................
2066
+ // MOUSE EVENTS
2067
+ //
2068
+
2069
+ /** @private
2070
+ Handles mouse down events on the collection view or on any of its
2071
+ children.
2072
+
2073
+ The default implementation of this method can handle a wide variety
2074
+ of user behaviors depending on how you have configured the various
2075
+ options for the collection view.
2076
+
2077
+ @param ev {Event} the mouse down event
2078
+ @returns {Boolean} Usually YES.
2079
+ */
2080
+ mouseDown: function(ev) {
2081
+
2082
+ // When the user presses the mouse down, we don't do much just yet.
2083
+ // Instead, we just need to save a bunch of state about the mouse down
2084
+ // so we can choose the right thing to do later.
2085
+
2086
+
2087
+ // find the actual view the mouse was pressed down on. This will call
2088
+ // hitTest() on item views so they can implement non-square detection
2089
+ // modes. -- once we have an item view, get its content object as well.
2090
+ var itemView = this.itemViewForEvent(ev),
2091
+ content = this.get('content'),
2092
+ contentIndex = itemView ? itemView.get('contentIndex') : -1,
2093
+ info, anchor, sel, isSelected, modifierKeyPressed,
2094
+ allowsMultipleSel = content.get('allowsMultipleSelection');
2095
+
2096
+ info = this.mouseDownInfo = {
2097
+ event: ev,
2098
+ itemView: itemView,
2099
+ contentIndex: contentIndex,
2100
+ at: Date.now()
2101
+ };
2102
+
2103
+ // become first responder if possible.
2104
+ this.becomeFirstResponder() ;
2105
+
2106
+ // Toggle the selection if selectOnMouseDown is true
2107
+ if (this.get('useToggleSelection')) {
2108
+ if (this.get('selectOnMouseDown')) {
2109
+ if (!itemView) return ; // do nothing when clicked outside of elements
2110
+
2111
+ // determine if item is selected. If so, then go on.
2112
+ sel = this.get('selection') ;
2113
+ isSelected = sel && sel.containsObject(itemView.get('content')) ;
2114
+
2115
+ if (isSelected) {
2116
+ this.deselect(contentIndex) ;
2117
+ } else if (!allowsMultipleSel) {
2118
+ this.select(contentIndex, NO) ;
2119
+ } else {
2120
+ this.select(contentIndex, YES) ;
2121
+ }
2122
+ }
2123
+
2124
+ return YES;
2125
+ }
2126
+
2127
+ // recieved a mouseDown on the collection element, but not on one of the
2128
+ // childItems... unless we do not allow empty selections, set it to empty.
2129
+ if (!itemView) {
2130
+ if (this.get('allowDeselectAll')) this.select(null, false);
2131
+ return YES ;
2132
+ }
2133
+
2134
+ // collection some basic setup info
2135
+ sel = this.get('selection');
2136
+ if (sel) sel = sel.indexSetForSource(content);
2137
+
2138
+ isSelected = sel ? sel.contains(contentIndex) : NO;
2139
+ info.modifierKeyPressed = modifierKeyPressed = ev.ctrlKey || ev.metaKey ;
2140
+
2141
+
2142
+ // holding down a modifier key while clicking a selected item should
2143
+ // deselect that item...deselect and bail.
2144
+ if (modifierKeyPressed && isSelected) {
2145
+ info.shouldDeselect = contentIndex >= 0;
2146
+
2147
+ // if the shiftKey was pressed, then we want to extend the selection
2148
+ // from the last selected item
2149
+ } else if (ev.shiftKey && sel && sel.get('length') > 0 && allowsMultipleSel) {
2150
+ sel = this._findSelectionExtendedByShift(sel, contentIndex);
2151
+ anchor = this._selectionAnchor ;
2152
+ this.select(sel) ;
2153
+ this._selectionAnchor = anchor; //save the anchor
2154
+
2155
+ // If no modifier key was pressed, then clicking on the selected item
2156
+ // should clear the selection and reselect only the clicked on item.
2157
+ } else if (!modifierKeyPressed && isSelected) {
2158
+ info.shouldReselect = contentIndex >= 0;
2159
+
2160
+ // Otherwise, if selecting on mouse down, simply select the clicked on
2161
+ // item, adding it to the current selection if a modifier key was pressed.
2162
+ } else {
2163
+
2164
+ if((ev.shiftKey || modifierKeyPressed) && !allowsMultipleSel){
2165
+ this.select(null, false);
2166
+ }
2167
+
2168
+ if (this.get("selectOnMouseDown")) {
2169
+ this.select(contentIndex, modifierKeyPressed);
2170
+ } else {
2171
+ info.shouldSelect = contentIndex >= 0 ;
2172
+ }
2173
+ }
2174
+
2175
+ // saved for extend by shift ops.
2176
+ info.previousContentIndex = contentIndex;
2177
+
2178
+ return YES;
2179
+ },
2180
+
2181
+ /** @private */
2182
+ mouseUp: function(ev) {
2183
+
2184
+ var view = this.itemViewForEvent(ev),
2185
+ info = this.mouseDownInfo,
2186
+ content = this.get('content'),
2187
+ contentIndex, sel, isSelected, canEdit, itemView, idx,
2188
+ allowsMultipleSel = content.get('allowsMultipleSelection');
2189
+
2190
+ if (this.get('useToggleSelection')) {
2191
+ // Return if clicked outside of elements or if toggle was handled by mouseDown
2192
+ if (!view || this.get('selectOnMouseDown')) return NO;
2193
+
2194
+ // determine if item is selected. If so, then go on.
2195
+ sel = this.get('selection') ;
2196
+ contentIndex = (view) ? view.get('contentIndex') : -1 ;
2197
+ isSelected = sel && sel.containsObject(view.get('content')) ;
2198
+
2199
+ if (isSelected) {
2200
+ this.deselect(contentIndex) ;
2201
+ } else if (!allowsMultipleSel) {
2202
+ this.select(contentIndex, NO) ;
2203
+ } else {
2204
+ this.select(contentIndex, YES) ;
2205
+ }
2206
+
2207
+ } else if(info) {
2208
+ idx = info.contentIndex;
2209
+ contentIndex = (view) ? view.get('contentIndex') : -1 ;
2210
+
2211
+ // this will be set if the user simply clicked on an unselected item and
2212
+ // selectOnMouseDown was NO.
2213
+ if (info.shouldSelect) this.select(idx, info.modifierKeyPressed);
2214
+
2215
+ // This is true if the user clicked on a selected item with a modifier
2216
+ // key pressed.
2217
+ if (info.shouldDeselect) this.deselect(idx);
2218
+
2219
+ // This is true if the user clicked on a selected item without a
2220
+ // modifier-key pressed. When this happens we try to begin editing
2221
+ // on the content. If that is not allowed, then simply clear the
2222
+ // selection and reselect the clicked on item.
2223
+ if (info.shouldReselect) {
2224
+
2225
+ // - contentValueIsEditable is true
2226
+ canEdit = this.get('isEditable') && this.get('canEditContent') ;
2227
+
2228
+ // - the user clicked on an item that was already selected
2229
+ // ^ this is the only way shouldReset is set to YES
2230
+
2231
+ // - is the only item selected
2232
+ if (canEdit) {
2233
+ sel = this.get('selection') ;
2234
+ canEdit = sel && (sel.get('length') === 1);
2235
+ }
2236
+
2237
+ // - the item view responds to contentHitTest() and returns YES.
2238
+ // - the item view responds to beginEditing and returns YES.
2239
+ if (canEdit) {
2240
+ itemView = this.itemViewForContentIndex(idx) ;
2241
+ canEdit = itemView && (!itemView.contentHitTest || itemView.contentHitTest(ev)) ;
2242
+ canEdit = (canEdit && itemView.beginEditing) ? itemView.beginEditing() : NO ;
2243
+ }
2244
+
2245
+ // if cannot edit, schedule a reselect (but give doubleClick a chance)
2246
+ if (!canEdit) {
2247
+ if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate() ;
2248
+ this._cv_reselectTimer = this.invokeLater(this.select, 300, idx, false) ;
2249
+ }
2250
+ }
2251
+
2252
+ this._cleanupMouseDown() ;
2253
+ }
2254
+
2255
+ // handle actions on editing
2256
+ this._cv_performSelectAction(view, ev, 0, ev.clickCount);
2257
+
2258
+ return NO; // bubble event to allow didDoubleClick to be called...
2259
+ },
2260
+
2261
+ /** @private */
2262
+ _cleanupMouseDown: function() {
2263
+
2264
+ // delete items explicitly to avoid leaks on IE
2265
+ var info = this.mouseDownInfo, key;
2266
+ if (info) {
2267
+ for(key in info) {
2268
+ if (!info.hasOwnProperty(key)) continue;
2269
+ delete info[key];
2270
+ }
2271
+ }
2272
+ this.mouseDownInfo = null;
2273
+ },
2274
+
2275
+ /** @private */
2276
+ mouseMoved: function(ev) {
2277
+ var view = this.itemViewForEvent(ev),
2278
+ last = this._lastHoveredItem ;
2279
+
2280
+ // handle hover events.
2281
+ if (view !== last) {
2282
+ if (last && last.mouseExited) last.mouseExited(ev);
2283
+ if (view && view.mouseEntered) view.mouseEntered(ev);
2284
+ }
2285
+ this._lastHoveredItem = view ;
2286
+
2287
+ if (view && view.mouseMoved) view.mouseMoved(ev);
2288
+ return YES;
2289
+ },
2290
+
2291
+ /** @private */
2292
+ mouseExited: function(ev) {
2293
+ var view = this._lastHoveredItem ;
2294
+ this._lastHoveredItem = null ;
2295
+ if (view && view.mouseExited) view.mouseExited(ev) ;
2296
+ return YES ;
2297
+ },
2298
+
2299
+ // ..........................................................
2300
+ // TOUCH EVENTS
2301
+ //
2302
+ touchStart: function(touch, evt) {
2303
+ // become first responder if possible.
2304
+ this.becomeFirstResponder() ;
2305
+
2306
+ if (!this.get('useToggleSelection')) {
2307
+ var itemView = this.itemViewForEvent(touch);
2308
+
2309
+ // We're faking the selection visually here
2310
+ // Only track this if we added a selection so we can remove it later
2311
+ if (itemView && !itemView.get('isSelected')) {
2312
+ itemView.set('isSelected', YES);
2313
+ this._touchSelectedView = itemView;
2314
+ } else {
2315
+ this._touchSelectedView = null;
2316
+ }
2317
+ }
2318
+
2319
+ return YES;
2320
+ },
2321
+
2322
+ touchesDragged: function(evt, touches) {
2323
+ touches.forEach(function(touch){
2324
+ if (
2325
+ Math.abs(touch.pageX - touch.startX) > 5 ||
2326
+ Math.abs(touch.pageY - touch.startY) > 5
2327
+ ) {
2328
+ // This calls touchCancelled
2329
+ touch.makeTouchResponder(touch.nextTouchResponder);
2330
+ }
2331
+ }, this);
2332
+
2333
+ },
2334
+
2335
+ touchEnd: function(touch) {
2336
+ var itemView = this.itemViewForEvent(touch),
2337
+ contentIndex = itemView ? itemView.get('contentIndex') : -1,
2338
+ isSelected = NO;
2339
+
2340
+ // Remove fake selection in case our contentIndex is -1, a select event will add it back
2341
+ if (this._touchSelectedView) { this._touchSelectedView.set('isSelected', NO); }
2342
+
2343
+ if (this.get('useToggleSelection')) {
2344
+ var sel = this.get('selection');
2345
+ isSelected = sel && sel.containsObject(itemView.get('content'));
2346
+ }
2347
+
2348
+ if (isSelected) {
2349
+ this.deselect(contentIndex);
2350
+ } else {
2351
+ this.select(contentIndex, NO);
2352
+
2353
+ // If actOnSelect is implemented, the action will be fired.
2354
+ this._cv_performSelectAction(itemView, touch, 0);
2355
+ }
2356
+ },
2357
+
2358
+ touchCancelled: function(evt) {
2359
+ // Remove fake selection
2360
+ if (this._touchSelectedView) { this._touchSelectedView.set('isSelected', NO); }
2361
+ },
2362
+
2363
+ /** @private */
2364
+ _findSelectionExtendedByShift: function(sel, contentIndex) {
2365
+
2366
+ // fast path. if we don't have a selection, just select index
2367
+ if (!sel || sel.get('length')===0) {
2368
+ return SC.IndexSet.create(contentIndex);
2369
+ }
2370
+
2371
+ // if we do have a selection, then figure out how to extend it.
2372
+ var content = this.get('content'),
2373
+ lim = content.get('length')-1,
2374
+ min = sel.get('min'),
2375
+ max = sel.get('max')-1,
2376
+ info = this.mouseDownInfo,
2377
+ anchor = this._selectionAnchor ;
2378
+ if (SC.none(anchor)) anchor = -1;
2379
+
2380
+ // clicked before the current selection set... extend it's beginning...
2381
+ if (contentIndex < min) {
2382
+ min = contentIndex;
2383
+ if (anchor<0) this._selectionAnchor = anchor = max; //anchor at end
2384
+
2385
+ // clicked after the current selection set... extend it's ending...
2386
+ } else if (contentIndex > max) {
2387
+ max = contentIndex;
2388
+ if (anchor<0) this._selectionAnchor = anchor = min; // anchor at start
2389
+
2390
+ // clicked inside the selection set... need to determine where the last
2391
+ // selection was and use that as an anchor.
2392
+ } else if (contentIndex >= min && contentIndex <= max) {
2393
+ if (anchor<0) this._selectionAnchor = anchor = min; //anchor at start
2394
+
2395
+ if (contentIndex === anchor) min = max = contentIndex ;
2396
+ else if (contentIndex > anchor) {
2397
+ min = anchor;
2398
+ max = contentIndex ;
2399
+ } else if (contentIndex < anchor) {
2400
+ min = contentIndex;
2401
+ max = anchor ;
2402
+ }
2403
+ }
2404
+
2405
+ return SC.IndexSet.create(min, max - min + 1);
2406
+ },
2407
+
2408
+ // ......................................
2409
+ // DRAG AND DROP SUPPORT
2410
+ //
2411
+
2412
+ /**
2413
+ When reordering its content, the collection view will store its reorder
2414
+ data using this special data type. The data type is unique to each
2415
+ collection view instance. You can use this data type to detect reorders
2416
+ if necessary.
2417
+
2418
+ @property
2419
+ @type String
2420
+ */
2421
+ reorderDataType: function() {
2422
+ return 'SC.CollectionView.Reorder.'+SC.guidFor(this) ;
2423
+ }.property().cacheable(),
2424
+
2425
+ /**
2426
+ This property is set to the IndexSet of content objects that are the
2427
+ subject of a drag whenever a drag is initiated on the collection view.
2428
+ You can consult this property when implementing your collection view
2429
+ delegate methods, but otherwise you should not use this property in your
2430
+ code.
2431
+
2432
+ @type SC.IndexSet
2433
+ */
2434
+ dragContent: null,
2435
+
2436
+ /**
2437
+ This property is set to the proposed insertion index during a call to
2438
+ collectionViewValidateDragOperation(). Your delegate implementations can
2439
+ change the value of this property to enforce a drop some in some other
2440
+ location.
2441
+
2442
+ @type Number
2443
+ */
2444
+ proposedInsertionIndex: null,
2445
+
2446
+ /**
2447
+ This property is set to the proposed drop operation during a call to
2448
+ collectionViewValidateDragOperation(). Your delegate implementations can
2449
+ change the value of this property to enforce a different type of drop
2450
+ operation.
2451
+
2452
+ @type Number
2453
+ @property
2454
+ */
2455
+ proposedDropOperation: null,
2456
+
2457
+ /** @private
2458
+ mouseDragged event handler. Initiates a drag if the following conditions
2459
+ are met:
2460
+
2461
+ - collectionViewShouldBeginDrag() returns YES *OR*
2462
+ - the above method is not implemented and canReorderContent is true.
2463
+ - the dragDataTypes property returns a non-empty array
2464
+ - a mouse down event was saved by the mouseDown method.
2465
+ */
2466
+ mouseDragged: function(ev) {
2467
+
2468
+ var del = this.get('selectionDelegate'),
2469
+ content = this.get('content'),
2470
+ sel = this.get('selection'),
2471
+ info = this.mouseDownInfo,
2472
+ groupIndexes = this.get('_contentGroupIndexes'),
2473
+ dragContent, dragDataTypes, dragView;
2474
+
2475
+ // if the mouse down event was cleared, there is nothing to do; return.
2476
+ if (!info || info.contentIndex<0) return YES ;
2477
+
2478
+ // Don't do anything unless the user has been dragging for 123msec
2479
+ if ((Date.now() - info.at) < 123) return YES ;
2480
+
2481
+ // OK, they must be serious, decide if a drag will be allowed.
2482
+ if (del.collectionViewShouldBeginDrag(this)) {
2483
+
2484
+ // First, get the selection to drag. Drag an array of selected
2485
+ // items appearing in this collection, in the order of the
2486
+ // collection.
2487
+ //
2488
+ // Compute the dragContent - the indexes we will be dragging.
2489
+ // if we don't select on mouse down, then the selection has not been
2490
+ // updated to whatever the user clicked. Instead use
2491
+ // mouse down content.
2492
+ if (!this.get("selectOnMouseDown")) {
2493
+ dragContent = SC.IndexSet.create(info.contentIndex);
2494
+ } else dragContent = sel ? sel.indexSetForSource(content) : null;
2495
+
2496
+ // remove any group indexes. groups cannot be dragged.
2497
+ if (dragContent && groupIndexes && groupIndexes.get('length')>0) {
2498
+ dragContent = dragContent.copy().remove(groupIndexes);
2499
+ if (dragContent.get('length')===0) dragContent = null;
2500
+ else dragContent.freeze();
2501
+ }
2502
+
2503
+ if (!dragContent) return YES; // nothing to drag
2504
+ else dragContent = dragContent.frozenCopy(); // so it doesn't change
2505
+
2506
+ dragContent = { content: content, indexes: dragContent };
2507
+ this.set('dragContent', dragContent) ;
2508
+
2509
+ // Get the set of data types supported by the delegate. If this returns
2510
+ // a null or empty array and reordering content is not also supported
2511
+ // then do not start the drag.
2512
+ dragDataTypes = this.get('dragDataTypes');
2513
+ if (dragDataTypes && dragDataTypes.get('length') > 0) {
2514
+
2515
+ // Build the drag view to use for the ghost drag. This
2516
+ // should essentially contain any visible drag items.
2517
+ dragView = del.collectionViewDragViewFor(this, dragContent.indexes);
2518
+ if (!dragView) dragView = this._cv_dragViewFor(dragContent.indexes);
2519
+
2520
+ // Make sure the dragView has created its layer.
2521
+ dragView.createLayer();
2522
+
2523
+ // Initiate the drag
2524
+ SC.Drag.start({
2525
+ event: info.event,
2526
+ source: this,
2527
+ dragView: dragView,
2528
+ ghost: NO,
2529
+ ghostActsLikeCursor: del.ghostActsLikeCursor,
2530
+ slideBack: YES,
2531
+ dataSource: this
2532
+ });
2533
+
2534
+ // Also use this opportunity to clean up since mouseUp won't
2535
+ // get called.
2536
+ this._cleanupMouseDown() ;
2537
+ this._lastInsertionIndex = null ;
2538
+
2539
+ // Drag was not allowed by the delegate, so bail.
2540
+ } else this.set('dragContent', null) ;
2541
+
2542
+ return YES ;
2543
+ }
2544
+ },
2545
+
2546
+ /** @private
2547
+ Compute a default drag view by grabbing the raw layers and inserting them
2548
+ into a drag view.
2549
+ */
2550
+ _cv_dragViewFor: function(dragContent) {
2551
+ // find only the indexes that are in both dragContent and nowShowing.
2552
+ var indexes = this.get('nowShowing').without(dragContent),
2553
+ dragLayer = this.get('layer').cloneNode(false),
2554
+ view = SC.View.create({ layer: dragLayer, parentView: this }),
2555
+ height=0, layout;
2556
+
2557
+ indexes = this.get('nowShowing').without(indexes);
2558
+
2559
+ // cleanup weird stuff that might make the drag look out of place
2560
+ SC.$(dragLayer).css('backgroundColor', 'transparent')
2561
+ .css('border', 'none')
2562
+ .css('top', 0).css('left', 0);
2563
+
2564
+ indexes.forEach(function(i) {
2565
+ var itemView = this.itemViewForContentIndex(i),
2566
+ isSelected, layer;
2567
+
2568
+ // render item view without isSelected state.
2569
+ if (itemView) {
2570
+ isSelected = itemView.get('isSelected');
2571
+ itemView.set('isSelected', NO);
2572
+
2573
+ itemView.updateLayerIfNeeded();
2574
+ layer = itemView.get('layer');
2575
+ if (layer) layer = layer.cloneNode(true);
2576
+
2577
+ itemView.set('isSelected', isSelected);
2578
+ itemView.updateLayerIfNeeded();
2579
+ }
2580
+
2581
+ if (layer) {
2582
+ dragLayer.appendChild(layer);
2583
+ layout = itemView.get('layout');
2584
+ if(layout.height+layout.top>height){
2585
+ height = layout.height+layout.top;
2586
+ }
2587
+ }
2588
+ layer = null;
2589
+
2590
+ }, this);
2591
+ // we don't want to show the scrollbars, resize the dragview'
2592
+ view.set('layout', {height:height});
2593
+
2594
+ dragLayer = null;
2595
+ return view ;
2596
+ },
2597
+
2598
+
2599
+ /**
2600
+ Implements the drag data source protocol for the collection view. This
2601
+ property will consult the collection view delegate if one is provided. It
2602
+ will also do the right thing if you have set canReorderContent to YES.
2603
+
2604
+ @property
2605
+ @type Array
2606
+ */
2607
+ dragDataTypes: function() {
2608
+ // consult delegate.
2609
+ var del = this.get('selectionDelegate'),
2610
+ ret = del.collectionViewDragDataTypes(this),
2611
+ key ;
2612
+
2613
+ if (this.get('canReorderContent')) {
2614
+ ret = ret ? ret.copy() : [];
2615
+ key = this.get('reorderDataType');
2616
+ if (ret.indexOf(key) < 0) ret.push(key);
2617
+ }
2618
+
2619
+ return ret ? ret : [];
2620
+ }.property(),
2621
+
2622
+ /**
2623
+ Implements the drag data source protocol method. The implementation of
2624
+ this method will consult the collection view delegate if one has been
2625
+ provided. It also respects the canReoderContent method.
2626
+ */
2627
+ dragDataForType: function(drag, dataType) {
2628
+
2629
+ // if this is a reorder, then return drag content.
2630
+ if (this.get('canReorderContent')) {
2631
+ if (dataType === this.get('reorderDataType')) {
2632
+ return this.get('dragContent') ;
2633
+ }
2634
+ }
2635
+
2636
+ // otherwise, just pass along to the delegate
2637
+ var del = this.get('selectionDelegate');
2638
+ return del.collectionViewDragDataForType(this, drag, dataType);
2639
+ },
2640
+
2641
+ /**
2642
+ Implements the SC.DropTarget interface. The default implementation will
2643
+ consult the collection view delegate, if you implement those methods.
2644
+
2645
+ This method is called once when the drag enters the view area. It's
2646
+ return value will be stored on the drag object as allowedDragOperations,
2647
+ possibly further constrained by the drag source.
2648
+
2649
+ @param {SC.Drag} drag the drag object
2650
+ @param {SC.Event} evt the event triggering this change, if available
2651
+ @returns {Number} logical OR'd mask of allowed drag operations.
2652
+ */
2653
+ computeDragOperations: function(drag, evt) {
2654
+
2655
+ // the proposed drag operation is DRAG_REORDER only if we can reorder
2656
+ // content and the drag contains reorder content.
2657
+ var op = SC.DRAG_NONE,
2658
+ del = this.get('selectionDelegate');
2659
+
2660
+ if (this.get('canReorderContent')) {
2661
+ if (drag.get('dataTypes').indexOf(this.get('reorderDataType')) >= 0) {
2662
+ op = SC.DRAG_REORDER ;
2663
+ }
2664
+ }
2665
+
2666
+ // Now pass this onto the delegate.
2667
+ op = del.collectionViewComputeDragOperations(this, drag, op);
2668
+ if (op & SC.DRAG_REORDER) op = SC.DRAG_MOVE ;
2669
+
2670
+ return op ;
2671
+ },
2672
+
2673
+ /** @private
2674
+ Determines the allowed drop operation insertion point, operation type,
2675
+ and the drag operation to be performed. Used by dragUpdated() and
2676
+ performDragOperation().
2677
+
2678
+ @param {SC.Drag} drag the drag object
2679
+ @param {SC.Event} evt source of this request, if available
2680
+ @param {Number} dragOp allowed drag operation mask
2681
+ Returns three params: [drop index, drop operation, allowed drag ops]
2682
+ */
2683
+ _computeDropOperationState: function(drag, evt, dragOp) {
2684
+
2685
+ // get the insertion index for this location. This can be computed
2686
+ // by a subclass using whatever method. This method is not expected to
2687
+ // do any data valdidation, just to map the location to an insertion
2688
+ // index.
2689
+ var loc = this.convertFrameFromView(drag.get('location'), null),
2690
+ dropOp = SC.DROP_BEFORE,
2691
+ del = this.get('selectionDelegate'),
2692
+ canReorder = this.get('canReorderContent'),
2693
+ objects, content, isPreviousInDrag, isNextInDrag, len, tmp;
2694
+
2695
+ // STEP 1: Try with a DROP_ON option -- send straight to delegate if
2696
+ // supported by view.
2697
+
2698
+ // get the computed insertion index and possibly drop operation.
2699
+ // prefer to drop ON.
2700
+ var idx = this.insertionIndexForLocation(loc, SC.DROP_ON) ;
2701
+ if (SC.typeOf(idx) === SC.T_ARRAY) {
2702
+ dropOp = idx[1] ; // order matters here
2703
+ idx = idx[0] ;
2704
+ }
2705
+
2706
+ // if the return drop operation is DROP_ON, then just check it with the
2707
+ // delegate method. If the delegate method does not support dropping on,
2708
+ // then it will return DRAG_NONE, in which case we will try again with
2709
+ // drop before.
2710
+ if (dropOp === SC.DROP_ON) {
2711
+
2712
+ // Now save the insertion index and the dropOp. This may be changed by
2713
+ // the collection delegate.
2714
+ this.set('proposedInsertionIndex', idx) ;
2715
+ this.set('proposedDropOperation', dropOp) ;
2716
+ tmp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp) ;
2717
+ idx = this.get('proposedInsertionIndex') ;
2718
+ dropOp = this.get('proposedDropOperation') ;
2719
+ this._dropInsertionIndex = this._dropOperation = null ;
2720
+
2721
+ // The delegate is OK with a drop on also, so just return.
2722
+ if (tmp !== SC.DRAG_NONE) return [idx, dropOp, tmp] ;
2723
+
2724
+ // The delegate is NOT OK with a drop on, try to get the insertion
2725
+ // index again, but this time prefer SC.DROP_BEFORE, then let the
2726
+ // rest of the method run...
2727
+ else {
2728
+ dropOp = SC.DROP_BEFORE ;
2729
+ idx = this.insertionIndexForLocation(loc, SC.DROP_BEFORE) ;
2730
+ if (SC.typeOf(idx) === SC.T_ARRAY) {
2731
+ dropOp = idx[1] ; // order matters here
2732
+ idx = idx[0] ;
2733
+ }
2734
+ }
2735
+ }
2736
+
2737
+ // if this is a reorder drag, set the proposed op to SC.DRAG_REORDER and
2738
+ // validate the insertion point. This only works if the insertion point
2739
+ // is DROP_BEFORE or DROP_AFTER. DROP_ON is not handled by reordering
2740
+ // content.
2741
+ if ((idx >= 0) && canReorder && (dropOp !== SC.DROP_ON)) {
2742
+
2743
+ objects = drag.dataForType(this.get('reorderDataType')) ;
2744
+ if (objects) {
2745
+ content = this.get('content') ;
2746
+
2747
+ // if the insertion index is in between two items in the drag itself,
2748
+ // then this is not allowed. Either use the last insertion index or
2749
+ // find the first index that is not in between selections. Stop when
2750
+ // we get to the beginning.
2751
+ if (dropOp === SC.DROP_BEFORE) {
2752
+ isPreviousInDrag = objects.indexes.contains(idx-1);
2753
+ isNextInDrag = objects.indexes.contains(idx);
2754
+ } else {
2755
+ isPreviousInDrag = objects.indexes.contains(idx);
2756
+ isNextInDrag = objects.indexes.contains(idx-1);
2757
+ }
2758
+
2759
+ if (isPreviousInDrag && isNextInDrag) {
2760
+ if (SC.none(this._lastInsertionIndex)) {
2761
+ if (dropOp === SC.DROP_BEFORE) {
2762
+ while ((idx >= 0) && objects.indexes.contains(idx)) idx--;
2763
+ } else {
2764
+ len = content ? content.get('length') : 0;
2765
+ while ((idx < len) && objects.indexes.contains(idx)) idx++;
2766
+ }
2767
+ } else idx = this._lastInsertionIndex ;
2768
+ }
2769
+
2770
+ // If we found a valid insertion point to reorder at, then set the op
2771
+ // to custom DRAG_REORDER.
2772
+ if (idx >= 0) dragOp = SC.DRAG_REORDER ;
2773
+ }
2774
+ }
2775
+
2776
+ // Now save the insertion index and the dropOp. This may be changed by
2777
+ // the collection delegate.
2778
+ this.set('proposedInsertionIndex', idx) ;
2779
+ this.set('proposedDropOperation', dropOp) ;
2780
+ dragOp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp) ;
2781
+ idx = this.get('proposedInsertionIndex') ;
2782
+ dropOp = this.get('proposedDropOperation') ;
2783
+ this._dropInsertionIndex = this._dropOperation = null ;
2784
+
2785
+ // return generated state
2786
+ return [idx, dropOp, dragOp] ;
2787
+ },
2788
+
2789
+ /**
2790
+ Implements the SC.DropTarget interface. The default implementation will
2791
+ determine the drop location and then consult the collection view delegate
2792
+ if you implement those methods. Otherwise it will handle reordering
2793
+ content on its own.
2794
+ */
2795
+ dragUpdated: function(drag, evt) {
2796
+
2797
+ var op = drag.get('allowedDragOperations'),
2798
+ state = this._computeDropOperationState(drag, evt, op),
2799
+ idx = state[0], dropOp = state[1], dragOp = state[2];
2800
+
2801
+ // if the insertion index or dropOp have changed, update the insertion
2802
+ // point
2803
+ if (dragOp !== SC.DRAG_NONE) {
2804
+ if ((this._lastInsertionIndex !== idx) || (this._lastDropOperation !== dropOp)) {
2805
+ var itemView = this.itemViewForContentIndex(idx) ;
2806
+ this.showInsertionPoint(itemView, dropOp) ;
2807
+ }
2808
+
2809
+ this._lastInsertionIndex = idx ;
2810
+ this._lastDropOperation = dropOp ;
2811
+ } else {
2812
+ this.hideInsertionPoint() ;
2813
+ this._lastInsertionIndex = this._lastDropOperation = null ;
2814
+ }
2815
+
2816
+ // Normalize drag operation to the standard kinds accepted by the drag
2817
+ // system.
2818
+ return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp;
2819
+ },
2820
+
2821
+ /**
2822
+ Implements the SC.DropTarget protocol. Hides any visible insertion
2823
+ point and clears some cached values.
2824
+ */
2825
+ dragExited: function() {
2826
+ this.hideInsertionPoint() ;
2827
+ this._lastInsertionIndex = this._lastDropOperation = null ;
2828
+ },
2829
+
2830
+ /**
2831
+ Implements the SC.DropTarget protocol.
2832
+ */
2833
+ acceptDragOperation: function(drag, op) { return YES; },
2834
+
2835
+ /**
2836
+ Implements the SC.DropTarget protocol. Consults the collection view
2837
+ delegate to actually perform the operation unless the operation is
2838
+ reordering content.
2839
+ */
2840
+ performDragOperation: function(drag, op) {
2841
+
2842
+ // Get the correct insertion point, drop operation, etc.
2843
+ var state = this._computeDropOperationState(drag, null, op),
2844
+ idx = state[0], dropOp = state[1], dragOp = state[2],
2845
+ del = this.get('selectionDelegate'),
2846
+ performed, objects, data, content, shift, indexes;
2847
+
2848
+ // The dragOp is the kinds of ops allowed. The drag operation must
2849
+ // be included in that set.
2850
+ if (dragOp & SC.DRAG_REORDER) {
2851
+ op = (op & SC.DRAG_MOVE) ? SC.DRAG_REORDER : SC.DRAG_NONE ;
2852
+ } else op = op & dragOp ;
2853
+
2854
+ // If no allowed drag operation could be found, just return.
2855
+ if (op === SC.DRAG_NONE) return op;
2856
+
2857
+ // Some operation is allowed through, give the delegate a chance to
2858
+ // handle it.
2859
+ performed = del.collectionViewPerformDragOperation(this, drag, op, idx, dropOp) ;
2860
+
2861
+ // If the delegate did not handle the drag (i.e. returned SC.DRAG_NONE),
2862
+ // and the op type is REORDER, then do the reorder here.
2863
+ if ((performed === SC.DRAG_NONE) && (op & SC.DRAG_REORDER)) {
2864
+
2865
+ data = drag.dataForType(this.get('reorderDataType')) ;
2866
+ if (!data) return SC.DRAG_NONE ;
2867
+
2868
+ content = this.get('content') ;
2869
+
2870
+ // check for special case - inserting BEFORE ourself...
2871
+ // in this case just pretend the move happened since it's a no-op
2872
+ // anyway
2873
+ indexes = data.indexes;
2874
+ if (indexes.get('length')===1) {
2875
+ if (((dropOp === SC.DROP_BEFORE) || (dropOp === SC.DROP_AFTER)) &&
2876
+ (indexes.get('min')===idx)) return SC.DRAG_MOVE;
2877
+ }
2878
+
2879
+ content.beginPropertyChanges(); // suspend notifications
2880
+
2881
+ // get each object, then remove it from the content. they will be
2882
+ // added again later.
2883
+ objects = [];
2884
+ shift = 0;
2885
+ data.indexes.forEach(function(i) {
2886
+ objects.push(content.objectAt(i-shift));
2887
+ content.removeAt(i-shift);
2888
+ shift++;
2889
+ if (i < idx) idx--;
2890
+ }, this);
2891
+
2892
+ // now insert objects into new insertion locaiton
2893
+ if (dropOp === SC.DROP_AFTER) idx++;
2894
+ content.replace(idx, 0, objects, dropOp);
2895
+ this.select(SC.IndexSet.create(idx, objects.length));
2896
+ content.endPropertyChanges(); // restart notifications
2897
+
2898
+ // make the op into its actual value
2899
+ op = SC.DRAG_MOVE ;
2900
+ }
2901
+
2902
+ return op;
2903
+ },
2904
+
2905
+ /**
2906
+ Default delegate method implementation, returns YES if canReorderContent
2907
+ is also true.
2908
+ */
2909
+ collectionViewShouldBeginDrag: function(view) {
2910
+ return this.get('canReorderContent') ;
2911
+ },
2912
+
2913
+
2914
+ // ..........................................................
2915
+ // INSERTION POINT
2916
+ //
2917
+
2918
+
2919
+ /**
2920
+ Get the preferred insertion point for the given location, including
2921
+ an insertion preference of before, after or on the named index.
2922
+
2923
+ You can implement this method in a subclass if you like to perform a
2924
+ more efficient check. The default implementation will loop through the
2925
+ item views looking for the first view to "switch sides" in the orientation
2926
+ you specify.
2927
+
2928
+ This method should return an array with two values. The first value is
2929
+ the insertion point index and the second value is the drop operation,
2930
+ which should be one of SC.DROP_BEFORE, SC.DROP_AFTER, or SC.DROP_ON.
2931
+
2932
+ The preferred drop operation passed in should be used as a hint as to
2933
+ the type of operation the view would prefer to receive. If the
2934
+ dropOperation is SC.DROP_ON, then you should return a DROP_ON mode if
2935
+ possible. Otherwise, you should never return DROP_ON.
2936
+
2937
+ For compatibility, you can also return just the insertion index. If you
2938
+ do this, then the collction view will assume the drop operation is
2939
+ SC.DROP_BEFORE.
2940
+
2941
+ If an insertion is NOT allowed, you should return -1 as the insertion
2942
+ point. In this case, the drop operation will be ignored.
2943
+
2944
+ @param loc {Point} the mouse location.
2945
+ @param dropOperation {DropOp} the preferred drop operation.
2946
+ @returns {Array} [proposed drop index, drop operation]
2947
+ */
2948
+ insertionIndexForLocation: function(loc, dropOperation) {
2949
+ return -1;
2950
+ },
2951
+
2952
+ // ..........................................................
2953
+ // INTERNAL SUPPORT
2954
+ //
2955
+
2956
+ /** @private - when we become visible, reload if needed. */
2957
+ _cv_isVisibleInWindowDidChange: function() {
2958
+ if (this.get('isVisibleInWindow')) {
2959
+ if (this._invalidIndexes) this.invokeOnce(this.reloadIfNeeded);
2960
+ if (this._invalidSelection) {
2961
+ this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
2962
+ }
2963
+ }
2964
+ }.observes('isVisibleInWindow'),
2965
+
2966
+
2967
+ /**
2968
+ Default delegate method implementation, returns YES if isSelectable
2969
+ is also true.
2970
+ */
2971
+ collectionViewShouldSelectItem: function(view, item) {
2972
+ return this.get('isSelectable') ;
2973
+ },
2974
+
2975
+ _TMP_DIFF1: SC.IndexSet.create(),
2976
+ _TMP_DIFF2: SC.IndexSet.create(),
2977
+
2978
+ /** @private
2979
+
2980
+ Whenever the nowShowing range changes, update the range observer on the
2981
+ content item and instruct the view to reload any indexes that are not in
2982
+ the previous nowShowing range.
2983
+
2984
+ */
2985
+ _cv_nowShowingDidChange: function() {
2986
+ var nowShowing = this.get('nowShowing'),
2987
+ last = this._sccv_lastNowShowing,
2988
+ diff, diff1, diff2;
2989
+
2990
+ // find the differences between the two
2991
+ // NOTE: reuse a TMP IndexSet object to avoid creating lots of objects
2992
+ // during scrolling
2993
+ if (last !== nowShowing) {
2994
+ if (last && nowShowing) {
2995
+ diff1 = this._TMP_DIFF1.add(last).remove(nowShowing);
2996
+ diff2 = this._TMP_DIFF2.add(nowShowing).remove(last);
2997
+ diff = diff1.add(diff2);
2998
+ } else diff = last || nowShowing ;
2999
+ }
3000
+
3001
+ // if nowShowing has actually changed, then update
3002
+ if (diff && diff.get('length') > 0) {
3003
+ this._sccv_lastNowShowing = nowShowing ? nowShowing.frozenCopy() : null;
3004
+ this.updateContentRangeObserver();
3005
+ this.reload(diff);
3006
+ }
3007
+
3008
+ // cleanup tmp objects
3009
+ if (diff1) diff1.clear();
3010
+ if (diff2) diff2.clear();
3011
+
3012
+ }.observes('nowShowing'),
3013
+
3014
+ init: function() {
3015
+ sc_super();
3016
+ if (this.useFastPath) this.mixin(SC.CollectionFastPath);
3017
+ if (this.get('canReorderContent')) this._cv_canReorderContentDidChange();
3018
+ this._sccv_lastNowShowing = this.get('nowShowing').clone();
3019
+ if (this.content) this._cv_contentDidChange();
3020
+ if (this.selection) this._cv_selectionDidChange();
3021
+ },
3022
+
3023
+ /** @private
3024
+ Become a drop target whenever reordering content is enabled.
3025
+ */
3026
+ _cv_canReorderContentDidChange: function() {
3027
+ if (this.get('canReorderContent')) {
3028
+ if (!this.get('isDropTarget')) this.set('isDropTarget', YES);
3029
+ SC.Drag.addDropTarget(this);
3030
+ }
3031
+ }.observes('canReorderContent'),
3032
+
3033
+ /** @private
3034
+ Fires an action after a selection if enabled.
3035
+
3036
+ if actOnSelect is YES, then try to invoke the action, passing the
3037
+ current selection (saved as a separate array so that a change in sel
3038
+ in the meantime will not be lost)
3039
+ */
3040
+ _cv_performSelectAction: function(view, ev, delay, clickCount) {
3041
+ var sel;
3042
+ if (delay === undefined) delay = 0 ;
3043
+ if (clickCount === undefined) clickCount = 1;
3044
+ if ((clickCount>1) || this.get('actOnSelect')) {
3045
+ if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate() ;
3046
+ sel = this.get('selection');
3047
+ sel = sel ? sel.toArray() : [];
3048
+ if (this._cv_actionTimer) this._cv_actionTimer.invalidate();
3049
+ this._cv_actionTimer = this.invokeLater(this._cv_action, delay, view, ev, sel) ;
3050
+ }
3051
+ },
3052
+
3053
+ /** @private
3054
+ Perform the action. Supports legacy behavior as well as newer style
3055
+ action dispatch.
3056
+ */
3057
+ _cv_action: function(view, evt, context) {
3058
+ var action = this.get('action');
3059
+ var target = this.get('target') || null;
3060
+
3061
+ this._cv_actionTimer = null;
3062
+ if (action) {
3063
+ // if the action is a function, just call it
3064
+ if (SC.typeOf(action) === SC.T_FUNCTION) return this.action(view, evt) ;
3065
+
3066
+ // otherwise, use the new sendAction style
3067
+ var pane = this.get('pane') ;
3068
+ if (pane) {
3069
+ pane.rootResponder.sendAction(action, target, this, pane, context);
3070
+ }
3071
+ // SC.app.sendAction(action, target, this) ;
3072
+
3073
+ // if no action is specified, then trigger the support action,
3074
+ // if supported.
3075
+ } else if (!view) {
3076
+ return ; // nothing to do
3077
+
3078
+ // if the target view has its own internal action handler,
3079
+ // trigger that.
3080
+ } else if (SC.typeOf(view._action) == SC.T_FUNCTION) {
3081
+ return view._action(evt) ;
3082
+
3083
+ // otherwise call the action method to support older styles.
3084
+ } else if (SC.typeOf(view.action) == SC.T_FUNCTION) {
3085
+ return view.action(evt) ;
3086
+ }
3087
+ }
3088
+
3089
+
3090
+ });