atome 0.5.3.8.1 → 0.5.3.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -3
  3. data/lib/atome/atome.rb +49 -46
  4. data/lib/atome/extensions/atome.rb +2 -2
  5. data/lib/atome/extensions/matrix.rb +27 -16
  6. data/lib/atome/genesis/generators/atome.rb +128 -85
  7. data/lib/atome/genesis/generators/identity.rb +82 -51
  8. data/lib/atome/genesis/generators/spatial.rb +8 -8
  9. data/lib/atome/genesis/generators/utility.rb +26 -17
  10. data/lib/atome/genesis/genesis.rb +7 -4
  11. data/lib/atome/genesis/sparkle.rb +6 -6
  12. data/lib/atome/helpers/essentials.rb +21 -18
  13. data/lib/atome/helpers/sanitizer.rb +10 -10
  14. data/lib/atome/helpers/utilities.rb +81 -29
  15. data/lib/atome/kernel/batch.rb +0 -1
  16. data/lib/atome/kernel/universe.rb +1 -1
  17. data/lib/atome/presets/atome.rb +22 -23
  18. data/lib/atome/renderers/browser/atome.rb +2 -1
  19. data/lib/atome/renderers/browser/helpers/browser_helper.rb +17 -0
  20. data/lib/atome/renderers/browser/helpers/text_helper.rb +10 -2
  21. data/lib/atome/renderers/browser/identity.rb +23 -5
  22. data/lib/atome/renderers/browser/utility.rb +5 -4
  23. data/lib/atome/renderers/renderer.rb +1 -0
  24. data/lib/atome/version.rb +1 -1
  25. data/sig/atome.rbs +20 -0
  26. data/sig/essentials.rbs +11 -0
  27. data/vendor/assets/src/medias/images/icons/email.svg +12 -12
  28. data/vendor/assets/src/medias/rubies/examples/add.rb +2 -3
  29. data/vendor/assets/src/medias/rubies/examples/animation.rb +2 -2
  30. data/vendor/assets/src/medias/rubies/examples/atome_new.rb +18 -6
  31. data/vendor/assets/src/medias/rubies/examples/{parents.rb → attach.rb} +6 -6
  32. data/vendor/assets/src/medias/rubies/examples/attached.rb +4 -4
  33. data/vendor/assets/src/medias/rubies/examples/box.rb +1 -1
  34. data/vendor/assets/src/medias/rubies/examples/code.rb +1 -1
  35. data/vendor/assets/src/medias/rubies/examples/color.rb +20 -4
  36. data/vendor/assets/src/medias/rubies/examples/delete.rb +2 -2
  37. data/vendor/assets/src/medias/rubies/examples/drag.rb +1 -1
  38. data/vendor/assets/src/medias/rubies/examples/fullscreen.rb +1 -1
  39. data/vendor/assets/src/medias/rubies/examples/image.rb +2 -2
  40. data/vendor/assets/src/medias/rubies/examples/link.rb +7 -5
  41. data/vendor/assets/src/medias/rubies/examples/markers.rb +1 -1
  42. data/vendor/assets/src/medias/rubies/examples/materials.rb +15 -0
  43. data/vendor/assets/src/medias/rubies/examples/monitoring.rb +44 -18
  44. data/vendor/assets/src/medias/rubies/examples/read.rb +2 -2
  45. data/vendor/assets/src/medias/rubies/examples/shadow.rb +1 -1
  46. data/vendor/assets/src/medias/rubies/examples/table.rb +2 -2
  47. data/vendor/assets/src/medias/rubies/examples/text.rb +4 -4
  48. data/vendor/assets/src/medias/rubies/examples/time.rb +1 -1
  49. data/vendor/assets/src/medias/rubies/examples/web.rb +2 -2
  50. metadata +7 -5
  51. /data/vendor/assets/src/medias/rubies/examples/{matrix.rb → _matrix.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd6a8f4f6c72f5e9d1974bcf411e6ce19c3469953d39a1ad7ef7de1497626b60
4
- data.tar.gz: 2e22cbbe3428e8506c1855fd0dadccfa55e6725912d5adf746963f0754e50884
3
+ metadata.gz: 6e15b6625b3ba6dd5801418dd7dab9f9d0670dedb65e3ea8caa03df984f29541
4
+ data.tar.gz: 5a23055c7535a94ebe0c29b4dd226477b99564aa73a7f2640c533447bf24f52e
5
5
  SHA512:
6
- metadata.gz: '0769c9974cf27f2b275d540baf5f5d22a3a30b979be3c41972fbb246400925864f14299e3fddf4acdf07a89952949dbcbaa96056f14439d27fbb0896d4c4a727'
7
- data.tar.gz: 6450a2fa9015d97cd14ca151324d9a70065a4893bd343f80936032ff6f8197ac7d80180d69eb959e5257a622905cb96830ee05dc03aa35c15820e92ca3fc3709
6
+ metadata.gz: ca47d04143b5d3cdec3120da89f863f3edaf84cbebee58fc257a8d12c7f1c2d699752ba6cc9e98e080cb10fbebe8900c788bd1c698705a59c7c0dfaa891073db
7
+ data.tar.gz: f1757fb74688cddb937f1a40790dd33ca121485a2446e2a5236f8de6ae9b302726b71521d2decd455e3cfca9613e37600075e91f3e96cf0777da3b5d67b4cb88
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ task :re_build do
15
15
  FileUtils.copy_entry('vendor/assets/src/js/', 'test/test_app/src/js/')
16
16
  FileUtils.copy_entry('vendor/assets/src/css/', 'test/test_app/src/css/')
17
17
  FileUtils.copy_entry('vendor/assets/src/medias/', 'test/test_app/src/medias/')
18
- `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
18
+ `gem cleanup atome;yes | gem uninstall atome;gem build atome.gemspec;gem install atome --local`
19
19
  `cd test/test_app;atome update`
20
20
  puts 'solution re-build!'
21
21
  # `cd test/test_app;atome update;atome run`
@@ -25,7 +25,7 @@ task :run_browser do
25
25
  FileUtils.copy_entry('vendor/assets/src/js/', 'test/test_app/src/js/')
26
26
  FileUtils.copy_entry('vendor/assets/src/css/', 'test/test_app/src/css/')
27
27
  FileUtils.copy_entry('vendor/assets/src/medias/', 'test/test_app/src/medias/')
28
- `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
28
+ `gem cleanup atome;yes | gem uninstall atome;gem build atome.gemspec;gem install atome --local`
29
29
  `cd test/test_app;atome update;atome run compile`
30
30
  puts 'atome browser is running'
31
31
  end
@@ -35,7 +35,7 @@ task :test_server do
35
35
  FileUtils.copy_entry('vendor/assets/src/js/', 'test/test_app/src/js/')
36
36
  FileUtils.copy_entry('vendor/assets/src/css/', 'test/test_app/src/css/')
37
37
  FileUtils.copy_entry('vendor/assets/src/medias/', 'test/test_app/src/medias/')
38
- `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
38
+ `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome --local`
39
39
  `cd test/test_app;atome update;atome run server`
40
40
  end
41
41
 
data/lib/atome/atome.rb CHANGED
@@ -3,8 +3,7 @@
3
3
  # TODO : remove monitoring
4
4
  # TODO : remove child
5
5
  # TODO : remove parents
6
- # new({ particle: :type })
7
- # create_particle(:type, true, true)
6
+
8
7
  # main entry here
9
8
  class Atome
10
9
  # TODO : clean or delete @private_atome
@@ -13,34 +12,20 @@ class Atome
13
12
  private
14
13
 
15
14
  def initialize(atomes = {}, &atomes_proc)
16
- # puts "atome are #{atomes}"
15
+
17
16
  atomes.each_value do |elements|
18
17
  # the instance variable below contain the id all any atomes that need to be informed when changes occurs
19
18
  @broadcast = {}
20
19
  # now we store the proc in a an atome's property called :bloc
21
20
  elements[:code] = atomes_proc if atomes_proc
21
+
22
22
  @atome = elements
23
23
  # we initiate the rendering suing set_type method,
24
24
  # eg for for browser we will call :browser_type generate method in identity.rb file
25
- set_type(@atome[:type], &atomes_proc)
26
25
  collapse
27
-
28
26
  end
29
27
  end
30
28
 
31
- def set_type(params, &atomes_proc)
32
- # @atome[params]
33
- # puts "params is : #{@atome[:children]}"
34
- # @atome[:children]={shapes: [params]}
35
- # @atome[:shape]=:poil
36
- # puts "type is : #{@atome[params].class}"
37
- # unless @atome[params]
38
- # @atome[params] = []
39
- # end
40
- # @atome[params] << params
41
- rendering(:type, params, &atomes_proc)
42
- end
43
-
44
29
  def new_particle(element, store, render, &method_proc)
45
30
  Atome.define_method element do |params = nil, &user_proc|
46
31
  if params || params == false
@@ -63,41 +48,67 @@ class Atome
63
48
  end
64
49
  end
65
50
 
66
- def atome_creation_pre_treatment(element, params, &user_proc)
51
+ def atome_parsing(element, params, &user_proc)
67
52
  params = sanitize(element, params)
53
+ current_atome = send(element).value
54
+
55
+ # The condition below check if we need to add or replace the newly created atome
56
+ if current_atome && !(@atome[:add] && @atome[:add][element])
57
+ detached(current_atome)
58
+ @atome[element] = []
59
+ end
60
+
61
+
62
+ # TODO :replace with the line below but need extensive testing as it crash some demos ex: animation
63
+ params = atome_common(element, params)
64
+ # ############ code to remove below
65
+ # parent_found = found_parents_and_renderers[:parent]
66
+ # render_found = found_parents_and_renderers[:renderers]
67
+ # default_params = Essentials.default_params[element] || {}
68
+ # generated_id = params[:id] || identity_generator(element)
69
+ #
70
+ # default_params = { renderers: render_found, id: generated_id, type: element,
71
+ # attach: parent_found }.merge(default_params)
72
+ # params = default_params.merge(params).merge({ clones: [] })
73
+ # ############ code to remove above
74
+ # puts params[:renderers]
75
+ # puts params[:id]
76
+ # new_params= {renderers: params[:renderers], id: params[:id]}.merge(params)
77
+ #
78
+ # params=new_params
79
+ # puts "new_params : #{params}"
80
+ ###
81
+ ###
82
+ # puts "params :\n #{params}\n\n, params2 :\n #{params2}"
68
83
  run_optional_proc("pre_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
69
- create_atome(element)
70
84
  run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
71
- send("set_#{element}", params, &user_proc)
85
+ send("set_#{element}", params, &user_proc) # it call Atome.define_method "set_#{element}" in new_atome method
72
86
  end
73
87
 
74
- # def atome_initializer(element, params = {})
75
- # temp_default = Essentials.default_params[element] || {}
76
- # generated_render = params[:renderers] || []
77
- # generated_id = params[:id] || identity_generator(:element)
78
- # alert "generated_parents: #{id.value}"
79
- # generated_parents = params[:parents] || [id.value]
80
- # generated_children = params[:children] || []
81
- # temp_default[:id] = generated_id
82
- # temp_default[:parents] = generated_parents
83
- # temp_default[:clones] = []
84
- # temp_default[:renderers] = generated_render
85
- # temp_default[:children] = generated_children
86
- # temp_default.merge(params)
87
- # end
88
-
89
88
  def new_atome(element, &method_proc)
90
- Atome.define_method element do |params = nil, &user_proc|
91
89
 
90
+ # the method define below is the slowest but params are analysed and sanitized
91
+ Atome.define_method element do |params = nil, &user_proc|
92
92
  if params
93
93
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
94
- atome_creation_pre_treatment(element, params, &user_proc)
94
+ atome_parsing(element, params, &user_proc)
95
95
  else
96
96
  get_atome(element, &user_proc)
97
97
  end
98
98
  end
99
+
100
+ # the method define below is the fastest params are passed directly
101
+ Atome.define_method "set_#{element}" do |params, &user_proc|
102
+ # we add the newly created atome to the list of "child in it's category, eg if it's a shape we add the new atome
103
+ # to the shape particles list : @atome[:shape] << params[:id]
104
+ new_atome = Atome.new({ element => params }, &user_proc)
105
+ # Now we return the newly created atome instead of the current atome that is the parent cf: b=box; c=b.circle
106
+ # c must return the circle not the parent box
107
+ new_atome
108
+ end
99
109
  # the method below generate Atome method creation at Object level
100
110
  create_method_at_object_level(element)
111
+
101
112
  end
102
113
 
103
114
  def new_render_engine(renderer_name, &method_proc)
@@ -158,8 +169,6 @@ class Atome
158
169
  virtual_atome.real_atome = @atome
159
170
  virtual_atome.property = element
160
171
  virtual_atome.user_proc = user_proc
161
- # run_optional_proc("pre_get_#{@atome[:type]}".to_sym, 'virtual_atome', &user_proc)
162
- # run_optional_proc("pre_get_#{element}".to_sym, self, 'virtual_atome', &user_proc)
163
172
  virtual_atome
164
173
  end
165
174
 
@@ -172,11 +181,5 @@ class Atome
172
181
  virtual_atome
173
182
  end
174
183
 
175
- def create_atome(new_atome)
176
- Atome.define_method "set_#{new_atome}" do |params, &user_proc|
177
- Atome.new({ new_atome => params }, &user_proc)
178
- end
179
- end
180
-
181
184
  Universe.connected
182
185
  end
@@ -20,7 +20,7 @@ def new(params, &bloc)
20
20
  end
21
21
  end
22
22
 
23
- def identity_generator(type=:element)
23
+ def identity_generator(type = :element)
24
24
  "#{type}_#{Universe.counter}"
25
25
  # { date: Time.now, location: geolocation }
26
26
  end
@@ -46,7 +46,7 @@ end
46
46
  def create_method_at_object_level(element)
47
47
 
48
48
  Object.define_method element do |params, &user_proc|
49
- default_parent=Essentials.default_params[element][:parents][0]# we get the first parents
49
+ default_parent=Essentials.default_params[element][:attach][0] # we get the first parents
50
50
  grab(default_parent).send(element, params, &user_proc)
51
51
  end
52
52
 
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- #
3
2
 
4
3
  module Matrix
5
4
  def content(items = nil)
@@ -80,6 +79,7 @@ module Matrix
80
79
  cells_to_alter = cells_in_column[value[0]..value[1]]
81
80
  cells_to_alter.each_with_index do |cell_nb, index|
82
81
  current_cell = grab("#{id.value}_#{cell_nb}")
82
+ # puts "==> current cell is #{id}"
83
83
  if index.zero?
84
84
  current_cell.height(cell_height * cells_to_alter.length + @margin * (cells_to_alter.length - 1))
85
85
  else
@@ -173,9 +173,8 @@ module Matrix
173
173
  x = (col_index + 1) * margin + col_index * cell_width
174
174
  y = (row_index + 1) * margin + row_index * cell_height
175
175
  current_cell = grab("#{matrix_id}_#{i}")
176
- # puts "===> #{current_cell}"
177
- current_cell.children.each do |child|
178
- # puts "=>#{cell_width}"
176
+ # puts current_cell
177
+ current_cell.materials.each do |child|
179
178
  grab(child).width(cell_width) if grab(child)
180
179
  grab(child).height(cell_width) if grab(child)
181
180
  end
@@ -189,19 +188,21 @@ module Matrix
189
188
 
190
189
  # exceptions management
191
190
 
192
- number_of_cells = nb_of_rows * nb_of_cols
191
+ # number_of_cells = nb_of_rows * nb_of_cols
193
192
  # columns exceptions
193
+ # return
194
194
  return unless exceptions
195
195
 
196
196
  fusion({ columns: exceptions[:columns_fusion] }) if exceptions[:columns_fusion]
197
- fusion({ rows: exceptions[:rows_fusion] }) if exceptions[:rows_fusion]
198
- divide({ columns: exceptions[:columns_divided] }) if exceptions[:columns_divided]
199
- divide({ rows: exceptions[:rows_divided] }) if exceptions[:rows_divided]
197
+ # fusion({ rows: exceptions[:rows_fusion] }) if exceptions[:rows_fusion]
198
+ # divide({ columns: exceptions[:columns_divided] }) if exceptions[:columns_divided]
199
+ # divide({ rows: exceptions[:rows_divided] }) if exceptions[:rows_divided]
200
200
  end
201
201
 
202
202
  def apply_style(current_cell, style)
203
203
  current_cell.set(style)
204
204
  end
205
+
205
206
  def matrix_sanitizer(params)
206
207
  default_params = {
207
208
 
@@ -213,8 +214,10 @@ module Matrix
213
214
  }
214
215
  default_params.merge(params)
215
216
  end
217
+
216
218
  def matrix(params = {}, &bloc)
217
- params= matrix_sanitizer(params)
219
+ params = matrix_sanitizer(params)
220
+
218
221
  columns_data = if params[:columns]
219
222
  params.delete(:columns)
220
223
  else
@@ -241,14 +244,17 @@ module Matrix
241
244
  exceptions_data = params.delete(:exceptions)
242
245
  default_renderer = Essentials.default_params[:render_engines]
243
246
  atome_type = :matrix
244
- generated_render = params[:renderers] || default_renderer
247
+ # generated_render = params[:renderers] || default_renderer
245
248
  generated_id = params[:id] || identity_generator(:matrix)
246
-
247
- generated_parents = params[:parents] || [id.value]
248
- generated_children = params[:children] || []
249
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
250
- the_matrix = Atome.new({ atome_type => params }, &bloc)
251
-
249
+ #
250
+ # generated_parents = params[:parents] || [id.value]
251
+ # generated_children = params[:shape] || []
252
+ # params = atome_common(atome_type, params)
253
+ params = atome_common(:matrix, params)
254
+ # puts "====>#{params} #{params.class}"
255
+ the_matrix = Atome.new( atome_type => params , &bloc)
256
+ # the_matrix = Atome.new(matrix: { type: :shape, id: :my_table, renderers: [:browser], parents: [] }, &bloc)
257
+ # example = Atome.new(code: { type: :code, renderers: [:headless], parents: [], children: [] })
252
258
  # TODO: use the standard atome creation method (generator.build_atome(:collector)),
253
259
  # TODO suite => For now its impossible to make it draggable because it return the created box not the matrix
254
260
  # get necessary params
@@ -322,7 +328,10 @@ module Matrix
322
328
  apply_style(current_cell, cells_data[:particles])
323
329
  end
324
330
  # lets create the columns and rows
331
+
332
+ # puts "(#{matrix_id}, #{matrix_width}, #{matrix_height}, #{rows}, #{columns}, #{margin}, #{exceptions})"
325
333
  the_matrix.format_matrix(matrix_id, matrix_width, matrix_height, rows, columns, margin, exceptions)
334
+
326
335
  the_matrix
327
336
  end
328
337
 
@@ -405,3 +414,5 @@ end
405
414
  class Atome
406
415
  include Matrix
407
416
  end
417
+
418
+
@@ -3,136 +3,179 @@
3
3
  new({ atome: :color, type: :hash })
4
4
 
5
5
  new({ sanitizer: :color }) do |params|
6
- parent_found = found_parents_and_renderers[:parent]
7
- if parent_found == [:black_matter]
6
+ # TODO : when attaching color to a shadow it should colorized it , cf : c.shadow({color: :blue}) should work
7
+ # parent_found = found_parents_and_renderers[:parent]
8
+ # if parent_found == [:view]
9
+ # parent_found = [:black_matter] if parent_found == [:view]
10
+ # elsif color.value
11
+ # # we delete any previous color if there's one
12
+ # # puts "========= #{@atome[:color]}>We should delete the color now except : #{@atome[:add]} "
13
+ # unless @atome[:add] && @atome[:add][:color]
14
+ # detached(color.value)
15
+ # @atome[:color] = [] # we had the condition because the shadow may exist but
16
+ # end
17
+ # end
8
18
 
9
- elsif color.value
10
- # we delete any previous color if there's one
11
- detached(color.value)
12
- grab(color.value)&.delete(true) # we had the condition because the color may exist but
13
- # so it is not sanitized so it has no id
14
- end
15
19
 
16
- render_found = found_parents_and_renderers[:renderers]
17
- generated_id = params[:id] || identity_generator(:color)
18
20
 
19
- default_params = { renderers: render_found, id: generated_id, type: :color,
20
- attach: parent_found,
21
- red: 0, green: 0, blue: 0, alpha: 1 }
21
+
22
+ # puts "---> :: #{@atome[:add]}"
23
+ ## we delete any previous shadow if there's one
24
+ # if color.value
25
+ # puts 'We should delete now'
26
+ # attached.value.delete(color.value)
27
+ # grab(color.value)&.delete(true) # we had the condition because the color may exist but
28
+ # # so it is not sanitized so it has no id
29
+ # end
30
+ # parent_found = found_parents_and_renderers[:parent]
31
+ # parent_found = [:user_view] if parent_found == [:view]
32
+ # render_found = found_parents_and_renderers[:renderers]
33
+ # generated_id = params[:id] || identity_generator(:color)
34
+
35
+ # default_params = { red: 0, green: 0, blue: 0, alpha: 1 }
22
36
  params = create_color_hash(params) unless params.instance_of? Hash
23
- new_params = default_params.merge!(params)
24
- atome[:color] = new_params[:id]
25
- new_params
37
+ # new_params = default_params.merge!(params)
38
+ # atome[:color] = [new_params[:id]]
39
+ # test below
40
+ # atome[:color] = [:poil]
41
+ # puts "==> #{color.value}"
42
+ # test above
43
+ # new_params
44
+ # atome[:color] << :poil
45
+ # params={}
46
+ #
47
+ params
26
48
  end
27
49
 
50
+ # new({ sanitizer: :color }) do |params|
51
+ # parent_found = found_parents_and_renderers[:parent]
52
+ # # puts "'''''code_below_is_not_executed'''''"
53
+ # if parent_found == [:black_matter]
54
+ # alert :stop_get_out_we_are_the_strong_arm_of_the_law
55
+ # elsif color.value
56
+ # puts ">>> Code_below_is_not_executed : #{self}"
57
+ # # we delete any previous color if there's one
58
+ # # detached(color.value)
59
+ # grab(color.value)&.delete(true) # we had the condition because the color may exist but
60
+ # # so it is not sanitized so it has no id
61
+ # end
62
+ #
63
+ # render_found = found_parents_and_renderers[:renderers]
64
+ # generated_id = params[:id] || identity_generator(:color)
65
+ #
66
+ # default_params = { renderers: render_found, id: generated_id, type: :color,
67
+ # attach: parent_found,
68
+ # red: 0, green: 0, blue: 0, alpha: 1 }
69
+ # params = create_color_hash(params) unless params.instance_of? Hash
70
+ # new_params = default_params.merge!(params)
71
+ # new_params
72
+ # end
73
+
28
74
  new({ atome: :image })
29
75
  new({ sanitizer: :image }) do |params|
30
76
  unless params.instance_of? Hash
31
77
  # TODO : we have to convert all image to png or maintain a database with extension
32
78
  params = { path: "./medias/images/#{params}" }
33
79
  end
34
- default_renderer = Essentials.default_params[:render_engines]
35
- generated_id = params[:id] || identity_generator(:image)
36
-
37
- generated_render = params[:renderers] || default_renderer
38
- generated_parents = params[:parents] || id.value
39
- # TODO : the line below should get the value from default params Essentials
40
- temp_default = { renderers: generated_render, id: generated_id, type: :image, parents: [generated_parents],
41
- children: [], width: 99, height: 99, path: './medias/images/atome.svg' }
42
- params = temp_default.merge(params)
80
+ # default_renderer = Essentials.default_params[:render_engines]
81
+ # generated_id = params[:id] || identity_generator(:image)
82
+ #
83
+ # generated_render = params[:renderers] || default_renderer
84
+ # generated_parents = params[:attach] || id.value
85
+ # # TODO : the line below should get the value from default params Essentials
86
+ # temp_default = { renderers: generated_render, id: generated_id, type: :image, attach: [generated_parents],
87
+ # width: 99, height: 99, path: './medias/images/atome.svg' }
88
+ # params = temp_default.merge(params)
43
89
  params
44
90
  end
45
91
  new({ atome: :video })
46
- new({ sanitizer: :video }) do |params|
47
- parent_found = found_parents_and_renderers[:parent]
48
- render_found = found_parents_and_renderers[:renderers]
49
- generated_id = params[:id] || identity_generator(:video)
50
-
51
- default_params = { renderers: render_found, id: generated_id, type: :video,
52
- parents: parent_found }
53
- default_params.merge!(params)
54
- end
55
- new({ atome: :shadow })
92
+ # new({ sanitizer: :video }) do |params|
93
+ # parent_found = found_parents_and_renderers[:parent]
94
+ # render_found = found_parents_and_renderers[:renderers]
95
+ # generated_id = params[:id] || identity_generator(:video)
96
+ #
97
+ # default_params = { renderers: render_found, id: generated_id, type: :video,
98
+ # attach: parent_found }
99
+ # default_params.merge!(params)
100
+ # end
101
+ new({ atome: :shadow, type: :hash })
56
102
  new({ sanitizer: :shadow }) do |params|
57
-
58
- parent_found = found_parents_and_renderers[:parent]
59
- if parent_found == [:view]
60
- parent_found = [:black_matter] if parent_found == [:view]
61
- elsif shadow.value
62
- # we delete any previous color if there's one
63
- detached(shadow.value)
64
- grab(shadow.value)&.delete(true) # we had the condition because the shadow may exist but
65
- # so it is not sanitized so it has no id
66
- end
103
+ # TODO : when attaching color to a shadow it should colorised it , cf : c.shadow({color: :blue}) should work
104
+ # puts "############################{params}###{test}###{test2}##################################"
105
+ params = {} unless params.instance_of? Hash
106
+ # parent_found = found_parents_and_renderers[:parent]
107
+ # if parent_found == [:view]
108
+ # parent_found = [:black_matter] if parent_found == [:view]
109
+ # elsif shadow.value
110
+ # # we delete any previous color if there's one
111
+ # detached(shadow.value)
112
+ # grab(shadow.value)&.delete(true) # we had the condition because the shadow may exist but
113
+ # end
67
114
  ## we delete any previous shadow if there's one
68
115
  # if shadow.value
69
116
  # attached.value.delete(shadow.value)
70
- # grab(shadow.value)&.delete(true) # we had the condition because the color may exist but
117
+ # grab(shadow.value)&.delete(true) # we had the condition because the color may exist but
71
118
  # # so it is not sanitized so it has no id
72
119
  # end
73
120
  # parent_found = found_parents_and_renderers[:parent]
74
121
  # parent_found = [:user_view] if parent_found == [:view]
75
- render_found = found_parents_and_renderers[:renderers]
76
- generated_id = params[:id] || identity_generator(:shadow)
122
+ # render_found = found_parents_and_renderers[:renderers]
123
+ # generated_id = params[:id] || identity_generator(:shadow)
124
+
125
+ # default_params = { renderers: render_found, id: generated_id, type: :shadow,
126
+ # attach: parent_found,
127
+ # red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
128
+
129
+
130
+ default_params = {red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
77
131
 
78
- default_params = { renderers: render_found, id: generated_id, type: :shadow,
79
- attach: parent_found,
80
- red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
81
- # default_params.merge!(params)
82
- params = create_shadow_hash(params) unless params.instance_of? Hash
83
132
  new_params = default_params.merge!(params)
84
- atome[:shadow] = new_params
133
+ # atome[:shadow] = [new_params[:id]]
85
134
  new_params
86
-
87
135
  end
88
136
  new({ atome: :shape })
89
137
  new({ atome: :code })
90
138
  new({ atome: :audio })
91
139
  new({ atome: :element })
92
140
  new({ sanitizer: :element }) do |params|
93
- parent_found = found_parents_and_renderers[:parent]
94
- render_found = []
95
- generated_id = params[:id] || identity_generator(:element)
141
+ # parent_found = found_parents_and_renderers[:parent]
142
+ # render_found = []
143
+ # generated_id = params[:id] || identity_generator(:element)
96
144
 
97
- default_params = { renderers: render_found, id: generated_id, type: :element,
98
- parents: parent_found, data: '' }
145
+ default_params = { data: '' }
99
146
  default_params.merge!(params)
100
147
  end
101
148
  new({ atome: :web })
102
149
  new({ sanitizer: :web }) do |params|
103
- default_renderer = Essentials.default_params[:render_engines]
104
- generated_id = params[:id] || identity_generator(:web)
105
-
106
- generated_render = params[:renderers] || default_renderer
107
- generated_parents = params[:parents] || id.value
150
+ # default_renderer = Essentials.default_params[:render_engines]
151
+ # generated_id = params[:id] || identity_generator(:web)
152
+ #
153
+ # generated_render = params[:renderers] || default_renderer
154
+ # generated_parents = params[:attach] || id.value
108
155
  # TODO : the line below should get the value from default params Essentials
109
- temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
110
- children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
156
+ temp_default = { path: 'https://www.youtube.com/embed/usQDazZKWAk' }
111
157
  params = temp_default.merge(params)
112
158
  params
113
159
  end
114
160
  new({ atome: :collector })
115
161
  new({ atome: :animation })
116
- new({ sanitizer: :animation }) do |params|
117
- default_renderer = Essentials.default_params[:render_engines]
118
- atome_type = :animation
119
- generated_render = params[:renderers] || default_renderer
120
- generated_id = params[:id] || identity_generator(atome_type)
121
- generated_parents = params[:parents] || []
122
- generated_children = params[:children] || []
123
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
124
- params
125
- end
162
+ # new({ sanitizer: :animation }) do |params|
163
+ # default_renderer = Essentials.default_params[:render_engines]
164
+ # atome_type = :animation
165
+ # generated_render = params[:renderers] || default_renderer
166
+ # generated_id = params[:id] || identity_generator(atome_type)
167
+ # generated_parents = params[:attach] || []
168
+ # params = atome_common(atome_type, generated_id, generated_render, generated_parents, params)
169
+ # params
170
+ # end
126
171
  new({ atome: :text, type: :hash })
127
172
  new({ sanitizer: :text }) do |params|
128
173
  params = { data: params } unless params.instance_of? Hash
129
- default_renderer = Essentials.default_params[:render_engines]
130
- atome_type = :text
131
- generated_render = params[:renderers] || default_renderer
132
- generated_id = params[:id] || identity_generator(atome_type)
133
- generated_parents = params[:parents] || [id.value]
134
- generated_children = params[:children] || []
135
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
174
+ # default_renderer = Essentials.default_params[:render_engines]
175
+ # atome_type = :text
176
+ # generated_render = params[:renderers] || default_renderer
177
+ # generated_id = params[:id] || identity_generator(atome_type)
178
+ # generated_parents = params[:attach] || [id.value]
179
+ # params = atome_common(atome_type, generated_id, generated_render, generated_parents, params)
136
180
  params
137
181
  end
138
-