motion-prime 0.7.2 → 0.8.0

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 (60) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +8 -9
  5. data/ROADMAP.md +4 -5
  6. data/bin/prime +19 -14
  7. data/files/Rakefile +0 -1
  8. data/files/app/app_delegate.rb +0 -12
  9. data/files/app/config/base.rb +1 -12
  10. data/files/app/screens/application.rb +1 -5
  11. data/files/app/sections/.gitkeep +0 -0
  12. data/files/app/styles/.gitkeep +0 -0
  13. data/files/resources/Default-568h@2x.png +0 -0
  14. data/files/resources/Default.png +0 -0
  15. data/files/resources/Default@2x.png +0 -0
  16. data/motion-prime/api_client.rb +2 -1
  17. data/motion-prime/config/base.rb +8 -3
  18. data/motion-prime/config/config.rb +18 -0
  19. data/motion-prime/elements/_text_mixin.rb +0 -4
  20. data/motion-prime/elements/base_element.rb +64 -51
  21. data/motion-prime/elements/draw/image.rb +3 -2
  22. data/motion-prime/elements/draw/label.rb +9 -2
  23. data/motion-prime/helpers/has_search_bar.rb +10 -1
  24. data/motion-prime/screens/_base_mixin.rb +1 -1
  25. data/motion-prime/screens/_sections_mixin.rb +8 -4
  26. data/motion-prime/sections/__section_with_container_mixin.rb +52 -0
  27. data/motion-prime/sections/_cell_section_mixin.rb +7 -21
  28. data/motion-prime/sections/_delegate_mixin.rb +12 -0
  29. data/motion-prime/sections/_draw_section_mixin.rb +4 -21
  30. data/motion-prime/sections/base_section.rb +7 -7
  31. data/motion-prime/sections/form.rb +7 -0
  32. data/motion-prime/sections/form/base_field_section.rb +9 -0
  33. data/motion-prime/sections/form/date_field_section.rb +1 -1
  34. data/motion-prime/sections/form/form_delegate.rb +0 -1
  35. data/motion-prime/sections/form/password_field_section.rb +1 -1
  36. data/motion-prime/sections/form/select_field_section.rb +1 -1
  37. data/motion-prime/sections/form/string_field_section.rb +1 -1
  38. data/motion-prime/sections/form/submit_field_section.rb +1 -1
  39. data/motion-prime/sections/form/switch_field_section.rb +1 -1
  40. data/motion-prime/sections/form/text_field_section.rb +1 -1
  41. data/motion-prime/sections/tabbed.rb +7 -0
  42. data/motion-prime/sections/table.rb +20 -7
  43. data/motion-prime/sections/table/table_delegate.rb +1 -9
  44. data/motion-prime/styles/base.rb +1 -1
  45. data/motion-prime/styles/form.rb +7 -7
  46. data/motion-prime/version.rb +1 -1
  47. data/motion-prime/views/layout.rb +4 -2
  48. metadata +6 -14
  49. data/files/app/screens/help.rb +0 -6
  50. data/files/app/screens/home.rb +0 -8
  51. data/files/app/screens/sidebar.rb +0 -14
  52. data/files/app/sections/home/section.rb +0 -3
  53. data/files/app/sections/sidebar/action.rb +0 -5
  54. data/files/app/sections/sidebar/table.rb +0 -20
  55. data/files/app/styles/home.rb +0 -9
  56. data/files/resources/fonts/ubuntu.ttf +0 -0
  57. data/files/resources/images/arrow.png +0 -0
  58. data/files/resources/images/menu_button.png +0 -0
  59. data/files/resources/images/menu_button@2x.png +0 -0
  60. data/motion-prime/styles/sidebar.rb +0 -23
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDk3ZTI2ODAzMjJjMmRlMTRlMDUyZjY5YTZkNjM0MWY0N2ExM2E3MQ==
4
+ OGVhYzU1YWVlZDBhZTZlMzhkY2VjYjA0Y2ZiMGM4YjAyZTQyZDIyZA==
5
5
  data.tar.gz: !binary |-
6
- NGRmNjY2MGU2ODE4MThhNTVhYzc4NTQ0YzA0NjI2NDNlMTdiN2E0Mw==
6
+ NmFkNjhlMzIyYWRlNzdkYzUxM2VlZGE4ZWZjNDYzYmIwYThhOTZmZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTA5NmMwMDhkN2U0OGZhZjgxYzJlOTQ4MTY1ZTYyZTNmNzM1NTM5MTVlZjY4
10
- NjJmMjgxYjg4NTk0ZDRiNjEwODg5YjJmNzliZGZhNDIyMWQyZjNhYjY1ZTFj
11
- NzQ5ZmRmNmQyMDZiY2NiZDA2ODMxNWYxNDVjOGZlNWQxMjBlNDY=
9
+ MTJhOGI3ZTNkMzNlY2E4ZTI5Yzk1ZDNlZTYyNTRiNTM4ZjU4NGY2ZDlhOWRk
10
+ ZGNlNjlhM2FlMDcxNmQ3YWI2Zjk4ZmE5MzY2OTY0ZjRiOTQ5YTU2ODY3YTY4
11
+ OGYxZmJlN2E4M2MyMjA4MjllODRmNDYyNTFiMGY2NGIyZTYwNTA=
12
12
  data.tar.gz: !binary |-
13
- YmJmNWQxNDFjM2RhZTQwZTMyNWRiYzJjYTFkNDIyNjg4Nzg3ZTVhOTQxZDYy
14
- ZTg5MDYwMDA4YzViZGIwOTJmNDMyYjA5MDNlZTJmMzg3MTg1MDcxZDUwZDkw
15
- MDFjYWIxOWEzNWNlMmZlZjgwMTk2MmZiMmY3ZTFiZjdjZmNhYWY=
13
+ MzczYzhkMjM0ZmJjYmExZTcxZTE0ZTExNzFkNDliNDg4NGFjYWFlNTdiOGVk
14
+ ODE4MzI1OGMxNmI1MDE1NGU0NjEyODY2YWNjMDQ3Zjg0Mjc3ZmVmNTQ4OWE3
15
+ YzQ0YmU5YjFiNjg3ODIyYTE0ODI4MTBkMDM2MjQ0NjhjY2Q3MDU=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ === 0.8.0
2
+ * Simpler syntax for using fonts. See prime_bootstrap.
3
+ * All style things moved from default prime template to bootstrap template.
4
+ * Removed root :title option support for submit field.
5
+ * Use field name as label text by default.
6
+ * Bug fixes.
7
+
1
8
  === 0.7.2
2
9
  * Added simpler syntax for rendering sections in screen. E.g. section :my_profile.
3
10
  * Bug fixes.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (0.7.2)
4
+ motion-prime (0.8.0)
5
5
  afmotion (~> 2.0.0)
6
6
  bubble-wrap (~> 1.4.0)
7
7
  cocoapods
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MotionPrime [![Build Status](https://travis-ci.org/droidlabs/motion-prime.png)](https://travis-ci.org/droidlabs/motion-prime) [![Code Climate](https://codeclimate.com/github/droidlabs/motion-prime.png)](https://codeclimate.com/github/droidlabs/motion-prime) [![Roadchange](https://roadchange.com/droidlabs/motion-prime/badge.png)](https://roadchange.com/droidlabs/motion-prime)
2
2
 
3
- ![Prime](https://s3-us-west-2.amazonaws.com/webmate/assets/prime.jpg)
3
+ ![Prime](https://s3.amazonaws.com/motionprime/logo-1.png)
4
4
 
5
5
  MotionPrime is yet another framework written on RubyMotion for creating really fast iOS applications.
6
6
 
@@ -15,14 +15,13 @@ MotionPrime is yet another framework written on RubyMotion for creating really f
15
15
 
16
16
  $ gem install motion-prime
17
17
 
18
- ### 2. Create MotionPrime project:
18
+ ### 2. Create empty MotionPrime project:
19
19
 
20
20
  $ prime new myapp
21
21
 
22
- ### 3. Setup application
22
+ ### 3. Or create bootstrap MotionPrime project:
23
23
 
24
- $ bundle install
25
- $ rake pod:install
24
+ $ prime bootstrap myapp
26
25
 
27
26
  ### 4. Run application
28
27
 
@@ -64,13 +63,13 @@ MotionPrime is yet another framework written on RubyMotion for creating really f
64
63
 
65
64
  ## Extensions
66
65
 
67
- * [ECSlidingViewController 2 integration](https://github.com/droidlabs/prime_sliding_menu) (Sidebar)
68
- * [RESideMenu integration](https://github.com/droidlabs/prime_reside_menu) (Sidebar)
69
- * [Sliding actions support](https://github.com/droidlabs/prime_sliding_action)
66
+ * [ECSlidingViewController 2 integration](https://github.com/motionprime/prime_sliding_menu) (Sidebar)
67
+ * [RESideMenu integration](https://github.com/motionprime/prime_reside_menu) (Sidebar)
68
+ * [Sliding actions support](https://github.com/motionprime/prime_sliding_action)
70
69
 
71
70
  ## Samples
72
71
 
73
- * [Simple to-do app](https://github.com/droidlabs/prime_sample_todo)
72
+ * [Simple to-do app](https://github.com/motionprime/prime_sample_todo)
74
73
 
75
74
  ## Documentation
76
75
 
data/ROADMAP.md CHANGED
@@ -1,15 +1,13 @@
1
- === 0.8.0
2
- * add cell preload for reverse scrolling table.
3
- * deprecate root level :title option for submit field
1
+ === 0.8.1
4
2
  * rename submit element in submit field to button element
5
3
  * rename date_picker element in date_picker field to input element
6
- * add more and better default options for fields
7
4
  * Rename model to data in sections.
8
5
 
9
6
  === 0.9.0
10
7
  * bug: if mp label do not have text and was set as hidden, it should unhide after setting text
11
8
  * bug: size_to_fit works incorrect with relative width.
12
- * add cleanup for section events
9
+ * bug: bind_keyboard_close breaks bind_guesture
10
+ * add clone to models to prevent problems when bag_key is overrided
13
11
  * add dsl for push notifications
14
12
  * add some extensions/middleware system, at least for networking.
15
13
  * create "display_network_error" extension.
@@ -20,6 +18,7 @@
20
18
  * add sections/screens/models generator
21
19
 
22
20
  === 1.1.0
21
+ * add cell preload for reverse scrolling table.
23
22
  * add computed_options.get(), this will allow to make sure that options is computed.
24
23
  * add testing framework
25
24
  * add DSL for ViewStyles#setValue conditions
data/bin/prime CHANGED
@@ -11,7 +11,8 @@ class App
11
11
 
12
12
  main do |command, opt|
13
13
  case command.to_sym
14
- when :new then create(opt)
14
+ when :new then create_base(opt)
15
+ when :bootstrap then create_bootstrap(opt)
15
16
  else help
16
17
  end
17
18
  0
@@ -24,14 +25,22 @@ class App
24
25
  info " Creates a new MotionPrime app from a template."
25
26
  end
26
27
 
27
- def self.create(name)
28
+ def self.create_base(name)
29
+ create(name, "motion-prime", "git://github.com/droidlabs/motion-prime.git")
30
+ end
31
+
32
+ def self.create_bootstrap(name)
33
+ create(name, "prime_bootstrap", "git://github.com/motionprime/prime_bootstrap.git")
34
+ end
35
+
36
+ def self.create(name, template_name, repo)
28
37
  return puts "Usage: prime new <appname>" unless name.to_s.length > 0
29
38
  info "Creating new MotionPrime iOS app: #{name}"
30
39
  if false
31
- sh "motion create #{name} --template=git://github.com/droidlabs/motion-prime.git"
40
+ sh "motion create #{name} --template=#{repo}"
32
41
  else
33
- clone_template
34
- sh "motion create #{name} --template=motion-prime"
42
+ clone_template(template_name, repo)
43
+ sh "motion create #{name} --template=#{template_name}"
35
44
  end
36
45
  info "Command: bundle instal"
37
46
  sh "cd ./#{name}; bundle install"
@@ -45,20 +54,16 @@ class App
45
54
  ENV['HOME'].split('/')[0..2].join('/')
46
55
  end
47
56
 
48
- def self.repo_url
49
- "git://github.com/droidlabs/motion-prime.git"
50
- end
51
-
52
- def self.clone_template
53
- path = File.expand_path(File.join(home_path, 'Library/RubyMotion/template', 'motion-prime'))
54
- git_clone(path)
57
+ def self.clone_template(name, repo)
58
+ path = File.expand_path(File.join(home_path, 'Library/RubyMotion/template', name))
59
+ git_clone(path, repo)
55
60
  end
56
61
 
57
- def self.git_clone(path)
62
+ def self.git_clone(path, repo)
58
63
  if File.exist?(path)
59
64
  system("git --work-tree=#{path} --git-dir=#{path}/.git pull origin master")
60
65
  else
61
- system("git clone #{repo_url} #{path}")
66
+ system("git clone #{repo} #{path}")
62
67
  end
63
68
  end
64
69
 
data/files/Rakefile CHANGED
@@ -14,5 +14,4 @@ Motion::Project::App.setup do |app|
14
14
 
15
15
  app.version = '0.0.1'
16
16
  app.icons = %w{Icon.png}
17
- app.fonts = ['fonts/ubuntu.ttf']
18
17
  end
@@ -1,17 +1,5 @@
1
1
  class AppDelegate < Prime::BaseAppDelegate
2
2
  def on_load(app, options)
3
- setup_navigation_styles
4
3
  open_screen :home, sidebar: true
5
4
  end
6
-
7
- def setup_navigation_styles
8
- bar_appearance = UINavigationBar.appearance
9
- bar_appearance.barTintColor = :app_dark.uicolor
10
-
11
- settings = {
12
- UITextAttributeFont => Prime::Config.font.name.uifont(17),
13
- UITextAttributeTextColor => :white.uicolor
14
- }
15
- bar_appearance.setTitleTextAttributes(settings)
16
- end
17
5
  end
@@ -1,14 +1,3 @@
1
1
  Prime::Config.configure do |config|
2
- config.colors do |colors|
3
- colors.base = 0x3aa9b6
4
- colors.dark = 0x41929c
5
- end
6
-
7
- config.font.name = "Ubuntu"
8
-
9
- config.api_client do |api|
10
- api.base = "http://example.com"
11
- api.client_id = ""
12
- api.client_secret = ""
13
- end
2
+
14
3
  end
@@ -1,7 +1,3 @@
1
1
  class ApplicationScreen < Prime::Screen
2
- before_render :setup_navigation
3
-
4
- def setup_navigation
5
- set_navigation_left_button 'menu', image: 'images/menu_button.png', action: :toggle_sidebar
6
- end
2
+
7
3
  end
File without changes
File without changes
Binary file
Binary file
Binary file
@@ -59,7 +59,8 @@ class ApiClient
59
59
  use_callback = block_given?
60
60
 
61
61
  client_method = files.present? ? :"multipart_#{method}" : method
62
- AFMotion::Client.shared.send client_method, "#{config.api_namespace}#{path}", data do |response, form_data, progress|
62
+ path = "#{config.api_namespace}#{path}" unless path.starts_with?('http')
63
+ AFMotion::Client.shared.send client_method, path, data do |response, form_data, progress|
63
64
  if form_data && files.present?
64
65
  files.each do |file_data|
65
66
  form_data.appendPartWithFileData(file_data[:data], name: file_data[:name], fileName:"avatar.png", mimeType: "image/jpeg")
@@ -5,9 +5,14 @@ MotionPrime::Config.configure do |config|
5
5
  else
6
6
  config.model.store_type = :file
7
7
  end
8
- config.font.name = "Ubuntu"
8
+
9
+ config.fonts do |fonts|
10
+ fonts.base = :system
11
+ end
12
+
9
13
  config.colors do |colors|
10
- colors.base = 0x424242
14
+ colors.base = 0x1b75bc
15
+ colors.dark = 0x333333
11
16
  colors.error = 0xef471f
12
17
  end
13
18
  config.api_client do |api|
@@ -22,5 +27,5 @@ MotionPrime::Config.configure do |config|
22
27
  end
23
28
  config.prime.cell_section.mixins = [Prime::CellSectionMixin]
24
29
  config.logger.level = :info
25
- config.logger.dealloc_items = ['screen', 'tab_bar']
30
+ config.logger.dealloc_items = ['screen']
26
31
  end
@@ -53,6 +53,7 @@ module MotionPrime
53
53
  end
54
54
  setup_models
55
55
  setup_colors
56
+ setup_fonts
56
57
  setup_logger
57
58
  end
58
59
 
@@ -74,6 +75,23 @@ module MotionPrime
74
75
  Symbol.css_colors.merge!(colors)
75
76
  end
76
77
 
78
+ def setup_fonts
79
+ return unless @base_config
80
+ colors = @base_config.fonts.to_hash.inject({}) do |res, (font, value)|
81
+ if [:system, :bold, :italic, :monospace].include?(value)
82
+ value = Symbol.uifont[value]
83
+ end
84
+ unless font == :prefix
85
+ unless @base_config.fonts.prefix.nil?
86
+ res[:"#{@base_config.fonts.prefix}_#{font}"] = value
87
+ end
88
+ res[:"app_#{font}"] = value
89
+ end
90
+ res
91
+ end
92
+ Symbol.uifont.merge!(colors)
93
+ end
94
+
77
95
  def setup_logger
78
96
  Prime::Logger.level = @base_config.logger.level
79
97
  Prime::Logger.dealloc_items = @base_config.logger.dealloc_items
@@ -22,10 +22,6 @@ module MotionPrime
22
22
  NSDocumentTypeDocumentAttribute => NSHTMLTextDocumentType,
23
23
  NSCharacterEncodingDocumentAttribute => NSNumber.numberWithInt(NSUTF8StringEncoding)
24
24
  }
25
- # DTCoreTextFontDescriptor.setOverrideFontName(Prime::Config.font.light, forFontFamily: 'Calibri', bold: false, italic: false)
26
- # DTCoreTextFontDescriptor.setOverrideFontName(Prime::Config.font.bold, forFontFamily: 'Calibri', bold: true, italic: false)
27
- # DTCoreTextFontDescriptor.setOverrideFontName(Prime::Config.font.light_italic, forFontFamily: 'Calibri', bold: false, italic: true)
28
- # DTCoreTextFontDescriptor.setOverrideFontName(Prime::Config.font.bold_italic, forFontFamily: 'Calibri', bold: true, italic: true)
29
25
 
30
26
  text = "#{options[:text]}<style>* { #{styles.join} }</style>"
31
27
  NSAttributedString.alloc.initWithData(text.dataUsingEncoding(NSUTF8StringEncoding), options: html_options, documentAttributes: nil, error: nil)
@@ -29,10 +29,10 @@ module MotionPrime
29
29
  @view_name = self.class_name_without_kvo.demodulize.underscore.gsub(/(_draw)?_element/, '')
30
30
  end
31
31
 
32
- # def dealloc
33
- # pp 'Deallocating elemenet', self.name, self.to_s, computed_options[:text]
34
- # super
35
- # end
32
+ def dealloc
33
+ Prime.logger.dealloc_message :element, self, self.name
34
+ super
35
+ end
36
36
 
37
37
  def add_target(target = nil, action = 'on_click:', event = :touch)
38
38
  return false unless self.view
@@ -111,53 +111,7 @@ module MotionPrime
111
111
 
112
112
  @styles = []
113
113
  if is_cell_section
114
- base_styles = {common: [], specific: []}
115
- suffixes = {common: [], specific: []}
116
-
117
- # following example in Prime::TableSection#cell_styles
118
- # form element/cell: <base|user>_form_field, <base|user>_form_string_field, user_form_field_email
119
- # table element/cell: <base|categories>_table_cell, categories_table_title
120
- if section.section_styles
121
- section.section_styles.each { |type, values| base_styles[type] += values }
122
- end
123
- if %w[base table_view_cell].exclude?(@view_name)
124
- # form element: _input
125
- # table element: _image
126
- suffixes[:common] << @view_name.to_sym
127
- suffixes[:common] << :"#{@view_name}_with_errors" if has_errors
128
- end
129
- if name && name.to_s != @view_name
130
- # form element: _input
131
- # table element: _icon
132
- suffixes[:specific] << name.to_sym
133
- suffixes[:specific] << :"#{name}_with_errors" if has_errors
134
- end
135
- # form cell: base_form_field, base_form_string_field
136
- # form element: base_form_field_string_field, base_form_string_field_text_field
137
- # table cell: base_table_cell
138
- # table element: base_table_cell_image
139
- common_styles = if suffixes[:common].any?
140
- build_styles_chain(base_styles[:common], suffixes[:common])
141
- elsif suffixes[:specific].any?
142
- build_styles_chain(base_styles[:common], suffixes[:specific])
143
- elsif @view_name == 'table_view_cell'
144
- base_styles[:common]
145
- end
146
- @styles += Array.wrap(common_styles)
147
-
148
- # form cell: user_form_field, user_form_string_field, user_form_field_email
149
- # form element: user_form_field_text_field, user_form_string_field_text_field, user_form_field_email_text_field
150
- # table cell: categories_table_cell, categories_table_title
151
- # table element: categories_table_cell_image, categories_table_title_image
152
- specific_base_common_suffix_styles = if suffixes[:common].any?
153
- build_styles_chain(base_styles[:specific], suffixes[:common])
154
- elsif suffixes[:specific].empty? && @view_name == 'table_view_cell'
155
- base_styles[:specific]
156
- end
157
- @styles += Array.wrap(specific_base_common_suffix_styles)
158
- # form element: user_form_field_input, user_form_string_field_input, user_form_field_email_input
159
- # table element: categories_table_cell_icon, categories_table_title_icon
160
- @styles += build_styles_chain(base_styles[:specific], suffixes[:specific])
114
+ @styles += compute_cell_style_options(style_sources, has_errors)
161
115
  end
162
116
  # don't use present? here, it's slower, while this method should be very fast
163
117
  if section && section.name && section.name != '' && name && name != ''
@@ -168,11 +122,70 @@ module MotionPrime
168
122
  custom_styles = style_sources.map do |source|
169
123
  normalize_object(source.delete(:styles), section)
170
124
  end.flatten
125
+
126
+ # styles got from mixins option
127
+ mixin_styles = style_sources.map do |source|
128
+ normalize_object(source.delete(:mixins), section)
129
+ end.flatten.map{ |m| :"_mixin_#{m}" }
130
+
171
131
  @styles += custom_styles
132
+ @styles += mixin_styles
172
133
  # puts @view_class.to_s + @styles.inspect, ''
173
134
  @styles
174
135
  end
175
136
 
137
+ def compute_cell_style_options(style_sources, has_errors)
138
+ base_styles = {common: [], specific: []}
139
+ suffixes = {common: [], specific: []}
140
+ all_styles = []
141
+
142
+ # following example in Prime::TableSection#cell_styles
143
+ # form element/cell: <base|user>_form_field, <base|user>_form_string_field, user_form_field_email
144
+ # table element/cell: <base|categories>_table_cell, categories_table_title
145
+ if section.section_styles
146
+ section.section_styles.each { |type, values| base_styles[type] += values }
147
+ end
148
+ if @view_name != 'base' && @view_name != 'table_view_cell'
149
+ # form element: _input
150
+ # table element: _image
151
+ suffixes[:common] << @view_name.to_sym
152
+ suffixes[:common] << :"#{@view_name}_with_errors" if has_errors
153
+ end
154
+ if name && name.to_s != @view_name
155
+ # form element: _input
156
+ # table element: _icon
157
+ suffixes[:specific] << name.to_sym
158
+ suffixes[:specific] << :"#{name}_with_errors" if has_errors
159
+ end
160
+ # form cell: base_form_field, base_form_string_field
161
+ # form element: base_form_field_string_field, base_form_string_field_text_field
162
+ # table cell: base_table_cell
163
+ # table element: base_table_cell_image
164
+ common_styles = if suffixes[:common].any?
165
+ build_styles_chain(base_styles[:common], suffixes[:common])
166
+ elsif suffixes[:specific].any?
167
+ build_styles_chain(base_styles[:common], suffixes[:specific])
168
+ elsif @view_name == 'table_view_cell'
169
+ base_styles[:common]
170
+ end
171
+ all_styles += Array.wrap(common_styles)
172
+
173
+ # form cell: user_form_field, user_form_string_field, user_form_field_email
174
+ # form element: user_form_field_text_field, user_form_string_field_text_field, user_form_field_email_text_field
175
+ # table cell: categories_table_cell, categories_table_title
176
+ # table element: categories_table_cell_image, categories_table_title_image
177
+ specific_base_common_suffix_styles = if suffixes[:common].any?
178
+ build_styles_chain(base_styles[:specific], suffixes[:common])
179
+ elsif suffixes[:specific].empty? && @view_name == 'table_view_cell'
180
+ base_styles[:specific]
181
+ end
182
+ all_styles += Array.wrap(specific_base_common_suffix_styles)
183
+ # form element: user_form_field_input, user_form_string_field_input, user_form_field_email_input
184
+ # table element: categories_table_cell_icon, categories_table_title_icon
185
+ all_styles += build_styles_chain(base_styles[:specific], suffixes[:specific])
186
+ all_styles
187
+ end
188
+
176
189
  class << self
177
190
  def factory(type, options = {})
178
191
  element_class = class_factory("#{type}_element", true) || self