atome 0.5.3.8.0 → 0.5.3.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -3
  3. data/exe/atome +2 -3
  4. data/lib/atome/atome.rb +54 -35
  5. data/lib/atome/extensions/atome.rb +3 -2
  6. data/lib/atome/extensions/matrix.rb +27 -16
  7. data/lib/atome/genesis/generators/atome.rb +131 -88
  8. data/lib/atome/genesis/generators/identity.rb +82 -51
  9. data/lib/atome/genesis/generators/spatial.rb +8 -8
  10. data/lib/atome/genesis/generators/utility.rb +26 -17
  11. data/lib/atome/genesis/genesis.rb +11 -2
  12. data/lib/atome/genesis/sparkle.rb +6 -6
  13. data/lib/atome/helpers/essentials.rb +21 -17
  14. data/lib/atome/helpers/sanitizer.rb +10 -10
  15. data/lib/atome/helpers/utilities.rb +84 -28
  16. data/lib/atome/kernel/batch.rb +0 -1
  17. data/lib/atome/kernel/universe.rb +1 -1
  18. data/lib/atome/presets/atome.rb +22 -23
  19. data/lib/atome/renderers/browser/atome.rb +2 -1
  20. data/lib/atome/renderers/browser/helpers/browser_helper.rb +17 -0
  21. data/lib/atome/renderers/browser/helpers/text_helper.rb +10 -2
  22. data/lib/atome/renderers/browser/identity.rb +23 -5
  23. data/lib/atome/renderers/browser/utility.rb +5 -4
  24. data/lib/atome/renderers/renderer.rb +1 -0
  25. data/lib/atome/version.rb +1 -1
  26. data/sig/atome.rbs +20 -0
  27. data/sig/essentials.rbs +11 -0
  28. data/vendor/assets/src/medias/images/icons/email.svg +12 -12
  29. data/vendor/assets/src/medias/rubies/examples/!run.rb +1 -1
  30. data/vendor/assets/src/medias/rubies/examples/add.rb +2 -3
  31. data/vendor/assets/src/medias/rubies/examples/animation.rb +2 -2
  32. data/vendor/assets/src/medias/rubies/examples/atome_new.rb +18 -6
  33. data/vendor/assets/src/medias/rubies/examples/{parents.rb → attach.rb} +6 -6
  34. data/vendor/assets/src/medias/rubies/examples/attached.rb +4 -4
  35. data/vendor/assets/src/medias/rubies/examples/box.rb +1 -1
  36. data/vendor/assets/src/medias/rubies/examples/code.rb +1 -1
  37. data/vendor/assets/src/medias/rubies/examples/color.rb +20 -4
  38. data/vendor/assets/src/medias/rubies/examples/delete.rb +2 -2
  39. data/vendor/assets/src/medias/rubies/examples/drag.rb +1 -1
  40. data/vendor/assets/src/medias/rubies/examples/fullscreen.rb +1 -1
  41. data/vendor/assets/src/medias/rubies/examples/image.rb +2 -2
  42. data/vendor/assets/src/medias/rubies/examples/link.rb +7 -5
  43. data/vendor/assets/src/medias/rubies/examples/markers.rb +1 -1
  44. data/vendor/assets/src/medias/rubies/examples/materials.rb +15 -0
  45. data/vendor/assets/src/medias/rubies/examples/monitoring.rb +44 -18
  46. data/vendor/assets/src/medias/rubies/examples/read.rb +2 -2
  47. data/vendor/assets/src/medias/rubies/examples/shadow.rb +1 -1
  48. data/vendor/assets/src/medias/rubies/examples/table.rb +2 -2
  49. data/vendor/assets/src/medias/rubies/examples/text.rb +4 -4
  50. data/vendor/assets/src/medias/rubies/examples/time.rb +1 -1
  51. data/vendor/assets/src/medias/rubies/examples/web.rb +2 -2
  52. metadata +7 -5
  53. /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: a7a73219833a1b762ef00a884f0799800a1b638742057c29352c98c4208f47df
4
- data.tar.gz: 7b343fa8cecaa21084ab2e764ce251b38dc954a8ff97d49e1a951fdcd18760fc
3
+ metadata.gz: 6e15b6625b3ba6dd5801418dd7dab9f9d0670dedb65e3ea8caa03df984f29541
4
+ data.tar.gz: 5a23055c7535a94ebe0c29b4dd226477b99564aa73a7f2640c533447bf24f52e
5
5
  SHA512:
6
- metadata.gz: 482d2e6986aef0fa1ff7dc11df7b89e62fb9fab3211196f9ef5b8be39050478d6735b24e99e9b0e263fdd0fbfcc1fc323ed28ee26daeb7871294ff847cf37d16
7
- data.tar.gz: d81ed5c1b4c5e5eacdc3cb85726d0e3d81781726c052bff148664fcf8fd11843f2af975ac3478be9c18b2cffd3cb6cf8a11c6a77de896b528095cc894b378fdf
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/exe/atome CHANGED
@@ -124,11 +124,10 @@ end
124
124
 
125
125
  def browser_case(location)
126
126
  # `cd #{location}/src;open index.html`
127
- guard_check
127
+ # `echo jello`
128
+ # guard_check
128
129
  end
129
130
 
130
- #
131
-
132
131
  def osx_case(location)
133
132
  `cd #{location};cargo tauri dev`
134
133
  end
data/lib/atome/atome.rb CHANGED
@@ -8,19 +8,20 @@
8
8
  class Atome
9
9
  # TODO : clean or delete @private_atome
10
10
  include Essentials
11
+
11
12
  private
12
13
 
13
14
  def initialize(atomes = {}, &atomes_proc)
15
+
14
16
  atomes.each_value do |elements|
15
17
  # the instance variable below contain the id all any atomes that need to be informed when changes occurs
16
18
  @broadcast = {}
17
19
  # now we store the proc in a an atome's property called :bloc
18
20
  elements[:code] = atomes_proc if atomes_proc
21
+
19
22
  @atome = elements
20
- # we initiate the rendering, eg for for browser we will call :browser_type generate method in identity.rb file
21
- create_particle(:type, true, true)
22
- # set type is a particle method it's dynamically generated at : generator/identity.rb
23
- set_type(@atome[:type])
23
+ # we initiate the rendering suing set_type method,
24
+ # eg for for browser we will call :browser_type generate method in identity.rb file
24
25
  collapse
25
26
  end
26
27
  end
@@ -30,7 +31,7 @@ class Atome
30
31
  if params || params == false
31
32
  # the line below execute the proc created when using the build_particle method
32
33
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
33
- params = sanitize(element, params,&user_proc)
34
+ params = sanitize(element, params, &user_proc)
34
35
  create_particle(element, store, render)
35
36
  send("set_#{element}", params, &user_proc)
36
37
  else
@@ -47,41 +48,67 @@ class Atome
47
48
  end
48
49
  end
49
50
 
50
- def atome_creation_pre_treatment(element, params, &user_proc)
51
+ def atome_parsing(element, params, &user_proc)
51
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}"
52
83
  run_optional_proc("pre_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
53
- create_atome(element)
54
84
  run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
55
- send("set_#{element}", params, &user_proc)
56
- end
57
-
58
- def atome_initializer(element, params = {})
59
- temp_default = Essentials.default_params[element] || {}
60
- generated_render = params[:renderers] || []
61
- generated_id = params[:id] || identity_generator(:element)
62
-
63
- generated_parents = params[:parents] || [id.value]
64
- generated_children = params[:children] || []
65
- temp_default[:id] = generated_id
66
- temp_default[:parents] = generated_parents
67
- temp_default[:clones] = []
68
- temp_default[:renderers] = generated_render
69
- temp_default[:children] = generated_children
70
- temp_default.merge(params)
85
+ send("set_#{element}", params, &user_proc) # it call Atome.define_method "set_#{element}" in new_atome method
71
86
  end
72
87
 
73
88
  def new_atome(element, &method_proc)
74
- Atome.define_method element do |params = nil, &user_proc|
75
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|
76
92
  if params
77
93
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
78
- atome_creation_pre_treatment(element, params, &user_proc)
94
+ atome_parsing(element, params, &user_proc)
79
95
  else
80
96
  get_atome(element, &user_proc)
81
97
  end
82
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
83
109
  # the method below generate Atome method creation at Object level
84
110
  create_method_at_object_level(element)
111
+
85
112
  end
86
113
 
87
114
  def new_render_engine(renderer_name, &method_proc)
@@ -119,10 +146,10 @@ class Atome
119
146
  # Params is now an instance variable so it should be passed thru different methods
120
147
  instance_variable_set("@#{element}", params) if store
121
148
  run_optional_proc("pre_render_#{element}".to_sym, self, params, &user_proc)
122
- rendering(element,params, &user_proc) if render
149
+ rendering(element, params, &user_proc) if render
123
150
  run_optional_proc("post_render_#{element}".to_sym, self, params, &user_proc)
124
151
  broadcasting(element)
125
- store_value(element) if store
152
+ store_value(element) if store
126
153
  self
127
154
  end
128
155
 
@@ -142,8 +169,6 @@ class Atome
142
169
  virtual_atome.real_atome = @atome
143
170
  virtual_atome.property = element
144
171
  virtual_atome.user_proc = user_proc
145
- # run_optional_proc("pre_get_#{@atome[:type]}".to_sym, 'virtual_atome', &user_proc)
146
- # run_optional_proc("pre_get_#{element}".to_sym, self, 'virtual_atome', &user_proc)
147
172
  virtual_atome
148
173
  end
149
174
 
@@ -156,11 +181,5 @@ class Atome
156
181
  virtual_atome
157
182
  end
158
183
 
159
- def create_atome(new_atome)
160
- Atome.define_method "set_#{new_atome}" do |params, &user_proc|
161
- Atome.new({ new_atome => params }, &user_proc)
162
- end
163
- end
164
-
165
184
  Universe.connected
166
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,8 @@ end
46
46
  def create_method_at_object_level(element)
47
47
 
48
48
  Object.define_method element do |params, &user_proc|
49
- grab(:view).send(element, params, &user_proc)
49
+ default_parent=Essentials.default_params[element][:attach][0] # we get the first parents
50
+ grab(default_parent).send(element, params, &user_proc)
50
51
  end
51
52
 
52
53
  end
@@ -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
+
@@ -1,138 +1,181 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({ atome: :color })
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 == [:view]
8
- parent_found = [:black_matter] if parent_found == [:view]
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
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
18
+
19
+
15
20
 
16
- render_found = found_parents_and_renderers[:renderers]
17
- generated_id = params[:id] || identity_generator(:color)
18
21
 
19
- default_params = { renderers: render_found, id: generated_id, type: :color,
20
- attach: parent_found,
21
- red: 0, green: 0, blue: 0, alpha: 1 }
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
126
- new({ atome: :text })
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
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
-