atome 0.5.1.4 → 0.5.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +23 -2
  3. data/lib/atome/atome.rb +40 -18
  4. data/lib/atome/extensions/atome.rb +5 -26
  5. data/lib/atome/extensions/geolocation.rb +0 -1
  6. data/lib/atome/extensions/matrix.rb +171 -0
  7. data/lib/atome/extensions/ping.rb +9 -11
  8. data/lib/atome/genesis/generators/atome.rb +14 -2
  9. data/lib/atome/genesis/generators/communication.rb +1 -1
  10. data/lib/atome/genesis/generators/event.rb +36 -0
  11. data/lib/atome/genesis/generators/identity.rb +28 -2
  12. data/lib/atome/genesis/generators/material.rb +21 -0
  13. data/lib/atome/genesis/generators/spatial.rb +1 -0
  14. data/lib/atome/genesis/generators/utility.rb +20 -2
  15. data/lib/atome/genesis/genesis.rb +2 -2
  16. data/lib/atome/genesis/sparkle.rb +1 -1
  17. data/lib/atome/helpers/callbacks.rb +76 -0
  18. data/lib/atome/helpers/essentials.rb +10 -5
  19. data/lib/atome/helpers/utilities.rb +52 -8
  20. data/lib/atome/kernel/universe.rb +0 -4
  21. data/lib/atome/presets/atome.rb +12 -8
  22. data/lib/atome/renderers/browser/atome.rb +8 -19
  23. data/lib/atome/renderers/browser/browser.rb +15 -210
  24. data/lib/atome/renderers/browser/effect.rb +2 -2
  25. data/lib/atome/renderers/browser/event.rb +49 -11
  26. data/lib/atome/renderers/browser/geometry.rb +2 -2
  27. data/lib/atome/renderers/browser/helpers/animation_helper.rb +69 -0
  28. data/lib/atome/renderers/browser/helpers/browser_helper.rb +17 -0
  29. data/lib/atome/renderers/browser/helpers/color_helper.rb +33 -0
  30. data/lib/atome/renderers/browser/helpers/drag_helper.rb +39 -0
  31. data/lib/atome/renderers/browser/helpers/effect_helper.rb +26 -0
  32. data/lib/atome/renderers/browser/helpers/event_helper.rb +59 -0
  33. data/lib/atome/renderers/browser/helpers/image_helper.rb +27 -0
  34. data/lib/atome/renderers/browser/helpers/shadow_helper.rb +33 -0
  35. data/lib/atome/renderers/browser/helpers/shape_helper.rb +22 -0
  36. data/lib/atome/renderers/browser/helpers/text_helper.rb +26 -0
  37. data/lib/atome/renderers/browser/helpers/video_helper.rb +43 -0
  38. data/lib/atome/renderers/browser/helpers/web_helper.rb +30 -0
  39. data/lib/atome/renderers/browser/identity.rb +10 -3
  40. data/lib/atome/renderers/browser/material.rb +28 -5
  41. data/lib/atome/renderers/browser/spatial.rb +36 -5
  42. data/lib/atome/renderers/browser/utility.rb +21 -12
  43. data/lib/atome/renderers/headless/utility.rb +2 -2
  44. data/lib/atome/renderers/html/atome.rb +5 -5
  45. data/lib/atome/renderers/html/effect.rb +1 -1
  46. data/lib/atome/renderers/html/event.rb +1 -1
  47. data/lib/atome/renderers/html/geometry.rb +2 -2
  48. data/lib/atome/renderers/html/html.rb +1 -1
  49. data/lib/atome/renderers/html/identity.rb +2 -2
  50. data/lib/atome/renderers/html/spatial.rb +5 -5
  51. data/lib/atome/renderers/html/utility.rb +7 -7
  52. data/lib/atome/renderers/server/utility.rb +2 -2
  53. data/lib/atome/version.rb +1 -1
  54. data/lib/atome.rb +6 -4
  55. data/sig/atome.rbs +1 -0
  56. data/sig/atome_js.rbs +1 -0
  57. data/vendor/assets/build/css/style.css +25 -17
  58. data/vendor/assets/build/index.html +12 -3
  59. data/vendor/assets/build/js/atome/atome.js +150 -145
  60. data/vendor/assets/build/js/atome/atome_helpers/atome_animate.js +65 -0
  61. data/vendor/assets/build/js/atome/atome_helpers/atome_drag.js +85 -0
  62. data/vendor/assets/build/js/atome/atome_helpers/atome_file.js +7 -0
  63. data/vendor/assets/build/js/atome/atome_helpers/atome_sort.js +20 -0
  64. data/vendor/assets/build/js/atome/atome_helpers/atome_time.js +10 -0
  65. data/vendor/assets/build/js/atome/atome_helpers/atome_video.js +12 -0
  66. data/vendor/assets/build/js/third_parties/popmotion.min.js +1 -1
  67. data/vendor/assets/build/js/third_parties/sortable.min.js +2 -0
  68. data/vendor/assets/build/js/third_parties/wad.min.js +9 -0
  69. data/vendor/assets/build/medias/audios/Binrpilot.mp3 +0 -0
  70. data/vendor/assets/build/medias/rubies/examples/_2_solve.rb +45 -0
  71. data/vendor/assets/build/medias/rubies/examples/_audio.rb +178 -0
  72. data/vendor/assets/build/medias/rubies/examples/_dataset.rb +82 -0
  73. data/vendor/assets/build/medias/rubies/examples/_markers.rb +57 -0
  74. data/vendor/assets/build/medias/rubies/examples/_os.rb +29 -0
  75. data/vendor/assets/build/medias/rubies/examples/_vie.rb +211 -0
  76. data/vendor/assets/build/medias/rubies/examples/animation.rb +81 -0
  77. data/vendor/assets/build/medias/rubies/examples/at.rb +21 -0
  78. data/vendor/assets/build/medias/rubies/examples/{atome.new.rb → atome_new.rb} +5 -5
  79. data/vendor/assets/build/medias/rubies/examples/bottom.rb +1 -1
  80. data/vendor/assets/build/medias/rubies/examples/center.rb +21 -0
  81. data/vendor/assets/build/medias/rubies/examples/clone.rb +20 -0
  82. data/vendor/assets/build/medias/rubies/examples/color.rb +20 -15
  83. data/vendor/assets/build/medias/rubies/examples/cursor.rb +7 -0
  84. data/vendor/assets/build/medias/rubies/examples/delete.rb +25 -3
  85. data/vendor/assets/build/medias/rubies/examples/drag.rb +39 -0
  86. data/vendor/assets/build/medias/rubies/examples/edit.rb +12 -0
  87. data/vendor/assets/build/medias/rubies/examples/empty_atome.rb +12 -0
  88. data/vendor/assets/build/medias/rubies/examples/hide.rb +7 -0
  89. data/vendor/assets/build/medias/rubies/examples/matrix.rb +58 -0
  90. data/vendor/assets/build/medias/rubies/examples/monitoring.rb +22 -11
  91. data/vendor/assets/build/medias/rubies/examples/mute.rb +22 -0
  92. data/vendor/assets/build/medias/rubies/examples/on.rb +7 -1
  93. data/vendor/assets/build/medias/rubies/examples/{parent.rb → parents.rb} +6 -6
  94. data/vendor/assets/build/medias/rubies/examples/pause.rb +15 -0
  95. data/vendor/assets/build/medias/rubies/examples/play.rb +15 -0
  96. data/vendor/assets/build/medias/rubies/examples/read.rb +7 -4
  97. data/vendor/assets/build/medias/rubies/examples/remove.rb +16 -0
  98. data/vendor/assets/build/medias/rubies/examples/right.rb +1 -1
  99. data/vendor/assets/build/medias/rubies/examples/schedule.rb +2 -2
  100. data/vendor/assets/build/medias/rubies/examples/shadow.rb +8 -1
  101. data/vendor/assets/build/medias/rubies/examples/sort.rb +19 -0
  102. data/vendor/assets/build/medias/rubies/examples/style.rb +4 -0
  103. data/vendor/assets/build/medias/rubies/examples/time.rb +14 -0
  104. data/vendor/assets/build/medias/rubies/examples/touch.rb +50 -7
  105. data/vendor/assets/build/medias/texts/lorem.txt +1 -0
  106. metadata +50 -7
  107. data/lib/atome/processors/utilities.rb +0 -10
  108. data/vendor/assets/build/medias/rubies/examples/_animation.rb +0 -0
  109. data/vendor/assets/build/medias/rubies/examples/_drag.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64c8921a4ed715c0ed422e430ca3e9b6ead122f06e81032d0e8843b9fa2e0e4c
4
- data.tar.gz: 7920b914b719630b1a930d1f27616d31161e8befe33fd409098a55a90cf30ced
3
+ metadata.gz: 9b7030ffafd358342bdc993dcee7f6a7f35c0c7c2504a85149bea5c2751b5d89
4
+ data.tar.gz: bab45507e748e52cf793b19f2bb7457bb0d05fce580286854b49c32515dabd66
5
5
  SHA512:
6
- metadata.gz: 2d1fe5f8e8967e1869da808953904dbcd41327676bf644cf19b260cc56f0febdf38a3d3673056ab51406ca0b6743708dcf2c5b1d8fb6e20cd7f8f8b94d425ebd
7
- data.tar.gz: 314bec01e683e3bcf0e57abfe1bc273bf38a91650da89f277449226b8f23dc7626c1d3d76e0d8408bdc7e82f5c337e8beb2fae3e73b23cd827102374d8b62c24
6
+ metadata.gz: 1d72ba4a1af3d68412a3a64f0e3907f523cb03188f0c5becc355e8afc2e4e0d3b59ef06863171c6d8808ceedbace062099535823be732a058282acac7943a320
7
+ data.tar.gz: 1146eea7819fca1b160453cdd7187d11bf2e6a9471afeb4489246ba9297ecc708563d63a1ce679caf594fe1218b524c24c6dec3349c6a04c546ae36da9cffb72
data/Rakefile CHANGED
@@ -14,17 +14,38 @@ task default: :test
14
14
  task :test_browser do
15
15
  FileUtils.copy_entry('vendor/assets/build/js/', 'test/test_app/build/js/')
16
16
  FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/css/')
17
- FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/medias/')
17
+ FileUtils.copy_entry('vendor/assets/build/medias/', 'test/test_app/build/medias/')
18
18
  `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
19
19
  `cd test/test_app;atome update;atome run guard`
20
20
  end
21
21
 
22
+
23
+
22
24
  task :test_server do
23
25
  FileUtils.copy_entry('vendor/assets/build/js/', 'test/test_app/build/js/')
24
26
  FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/css/')
25
- FileUtils.copy_entry('vendor/assets/build/css/', 'test/test_app/build/medias/')
27
+ FileUtils.copy_entry('vendor/assets/build/medias/', 'test/test_app/build/medias/')
26
28
  `gem cleanup atome;yes | gem uninstall atome ;gem build atome.gemspec;gem install atome`
27
29
  `cd test/test_app;atome update;atome run server`
28
30
  end
29
31
 
32
+ task :run_browser do
33
+ `cd test/test_app;atome run guard`
34
+ end
35
+
36
+ task :run_server do
37
+ `cd test/test_app;atome run server guard`
38
+ end
39
+
40
+ task :run_example do
41
+ FileUtils.copy_entry('vendor/assets/build/medias/rubies/examples/', 'test/test_app/build/medias/rubies/examples/')
42
+ `cd test/test_app;atome run `
43
+ end
44
+
45
+ task :run_example_server do
46
+ FileUtils.copy_entry('vendor/assets/build/medias/rubies/examples/', 'test/test_app/build/medias/rubies/examples/')
47
+ `cd test/test_app;atome run server `
48
+ end
49
+
50
+
30
51
  task default: :test
data/lib/atome/atome.rb CHANGED
@@ -15,22 +15,27 @@ class Atome
15
15
  atomes.each_value do |elements|
16
16
  # the instance variable below contain the id all any atomes that need to be informed when changes occurs
17
17
  @broadcast = {}
18
+ @at_time = {}
19
+ @markers = {}
18
20
  # now we store the proc in a an atome's property called :bloc
19
21
  elements[:code] = atomes_proc if atomes_proc
20
22
  @atome = elements
21
23
  # we initiate the rendering, eg for for browser we will call :browser_type generate method in identity.rb file
22
- create_particle(:type, @atome[:type])
24
+ # create_particle(:type, @atome[:type])
25
+ create_particle(:type)
26
+ set_type(@atome[:type])
23
27
  collapse
24
28
  end
25
29
  end
26
30
 
27
31
  def new_particle(element, &method_proc)
28
32
  Atome.define_method element do |params = nil, &user_proc|
29
- if params
33
+ if params || params == false
30
34
  # the line below execute the proc created when using the build_particle method
31
35
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
32
36
  params = sanitize(element, params)
33
- create_particle(element, params, &user_proc)
37
+ create_particle(element)
38
+ send("set_#{element}", params, &user_proc)
34
39
  else
35
40
  get_particle(element, &user_proc)
36
41
  end
@@ -41,20 +46,27 @@ class Atome
41
46
  Atome.define_method "#{element}=" do |params = nil, &user_proc|
42
47
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
43
48
  params = sanitize(element, params)
44
- create_particle(element, params, &user_proc)
49
+ particle_creation(element, params, &user_proc)
45
50
  end
46
51
  end
47
52
 
53
+ def atome_creation_pre_treatment(element, params, &user_proc)
54
+ params = sanitize(element, params)
55
+ create_atome(element)
56
+ send("set_#{element}", params, &user_proc)
57
+ end
58
+
48
59
  def new_atome(element, &method_proc)
49
60
  Atome.define_method element do |params = nil, &user_proc|
50
61
  if params
51
62
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
52
- params = sanitize(element, params)
53
- Atome.new({ element => params })
63
+ atome_creation_pre_treatment(element, params, &user_proc)
54
64
  else
55
65
  get_atome(element, &user_proc)
56
66
  end
57
67
  end
68
+ # the method below generate Atome method creation at Object level
69
+ create_method_at_object_level(element)
58
70
  end
59
71
 
60
72
  def new_render_engine(renderer_name, &method_proc)
@@ -63,9 +75,9 @@ class Atome
63
75
  end
64
76
  end
65
77
 
66
- def run_optional_proc(proc_name, atome = self, value = '')
78
+ def run_optional_proc(proc_name, atome = self, value = '', &user_proc)
67
79
  option_found = Universe.get_optional_method(proc_name)
68
- atome.instance_exec(value, &option_found) if option_found.is_a?(Proc)
80
+ atome.instance_exec(value, user_proc,atome, &option_found) if option_found.is_a?(Proc)
69
81
  end
70
82
 
71
83
  def inject_value(element, value)
@@ -81,23 +93,31 @@ class Atome
81
93
  public
82
94
 
83
95
  # the line below is used for ephemera atomes
84
- attr_accessor :property, :value, :real_atome, :user_proc
85
- attr_reader :atome, :structure
96
+ attr_accessor :property, :value, :real_atome, :user_proc, :markers
97
+ attr_reader :atome, :structure, :at_time
86
98
 
87
99
  def set(value)
88
100
  @real_atome[@property] = value
89
101
  end
90
102
 
91
- def create_particle(element, value, &user_proc)
92
- return false unless security_pass(element, value)
103
+ def particle_creation(element, params, &user_proc)
104
+ return false unless security_pass(element, params)
93
105
 
94
- run_optional_proc("pre_render_#{element}".to_sym, self, value)
95
- rendering(element, value, &user_proc)
96
- run_optional_proc("post_render_#{element}".to_sym, self, value)
97
- store_value(element, value)
106
+ # we create a proc holder of any new particle if user pass a bloc
107
+ store_code_bloc(element, &user_proc) if user_proc
108
+ run_optional_proc("pre_render_#{element}".to_sym, self, params, &user_proc)
109
+ rendering(element, params, &user_proc)
110
+ run_optional_proc("post_render_#{element}".to_sym, self, params, &user_proc)
111
+ store_value(element, params)
98
112
  self
99
113
  end
100
114
 
115
+ def create_particle(element)
116
+ Atome.define_method "set_#{element}" do |params, &user_proc|
117
+ particle_creation(element, params, &user_proc)
118
+ end
119
+ end
120
+
101
121
  def get(element)
102
122
  @atome[element]
103
123
  end
@@ -108,7 +128,7 @@ class Atome
108
128
  virtual_atome.real_atome = @atome
109
129
  virtual_atome.property = element
110
130
  virtual_atome.user_proc = user_proc
111
- run_optional_proc("pre_get_#{element}".to_sym, virtual_atome)
131
+ run_optional_proc("pre_get_#{element}".to_sym,self, "virtual_atome", &user_proc)
112
132
  virtual_atome
113
133
  end
114
134
 
@@ -122,7 +142,9 @@ class Atome
122
142
  end
123
143
 
124
144
  def create_atome(new_atome)
125
- Atome.new(new_atome)
145
+ Atome.define_method "set_#{new_atome}" do |params, &user_proc|
146
+ Atome.new({ new_atome => params }, &user_proc)
147
+ end
126
148
  end
127
149
 
128
150
  Universe.connected
@@ -12,30 +12,9 @@ def circle(params = {}, &proc)
12
12
  grab(:view).circle(params, &proc)
13
13
  end
14
14
 
15
- def text(params = {}, &bloc)
16
- grab(:view).text(params, &bloc)
17
- end
18
-
19
- def image(params = {}, &bloc)
20
- grab(:view).image(params, &bloc)
21
- end
22
-
23
- def video(params = {}, &bloc)
24
- grab(:view).video(params, &bloc)
25
- end
26
-
27
- def color(params = {}, &bloc)
28
- grab(:view).color(params, &bloc)
29
- end
30
-
31
- def element(params = {}, &bloc)
32
- grab(:view).element(params, &bloc)
33
- end
34
-
35
- def shadow(params = {}, &bloc)
36
- grab(:view).shadow(params, &bloc)
37
- end
38
-
39
- def web(params = {}, &bloc)
40
- grab(:view).web(params, bloc)
15
+ # the method below generate Atome method creation at Object level
16
+ def create_method_at_object_level(element)
17
+ Object.define_method element do |params = nil, &user_proc|
18
+ grab(:view).send(element, params, &user_proc)
19
+ end
41
20
  end
@@ -11,4 +11,3 @@ class Atome
11
11
  results.first.coordinates
12
12
  end
13
13
  end
14
-
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ # powerful and simple to use table and list generator
4
+ class Matrix
5
+ attr_accessor :matrix
6
+
7
+ def create_matrix_back( id, style)
8
+ @matrix = Atome.new(
9
+ shape: { type: :shape, renderers: [:browser], id: id, parents: [:view], children: [:matrix_color],
10
+ overflow: :auto }
11
+ )
12
+ @matrix.style(style)
13
+ end
14
+
15
+ def create_matrix_colors
16
+ Atome.new({ color: { renderers: [:browser], id: :matrix_color, type: :color, parents: [], children: [],
17
+ red: 0, green: 1, blue: 1, alpha: 1 } })
18
+
19
+ Atome.new({ color: { renderers: [:browser], id: :cell_color, type: :color, parents: [], children: [],
20
+ red: 1, green: 0.15, blue: 0.7, alpha: 1 } })
21
+ end
22
+
23
+ def create_cells(id, cell_number, number_of_cells, style)
24
+ while cell_number < number_of_cells
25
+ @matrix_dataset[cell_number] = []
26
+ @cells << a = Atome.new(
27
+ shape: { type: :shape, renderers: [:browser], id: id + "_#{cell_number}", parents: [id],
28
+ children: [:cell_color] }
29
+ )
30
+ a.style(style)
31
+ cell_number += 1
32
+ end
33
+ end
34
+
35
+ def initialize(params)
36
+ default = { col: 4, row: 4, size: 333, margin: 12, name: :matrix, parent: :view }
37
+ params = default.merge(params)
38
+ nb_of_rows = params[:row]
39
+ nb_of_cols = params[:col]
40
+ matrix_width = params[:width]
41
+ matrix_height = params[:height]
42
+
43
+ @matrix_dataset = []
44
+ @matrix_margin = params[:margin]
45
+ params[:id] = :matrix unless params[:id]
46
+ @matrix_id = params[:id]
47
+ # styles
48
+ @matrix_style = params[:matrix_style]
49
+ @cell_style = params[:cell_style]
50
+ # Colors
51
+ create_matrix_colors
52
+ # now we create the background
53
+ create_matrix_back( @matrix_id, @matrix_style)
54
+
55
+ @nb_of_rows = nb_of_rows.to_i
56
+ @nb_of_cols = nb_of_cols.to_i
57
+ number_of_cells = @nb_of_rows * @nb_of_cols
58
+ @cells = []
59
+ cell_number = 0
60
+ create_cells(@matrix_id, cell_number, number_of_cells, @cell_style)
61
+
62
+ resize_matrix({ width: matrix_width, height: matrix_height })
63
+ end
64
+
65
+ def width(val = nil)
66
+ if val
67
+ resize_matrix({ height: height, width: val })
68
+ else
69
+ @matrix.width.value
70
+ end
71
+
72
+ end
73
+
74
+ def height(val = nil)
75
+ if val
76
+ resize_matrix({ width: width, height: val })
77
+ else
78
+ @matrix.height.value
79
+ end
80
+ end
81
+
82
+ def left(val)
83
+ @matrix.left(val)
84
+ end
85
+
86
+ def right(val)
87
+ @matrix.right(val)
88
+ end
89
+
90
+ def resize_matrix(params)
91
+ matrix_width = params[:width]
92
+ matrix_height = params[:height]
93
+ cell_width = (matrix_width / @nb_of_cols) - @matrix_margin
94
+ cell_height = (matrix_height / @nb_of_rows) - @matrix_margin
95
+ row = -1
96
+ @cells.each_with_index do |cell, index|
97
+ cell.height = cell_height
98
+ cell.width = cell_width
99
+ row += 1 if index.modulo(@nb_of_cols).zero?
100
+ cell.left(index % @nb_of_cols * (cell_width + @matrix_margin) + @matrix_margin)
101
+ cell.top(row * (cell_height + @matrix_margin) + @matrix_margin)
102
+ end
103
+
104
+ @matrix.width = matrix_width + @matrix_margin
105
+ @matrix.height = matrix_height + @matrix_margin
106
+ end
107
+
108
+ def get_cell(id)
109
+ grab("#{@matrix_id}_#{id}")
110
+ end
111
+
112
+ def delete(val = true)
113
+ @matrix.delete(true) if val
114
+ end
115
+
116
+ attr_reader :cells
117
+
118
+ def name
119
+ @matrix.name
120
+ end
121
+
122
+ def get_cell_data(codes, cell_nb)
123
+ codes.each do |proc|
124
+ if proc.is_a? Proc
125
+ assign(cell_nb, &proc)
126
+ end
127
+ end
128
+ end
129
+
130
+ def add(params)
131
+ nb_of_cols = @nb_of_cols + params[:columns].to_i
132
+ nb_of_rows = @nb_of_rows + params[:rows].to_i
133
+ current_id = @matrix.atome[:id]
134
+ # we delete all children to unbind any event
135
+ @cells.each do |cell|
136
+ cell.delete(true)
137
+ cell.unbind(:all)
138
+ end
139
+ temp_id = "#{current_id}_temporary"
140
+ @matrix.id = temp_id
141
+ old_matrix=grab(temp_id)
142
+
143
+ old_matrix.delete(true)
144
+
145
+
146
+ Matrix.new({ col: nb_of_cols, row: nb_of_rows, width: 300, height: 300, id: current_id, margin: @matrix_margin,
147
+ matrix_style: @matrix_style,
148
+ cell_style: @cell_style
149
+ })
150
+
151
+ @matrix_dataset.each_with_index do |cell_data, index|
152
+ get_cell_data(cell_data, index)
153
+ end
154
+ end
155
+
156
+ def assign(cell_nb = nil, &proc)
157
+ current_cell = grab("#{@matrix_id}_#{cell_nb}")
158
+ if proc
159
+ @matrix_dataset[cell_nb] << proc
160
+ current_cell.instance_exec(&proc) if proc.is_a? Proc
161
+ else
162
+ @matrix_dataset[cell_nb]
163
+ end
164
+ end
165
+
166
+ def reformat(params)
167
+ @nb_of_rows = params[:rows]
168
+ @nb_of_cols = params[:cols]
169
+ resize_matrix({ height: height, width: width })
170
+ end
171
+ end
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # ping method
3
4
  class Atome
4
- def ping(address, my_proc: false)
5
- # if RUBY_ENGINE.downcase != 'opal'
6
- def up?(host, my_proc)
7
- check = Net::Ping::External.new(host)
8
- if check.ping?
9
- puts "ping respond!! "
10
- end
11
- end
5
+ def up?(host, _my_proc)
6
+ check = Net::Ping::External.new(host)
7
+ return unless check.ping?
8
+
9
+ puts 'ping respond!!'
10
+ end
12
11
 
13
- chost = address
14
- puts up?(chost, my_proc) # prints "true" if ping replies
15
- # end
12
+ def ping(address, my_proc: false)
13
+ puts up(address, my_proc) # prints "true" if ping replies
16
14
  end
17
15
  end
@@ -2,15 +2,18 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
+ generator.build_atome(:animation)
5
6
  generator.build_atome(:color)
6
7
  generator.build_sanitizer(:color) do |params|
7
8
  parent_found = found_parents_and_renderers[:parent]
8
9
  render_found = found_parents_and_renderers[:renderers]
9
10
  default_params = { renderers: render_found, id: "color_#{Universe.atomes.length}", type: :color,
10
- parents: parent_found,
11
+ attach: parent_found,
11
12
  red: 0, green: 0, blue: 0, alpha: 1 }
12
13
  params = create_color_hash(params) unless params.instance_of? Hash
13
- default_params.merge!(params)
14
+ new_params = default_params.merge!(params)
15
+ atome[:color] = new_params
16
+ new_params
14
17
  end
15
18
 
16
19
  generator.build_sanitizer(:video) do |params|
@@ -21,6 +24,15 @@ generator.build_sanitizer(:video) do |params|
21
24
  default_params.merge!(params)
22
25
  end
23
26
  generator.build_atome(:shadow)
27
+
28
+ generator.build_sanitizer(:shadow) do |params|
29
+ parent_found = found_parents_and_renderers[:parent]
30
+ render_found = found_parents_and_renderers[:renderers]
31
+ default_params = { renderers: render_found, id: "shadow_#{Universe.atomes.length}", type: :shadow,
32
+ attach: parent_found,
33
+ red: 0, green: 0, blue: 0, alpha: 1 , blur: 3, left: 3, top: 3}
34
+ default_params.merge!(params)
35
+ end
24
36
  generator.build_atome(:shape)
25
37
  generator.build_atome(:text)
26
38
  generator.build_atome(:image)
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- generator = Genesis.generator
3
+ # generator = Genesis.generator
@@ -2,9 +2,45 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
+ # touch
5
6
  generator.build_particle(:touch)
7
+ # video
6
8
  generator.build_particle(:play)
7
9
  generator.build_particle(:time)
8
10
  generator.build_particle(:pause)
9
11
  generator.build_particle(:on)
10
12
  generator.build_particle(:fullscreen)
13
+ generator.build_particle(:mute)
14
+ # TODO : add the at event to ny particle : (width, left, ...) maybe use monitor particle
15
+ generator.build_particle(:at)
16
+ # drag
17
+ generator.build_particle(:drag)
18
+ generator.build_sanitizer(:drag) do |params|
19
+ params = { move: true } if params == true
20
+ params
21
+ end
22
+ # sort
23
+ generator.build_particle(:sort) do |_value, sort_proc|
24
+ @sort_proc = sort_proc
25
+ end
26
+
27
+ # animation
28
+ generator.build_particle(:targets)
29
+ generator.build_particle(:start)
30
+ generator.build_option(:pre_render_start) do |_value, user_proc|
31
+ @animation_start_proc = user_proc
32
+ end
33
+ generator.build_particle(:stop)
34
+ generator.build_option(:pre_render_stop) do |_value, user_proc|
35
+ @animation_stop_proc = user_proc
36
+ end
37
+ generator.build_particle(:begin)
38
+ generator.build_particle(:end)
39
+ generator.build_particle(:duration)
40
+ generator.build_particle(:mass)
41
+ generator.build_particle(:damping)
42
+ generator.build_particle(:stiffness)
43
+ generator.build_particle(:velocity)
44
+ generator.build_particle(:repeat)
45
+ generator.build_particle(:ease)
46
+ generator.build_particle(:unbind)
@@ -10,7 +10,6 @@ generator.build_particle(:link) do |child_id|
10
10
  child_found.atome[:parents] << @atome[:id]
11
11
  child_found.refresh
12
12
  end
13
-
14
13
  generator.build_particle(:id)
15
14
  generator.build_sanitizer(:id) do |params|
16
15
  if @atome[:id] != params
@@ -20,10 +19,37 @@ generator.build_sanitizer(:id) do |params|
20
19
  end
21
20
  params
22
21
  end
23
-
24
22
  generator.build_option(:pre_render_parents) do |parents_id_found|
25
23
  parents_id_found.each do |parents_id|
26
24
  parents_found = grab(parents_id)
27
25
  parents_found.children << id if parents_found
28
26
  end
29
27
  end
28
+ generator.build_particle(:name)
29
+
30
+ generator.build_particle(:active)
31
+
32
+ generator.build_particle(:attach) do |parents|
33
+ parents.each do |parent|
34
+ grab(parent).atome[:attached] = [atome[:id]]
35
+ end
36
+ end
37
+
38
+ generator.build_particle(:attached) do |targets|
39
+ targets.each do |target|
40
+ grab(target).attach([atome[:id]])
41
+ end
42
+ end
43
+
44
+ generator.build_particle(:clones) do |clones_found|
45
+ clones_found.each_with_index do |clone_found, index|
46
+ clone_id="#{particles[:id]}_clone_#{index}"
47
+ original_id=atome[:id]
48
+ clone_found[:id] = clone_id
49
+ clone_found = particles.merge(clone_found)
50
+ cloned_atome=Atome.new({ shape: clone_found })
51
+ cloned_atome.monitor({ atomes: [original_id], particles: [:width, :attached,:height ]}) do |_atome, particle, value|
52
+ cloned_atome.send(particle,value)
53
+ end
54
+ end
55
+ end
@@ -6,5 +6,26 @@ generator.build_particle(:red)
6
6
  generator.build_particle(:green)
7
7
  generator.build_particle(:blue)
8
8
  generator.build_particle(:alpha)
9
+ generator.build_particle(:diffusion)
9
10
  generator.build_particle(:visual)
10
11
  generator.build_particle(:overflow)
12
+ generator.build_particle(:edit)
13
+ generator.build_particle(:style)
14
+ generator.build_option(:pre_render_style) do |styles_send, _user_proc|
15
+ styles_send.each do |particle_send, value|
16
+ send(particle_send, value)
17
+ end
18
+ end
19
+ generator.build_particle(:hide)
20
+
21
+ generator.build_particle(:remove) do |particle_to_remove|
22
+ case particle_to_remove
23
+ when :color
24
+ send(particle_to_remove, :black)
25
+ when :shadow
26
+ # TODO : code to write
27
+ puts 'code to write'
28
+ else
29
+ send(particle_to_remove, 0)
30
+ end
31
+ end
@@ -11,3 +11,4 @@ generator.build_particle(:top)
11
11
  generator.build_particle(:bottom)
12
12
  generator.build_particle(:rotate)
13
13
  generator.build_particle(:direction)
14
+ generator.build_particle(:center)
@@ -11,8 +11,23 @@ end
11
11
  generator.build_particle(:broadcast)
12
12
  generator.build_particle(:additional)
13
13
  generator.build_particle(:data)
14
- generator.build_particle(:delete) do
15
- Universe.delete(@atome[:id])
14
+ generator.build_particle(:delete) do |params|
15
+ if params == true
16
+ # the machine delete the current atome
17
+ Universe.delete(@atome[:id])
18
+ elsif params[:id]
19
+ # the machine try to an atome by it's ID and delete it
20
+ grab(params[:id]).delete(true)
21
+ elsif instance_of? Hash
22
+ # the machine try to find the sub particle id and remove it eg a.delete(monitor: :my_monitor) remove the monitor
23
+ # with id my_monitor
24
+ params.each do |param, value|
25
+ atome[param][value] = nil
26
+ end
27
+ else
28
+ # the machine try to reset the current particle(params), eg a.delete(:left) => left: 0
29
+ send(params,0)
30
+ end
16
31
  end
17
32
  generator.build_particle(:clear)
18
33
  generator.build_particle(:path)
@@ -29,3 +44,6 @@ generator.build_particle(:read) do |file, proc|
29
44
  send("#{renderer}_reader", file, &proc)
30
45
  end
31
46
  end
47
+
48
+ generator.build_particle(:cursor)
49
+
@@ -28,11 +28,11 @@ class Atome
28
28
 
29
29
  def auto_render_generator(element)
30
30
  Universe.renderer_list.each do |render_engine|
31
- build_render_method("#{render_engine}_#{element}")
31
+ build_render("#{render_engine}_#{element}")
32
32
  end
33
33
  end
34
34
 
35
- def build_render_method(renderer_name, &method_proc)
35
+ def build_render(renderer_name, &method_proc)
36
36
  new_render_engine(renderer_name, &method_proc)
37
37
  end
38
38
 
@@ -37,7 +37,7 @@ Atome.new(
37
37
  Atome.new(
38
38
  { shape: { renderers: default_render, id: :view, type: :shape, parents: [:user_view], children: [],
39
39
  left: 0, right: 0, top: 0, bottom: 0, overflow: :auto,
40
- color: { renderers: default_render, id: :view_color, type: :color, parents: [:view],
40
+ color: { renderers: default_render, id: :view_color, type: :color, attach: [:view],
41
41
  red: 0.15, green: 0.15, blue: 0.15, alpha: 1 } } }
42
42
  )
43
43