sproutcore 1.6.0.1-java → 1.7.1.beta-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. data/CHANGELOG +21 -0
  2. data/Gemfile +5 -0
  3. data/Rakefile +26 -13
  4. data/VERSION.yml +2 -2
  5. data/lib/Buildfile +43 -4
  6. data/lib/buildtasks/build.rake +10 -0
  7. data/lib/buildtasks/helpers/file_rule.rb +22 -0
  8. data/lib/buildtasks/helpers/file_rule_list.rb +137 -0
  9. data/lib/buildtasks/manifest.rake +133 -122
  10. data/lib/frameworks/sproutcore/CHANGELOG.md +69 -2
  11. data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +1 -0
  12. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -22
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +9 -5
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +1 -1
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +18 -13
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +5 -3
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +2 -0
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +80 -0
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +84 -116
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +8 -5
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +157 -157
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +5 -3
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +6 -6
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +10 -7
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +106 -0
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +18 -0
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +71 -1
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/attribute_bindings_test.js +38 -0
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +47 -0
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +18 -18
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +42 -10
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +158 -1
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +26 -1
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +14 -8
  35. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +15 -2
  36. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +108 -108
  37. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1 -1
  38. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +2 -4
  39. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +2 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +26 -0
  41. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +7 -0
  42. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +1 -1
  43. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +4 -1
  44. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +6 -0
  45. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +26 -5
  46. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +97 -96
  47. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +4 -3
  48. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +17 -4
  49. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +7 -7
  50. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +7 -5
  51. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +12 -3
  52. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +23 -14
  53. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +5 -1
  54. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +28 -0
  55. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +235 -0
  56. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +363 -0
  57. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +250 -0
  58. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +92 -0
  59. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +25 -0
  60. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +33 -0
  61. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +76 -0
  62. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +50 -0
  63. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +143 -0
  64. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +258 -0
  65. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +1164 -0
  66. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +332 -0
  67. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +236 -0
  68. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +347 -0
  69. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +15 -0
  70. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +10 -0
  71. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +804 -0
  72. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +133 -0
  73. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +3 -3
  74. data/lib/frameworks/sproutcore/frameworks/foundation/validators/number.js +3 -1
  75. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +3 -3
  76. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +2 -1
  77. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +2 -1
  78. data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +2 -4
  79. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +2 -4
  80. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +2 -4
  81. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +2 -2
  82. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +29 -3
  83. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  84. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +1 -1
  85. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -1
  86. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +3 -3
  87. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +2 -2
  88. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +1 -1
  89. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
  90. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/segmented.css +1 -1
  91. data/lib/gen/app/templates/apps/@target_name@/Buildfile +3 -5
  92. data/lib/gen/app/templates/apps/@target_name@/resources/_theme.css +18 -0
  93. data/lib/gen/project/templates/@filename@/Buildfile +2 -2
  94. data/lib/sproutcore.rb +30 -5
  95. data/lib/sproutcore/builders.rb +1 -0
  96. data/lib/sproutcore/builders/chance_file.rb +9 -16
  97. data/lib/sproutcore/builders/html.rb +2 -1
  98. data/lib/sproutcore/builders/minify.rb +4 -35
  99. data/lib/sproutcore/builders/module.rb +38 -1
  100. data/lib/sproutcore/builders/split.rb +63 -0
  101. data/lib/sproutcore/builders/strings.rb +7 -1
  102. data/lib/sproutcore/helpers.rb +1 -1
  103. data/lib/sproutcore/helpers/css_split.rb +190 -0
  104. data/lib/sproutcore/helpers/entry_sorter.rb +2 -0
  105. data/lib/sproutcore/helpers/minifier.rb +40 -16
  106. data/lib/sproutcore/helpers/static_helper.rb +35 -17
  107. data/lib/sproutcore/models/manifest.rb +26 -0
  108. data/lib/sproutcore/models/target.rb +12 -1
  109. data/lib/sproutcore/rack.rb +1 -0
  110. data/lib/sproutcore/rack/proxy.rb +244 -225
  111. data/lib/sproutcore/rack/restrict_ip.rb +67 -0
  112. data/lib/sproutcore/rack/service.rb +8 -2
  113. data/lib/sproutcore/tools.rb +102 -46
  114. data/lib/sproutcore/tools/build.rb +91 -43
  115. data/lib/sproutcore/tools/gen.rb +2 -3
  116. data/lib/sproutcore/tools/manifest.rb +22 -16
  117. data/lib/sproutcore/tools/server.rb +21 -0
  118. data/spec/buildtasks/helpers/accept_list +22 -0
  119. data/spec/buildtasks/helpers/accept_list.rb +128 -0
  120. data/spec/buildtasks/helpers/list.json +11 -0
  121. data/spec/buildtasks/manifest/prepare_build_tasks/chance_2x_spec.rb +1 -39
  122. data/spec/buildtasks/manifest/prepare_build_tasks/chance_spec.rb +0 -38
  123. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +4 -4
  124. data/spec/buildtasks/manifest/prepare_build_tasks/module_spec.rb +2 -2
  125. data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_indirect_spec.rb +7 -16
  126. data/spec/buildtasks/manifest/prepare_build_tasks/packed_2x_spec.rb +7 -17
  127. data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +11 -6
  128. data/spec/fixtures/builder_tests/Buildfile +2 -1
  129. data/spec/fixtures/builder_tests/apps/module_test/modules/required_module/core.js +0 -0
  130. data/spec/lib/builders/module_spec.rb +1 -1
  131. data/spec/spec_helper.rb +1 -0
  132. data/sproutcore.gemspec +4 -9
  133. data/vendor/chance/lib/chance.rb +25 -6
  134. data/vendor/chance/lib/chance/factory.rb +45 -0
  135. data/vendor/chance/lib/chance/instance.rb +173 -28
  136. data/vendor/chance/lib/chance/instance/data_url.rb +0 -29
  137. data/vendor/chance/lib/chance/instance/slicing.rb +57 -4
  138. data/vendor/chance/lib/chance/instance/spriting.rb +112 -21
  139. data/vendor/chance/lib/chance/parser.rb +80 -52
  140. data/vendor/sproutcore/SCCompiler.jar +0 -0
  141. data/vendor/sproutcore/lib/args4j-2.0.12.jar +0 -0
  142. data/vendor/sproutcore/lib/yuicompressor-2.4.2.jar +0 -0
  143. metadata +84 -25
@@ -6,6 +6,8 @@
6
6
  # Tasks invoked while building Manifest objects. You can override these
7
7
  # tasks in your buildfiles.
8
8
 
9
+ require File.dirname(__FILE__) + '/helpers/file_rule_list'
10
+
9
11
  namespace :manifest do
10
12
 
11
13
  desc "Invoked just before a manifest object is built to setup standard properties"
@@ -52,47 +54,21 @@ namespace :manifest do
52
54
 
53
55
  source_root = target[:source_root]
54
56
 
55
- whitelist = nil
56
-
57
- # Find and parse the BuildWhitelist json file
58
- # Right now, the build whitelist is read for every target, can we optimize this?
59
- Dir.glob("#{Dir.pwd}/Whitelist").each do |path|
60
- next unless File.file?(path)
61
-
62
- contents = File.read(path)
63
- parser = JSON.parser.new(contents)
64
- whitelist = parser.parse
57
+ file_rule_list = SproutCore::FileRuleList.new
58
+
59
+ Dir.glob("#{Dir.pwd}/#{SC.env[:whitelist_name]}").each do |path|
60
+ file_rule_list.read_json(path, :allow) if File.file? path
65
61
  end
66
-
67
- if whitelist
68
- acceptableFilesForTarget = whitelist["#{target[:target_name]}"]
69
-
70
- # Always accept these files
71
- defaultAcceptableFiles = [
72
- '.manifest',
73
- '.htm',
74
- '.html',
75
- '.rhtml',
76
- '.png',
77
- '.jpg',
78
- '.jpeg',
79
- '.gif'
80
- ]
81
-
82
- if acceptableFilesForTarget.kind_of?(Array)
83
- acceptableFilesForTarget += defaultAcceptableFiles
84
-
85
- # I make an assumption that if the type of acceptableFilesForTarget is String,
86
- # then the user wants to match that across any file, so make it an array to accomodate
87
- elsif acceptableFilesForTarget.kind_of?(String)
88
- acceptableFilesForTarget = [acceptableFilesForTarget] + defaultAcceptableFiles
89
-
90
- else
91
- #WhiteList isn't defined, don't include anything
92
- acceptableFilesForTarget = defaultAcceptableFiles
62
+
63
+ Dir.glob("#{Dir.pwd}/#{SC.env[:blacklist_name]}").each do |path|
64
+ if File.file? path
65
+ file_rule_list.allow_by_default = true
66
+ file_rule_list.read_json(path, :deny)
93
67
  end
94
- else
95
- acceptableFilesForTarget = [".*"]
68
+ end
69
+
70
+ Dir.glob("#{Dir.pwd}/#{SC.env[:accept_name]}").each do |path|
71
+ file_rule_list.read(path) if File.file? path
96
72
  end
97
73
 
98
74
  number_rejected_entries = 0
@@ -100,18 +76,8 @@ namespace :manifest do
100
76
  Dir.glob("#{source_root}/**/*").each do |path|
101
77
  next unless File.file?(path)
102
78
  next if target.target_directory?(path)
103
-
104
- valid = false
105
-
106
- acceptableFilesForTarget.each do |acceptableFile|
107
- if path =~ Regexp.new(acceptableFile) then
108
- valid = true
109
- break
110
- end
111
- end
112
-
113
- if valid
114
- # cut source root out to make filename. make sure path separators are /
79
+
80
+ if file_rule_list.include?(target[:target_name], path)
115
81
  filename = path.sub /^#{Regexp.escape source_root}\//, ''
116
82
  filename = filename.split(::File::SEPARATOR).join('/')
117
83
  manifest.add_entry filename, :original => true # entry:prepare will fill in the rest
@@ -214,7 +180,7 @@ namespace :manifest do
214
180
  namespace :prepare_build_tasks do
215
181
 
216
182
  desc "main entrypoint for preparing all build tasks. This should invoke all needed tasks"
217
- task :all => %w(css handlebars javascript module_info sass less combine string_wrap minify string_wrap html strings tests packed)
183
+ task :all => %w(css handlebars javascript module_info sass less combine string_wrap minify string_wrap html strings tests packed split)
218
184
 
219
185
  desc "executes prerequisites needed before one of the subtasks can be invoked. All subtasks that have this as a prereq"
220
186
  task :setup => %w(manifest:catalog manifest:hide_buildfiles manifest:localize)
@@ -275,6 +241,7 @@ namespace :manifest do
275
241
  desc "scans for javascript files, annotates them and prepares combined entries for each output target"
276
242
  task :javascript => :setup do |task, env|
277
243
  manifest = env[:manifest]
244
+ target = env[:target]
278
245
  config = CONFIG
279
246
 
280
247
  # select all original entries with with ext of css
@@ -293,6 +260,7 @@ namespace :manifest do
293
260
  :build_task => 'build:javascript',
294
261
  :resource => 'javascript',
295
262
  :entry_type => :javascript
263
+
296
264
  entry.discover_build_directives!
297
265
  end
298
266
  end
@@ -426,9 +394,10 @@ namespace :manifest do
426
394
  task :chance => %w(setup images javascript module_info css sass less) do |task, env|
427
395
  config = CONFIG
428
396
  manifest = env[:manifest]
397
+ target = manifest.target
429
398
 
430
399
  sprited = CONFIG[:use_sprites]
431
- minify = CONFIG[:minify_css]
400
+ minify = !SC.env[:dont_minify] && (CONFIG[:minify_css].nil? ? CONFIG[:minify] : CONFIG[:minify_css])
432
401
 
433
402
  # the image files will be shared between all css_entries-- that is,
434
403
  # all instances of Chance created
@@ -458,10 +427,6 @@ namespace :manifest do
458
427
  all_chance_entries = []
459
428
  timestamps = []
460
429
 
461
- # We need a collection of source paths for our mhtml and JS files to
462
- # check mtimes against.
463
- source_paths = []
464
-
465
430
  # build combined CSS entry
466
431
  css_entries.each do |resource_name, entries|
467
432
  # Send image files to the build task if Chance is being used
@@ -472,23 +437,57 @@ namespace :manifest do
472
437
  # way to know what sprties, etc. need to be put into the manifest.
473
438
  #
474
439
  # Still, Chance has to get created sometime.
475
- chance = Chance::Instance.new({ :theme => CONFIG[:css_theme], :minify => CONFIG[:minify_css] })
476
-
440
+ #
441
+ # To help, we cache the Chance Instance based on a key we generate. The Chance Factory does
442
+ # this for us. It will automatically handle when things change, for the most part (though
443
+ # the builder still has to tell Chance to double-check things, etc.)
444
+ opts = {
445
+ # the value of $theme
446
+ :theme => CONFIG[:css_theme],
447
+
448
+ # whether it should minify
449
+ :minify => minify,
450
+
451
+ # whether it should optimize sprites. This is opt-in, and comes from the buildfile.
452
+ :optimize_sprites => CONFIG[:optimize_sprites],
453
+
454
+ # Whether it should pad slices for debugging when writing them to the sprite. This is opt-out
455
+ # in development, but is off during production.
456
+ :pad_sprites_for_debugging => CONFIG[:pad_sprites_for_debugging],
457
+
458
+ # a unique identifier for the instance. we can share across localizations; this is
459
+ # merely used to prevent conflicts within the SAME CSS file: Chance makes sure
460
+ # all rules for generated images include this key. We'll use the target name.
461
+ :instance_id => target[:target_name]
462
+ }
463
+ chance_key = manifest[:staging_root] + "/" + resource_name
464
+
465
+ chance = Chance::ChanceFactory.instance_for_key(chance_key, opts)
466
+ chance_files = {}
467
+
477
468
  timestamp = 0
478
469
  has_2x_entries = false
479
470
  entries.each do |entry|
480
471
  timestamp = [entry.timestamp, timestamp].max
481
472
 
482
- # unfortunately, we have to stage the source entries NOW.
483
- src_path = entry.stage![:staging_path]
473
+ # unfortunately, we have to stage the source entries NOW. But only if they require
474
+ # building to be used. This applies primarily to sass and less entries.
475
+ if entry[:build_required]
476
+ src_path = entry.stage![:staging_path]
477
+ else
478
+ src_path = entry[:source_path]
479
+ end
480
+
484
481
  next unless File.exist?(src_path)
485
482
 
486
483
  Chance.add_file src_path
487
484
  # Also remove source/ from the filename for sc_require and @import
488
- chance.map_file(entry.filename.sub(/^source\//, ''), src_path)
485
+ chance_files[entry.filename.sub(/^source\//, '')] = src_path
489
486
 
490
487
  has_2x_entries = true if src_path.include?("@2x")
491
488
  end
489
+
490
+ Chance::ChanceFactory.update_instance(chance_key, opts, chance_files)
492
491
 
493
492
  timestamps << timestamp
494
493
  chance_instances << chance
@@ -501,11 +500,11 @@ namespace :manifest do
501
500
  # for the entry to compare mtimes with to know if it needs to update.
502
501
  entry_source_paths = entries.map {|e| e[:source_path] }
503
502
 
504
- add_chance_file = lambda {|entry_name, chance_file|
503
+ add_chance_file = lambda {|entry_name, chance_file, entry_type|
505
504
  manifest.add_entry entry_name,
506
505
  :variation => manifest.variation,
507
506
  :build_task => 'build:chance_file',
508
- :entry_type => :css,
507
+ :entry_type => entry_type,
509
508
  :combined => true,
510
509
 
511
510
  :source_entries => entries,
@@ -524,9 +523,7 @@ namespace :manifest do
524
523
 
525
524
  # So that modules, etc. can figure out what resource it belongs to
526
525
  :resource => resource_name,
527
-
528
- # Chance does minification on its own
529
- :minify => minify,
526
+ :minified => minify,
530
527
 
531
528
  # So that it can easily be recognized as an @2x entry.
532
529
  :x2 => entry_name.include?("@2x")
@@ -535,52 +532,25 @@ namespace :manifest do
535
532
 
536
533
  chance_file = "chance" + (sprited ? "-sprited" : "") + ".css"
537
534
 
538
- add_chance_file.call(resource_name + ".css", chance_file)
535
+ add_chance_file.call(resource_name + ".css", chance_file, :css)
539
536
 
540
537
  # We only want to add the 2x version if there is a need for it.
541
538
  # NOTE: the HTML builder will need to pick the normal version if it
542
539
  # cannot find the @2x version.
543
540
  if has_2x_entries
544
541
  chance_2x_file = "chance" + (sprited ? "-sprited" : "") + "@2x.css"
545
- add_chance_file.call(resource_name + "@2x.css", chance_2x_file)
542
+ add_chance_file.call(resource_name + "@2x.css", chance_2x_file, :css)
546
543
  end
547
544
 
548
545
  if sprited
549
546
  chance.sprite_names.each {|name|
550
- add_chance_file.call(resource_name + "-" + name, name);
547
+ add_chance_file.call(resource_name + "-" + name, name, :image);
551
548
  }
552
549
 
553
550
  chance.sprite_names({:x2 => true}).each {|name|
554
- add_chance_file.call(resource_name + "-" + name, name);
551
+ add_chance_file.call(resource_name + "-" + name, name, :image);
555
552
  }
556
553
  end
557
-
558
- # We also have a set of all source paths for the chance task. We need
559
- # to keep it up-to-date so that the MHTML and JS tasks can compare mtimes
560
- # with the entries.
561
- source_paths += entry_source_paths
562
- all_chance_entries += entries
563
- end
564
-
565
- if chance_instances.length > 0
566
- manifest.add_entry "__sc_chance.js",
567
- :build_task => 'build:chance_file',
568
- :chance_instances => chance_instances,
569
- :entry_type => :javascript,
570
- :resource => "javascript",
571
- :chance_file => "chance.js",
572
- :timestamp => timestamps.max,
573
- :source_paths => source_paths,
574
- :source_entries => all_chance_entries
575
-
576
- manifest.add_entry "__sc_chance_mhtml.txt",
577
- :build_task => 'build:chance_file',
578
- :chance_instances => chance_instances,
579
- :entry_type => :mhtml,
580
- :chance_file => "chance-mhtml.txt",
581
- :timestamp => timestamps.max,
582
- :source_paths => source_paths,
583
- :source_entries => all_chance_entries
584
554
  end
585
555
 
586
556
  end
@@ -607,7 +577,7 @@ namespace :manifest do
607
577
  resource_name = resource_name.ext('js')
608
578
 
609
579
  if resource_name == 'javascript.js'
610
- pf = ['source/lproj/strings.js', 'source/core.js', 'source/utils.js']
580
+ pf = ['source/lproj/layout.js', 'source/lproj/strings.js', 'source/core.js', 'source/utils.js']
611
581
  if manifest.target.target_type == :app
612
582
  target_name = manifest.target.target_name.to_s.split('/')[-1]
613
583
  pf.insert(2, "source/#{target_name}.js")
@@ -642,6 +612,10 @@ namespace :manifest do
642
612
  :entry_type => :javascript,
643
613
  :hide_entries => false,
644
614
  :source_entries => [entry],
615
+
616
+ # carry forward minification so we can do a last-minute security check
617
+ # and not reject this file.
618
+ :minified => entry.minified?,
645
619
  :packed => entry.packed? # carry forward
646
620
  end
647
621
 
@@ -687,18 +661,30 @@ namespace :manifest do
687
661
 
688
662
  # packed entries only for apps now.
689
663
  if target[:target_type] == :app
690
-
691
- %w(stylesheet stylesheet@2x).each {|resource|
664
+
665
+ combine_entries = [{
666
+ :resource => 'stylesheet',
667
+ :fallback => nil
668
+ }, {
669
+ :resource => 'stylesheet@2x',
670
+ :fallback => 'stylesheet'
671
+ }]
672
+
673
+ combine_entries.each {|combine_entry|
674
+ resource = combine_entry[:resource]
675
+ fallback = combine_entry[:fallback]
692
676
 
693
677
  # Handle CSS version. get all required targets and find their
694
678
  # stylesheet.css. Build packed css from that.
695
679
  targets = target.expand_required_targets({ :theme => true }) + [target]
696
680
  entries = targets.map do |target|
697
681
  m = target.manifest_for(manifest.variation).build!
698
-
699
- # need to find the version that is not minified
700
682
  entry = m.entry_for(resource + ".css")
701
- entry = entry.source_entry while entry && entry.minified?
683
+
684
+ if entry.nil? and not fallback.nil?
685
+ entry = m.entry_for(fallback + ".css")
686
+ end
687
+
702
688
  entry
703
689
  end
704
690
 
@@ -719,8 +705,30 @@ namespace :manifest do
719
705
  end
720
706
 
721
707
  end
708
+
709
+ desc "splits packed CSS files into chunks based on selector count because internet explorer is shitty"
710
+ task :split => %w(packed) do |task, env|
711
+ # The split_css transform, which we add to stylesheet-packed, splits CSS based on number
712
+ # of selectors (because IE has a maximum of ~4096 per file). It actually ends up adding
713
+ # more manifest entries, which is UBER HACKY!!! But, what can you do when you don't
714
+ # know what files you'll have to create until you've already started building?
715
+ target = env[:target]
716
+ manifest = env[:manifest]
717
+
718
+ if target[:target_type] == :app
719
+ # We don't need to do @2x: it is safari only.
720
+ resource = "stylesheet-packed.css"
721
+ entry = manifest.entry_for(resource)
722
+
723
+ # There may not be a stylesheet-packed.
724
+ if not entry.nil?
725
+ entry = manifest.add_transform entry,
726
+ :build_task => 'build:split_css'
727
+ end
728
+ end
729
+ end
722
730
 
723
- task :minify => :packed # IMPORTANT: don't want minified version
731
+ task :minify => :split # IMPORTANT: don't want minified version
724
732
 
725
733
  #Create builder tasks for sass and less in a DRY way
726
734
  [:sass, :less].each do |csscompiler|
@@ -737,6 +745,7 @@ namespace :manifest do
737
745
  :url => [manifest[:url_root], 'source', entry[:filename]].join("/"),
738
746
  :build_task => 'build:'+csscompiler.to_s,
739
747
  :entry_type => :css,
748
+ :build_required => true, # tells the :chance step that it needs to stage it before it can use it
740
749
  :ext => 'css',
741
750
  :resource => 'stylesheet',
742
751
  :required => []
@@ -843,37 +852,39 @@ namespace :manifest do
843
852
  end
844
853
 
845
854
  desc "creates transform entries for all css and Js entries to minify them if needed"
846
- task :minify => %w(setup javascript module_info css combine sass less) do |task, env|
855
+ task :minify => %w(setup javascript module_info css combine sass less html) do |task, env|
847
856
  manifest = env[:manifest]
848
857
  config = CONFIG
849
858
 
850
- minify_css = config[:minify_css]
851
- minify_css = config[:minify] if minify_css.nil?
852
-
853
859
  minify_javascript = config[:minify_javascript]
854
860
  minify_javascript = config[:minify] if minify_javascript.nil?
861
+
862
+ minify_html = config[:minify_html]
863
+ minify_html = config[:minify] if minify_html.nil?
864
+
865
+ if SC.env[:dont_minify]
866
+ minify_javascript = false
867
+ minify_html = false
868
+ end
855
869
 
856
870
  manifest.entries.dup.each do |entry|
857
871
  case entry[:entry_type]
858
- when :css
859
- # NOTE: CSS MINIFICATION USING YUI MINIFIER IS CURRENTLY NOT WORKING.
860
- # But, since Chance is minifying it, we can disable this code path
861
- # for the moment. We'll need to add it back and fix YUI if we end up
862
- # supporting disabling Chance.
863
- # if minify_css
864
- # manifest.add_transform entry,
865
- # :build_task => 'build:minify:css',
866
- # :entry_type => :css,
867
- # :minified => true,
868
- # :packed => entry.packed? # carry forward
869
- # end
870
-
872
+ # NOTE: CSS IS MINIFIED BY CHANCE. So we ignore it here.
873
+
874
+ when :html
875
+ if minify_html
876
+ manifest.add_transform entry,
877
+ :build_task => 'build:minify:html',
878
+ :entry_type => :html,
879
+ :minified => true
880
+ end
871
881
  when :javascript
872
882
  if minify_javascript
873
883
  manifest.add_transform entry,
874
884
  :build_task => 'build:minify:javascript',
875
885
  :entry_type => :javascript,
876
886
  :minified => true,
887
+ :combined => entry.combined?, # carry forward
877
888
  :packed => entry.packed? # carry forward
878
889
  end
879
890
  end
@@ -1,5 +1,72 @@
1
- CHANGE LOG FOR 1.6
2
- ==================
1
+ CHANGE LOG FOR 1.6+
2
+ ===================
3
+
4
+ 1.7.1.beta
5
+ ----------
6
+
7
+ ### MINOR FEATURES
8
+
9
+ * Added Safari Lion browser detection.
10
+ * Speed improvements in renderContext, switching from joining arrays of strings to simple string concatenation.
11
+ * Faster code escaping using regular expressions instead of DOM.
12
+ * New flag to stop picker repositioning when the window is resized.
13
+ * SegmentedView update to enable/disable overflow.
14
+ * Small performance improvement for splitView.
15
+ * New string measurement functions to optimize for string wrapping.
16
+ * Added support for autoCorrect and autoCapitalize in TextFields.
17
+ * Added back object types previously removed by the refactored SC.Object
18
+ * Refactored observer paths code for a more robust handling.
19
+ * Rewrite SC.LOG_RUNLOOP_INVOCATIONS — now renamed to SC.LOG_DEFERRED_CALLS — to work with the new runloop implementation.
20
+ * Added this SC.RunLoop.kill to terminate cleanly a run loop in case of an error.
21
+ * Added the ability to dynamically add substates to a statechart via a state's addSubstate method.
22
+ * Updated the statechart tracing logic.
23
+ * Updated SC.State. getSubstate now accepts a callback; added getState method; gotoState and gotoHistoryState now use getState
24
+ * Updated state's gotoState and gotoHistoryState to allow for a more expressive state arg that now allows for the use of 'parentState'
25
+ * Updated SC.State's getSubstate method to allow for path expressions. Also refacted the findFirstRelativeCurrentState method.
26
+ * New SC globals to provide information like build mode, build number and locale.
27
+
28
+ ### BUG FIXES
29
+
30
+ * Bug fix, when the apps don’t have a first responder at loading time the app throws an error.
31
+ * Tweaked scrolling acceleration and speed to match native scroller.
32
+ * Removed Internet Explorer legacy code.
33
+ * Passing the native event when a focus or blur event is called. This makes it consistent with all the other event handlers.
34
+ * Workarounds for mobileSafari touch handling in textfields and links.
35
+ * IE was getting two blur/focus events.
36
+ * Small bug fix for timers when there is no currentRunLoop.
37
+ * Unit test updates for renderContext.
38
+ * Reverted change to receive focus if it the view becomes key responder.
39
+ * Disabling layout style calculations for opacity in IE, as this will always break transparent pngs.
40
+ * Changed code to get a reliable anchor for pickers and menus.
41
+ * Reposition pickers based on the size of the app and not the window viewport.
42
+ * Added tooltips back to button.
43
+ * Fix for popup_buttons as they were not rendering as expected.
44
+ * Removing acceleration layer on sliders as this was creating GPU glitches on views appended after the slider.
45
+ * Removing legacy handler of buttons to improve speed.
46
+ * Bug fix to update list scrollers when adding new items to the list.
47
+ * Changed timeout value for a faster experience in menu scrolling.
48
+ * Removed deltaAdjust in scrollView and left only the calculations done in SC.Event.
49
+ * Updated values in select button to fix rendering regressions.
50
+ * Refactored childViews creation in formView.
51
+ * Updated new selectView to correctly support width resizing.
52
+ * Better string measurements for autoResize mixin. Also included the support to auto fit text (reduce font size if neccessary.
53
+ * FlowedLayout fixes when the view changes visibility and code clean up.
54
+ * Added back hints to labels.
55
+ * Removed unneccesary font-weight label css attribute.
56
+ * Removed zIndex in text-fields.
57
+ * Removed preload images task for “Chance” slicing system .
58
+ * Several modular loading bug fixes, including support for css.
59
+ * Bug fix for string measurement. It was double escaping.
60
+ * Observers failing in IE as strings don’t work as arrays.
61
+ * Don't schedule multiple run loops when we only need one in SC.Binding.
62
+ * Add in support for specifying an optional prefix that will be applied to all messages.
63
+ * Updated observable unit tests
64
+ * Updated SC.Logger unit tests
65
+ * Updated SC.State's getSubstate method to allow for path expressions.
66
+ * Updated Statechart unit tests
67
+ * Updated state charts unit tests
68
+ * Updated css to match abbot css fixes for $skip parameter in chance.
69
+ * Added css style namespace to sc-focus, this was generating problems when focusing the elements the first time in the app.
3
70
 
4
71
  1.6.0
5
72
  -----