atome 0.5.7.3.9 → 0.5.7.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/atome/atome.rb +24 -56
  3. data/lib/atome/extensions/atome.rb +10 -59
  4. data/lib/atome/extensions/sha.rb +7 -7
  5. data/lib/atome/genesis/genesis.rb +0 -89
  6. data/lib/atome/genesis/particles/communication.rb +1 -1
  7. data/lib/atome/genesis/particles/event.rb +0 -8
  8. data/lib/atome/genesis/particles/geometry.rb +0 -1
  9. data/lib/atome/genesis/particles/hierarchy.rb +0 -34
  10. data/lib/atome/genesis/particles/identity.rb +0 -30
  11. data/lib/atome/genesis/particles/material.rb +0 -11
  12. data/lib/atome/genesis/particles/property.rb +14 -16
  13. data/lib/atome/genesis/particles/security.rb +0 -45
  14. data/lib/atome/genesis/particles/utility.rb +17 -185
  15. data/lib/atome/genesis/sparkle.rb +3 -12
  16. data/lib/atome/kernel/black_matter.rb +0 -1
  17. data/lib/atome/kernel/universe.rb +5 -45
  18. data/lib/atome/presets/atome.rb +0 -22
  19. data/lib/atome/version.rb +1 -1
  20. data/lib/molecules/init.rb +0 -14
  21. data/lib/molecules/intuition/tools.rb +3 -22
  22. data/lib/molecules/intuition/utilities.rb +121 -77
  23. data/lib/platform_specific/opal/atome_opal_extensions.rb +0 -1
  24. data/lib/platform_specific/opal/extensions/color.rb +0 -5
  25. data/lib/platform_specific/opal/extensions/geolocation.rb +5 -5
  26. data/lib/platform_specific/opal/extensions/ping.rb +11 -20
  27. data/lib/renderers/html/effect.rb +0 -11
  28. data/lib/renderers/html/event.rb +0 -7
  29. data/lib/renderers/html/geometry.rb +0 -31
  30. data/lib/renderers/html/html.rb +13 -134
  31. data/lib/renderers/html/material.rb +0 -22
  32. data/lib/renderers/html/spatial.rb +0 -9
  33. data/lib/renderers/html/utility.rb +5 -8
  34. data/lib/renderers/renderer.rb +0 -1
  35. data/vendor/assets/application/examples/applications.rb +19 -71
  36. data/vendor/assets/application/examples/buttons.rb +5 -4
  37. data/vendor/assets/application/examples/unfasten.rb +15 -9
  38. data/vendor/assets/application/index.rb +1 -1
  39. data/vendor/assets/server/capture.rb +0 -1
  40. data/vendor/assets/server/database.rb +0 -1
  41. data/vendor/assets/server/eDen.rb +5 -80
  42. data/vendor/assets/src/index_server_wasm.html +0 -3
  43. data/vendor/assets/src/index_wasm.html +0 -6
  44. metadata +2 -6
  45. data/lib/molecules/_deprecated_examples/site.rb +0 -34
  46. data/lib/molecules/intuition/_deprecated_inputs.rb +0 -111
  47. data/lib/molecules/intuition/_deprecated_toolbox.rb +0 -282
  48. data/lib/platform_specific/opal/extensions/sha.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddc505fc7f548b01c08b84bd2b3a9ce394ca9303ce9f13acdd8d20b0fc982d26
4
- data.tar.gz: 2bba44abac153bb5e4aad6b6953d60b5eaa5b6e9883acf4dae8c73cf22b5da1a
3
+ metadata.gz: 6c766c7eb85bcd7a3de7dda8058e641e6353e4be8f0813326c4626affd3254e1
4
+ data.tar.gz: '079339808511cf96b9e393897a9c58e35d7b4ad964916f8392dc9e636fa65b52'
5
5
  SHA512:
6
- metadata.gz: dadc4db10cfd19828d6a2e66eb49b1e232a787a8181957c57b2be8f32b3892789bbdf26d96c32be8881d797df2a7408553c80e7d696d9c2241946b1860414465
7
- data.tar.gz: afb512c526b3341cb872fc63804f8dbdc60b24bea7edad9c877f2a9289cb7c577cbe8a6700599c0b7c889d56a5278c7c0ede870f7425b92c38405636023a5101
6
+ metadata.gz: 778782a81a4f6b55e11afd04e0d4c16506156eda4861a3bb615c326ce1b4d0949229b9740afbc31c291a77de97957e084b516dd3cd560c42ada9e3f6e25bcaea
7
+ data.tar.gz: 34f16f5b2446434aedc38490ad0726d9170d8d191109e6e2671f05ff88e5269005657b849190aa88c926a1fd1ce1952626cc3fd5e7e4c5657cede5d0e897a670
data/lib/atome/atome.rb CHANGED
@@ -15,33 +15,16 @@ class Atome
15
15
  # dummy method to catch a method get all instance variable and try to call a method but initialized is only an
16
16
  # instance variable not a method
17
17
  # FIXME : replace all
18
- # def initialized(*_msg)
19
- #
20
- # end
21
18
 
22
19
  def initialize(new_atome = {}, &atomes_proc)
23
20
  # TODO: atome format should always be as followed : {value: 0.44, unit: :px, opt1: 554}
24
- # when using optimised version of atome you must type eg : a.set({left: {value: 33, unit: '%', reference: :center}})
25
- # if Universe.atomes[new_atome[:id]]
26
- # # puts "------ 2 #{new_atome[:id]} => #{Universe.atomes[new_atome[:id]]}"
27
- # # puts 'atome_id already exist'
28
- # # old_atome= grab(new_atome[:id])
29
- # # new_atome.each do |element, value|
30
- # # old_atome.send(element, value)
31
- # # end
32
- # # return false
33
- # grab(new_atome[:id])
34
- # else
35
21
  # the keys :renderers, :type and :id should be placed in the first position in the hash
36
22
  @history = {}
37
- # @language = :english
38
- # @callback = {}
39
23
  @tag = {}
40
24
  @tick = {}
41
25
  @storage = {}
42
26
  @behavior = {}
43
27
  @selected = false
44
- #@metrics = {}
45
28
  @unit = {}
46
29
  @apply = []
47
30
  @collect = {}
@@ -51,40 +34,31 @@ class Atome
51
34
  @aid = new_atome[:aid] || identity_generator
52
35
  @controller_proc = []
53
36
  @id = new_atome[:id] || @aid
54
- # if grab(@id)
55
- # collapse({})
56
- # puts "#{@id} already exists"
57
- # else
58
- Universe.atomes.each_value do |atome_f|
59
- # we affect the already existing atome to target
60
- next unless atome_f.id == @id
61
-
62
- new_atome[:affect].each do |affected|
63
- grab(affected).apply(@id)
64
- end if new_atome[:affect]
65
- return false
66
- end
67
- Universe.add_to_atomes(@aid, self)
68
- Universe.id_to_aid(@id, @aid)
69
- @type = new_atome[:type] || :element
70
- @fasten = []
71
- @affect = []
72
- @category = []
73
- # @display = { mode: :default }
74
- # @backup={} # mainly used to restore particle when using grid /table /list display mode
75
- @html = HTML.new(@id, self)
76
- @headless = Headless.new(@id, self)
77
- @initialized = {}
78
- @creator = Universe.current_user
79
- # now we store the proc in a an atome's property called :bloc
80
- new_atome[:code] = atomes_proc if atomes_proc
81
- # we reorder the hash
82
- reordered_atome = reorder_particles(new_atome)
83
- # FIXME : try to remove the condition below (it crash in the method : def generator ... in genesis.rb)
84
-
85
- collapse(reordered_atome)
86
- # end
37
+ Universe.atomes.each_value do |atome_f|
38
+ # we affect the already existing atome to target
39
+ next unless atome_f.id == @id
87
40
 
41
+ new_atome[:affect].each do |affected|
42
+ grab(affected).apply(@id)
43
+ end if new_atome[:affect]
44
+ return false
45
+ end
46
+ Universe.add_to_atomes(@aid, self)
47
+ Universe.id_to_aid(@id, @aid)
48
+ @type = new_atome[:type] || :element
49
+ @fasten = []
50
+ @affect = []
51
+ @category = []
52
+ @html = HTML.new(@id, self)
53
+ @headless = Headless.new(@id, self)
54
+ @initialized = {}
55
+ @creator = Universe.current_user
56
+ # now we store the proc in a an atome's property called :bloc
57
+ new_atome[:code] = atomes_proc if atomes_proc
58
+ # we reorder the hash
59
+ reordered_atome = reorder_particles(new_atome)
60
+ # FIXME : try to remove the condition below (it crash in the method : def generator ... in genesis.rb)
61
+ collapse(reordered_atome)
88
62
  end
89
63
 
90
64
  def js
@@ -93,7 +67,6 @@ class Atome
93
67
 
94
68
  def particle_creation(element, params, store, rendering, &user_proc)
95
69
 
96
- # @store_allow = false
97
70
  params = particle_main(element, params, &user_proc)
98
71
  # Params is now an instance variable so it should be passed thru different methods
99
72
  instance_variable_set("@#{element}", params) if store
@@ -103,14 +76,11 @@ class Atome
103
76
  particle_callback(element)
104
77
  store_proc(element, params, &user_proc) if user_proc
105
78
  render(element, params, &user_proc) if rendering
106
- # broadcasting(element)
107
79
  # post rendering processor
108
80
  params = particle_post(element, params, &user_proc)
109
81
  instance_variable_set("@#{element}", params) if store
110
82
  Universe.historicize(@aid, :write, element, params)
111
- # after storage processor
112
83
  particle_after(element, params, &user_proc)
113
- # self
114
84
  end
115
85
 
116
86
  def inspect
@@ -122,5 +92,3 @@ class Atome
122
92
  "#<#{self.class}: #{content}>"
123
93
  end
124
94
  end
125
-
126
-
@@ -42,31 +42,15 @@ module ObjectExtension
42
42
  end
43
43
  render_method = "#{renderer_found}_#{params[:specific]}#{params[:method]}"
44
44
  Genesis.build_render(render_method, &bloc)
45
- # elsif params.key?(:callback)
46
- # particle_targetted = params[:callback]
47
- # Atome.define_method("#{particle_targetted}_callback", option) do
48
- # alert option
49
- # bloc.call(option)
50
- # end
51
45
  elsif params.key?(:molecule)
52
46
  molecule = params[:molecule]
53
47
  Genesis.build_molecule(molecule, &bloc)
54
48
  Universe.add_to_molecule_list(molecule)
55
-
56
- # elsif params.key?(:applicaton)
57
- # alert params
58
-
59
- # molecule=params[:molecule]
60
- # Genesis.build_molecule(molecule, &bloc)
61
- # Universe.add_to_molecule_list(molecule)
62
49
  elsif params.key?(:tool)
63
50
  # we only store tools definition in the universe so it can be instanced using "A.build_tool" method when needed
64
-
65
51
  tool_content = Atome.instance_exec(&bloc) if bloc.is_a?(Proc)
66
-
67
52
  Universe.tools[params[:tool]] = tool_content
68
53
  # Universe.tools[params[:tool]]=bloc
69
-
70
54
  elsif params.key?(:template)
71
55
  A.build_template(&bloc)
72
56
  elsif params.key?(:code)
@@ -75,7 +59,6 @@ module ObjectExtension
75
59
  A.build_test(&bloc)
76
60
  elsif params.key?(:preset)
77
61
  Atome.preset_builder(params[:preset], &bloc)
78
- # A.build_test(&bloc)
79
62
  end
80
63
  super if defined?(super)
81
64
  end
@@ -86,7 +69,6 @@ end
86
69
  class Object
87
70
  include ObjectExtension
88
71
 
89
-
90
72
  def deep_copy(obj)
91
73
  # utility for buttons
92
74
  case obj
@@ -104,12 +86,13 @@ class Object
104
86
  end
105
87
 
106
88
  def flash(msg)
107
- flash_box=box({width: 235, height: 112})
89
+ flash_box = box({ width: 235, height: 112 })
108
90
  flash_box.text(msg)
109
91
  flash_box.touch(true) do
110
92
  flash_box.delete({ recursive: true })
111
93
  end
112
94
  end
95
+
113
96
  def reorder_particles(hash_to_reorder)
114
97
  # we reorder the hash
115
98
  ordered_keys = %i[renderers id alien type attach int8 unit]
@@ -118,7 +101,6 @@ class Object
118
101
  other_part = hash_to_reorder.reject { |k, _| ordered_keys.include?(k) }
119
102
  # merge the parts to obtain an re-ordered hash
120
103
  ordered_part.merge(other_part)
121
- # reordered_hash
122
104
  end
123
105
 
124
106
  def delete (atomes)
@@ -139,16 +121,6 @@ class Object
139
121
  return if id_to_get == false
140
122
  aid_to_get = Universe.atomes_ids[id_to_get]
141
123
  aid_to_get = '' if aid_to_get.instance_of? Array
142
- # id_to_get = id_to_get.to_sym
143
-
144
- # if id_to_get.nil? do
145
- # if aid_to_get.nil?
146
- # alert id_to_get
147
- # else
148
-
149
- # end
150
- # end
151
- # alert Universe.atomes[id_to_get]
152
124
  Universe.atomes[aid_to_get]
153
125
  end
154
126
 
@@ -306,7 +278,6 @@ class Object
306
278
  end
307
279
  console_top.shadow({
308
280
  id: :s1,
309
- # affect: [:the_circle],
310
281
  left: 0, top: 3, blur: 9,
311
282
  invert: false,
312
283
  red: 0, green: 0, blue: 0, alpha: 1
@@ -316,8 +287,6 @@ class Object
316
287
  y = console.to_px(:top) + dy.to_f
317
288
  console.top(y)
318
289
  console.height(:auto)
319
- total_height = grab(:view).to_px(:height)
320
- # console_back.height(total_height-console.top)
321
290
  end
322
291
  console_output = console_back.text({ data: '', id: :console_output, component: { size: 12 } })
323
292
  JS.eval <<~JS
@@ -331,7 +300,7 @@ class Object
331
300
  oldLog.apply(console, arguments);
332
301
  };
333
302
  }());
334
- JS
303
+ JS
335
304
 
336
305
  console_clear = console_top.circle({ id: :console_clear, color: :red, top: 3, left: 3, width: 19, height: 19 })
337
306
  console_clear.touch(true) do
@@ -339,8 +308,6 @@ class Object
339
308
  end
340
309
  JS.global[:document].addEventListener("contextmenu") do |event|
341
310
  end
342
- # element[:style][:WebkitUserSelect] = 'none'
343
- # element[:style][:MozUserSelect] = 'none'
344
311
  else
345
312
  grab(:console_back).delete(true)
346
313
  JS.global[:document].addEventListener("contextmenu") do |native_event|
@@ -488,19 +455,13 @@ class Object
488
455
  current_atome.height(current_atome.to_px(:height) * ratio)
489
456
  end
490
457
  end
491
- # total_size, max_other_axis_size = calculate_total_size(objet_atome, axis)
492
- # scale_factor = target_size.to_f / total_size
493
- # resize_and_reposition(objet_atome, scale_factor, axis, max_other_axis_size)
494
458
  end
495
459
 
496
460
  def found_area_used(ids)
497
-
498
461
  min_x, min_y = Float::INFINITY, Float::INFINITY
499
462
  max_x, max_y = 0, 0
500
-
501
463
  ids.each do |id|
502
464
  atome = grab(id)
503
-
504
465
  x = atome.compute({ particle: :left })[:value]
505
466
  y = atome.compute({ particle: :top })[:value]
506
467
  width = atome.to_px(:width)
@@ -510,24 +471,19 @@ class Object
510
471
  max_x = [max_x, x + width].max
511
472
  max_y = [max_y, y + height].max
512
473
  end
513
-
514
474
  { min: { x: min_x, y: min_y }, max: { x: max_x, y: max_y } }
515
-
516
475
  end
517
476
 
518
477
  def calculate_total_size(objet_atome, axis)
519
478
  total_size = (axis == :x) ? objet_atome.to_px(:width) : objet_atome.to_px(:height)
520
479
  max_other_axis_size = (axis == :x) ? objet_atome.to_px(:height) : objet_atome.to_px(:width)
521
-
522
480
  objet_atome.fasten.each do |child_id|
523
481
  child = grab(child_id)
524
482
  child_size = (axis == :x) ? child.to_px(:width) : child.to_px(:height)
525
483
  other_axis_size = (axis == :x) ? child.to_px(:height) : child.to_px(:width)
526
-
527
484
  total_size += child_size
528
485
  max_other_axis_size = [max_other_axis_size, other_axis_size].max
529
486
  end
530
-
531
487
  [total_size, max_other_axis_size]
532
488
  end
533
489
 
@@ -563,11 +519,11 @@ class Object
563
519
  params = { target: params }
564
520
  end
565
521
  id = params[:id]
566
- if id
567
- id_wanted = { id: id }
568
- else
569
- id_wanted = {}
570
- end
522
+ id_wanted = if id
523
+ { id: id }
524
+ else
525
+ {}
526
+ end
571
527
  basis = { alien: params[:target], renderers: [:html], type: :atomized }.merge(id_wanted)
572
528
  a = Atome.new(basis)
573
529
  return a
@@ -576,10 +532,8 @@ class Object
576
532
 
577
533
  def touch_allow(allow)
578
534
  if allow
579
- # Retire l'écouteur d'événements en utilisant la fonction globale
580
535
  JS.eval('document.removeEventListener("contextmenu", window.preventDefaultAction);')
581
536
  else
582
- # Ajoute l'écouteur d'événements en utilisant la fonction globale
583
537
  JS.eval('document.addEventListener("contextmenu", window.preventDefaultAction);')
584
538
  end
585
539
  end
@@ -589,13 +543,13 @@ class Object
589
543
  # allow selection and text copy
590
544
  JS.eval(<<~JS)
591
545
  document.body.style.userSelect = 'auto'; // allow text slectiion
592
- document.removeEventListener('copy', preventDefaultAction); // allow copy
546
+ document.removeEventListener('copy', preventDefaultAction); // allow copy
593
547
  JS
594
548
  else
595
549
  # lock selection and text copy
596
550
  JS.eval(<<~JS)
597
551
  document.body.style.userSelect = 'none'; // prevent text selection
598
- document.addEventListener('copy', preventDefaultAction); // prevent copy
552
+ document.addEventListener('copy', preventDefaultAction); // prevent copy
599
553
  JS
600
554
  end
601
555
  end
@@ -814,7 +768,4 @@ class CssProxy
814
768
  parsed = JSON.parse(msg)
815
769
  bloc.call(parsed)
816
770
  end
817
-
818
771
  end
819
-
820
-
@@ -1,8 +1,8 @@
1
1
  # # frozen_string_literal: true
2
- #
3
- # # to create a hash
4
- # class Atome
5
- # def calculate_sha(string)
6
- # Digest::SHA256.hexdigest(string)
7
- # end
8
- # end
2
+
3
+ # to create a hash
4
+ class Atome
5
+ def calculate_sha(string)
6
+ Digest::SHA256.hexdigest(string)
7
+ end
8
+ end
@@ -22,8 +22,6 @@ class Genesis
22
22
  # we add the new method to the particle's collection of methods
23
23
  Universe.add_to_particle_list(particle_name, type, category)
24
24
  # the line below create an empty particle method for each renderer, eg: browser_left, headless_width, ...
25
- # the line below create the corresponding particle method for Batch class
26
- # particle_method_for_batch(particle_name)
27
25
  auto_render_generator(particle_name) if render
28
26
  new_particle(particle_name, store, render, &particle_proc)
29
27
  # the line below create all alternatives methods such as create 'method='
@@ -36,8 +34,6 @@ class Genesis
36
34
  # the method below generate Atome method creation at Object level,
37
35
  # so a syntax like : 'text(:hello)' is possible instead of the mandatory : grab(:view).text(:hello)
38
36
  atome_method_for_object(atome_name)
39
- # the line below create the corresponding atome method for Batch class
40
- # atome_method_for_batch(atome_name)
41
37
  unless Essentials.default_params[atome_name]
42
38
  # we create default params for the new created atome, adding the hash to : module essential, @default_params
43
39
  # FIXME : the hash : attach: [:view] means that newly atome will systematically be fasten to the wview instaed of the parent:
@@ -76,9 +72,6 @@ class Genesis
76
72
  end
77
73
 
78
74
  def new_particle(element, store, render, &_method_proc)
79
- # unless @id
80
- # alert self.id
81
- # end
82
75
 
83
76
  Atome.define_method element do |params = nil, &user_proc|
84
77
  @history[element] ||= []
@@ -87,7 +80,6 @@ class Genesis
87
80
  params = particle_sanitizer(element, params, &user_proc)
88
81
  # the line below execute the main code when creating a new particle
89
82
  # ex : new({ particle: :my_particle } do....
90
- # instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
91
83
  Genesis.create_particle(element, store, render)
92
84
  # TODO: try to optimise and find a better way wo we can remove the condition below
93
85
  if @type == :group && !%i[type id collect layout].include?(element)
@@ -98,18 +90,12 @@ class Genesis
98
90
 
99
91
  computed_params = send("set_#{element}", params, &user_proc) # sent to : create_particle / Atome.define_method "set_#{element}"
100
92
 
101
- # we historicize all write action below
102
- # we add the changes to the stack that must be synchronised
103
- # Universe.historicize(@aid, :write, element, params)
104
93
  computed_params
105
94
  elsif params || params == false
106
95
  "send a valid password to write #{element} value"
107
96
  elsif read_auth(element)
108
97
  # particle getter below
109
98
  value_found = instance_variable_get("@#{element}")
110
- # uncomment below to historicize all read action
111
- # Universe.historicize(@id, :read, element, value_found)
112
- # we add the optional read plugin
113
99
  value_found = particle_read(element, value_found, &user_proc)
114
100
  value_found
115
101
  # TODO : create a fast method to get particle: eg:
@@ -117,9 +103,6 @@ class Genesis
117
103
  else
118
104
  "send a valid password to read #{element} value"
119
105
  end
120
- # else
121
- #
122
- # end
123
106
  end
124
107
  end
125
108
 
@@ -145,25 +128,18 @@ class Genesis
145
128
  # as getter should give us all atome of a given within the atome
146
129
  # ex : puts a.shape => return all atome with the type 'shape' in this atome
147
130
  collected_atomes = []
148
- # fasten.each do |fasten_atome|
149
- # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
150
- # end
151
131
  if Universe.applicable_atomes.include?(element)
152
132
  # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being fasten
153
133
  @apply.each do |fasten_atome|
154
134
  collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
155
135
  end
156
136
  else
157
- # collected_atomes = fasten
158
- # if @fasten
159
137
  fasten.each do |fasten_atome|
160
138
  collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
161
139
  end
162
- # end
163
140
 
164
141
  end
165
142
  # TODO/ FIXME : potential problem with group here"
166
- # group({ collect: collected_atomes })
167
143
  collected_atomes
168
144
  end
169
145
  end
@@ -174,7 +150,6 @@ class Genesis
174
150
  # Object.const_set(element, Module.new)
175
151
  # 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
176
152
  # to the shape particles list : @!atome[:shape] << params[:id]
177
- # Atome.new(params, &user_proc)
178
153
 
179
154
  if Universe.atomes[params[:id]]
180
155
  # if atome id already exist we grab the previous one
@@ -192,75 +167,11 @@ class Genesis
192
167
  end
193
168
 
194
169
  def new_molecule(molecule, &method_proc)
195
-
196
170
  Molecule.define_method molecule do |params, &user_proc|
197
171
  object_to_return = instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
198
- # new_objet = Object.new
199
- # # we store the molecule into an instance variable in a basic ruby object
200
- # new_objet.instance_variable_set(:@molecule, object_to_return)
201
- # new_objet
202
172
  object_to_return
203
173
  end
204
-
205
- # # the method define below is the slowest but params are analysed and sanitized
206
- # Atome.define_method element do |params = nil, &user_proc|
207
- # instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
208
- # if params
209
- # params = atome_sanitizer(element, params, &user_proc)
210
- # atome_processor(element, params, &user_proc)
211
- # else
212
- # # when no params passed whe assume teh user want a getter,
213
- # # as getter should give us all atome of a given within the atome
214
- # # ex : puts a.shape => return all atome with the type 'shape' in this atome
215
- # collected_atomes = []
216
- # # fasten.each do |fasten_atome|
217
- # # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
218
- # # end
219
- # # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
220
- # # then add condition same things fo code in presets/atome atome_common
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 fasten
223
- # @apply.each do |fasten_atome|
224
- # collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
225
- # end
226
- # else
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
- # end
232
- # # end
233
- #
234
- # end
235
- # # TODO/ FIXME : potential problem with group here"
236
- # # group({ collect: collected_atomes })
237
- # collected_atomes
238
- # end
239
- # end
240
- #
241
- # # the method define below is the fastest params are passed directly
242
- # Atome.define_method "set_#{element}" do |params, &user_proc|
243
- # # we generate the corresponding module here:
244
- # # Object.const_set(element, Module.new)
245
- # # 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
246
- # # to the shape particles list : @!atome[:shape] << params[:id]
247
- # # Atome.new(params, &user_proc)
248
- #
249
- # if Universe.atomes[params[:id]]
250
- # # if atome id already exist we grab the previous one
251
- # # this prevent the creation of new atome if the atome already exist
252
- # previous_atome= grab(params[:id])
253
- # # now we must re-affect affected atomes
254
- # previous_atome.affect(params[:affect])
255
- # previous_atome
256
- # else
257
- # Atome.new(params, &user_proc)
258
- # end
259
- # # Now we return the newly created atome instead of the current atome that is the parent cf: b=box; c=b.circle
260
- # end
261
-
262
174
  end
263
-
264
175
  end
265
176
 
266
177
  end
@@ -28,7 +28,7 @@ new({ particle: :language, category: :communication, type: :string }) do |params
28
28
  @data = int8[params]
29
29
  params
30
30
  end
31
- # method below are used for communication with ntaive core
31
+ # method below are used for communication with native core
32
32
  def receptor(msg)
33
33
  parsed = JSON.parse(msg)
34
34
  A.controller_code[:controller].call(parsed)
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  class Atome
3
3
  def animation_callback(proc_sub_category, value=nil)
4
- # puts "#{p◊roc_sub_category}"
5
4
  proc_found = @animate_code[proc_sub_category]
6
- # puts proc_found
7
5
  instance_exec(value,&proc_found) if proc_found.is_a?(Proc)
8
6
  end
9
7
  end
@@ -371,9 +369,3 @@ end
371
369
  new({ after: :animate }) do |params|
372
370
  html.animate(params) unless params[:end] || params[:start]
373
371
  end
374
-
375
-
376
- # new({ particle: :repeat, category: :event, type: :boolean })
377
- # # new({ particle: :sort }) do |_value, sort_proc|
378
- # # @sort_proc = sort_proc
379
- # # end
@@ -8,7 +8,6 @@ new({ particle: :size, category: :geometry, type: :int }) do |params|
8
8
  params[:recursive] ||= false
9
9
  params[:reference] ||= :x
10
10
  params[:target] ||= :self # :all resize atome + fasten +distance between to the value
11
- # self: resize the current atome to current value
12
11
  params[:propagate] ||= :raw # proportional atome children will be resize according
13
12
  # to its parent , raw apply the raw value to the fasten atomes
14
13
  if params[:reference] == :x
@@ -7,10 +7,6 @@ def detach_child(child)
7
7
 
8
8
  end
9
9
 
10
- # def detach_from_parent(parent_found, child_found)
11
- # child_found.attach(parent_found.id)
12
- # end
13
-
14
10
  def attachment_common(child_id, parents_id, direction, &user_proc)
15
11
 
16
12
  parent_found = grab(parents_id)
@@ -20,9 +16,6 @@ def attachment_common(child_id, parents_id, direction, &user_proc)
20
16
  parent_found.fasten.push(@id) unless parent_found.fasten.include?(@id)
21
17
  detach_child(self)
22
18
  render(:attach, parents_id, &user_proc)
23
- else
24
- # we remove the current id from parent
25
- # grab(attach).fasten.delete(@id)
26
19
  end
27
20
  else
28
21
  child_found = grab(child_id)
@@ -110,31 +103,4 @@ new({ particle: :affect, category: :hierarchy, type: :string, render: false }) d
110
103
  children_ids
111
104
  end
112
105
 
113
- # new({ particle: :detached, category: :hierarchy, type: :string, store: false }) # unfastened
114
- # new({ sanitizer: :detached }) do |values|
115
- # # unfastened
116
- # if values.innew({ particle: :detached, category: :hierarchy, type: :string, store: false }) # unfastened
117
- # # new({ sanitizer: :detached }) do |values|
118
- # # # unfastened
119
- # # if values.instance_of? Array
120
- # # values.each do |value|
121
- # # detach_atome(value)
122
- # # end
123
- # # else
124
- # # detach_atome(values)
125
- # # # we sanitize the values so it always return an array to the renderer
126
- # # values = [values]
127
- # # end
128
- # # values
129
- # # endstance_of? Array
130
- # values.each do |value|
131
- # detach_atome(value)
132
- # end
133
- # else
134
- # detach_atome(values)
135
- # # we sanitize the values so it always return an array to the renderer
136
- # values = [values]
137
- # end
138
- # values
139
- # end
140
106
  new({ particle: :collect, category: :hierarchy, type: :string })
@@ -7,41 +7,11 @@ new({ sanitizer: :id }) do |params|
7
7
  # first we sanitize the the id below
8
8
 
9
9
  params = params.to_sym
10
- # we check id is already assign
11
- # the condition below is to prevent the creation of multiple unwanted colors with same property and no ID specified
12
- # if @id.to_sym != params
13
- # Universe.update_atome_id(params, self, @id)
14
- # else
15
- # Universe.add_to_atomes(params, self)
16
- # end
17
-
18
- # Universe.atomes.each do |_aid,atome_f|
19
- #
20
- # if atome_f.id == params
21
- # puts "===> no for #{params}"
22
- # end
23
- #
24
- # end
25
10
 
26
11
  params
27
12
  end
28
13
  new({ particle: :name, category: :identity, type: :string })
29
14
  new({ particle: :active, category: :identity, type: :boolean })
30
- # new({ particle: :entangled, type: :array })
31
- # new({ particle: :clones }) do |clones_found|
32
- # clones_found.each_with_index do |clone_found, index|
33
- # particles_entangled = clone_found[:entangled] ||= []
34
- # clone_id = "#{particles[:id]}_clone_#{index}"
35
- # original_id = atome[:id]
36
- # clone_found[:id] = clone_id
37
- # clone_found = particles.merge(clone_found)
38
- # clone_found.delete(:html_object)
39
- # cloned_atome = Atome.new(clone_found)
40
- # monitor({ atomes: [original_id], particles: particles_entangled }) do |_atome, particle, value|
41
- # cloned_atome.send(particle, value)
42
- # end
43
- # end
44
- # end
45
15
  new({ particle: :markup, category: :identity, type: :string })
46
16
  new({ particle: :bundle, category: :identity, type: :string })
47
17
  new({ particle: :data, category: :identity, type: :string })