atome 0.5.7.3.6 → 0.5.7.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/documentation/deep learning/architecture.txt +4 -4
  4. data/documentation/deep learning/basic_infos.txt +2 -2
  5. data/documentation/deep learning/example_of_users_code.rb +43 -43
  6. data/documentation/installation/buiding_atome.md +2 -2
  7. data/lib/atome/atome.rb +1 -1
  8. data/lib/atome/extensions/atome.rb +22 -19
  9. data/lib/atome/genesis/atomes.rb +1 -1
  10. data/lib/atome/genesis/genesis.rb +19 -19
  11. data/lib/atome/genesis/particles/geometry.rb +3 -3
  12. data/lib/atome/genesis/particles/hierarchy.rb +56 -21
  13. data/lib/atome/genesis/particles/material.rb +13 -1
  14. data/lib/atome/genesis/particles/property.rb +27 -0
  15. data/lib/atome/genesis/particles/utility.rb +199 -91
  16. data/lib/atome/genesis/sparkle.rb +1 -1
  17. data/lib/atome/kernel/black_matter.rb +3 -0
  18. data/lib/atome/utilities/utilities.rb +19 -8
  19. data/lib/atome/version.rb +2 -1
  20. data/lib/molecules/intuition/tools.rb +30 -30
  21. data/lib/molecules/intuition/utilities.rb +169 -87
  22. data/lib/platform_specific/opal/extensions/object.rb +1 -1
  23. data/lib/renderers/html/html.rb +26 -1
  24. data/vendor/assets/application/examples/account.rb +35 -0
  25. data/vendor/assets/application/examples/actor&role.rb +23 -0
  26. data/vendor/assets/application/examples/animation.rb +1 -1
  27. data/vendor/assets/application/examples/applications.rb +11 -10
  28. data/vendor/assets/application/examples/atome.rb +1 -1
  29. data/vendor/assets/application/examples/attach.rb +7 -7
  30. data/vendor/assets/application/examples/attached.rb +13 -15
  31. data/vendor/assets/application/examples/basic_understanding.rb +1 -1
  32. data/vendor/assets/application/examples/buttons.rb +47 -0
  33. data/vendor/assets/application/examples/clear.rb +12 -12
  34. data/vendor/assets/application/examples/clones&monitoring.rb +1 -1
  35. data/vendor/assets/application/examples/delete.rb +19 -14
  36. data/vendor/assets/application/examples/detach.rb +8 -0
  37. data/vendor/assets/application/examples/dig.rb +1 -1
  38. data/vendor/assets/application/examples/display.rb +6 -6
  39. data/vendor/assets/application/examples/drag.rb +1 -1
  40. data/vendor/assets/application/examples/duplicate.rb +6 -6
  41. data/vendor/assets/application/examples/exchange.rb +17 -0
  42. data/vendor/assets/application/examples/generator_and_build.rb +3 -3
  43. data/vendor/assets/application/examples/hierarchy.rb +5 -5
  44. data/vendor/assets/application/examples/layout.rb +1 -1
  45. data/vendor/assets/application/examples/preset.rb +3 -3
  46. data/vendor/assets/application/examples/selected.rb +1 -1
  47. data/vendor/assets/application/examples/shapes.rb +1 -1
  48. data/vendor/assets/application/examples/size.rb +1 -1
  49. data/vendor/assets/application/examples/test.rb +0 -320
  50. data/vendor/assets/application/examples/tools.rb +136 -192
  51. data/vendor/assets/application/examples/unfasten.rb +17 -0
  52. data/vendor/assets/server/atome_server.rb +1 -0
  53. data/vendor/assets/server/eDen.rb +68 -71
  54. data/vendor/assets/src/index_server_wasm.html +4 -0
  55. data/vendor/assets/src/js/atome/specific/wasm.js +22 -4
  56. data/vendor/assets/src/js/third_parties/three.min.js +1 -1
  57. data/vendor/assets/src/medias/fonts/Roboto/LICENSE.txt +1 -1
  58. data/vendor/assets/src/medias/fonts/Roboto_Slab/LICENSE.txt +1 -1
  59. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdac6b85c37bdf4d8e6842a2b423912931a8d33dd693aa03dd90d46a8c91e16f
4
- data.tar.gz: d52b45f795e5c583a548a29a6d979ffc4fd6671907070c1b28f0234351a83131
3
+ metadata.gz: ddc505fc7f548b01c08b84bd2b3a9ce394ca9303ce9f13acdd8d20b0fc982d26
4
+ data.tar.gz: 2bba44abac153bb5e4aad6b6953d60b5eaa5b6e9883acf4dae8c73cf22b5da1a
5
5
  SHA512:
6
- metadata.gz: 276797c37915a64902cd3491ec29111aa17364e7aa87b7eeff16f3c7901428a9cd5f94117c459e5e9f11acfd7d39ccccbd5e8aea0baa8f96f57ec3f930710b8f
7
- data.tar.gz: 88e5562ae2ad330ae11c895e905296c56498f09868c0b881242b17d2c268c9aadd915e35b804610d54a9f3d68c3c6091d21483e3aff52f21186496ba6825b6e5
6
+ metadata.gz: dadc4db10cfd19828d6a2e66eb49b1e232a787a8181957c57b2be8f32b3892789bbdf26d96c32be8881d797df2a7408553c80e7d696d9c2241946b1860414465
7
+ data.tar.gz: afb512c526b3341cb872fc63804f8dbdc60b24bea7edad9c877f2a9289cb7c577cbe8a6700599c0b7c889d56a5278c7c0ede870f7425b92c38405636023a5101
data/CHANGELOG.md CHANGED
@@ -15,7 +15,7 @@ vector now use class instead of a local style
15
15
  ## [0.5.4.1.7] - 2023-05-25
16
16
 
17
17
  remove "shape :pre" and move the condition when using :definition to atome_common , because of a bug that remove all
18
- attached atome
18
+ fasten atome
19
19
 
20
20
  ## [0.5.4.1.8] - 2023-05-25
21
21
  Ready to add gradient color now systematically use a variable for each component( Red, green , blue , alpha)
@@ -344,7 +344,7 @@ This is a detailed view of the file tree of the Atome framework:
344
344
  │ │ │ ├── animation.rb
345
345
  │ │ │ ├── atome_new.rb
346
346
  │ │ │ ├── attach.rb
347
- │ │ │ ├── attached.rb
347
+ │ │ │ ├── fasten.rb
348
348
  │ │ │ ├── auto_height.rb
349
349
  │ │ │ ├── auto_width.rb
350
350
  │ │ │ ├── batch.rb
@@ -507,7 +507,7 @@ This is a detailed view of the file tree of the Atome framework:
507
507
  │ │ │ ├── animation.rb
508
508
  │ │ │ ├── atome.rb
509
509
  │ │ │ ├── attach.rb
510
- │ │ │ ├── attached.rb
510
+ │ │ │ ├── fasten.rb
511
511
  │ │ │ ├── basic_understanding.rb
512
512
  │ │ │ ├── browse.rb
513
513
  │ │ │ ├── callback.rb
@@ -3453,7 +3453,7 @@ This is a detailed view of the file tree of the Atome framework:
3453
3453
  │ │ │ ├── animation.rb
3454
3454
  │ │ │ ├── atome.rb
3455
3455
  │ │ │ ├── attach.rb
3456
- │ │ │ ├── attached.rb
3456
+ │ │ │ ├── fasten.rb
3457
3457
  │ │ │ ├── browse.rb
3458
3458
  │ │ │ ├── callback.rb
3459
3459
  │ │ │ ├── clear.rb
@@ -3532,7 +3532,7 @@ This is a detailed view of the file tree of the Atome framework:
3532
3532
  │ │ ├── animation.rb
3533
3533
  │ │ ├── atome.rb
3534
3534
  │ │ ├── attach.rb
3535
- │ │ ├── attached.rb
3535
+ │ │ ├── fasten.rb
3536
3536
  │ │ ├── basic_understanding.rb
3537
3537
  │ │ ├── browse.rb
3538
3538
  │ │ ├── callback.rb
@@ -232,14 +232,14 @@ Each Each particles and atome is store as an :
232
232
  It may need a bit more optimization
233
233
 
234
234
 
235
- Atomes have a special method to monitor all attached /affected atomes , call : Atome.global_monitoring
235
+ Atomes have a special method to monitor all fasten /affected atomes , call : Atome.global_monitoring
236
236
  Code at : helpers/utilities.rb /def global_monitoring
237
237
  Usage :
238
238
  Atome.global_monitoring(self, [:red, :blue, :blue, :alpha, :left, :right, :diffusion], [:variable1, :variable2])
239
239
 
240
240
  The ephemera @new_atome to allow access to data send to the atome at init time
241
241
 
242
- Important : for atomes that needs to be attached or apply to
242
+ Important : for atomes that needs to be fasten or apply to
243
243
  This happen in the method in presets/atome.rb : atome_common
244
244
  at this line :
245
245
  if params[:type] == :color || basic_params[:type] == :color || params[:type] == :shadow || basic_params[:type] == :shadow
@@ -6,17 +6,17 @@ b.animate(true)
6
6
 
7
7
 
8
8
  Atome.new( { renderers: [:html], attach: [:view],id: :my_test_box, type: :shape, apply: [:shape_color],
9
- left: 120, top: 0, width: 100, smooth: 15, height: 100, overflow: :visible, attached: [], center: true
9
+ left: 120, top: 0, width: 100, smooth: 15, height: 100, overflow: :visible, fasten: [], center: true
10
10
  })
11
11
 
12
12
 
13
13
  # Here is the attach explanation and example
14
14
  # the attach method in atome is both a getter and a setter
15
- # attach and attached particles serve the same purpose but just in the opposite direction
15
+ # attach and fasten particles serve the same purpose but just in the opposite direction
16
16
  # please note that atome.attach([:atome_id]) means that atome will be the parent of the atome with the id :atome_id
17
- # to sum up : attach and attached are both setter and getter :
17
+ # to sum up : attach and fasten are both setter and getter :
18
18
  # attach will attach the current object to the IDs passed in the params. The current atome will be the child of the the atomes width IDS passed in the the params,
19
- # while attached is the opposite to attached it will attach IDs passed in the params to the current atome. The current atome will be the parent of of the the atomes width IDS passed in the the params
19
+ # while fasten is the opposite to fasten it will attach IDs passed in the params to the current atome. The current atome will be the parent of of the the atomes width IDS passed in the the params
20
20
 
21
21
  # atome.attach([:atome_id]) means that atome will be the child of the atome with the id :atome_id
22
22
  # Here is how to use it as a setter :
@@ -36,20 +36,20 @@ box({ id: :my_test_box })
36
36
  wait 1 do
37
37
  b.attach([:c_12])
38
38
  # Here is how to use it as a getter :
39
- # to retrieve witch atomes b315 is attached to to the atome c_12 just type
39
+ # to retrieve witch atomes b315 is fasten to to the atome c_12 just type
40
40
  puts b.attach # => [:c_12]
41
- # to retrieve atome attached to the atome c_12 just type tha other method
42
- puts c.attached #=> [:b_1]
41
+ # to retrieve atome fasten to the atome c_12 just type tha other method
42
+ puts c.fasten #=> [:b_1]
43
43
  end
44
44
 
45
- # Here is the attached explanation and example :
45
+ # Here is the fasten explanation and example :
46
46
 
47
- # the attached method in atome is both a getter and a setter
48
- # attach and attached particles serve the same purpose but just in the opposite direction
47
+ # the fasten method in atome is both a getter and a setter
48
+ # attach and fasten particles serve the same purpose but just in the opposite direction
49
49
  # please note that atome.attach([:atome_id]) means that atome will be the parent of the atome with the id :atome_id
50
- # to sum up : attach and attached are both setter and getter :
50
+ # to sum up : attach and fasten are both setter and getter :
51
51
  # attach will attach the current object to the IDs passed in the params. The current atome will be the child of the the atomes width IDS passed in the the params,
52
- # while attached is the opposite to attached it will attach IDs passed in the params to the current atome. The current atome will be the parent of of the the atomes width IDS passed in the the params
52
+ # while fasten is the opposite to fasten it will attach IDs passed in the params to the current atome. The current atome will be the parent of of the the atomes width IDS passed in the the params
53
53
 
54
54
 
55
55
  # Here is how to use it as a setter :
@@ -63,13 +63,13 @@ end
63
63
  c = circle({ left: 333, id: :the_circle })
64
64
  wait 2 do
65
65
  c.apply(:inactive_color)
66
- b.attached([c.id])
66
+ b.fasten([c.id])
67
67
 
68
68
  # Here is how to use it as a getter :
69
- # to retrieve witch atomes b315 is attached to to the atome c_12 just type
69
+ # to retrieve witch atomes b315 is fasten to to the atome c_12 just type
70
70
  puts c.attach # => [:the_box]
71
- # to retrieve atome attached to the atome c_12 just type tha other method
72
- puts b.attached #=> [:the_circle]
71
+ # to retrieve atome fasten to the atome c_12 just type tha other method
72
+ puts b.fasten #=> [:the_circle]
73
73
  end
74
74
 
75
75
 
@@ -121,7 +121,7 @@ a.apply([:box_color])
121
121
  wait 2 do
122
122
  # a bit less efficient and a bit more processor intensive solution is to use the box preset, that render a box too
123
123
  b=box
124
- # we can add a color atome onto the new atome my_shape. as stated before for some atome types such as color, shadows ,the relation between the two atomes won't be attach and attached but apply and affect instead the atome color with the particle red onto the
124
+ # we can add a color atome onto the new atome my_shape. as stated before for some atome types such as color, shadows ,the relation between the two atomes won't be attach and fasten but apply and affect instead the atome color with the particle red onto the
125
125
  b.color(:red)
126
126
  end
127
127
 
@@ -173,56 +173,56 @@ end
173
173
 
174
174
 
175
175
  #Atome.new(
176
- # { renderers: [], id: :eDen, type: :element, tag: { system: true }, attach: [], attached: [] }
176
+ # { renderers: [], id: :eDen, type: :element, tag: { system: true }, attach: [], fasten: [] }
177
177
  # )
178
178
  # Atome.new(
179
179
  # { renderers: [], id: :user_view, type: :element, tag: { system: true },
180
- # attach: [:eDen], attached: [] }
180
+ # attach: [:eDen], fasten: [] }
181
181
  # )
182
182
  #
183
183
  # # color creation
184
184
  # Atome.new(
185
185
  # { renderers: default_render, id: :view_color, type: :color, tag: ({ system: true, persistent: true }),
186
- # red: 0.15, green: 0.15, blue: 0.15, alpha: 1, top: 12, left: 12, diffusion: :linear, attach: [], attached: [] }
186
+ # red: 0.15, green: 0.15, blue: 0.15, alpha: 1, top: 12, left: 12, diffusion: :linear, attach: [], fasten: [] }
187
187
  # )
188
188
  #
189
189
  # Atome.new(
190
190
  # { renderers: default_render, id: :shape_color, type: :color, tag: ({ system: true, persistent: true }),
191
- # red: 0.4, green: 0.4, blue: 0.4, alpha: 1, attach: [], attached: [] }
191
+ # red: 0.4, green: 0.4, blue: 0.4, alpha: 1, attach: [], fasten: [] }
192
192
  # )
193
193
  #
194
194
  # Atome.new(
195
195
  # { renderers: default_render, id: :box_color, type: :color, tag: ({ system: true, persistent: true }),
196
- # red: 0.5, green: 0.5, blue: 0.5, alpha: 1, attach: [], attached: [] }
196
+ # red: 0.5, green: 0.5, blue: 0.5, alpha: 1, attach: [], fasten: [] }
197
197
  # )
198
198
  #
199
199
  # Atome.new(
200
200
  # { renderers: default_render, id: :invisible_color, type: :color, tag: ({ system: true, persistent: true }),
201
- # red: 0, green: 0, blue: 0, alpha: 1, attach: [], attached: [] }
201
+ # red: 0, green: 0, blue: 0, alpha: 1, attach: [], fasten: [] }
202
202
  # )
203
203
  #
204
204
  # Atome.new(
205
205
  # { renderers: default_render, id: :text_color, type: :color, tag: ({ system: true, persistent: true }),
206
- # red: 0.9, green: 0.9, blue: 0.9, alpha: 1, attach: [], attached: [] }
206
+ # red: 0.9, green: 0.9, blue: 0.9, alpha: 1, attach: [], fasten: [] }
207
207
  # )
208
208
  #
209
209
  # Atome.new(
210
210
  # { renderers: default_render, id: :circle_color, type: :color, tag: ({ system: true, persistent: true }),
211
- # red: 0.6, green: 0.6, blue: 0.6, alpha: 1, attach: [], attached: [] }
211
+ # red: 0.6, green: 0.6, blue: 0.6, alpha: 1, attach: [], fasten: [] }
212
212
  # )
213
213
  #
214
214
  # # system object creation
215
215
  # # the black_matter is used to store un materialized atomes
216
216
  # Atome.new(
217
217
  # { renderers: default_render, id: :black_matter, type: :shape, attach: [:user_view],apply: [],
218
- # left: 0, right: 0, top: 0, bottom: 0, width: 0, height: 0, overflow: :hidden, tag: { system: true }, attached: []
218
+ # left: 0, right: 0, top: 0, bottom: 0, width: 0, height: 0, overflow: :hidden, tag: { system: true }, fasten: []
219
219
  # })
220
220
  #
221
221
  # # view port
222
222
  # Atome.new(
223
223
  # { renderers: default_render, id: :view, type: :shape, attach: [:user_view], apply: [:view_color],
224
224
  # tag: { system: true },
225
- # attached: [], left: 0, right: 0, top: 0, bottom: 0, width: :auto, height: :auto, overflow: :auto,
225
+ # fasten: [], left: 0, right: 0, top: 0, bottom: 0, width: :auto, height: :auto, overflow: :auto,
226
226
  # }
227
227
  #
228
228
  # )
@@ -230,7 +230,7 @@ end
230
230
  # # unreal port, hold system object and tools
231
231
  # Atome.new(
232
232
  # { renderers: default_render, id: :intuition, type: :shape, attach: [:user_view], tag: { system: true },
233
- # left: 0, top: 0, width: 0, height: 0, overflow: :visible, attached: [],apply: []
233
+ # left: 0, top: 0, width: 0, height: 0, overflow: :visible, fasten: [],apply: []
234
234
  # }
235
235
  # )
236
236
  #
@@ -247,7 +247,7 @@ end
247
247
  # Universe.current_machine = machine_id
248
248
  # # the constant A is used to access alla atomes methods
249
249
  # A = Atome.new(
250
- # { renderers: default_render, id: :atome, type: :element, tag: { system: true }, attach: [], attached: [] }
250
+ # { renderers: default_render, id: :atome, type: :element, tag: { system: true }, attach: [], fasten: [] }
251
251
  # )#
252
252
  #
253
253
  # # TODO : clones alteration must be bidirectional, to do so :
@@ -257,7 +257,7 @@ end
257
257
  #
258
258
  # b = box({ color: :red, smooth: 6, id: :the_box })
259
259
  #
260
- # b.clones([{ left: 300, top: 300, color: :blue, entangled: [:width, :attached, :height] },
260
+ # b.clones([{ left: 300, top: 300, color: :blue, entangled: [:width, :fasten, :height] },
261
261
  # { left: 600, top: 366, color: :green, entangled: [:left, :height] }])
262
262
  #
263
263
  # wait 1 do
@@ -570,8 +570,8 @@ def duplicate(ids)
570
570
 
571
571
  atome_passed=grab(id_passed)
572
572
  # atome_passed.particles.delete(:left)
573
- # we remove attached
574
- particle_to_remove=[:id, :broadcast, :history,:callback, :html_object, :store_allow,:attached]
573
+ # we remove fasten
574
+ particle_to_remove=[:id, :broadcast, :history,:callback, :html_object, :store_allow,:fasten]
575
575
  particles_found=atome_passed.particles.dup
576
576
  particles_found.delete_if { |key, value| particle_to_remove.include?(key) }
577
577
  particles_found[:id]=identity_generator(particles_found[:type])
@@ -601,7 +601,7 @@ c.text(:hello)
601
601
  b.touch(true) do
602
602
  puts @id
603
603
  end
604
- b.clones([{ left: 300, top: 300, color: :blue, entangled: [:width, :attached, :height] },
604
+ b.clones([{ left: 300, top: 300, color: :blue, entangled: [:width, :fasten, :height] },
605
605
  { left: 600, top: 366, color: :green, entangled: [:left, :height] }])
606
606
 
607
607
 
@@ -769,7 +769,7 @@ clone = ""
769
769
  b.drag(:start) do
770
770
  b.color(:black)
771
771
  b.height(123)
772
- # beware you must use grab(:view) else it'll be attached to the context, that means to 'b' in this case
772
+ # beware you must use grab(:view) else it'll be fasten to the context, that means to 'b' in this case
773
773
  clone = grab(:view).circle({ id: "#{b.id}_cloned",color: :white, left: b.left, top: b.top, depth: 3 })
774
774
  end
775
775
 
@@ -961,7 +961,7 @@ end
961
961
  # FIXME : on touch code above crash but works with wait
962
962
 
963
963
 
964
- # here is how to setup a hierarchy within atome using a more simple way than attached and attach .simply adding atome inside another atome. here is a example to do to so : b = box({ id: :the_box })
964
+ # here is how to setup a hierarchy within atome using a more simple way than fasten and attach .simply adding atome inside another atome. here is a example to do to so : b = box({ id: :the_box })
965
965
  b=box
966
966
  # the line below will create a circle inside the box b
967
967
  c = b.circle({ id: :the_circle })
@@ -972,14 +972,14 @@ t.image({ path: 'medias/images/logos/atome.svg', width: 33 })
972
972
 
973
973
  # note that creating a hierarchy this way automatically
974
974
 
975
- # Note that when you create a hierarchy in this way, it automatically creates a relationship by populating the 'attach' and 'attached' properties. So, if you enter:
975
+ # Note that when you create a hierarchy in this way, it automatically creates a relationship by populating the 'attach' and 'fasten' properties. So, if you enter:
976
976
 
977
977
 
978
- puts "b attach : #{b.attach}" # prints [:view] in the console as it is attached to the view atom
979
- puts "b attached :#{b.attached}" # prints [:the_circle, :the_cirle] in the console
978
+ puts "b attach : #{b.attach}" # prints [:view] in the console as it is fasten to the view atom
979
+ puts "b fasten :#{b.fasten}" # prints [:the_circle, :the_cirle] in the console
980
980
 
981
981
  puts "c attach: #{c.attach}" # prints [:the_box] in the console
982
- puts "c attached: #{c.attached}" # prints [:box_14] in the console as there's no child#
982
+ puts "c fasten: #{c.fasten}" # prints [:box_14] in the console as there's no child#
983
983
 
984
984
  b = box({ id: :the_box })
985
985
  b.data(:canyouwritethis)
@@ -1344,7 +1344,7 @@ puts "restrict ro :view doesnt work"
1344
1344
  my_box=box
1345
1345
  # using the code line above a lot of particles will be implicitly created, if we inspect my_box
1346
1346
  puts my_box.inspect # this will print :
1347
- #[Log] #<Atome: @broadcast={}, @callback={}, @tag={}, @attached=[], @unit={}, @collected={}, @id=:box_14, @type=:shape, @html=#<HTML:0x0662a164 @element=[object HTMLDivElement], @id="box_14", @original_atome=#<Atome: @broadcast={}, @callback={}, @tag={}, @attached=[], @unit={}, @collected={}, @id=:box_14, @type=:shape, @html=#<HTML:0x0662a164 ...>, @attach=[:view], @renderers=[:html], @width=99, @height=99, @apply=[:box_color], @left=100, @top=100, @clones=[], @preset={:box=>{:width=>99, :height=>99, :apply=>[:box_color], :left=>100, :top=>100, :clones=>[]}}>, @element_type="div">, @attach=[:view], @renderers=[:html], @width=99, @height=99, @apply=[:box_color], @left=100, @top=100, @clones=[], @preset={:box=>{:width=>99, :height=>99, :apply=>[:box_color], :left=>100, :top=>100, :clones=>[]}}> (browser.script.iife.min.js, line 13)
1347
+ #[Log] #<Atome: @broadcast={}, @callback={}, @tag={}, @fasten=[], @unit={}, @collected={}, @id=:box_14, @type=:shape, @html=#<HTML:0x0662a164 @element=[object HTMLDivElement], @id="box_14", @original_atome=#<Atome: @broadcast={}, @callback={}, @tag={}, @fasten=[], @unit={}, @collected={}, @id=:box_14, @type=:shape, @html=#<HTML:0x0662a164 ...>, @attach=[:view], @renderers=[:html], @width=99, @height=99, @apply=[:box_color], @left=100, @top=100, @clones=[], @preset={:box=>{:width=>99, :height=>99, :apply=>[:box_color], :left=>100, :top=>100, :clones=>[]}}>, @element_type="div">, @attach=[:view], @renderers=[:html], @width=99, @height=99, @apply=[:box_color], @left=100, @top=100, @clones=[], @preset={:box=>{:width=>99, :height=>99, :apply=>[:box_color], :left=>100, :top=>100, :clones=>[]}}> (browser.script.iife.min.js, line 13)
1348
1348
 
1349
1349
  # please note that an ID is automatically created using a simple strategy id : atome_type_total_number_of_users_atomes ex here : @id="box_14"
1350
1350
 
@@ -1355,7 +1355,7 @@ puts " my_box preset is : #{my_box.preset}"
1355
1355
 
1356
1356
  c=circle
1357
1357
  puts " c is : #{c.inspect }"
1358
- # this print : [Log] c is : #<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_16, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @attached=[], @unit={}, @collected={}, @html=#<HTML:0x06579be8 @element=[object HTMLDivElement], @id="circle_16", @original_atome=#<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_16, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @attached=[], @unit={}, @collected={}, @html=#<HTML:0x06579be8 ...>, @top=100, @attach=[:view], @left=100, @apply=[:circle_color], @clones=[], @preset={:circle=>{:width=>99, :height=>99, :smooth=>"100%", :apply=>[:circle_color], :left=>100, :top=>100, :clones=>[]}}>, @element_type="div">, @top=100, @attach=[:view], @left=100, @apply=[:circle_color], @clones=[], @preset={:circle=>{:width=>99, :height=>99, :smooth=>"100%", :apply=>[:circle_color], :left=>100, :top=>100, :clones=>[]}}> (browser.script.iife.min.js, line 13)
1358
+ # this print : [Log] c is : #<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_16, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @fasten=[], @unit={}, @collected={}, @html=#<HTML:0x06579be8 @element=[object HTMLDivElement], @id="circle_16", @original_atome=#<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_16, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @fasten=[], @unit={}, @collected={}, @html=#<HTML:0x06579be8 ...>, @top=100, @attach=[:view], @left=100, @apply=[:circle_color], @clones=[], @preset={:circle=>{:width=>99, :height=>99, :smooth=>"100%", :apply=>[:circle_color], :left=>100, :top=>100, :clones=>[]}}>, @element_type="div">, @top=100, @attach=[:view], @left=100, @apply=[:circle_color], @clones=[], @preset={:circle=>{:width=>99, :height=>99, :smooth=>"100%", :apply=>[:circle_color], :left=>100, :top=>100, :clones=>[]}}> (browser.script.iife.min.js, line 13)
1359
1359
  # it's pôssible to alter basic preset using the particle .preset
1360
1360
  my_box.preset({ circle: {type: :shape, :width=>99, :height=>99, :smooth=>"100%", color: :red, :left=>100, :top=>100, :clones=>[]}})
1361
1361
  puts " my_box preset is now : #{my_box.preset}"
@@ -1366,7 +1366,7 @@ my_box.touch(true) do
1366
1366
 
1367
1367
  new_circle=circle # as the preset circle has been modified tha circle is now red as specified in the updated preset
1368
1368
  puts "new_circle is : #{new_circle.inspect}"
1369
- # this print : new_circle is : #<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_18, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @attached=[], @unit={}, @collected={}, @html=#<HTML:0x0664e99c @element=[object HTMLDivElement], @id="circle_18", @original_atome=#<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_18, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @attached=[], @unit={}, @collected={}, @html=#<HTML:0x0664e99c ...>, @top=100, @attach=[:box_14], @left=100, @apply=[:circle_18_color_1_0_0_0_0_0____], @clones=[]>, @element_type="div">, @top=100, @attach=[:box_14], @left=100, @apply=[:circle_18_color_1_0_0_0_0_0____], @clones=[]>
1369
+ # this print : new_circle is : #<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_18, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @fasten=[], @unit={}, @collected={}, @html=#<HTML:0x0664e99c @element=[object HTMLDivElement], @id="circle_18", @original_atome=#<Atome: @type=:shape, @smooth="100%", @width=99, @id=:circle_18, @renderers=[:html], @height=99, @broadcast={}, @callback={}, @tag={}, @fasten=[], @unit={}, @collected={}, @html=#<HTML:0x0664e99c ...>, @top=100, @attach=[:box_14], @left=100, @apply=[:circle_18_color_1_0_0_0_0_0____], @clones=[]>, @element_type="div">, @top=100, @attach=[:box_14], @left=100, @apply=[:circle_18_color_1_0_0_0_0_0____], @clones=[]>
1370
1370
  end
1371
1371
  #
1372
1372
 
@@ -1616,7 +1616,7 @@ the_text.shadow({
1616
1616
 
1617
1617
  shape(
1618
1618
  { renderers: [:html], id: :my_test_box, type: :shape, apply: [:shape_color],
1619
- left: 120, top: 0, width: 100, smooth: 15, height: 100, overflow: :visible, attached: [], center: true
1619
+ left: 120, top: 0, width: 100, smooth: 15, height: 100, overflow: :visible, fasten: [], center: true
1620
1620
  })
1621
1621
 
1622
1622
 
@@ -250,14 +250,14 @@ Each Each particles and atome is store as an :
250
250
  It may need a bit more optimization
251
251
 
252
252
 
253
- Atomes have a special method to monitor all attached /affected atomes , call : Atome.global_monitoring
253
+ Atomes have a special method to monitor all fasten /affected atomes , call : Atome.global_monitoring
254
254
  Code at : helpers/utilities.rb /def global_monitoring
255
255
  Usage :
256
256
  Atome.global_monitoring(self, [:red, :blue, :blue, :alpha, :left, :right, :diffusion], [:variable1, :variable2])
257
257
 
258
258
  The ephemera @new_atome to allow access to data send to the atome at init time
259
259
 
260
- Important : for atomes that needs to be attached or apply to
260
+ Important : for atomes that needs to be fasten or apply to
261
261
  This happen in the method in presets/atome.rb : atome_common
262
262
  at this line :
263
263
  if params[:type] == :color || basic_params[:type] == :color || params[:type] == :shadow || basic_params[:type] == :shadow
data/lib/atome/atome.rb CHANGED
@@ -67,7 +67,7 @@ class Atome
67
67
  Universe.add_to_atomes(@aid, self)
68
68
  Universe.id_to_aid(@id, @aid)
69
69
  @type = new_atome[:type] || :element
70
- @attached = []
70
+ @fasten = []
71
71
  @affect = []
72
72
  @category = []
73
73
  # @display = { mode: :default }
@@ -81,9 +81,28 @@ module ObjectExtension
81
81
  end
82
82
 
83
83
  end
84
+
84
85
  # atome extensions
85
86
  class Object
86
87
  include ObjectExtension
88
+
89
+
90
+ def deep_copy(obj)
91
+ # utility for buttons
92
+ case obj
93
+ when Hash
94
+ obj.each_with_object({}) do |(k, v), h|
95
+ unless k == :code # exception to avoid Proc accumulation
96
+ h[deep_copy(k)] = deep_copy(v)
97
+ end
98
+ end
99
+ when Array
100
+ obj.map { |e| deep_copy(e) }
101
+ else
102
+ obj.dup rescue obj
103
+ end
104
+ end
105
+
87
106
  def flash(msg)
88
107
  flash_box=box({width: 235, height: 112})
89
108
  flash_box.text(msg)
@@ -133,18 +152,6 @@ class Object
133
152
  Universe.atomes[aid_to_get]
134
153
  end
135
154
 
136
- # def box(params = {}, &proc)
137
- # grab(:view).box(params, &proc)
138
- # end
139
- #
140
- # # def intuition(params = {}, &proc)
141
- # # grab(:view).intuition(params, &proc)
142
- # # end
143
- #
144
- # def circle(params = {}, &proc)
145
- # grab(:view).circle(params, &proc)
146
- # end
147
-
148
155
  # the method below generate Atome method creation at Object level
149
156
  def atome_method_for_object(element)
150
157
  Object.define_method element do |params, &user_proc|
@@ -170,10 +177,6 @@ class Object
170
177
  id
171
178
  end
172
179
 
173
- # def repeater(counter, proc)
174
- # instance_exec(counter, &proc) if proc.is_a?(Proc)
175
- # end
176
-
177
180
  def repeat_callback(params, counter)
178
181
  @repeat[params].call(counter)
179
182
  end
@@ -446,7 +449,7 @@ class Object
446
449
  ids = []
447
450
  dig_recursive = lambda do |atome|
448
451
  ids << atome.id
449
- atome.attached.each { |attached_atome| dig_recursive.call(grab(attached_atome)) }
452
+ atome.fasten.each { |fasten_atome| dig_recursive.call(grab(fasten_atome)) }
450
453
  end
451
454
  dig_recursive.call(self)
452
455
  ids
@@ -516,7 +519,7 @@ class Object
516
519
  total_size = (axis == :x) ? objet_atome.to_px(:width) : objet_atome.to_px(:height)
517
520
  max_other_axis_size = (axis == :x) ? objet_atome.to_px(:height) : objet_atome.to_px(:width)
518
521
 
519
- objet_atome.attached.each do |child_id|
522
+ objet_atome.fasten.each do |child_id|
520
523
  child = grab(child_id)
521
524
  child_size = (axis == :x) ? child.to_px(:width) : child.to_px(:height)
522
525
  other_axis_size = (axis == :x) ? child.to_px(:height) : child.to_px(:width)
@@ -532,7 +535,7 @@ class Object
532
535
  current_position = 0
533
536
  resize_object(objet_atome, scale_factor, axis, max_other_axis_size)
534
537
  current_position += (axis == :x) ? objet_atome.to_px(:width) : objet_atome.to_px(:height)
535
- objet_atome.attached.each do |child_id|
538
+ objet_atome.fasten.each do |child_id|
536
539
  child = grab(child_id)
537
540
  resize_object(child, scale_factor, axis, max_other_axis_size)
538
541
  child.top(child.top * scale_factor)
@@ -90,7 +90,7 @@ new({ post: :text }) do |params|
90
90
  if index == 0
91
91
  send(:data, data_found)
92
92
  else
93
- # we create new text's atome attached to the main one (the first element above)
93
+ # we create new text's atome fasten to the main one (the first element above)
94
94
  text(data_found)
95
95
  end
96
96
 
@@ -40,7 +40,7 @@ class Genesis
40
40
  # atome_method_for_batch(atome_name)
41
41
  unless Essentials.default_params[atome_name]
42
42
  # we create default params for the new created atome, adding the hash to : module essential, @default_params
43
- # FIXME : the hash : attach: [:view] means that newly atome will systematically be attached to the wview instaed of the parent:
43
+ # FIXME : the hash : attach: [:view] means that newly atome will systematically be fasten to the wview instaed of the parent:
44
44
  # ex : b.www will attach to view not b!
45
45
  Essentials.new_default_params(atome_name => { type: atome_name })
46
46
  end
@@ -145,19 +145,19 @@ class Genesis
145
145
  # as getter should give us all atome of a given within the atome
146
146
  # ex : puts a.shape => return all atome with the type 'shape' in this atome
147
147
  collected_atomes = []
148
- # attached.each do |attached_atome|
149
- # collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
148
+ # fasten.each do |fasten_atome|
149
+ # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
150
150
  # end
151
151
  if Universe.applicable_atomes.include?(element)
152
- # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being attached
153
- @apply.each do |attached_atome|
154
- collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
152
+ # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being fasten
153
+ @apply.each do |fasten_atome|
154
+ collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
155
155
  end
156
156
  else
157
- # collected_atomes = attached
158
- # if @attached
159
- attached.each do |attached_atome|
160
- collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
157
+ # collected_atomes = fasten
158
+ # if @fasten
159
+ fasten.each do |fasten_atome|
160
+ collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
161
161
  end
162
162
  # end
163
163
 
@@ -213,21 +213,21 @@ class Genesis
213
213
  # # as getter should give us all atome of a given within the atome
214
214
  # # ex : puts a.shape => return all atome with the type 'shape' in this atome
215
215
  # collected_atomes = []
216
- # # attached.each do |attached_atome|
217
- # # collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
216
+ # # fasten.each do |fasten_atome|
217
+ # # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
218
218
  # # end
219
219
  # # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
220
220
  # # then add condition same things fo code in presets/atome atome_common
221
221
  # if %i[color shadow paint border].include?(element)
222
- # # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being attached
223
- # @apply.each do |attached_atome|
224
- # collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
222
+ # # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being fasten
223
+ # @apply.each do |fasten_atome|
224
+ # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
225
225
  # end
226
226
  # else
227
- # # collected_atomes = attached
228
- # # if @attached
229
- # attached.each do |attached_atome|
230
- # collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
227
+ # # collected_atomes = fasten
228
+ # # if @fasten
229
+ # fasten.each do |fasten_atome|
230
+ # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
231
231
  # end
232
232
  # # end
233
233
  #
@@ -7,10 +7,10 @@ new({ particle: :size, category: :geometry, type: :int }) do |params|
7
7
  params = { value: params } unless params.instance_of? Hash
8
8
  params[:recursive] ||= false
9
9
  params[:reference] ||= :x
10
- params[:target] ||= :self # :all resize atome + attached +distance between to the value
10
+ params[:target] ||= :self # :all resize atome + fasten +distance between to the value
11
11
  # self: resize the current atome to current value
12
12
  params[:propagate] ||= :raw # proportional atome children will be resize according
13
- # to its parent , raw apply the raw value to the attached atomes
13
+ # to its parent , raw apply the raw value to the fasten atomes
14
14
  if params[:reference] == :x
15
15
  original_width = width
16
16
  width(params[:value])
@@ -22,7 +22,7 @@ new({ particle: :size, category: :geometry, type: :int }) do |params|
22
22
  end
23
23
 
24
24
  if params[:recursive]
25
- attached.each do |atome_id|
25
+ fasten.each do |atome_id|
26
26
  grab(atome_id).size(params)
27
27
  end
28
28