atome 0.5.3.2 → 0.5.3.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +8 -3
  3. data/app_builder_helpers/Rakefile +9 -3
  4. data/exe/atome +11 -18
  5. data/lib/atome/atome.rb +29 -19
  6. data/lib/atome/extensions/atome.rb +23 -1
  7. data/lib/atome/extensions/matrix.rb +71 -63
  8. data/lib/atome/genesis/generators/atome.rb +149 -22
  9. data/lib/atome/genesis/generators/effect.rb +8 -3
  10. data/lib/atome/genesis/generators/event.rb +77 -34
  11. data/lib/atome/genesis/generators/geometry.rb +21 -5
  12. data/lib/atome/genesis/generators/identity.rb +110 -57
  13. data/lib/atome/genesis/generators/material.rb +74 -16
  14. data/lib/atome/genesis/generators/spatial.rb +8 -9
  15. data/lib/atome/genesis/generators/time.rb +1 -1
  16. data/lib/atome/genesis/generators/utility.rb +66 -39
  17. data/lib/atome/genesis/genesis.rb +7 -5
  18. data/lib/atome/genesis/sparkle.rb +8 -2
  19. data/lib/atome/helpers/essentials.rb +2 -6
  20. data/lib/atome/helpers/utilities.rb +15 -0
  21. data/lib/atome/kernel/universe.rb +2 -2
  22. data/lib/atome/presets/atome.rb +60 -61
  23. data/lib/atome/renderers/browser/event.rb +6 -3
  24. data/lib/atome/renderers/browser/geometry.rb +18 -10
  25. data/lib/atome/renderers/browser/helpers/browser_helper.rb +9 -0
  26. data/lib/atome/renderers/browser/helpers/color_helper.rb +4 -4
  27. data/lib/atome/renderers/browser/helpers/event_helper.rb +24 -12
  28. data/lib/atome/renderers/browser/helpers/shape_helper.rb +4 -4
  29. data/lib/atome/renderers/browser/helpers/text_helper.rb +4 -4
  30. data/lib/atome/renderers/browser/helpers/video_helper.rb +1 -1
  31. data/lib/atome/renderers/browser/helpers/web_helper.rb +4 -4
  32. data/lib/atome/renderers/browser/identity.rb +4 -0
  33. data/lib/atome/renderers/browser/material.rb +20 -1
  34. data/lib/atome/renderers/browser/spatial.rb +4 -0
  35. data/lib/atome/version.rb +1 -1
  36. data/sig/atome.rbs +12 -0
  37. data/sig/genesis.rbs +3 -0
  38. data/vendor/assets/application/index.rb +2 -0
  39. data/vendor/assets/src/index.html +1 -1
  40. data/vendor/assets/src/js/atome/atome.js +2 -1
  41. data/vendor/assets/src/medias/images/icons/email.svg +13 -0
  42. data/vendor/assets/src/medias/images/icons/mail_gray.svg +6 -0
  43. data/vendor/assets/src/medias/images/icons/mail_green.svg +6 -0
  44. data/vendor/assets/src/medias/images/icons/mail_orange.svg +6 -0
  45. data/vendor/assets/src/medias/images/icons/undo.svg +4 -0
  46. data/vendor/assets/src/medias/images/logos/Orange/Facebook.svg +8 -0
  47. data/vendor/assets/src/medias/images/logos/Orange/TikTok.svg +11 -0
  48. data/vendor/assets/src/medias/images/logos/Orange/Twitter.svg +8 -0
  49. data/vendor/assets/src/medias/images/logos/Orange/instagram.svg +8 -0
  50. data/vendor/assets/src/medias/images/logos/Orange/vimeo.svg +8 -0
  51. data/vendor/assets/src/medias/images/logos/Orange/youtube.svg +7 -0
  52. data/vendor/assets/src/medias/images/logos/gray/Facebook.svg +8 -0
  53. data/vendor/assets/src/medias/images/logos/gray/TikTok.svg +11 -0
  54. data/vendor/assets/src/medias/images/logos/gray/Twitter.svg +8 -0
  55. data/vendor/assets/src/medias/images/logos/gray/instagram.svg +8 -0
  56. data/vendor/assets/src/medias/images/logos/gray/vimeo.svg +8 -0
  57. data/vendor/assets/src/medias/images/logos/gray/youtube.svg +7 -0
  58. data/vendor/assets/src/medias/images/logos/gray/youtube2.svg +13 -0
  59. data/vendor/assets/src/medias/images/logos/vimeo.svg +17 -0
  60. data/vendor/assets/src/medias/rubies/examples/_table2.rb +108 -0
  61. data/vendor/assets/src/medias/rubies/examples/add.rb +1 -3
  62. data/vendor/assets/src/medias/rubies/examples/attached.rb +16 -0
  63. data/vendor/assets/src/medias/rubies/examples/class.rb +13 -0
  64. data/vendor/assets/src/medias/rubies/examples/code.rb +1 -1
  65. data/vendor/assets/src/medias/rubies/examples/depth.rb +6 -0
  66. data/vendor/assets/src/medias/rubies/examples/detached.rb +13 -0
  67. data/vendor/assets/src/medias/rubies/examples/matrix.rb +1 -1
  68. data/vendor/assets/src/medias/rubies/examples/opacity.rb +5 -0
  69. data/vendor/assets/src/medias/rubies/examples/over.rb +19 -0
  70. data/vendor/assets/src/medias/rubies/examples/read.rb +1 -0
  71. data/vendor/assets/src/medias/rubies/examples/schedule.rb +5 -2
  72. data/vendor/assets/src/medias/rubies/examples/text.rb +12 -11
  73. data/vendor/assets/src/medias/rubies/examples/time.rb +5 -1
  74. metadata +31 -10
  75. data/vendor/assets/src/medias/images/cache.svg +0 -10
  76. data/vendor/assets/src/medias/images/eyes.jpg +0 -0
  77. data/vendor/assets/src/medias/images/killer.jpg +0 -0
  78. data/vendor/assets/src/medias/images/logos/GitHub-Mark.eps +0 -7696
  79. data/vendor/assets/src/medias/images/poisson.jpg +0 -0
  80. data/vendor/assets/src/medias/images/sky.jpg +0 -0
@@ -1,39 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- generator = Genesis.generator
4
-
5
- generator.build_particle(:red) do
3
+ new({ particle: :red }) do
6
4
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
7
5
  self
8
6
  end
9
- generator.build_particle(:green) do
7
+ new({ particle: :green }) do
10
8
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
11
9
  self
12
10
  end
13
- generator.build_particle(:blue) do
11
+ new({ particle: :blue }) do
14
12
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
15
13
  self
16
14
  end
17
- generator.build_particle(:alpha) do
15
+ new({ particle: :alpha }) do
18
16
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
19
17
  self
20
18
  end
21
- generator.build_particle(:diffusion) do
19
+ new({ particle: :diffusion }) do
22
20
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
23
21
  self
24
22
  end
25
- generator.build_particle(:visual)
26
- generator.build_particle(:overflow)
27
- generator.build_particle(:edit)
28
- generator.build_particle(:style)
29
- generator.build_option(:pre_render_style) do |styles_send, _user_proc|
23
+ new({ particle: :visual })
24
+ new({ particle: :overflow })
25
+ new({ particle: :edit })
26
+ new({ particle: :style })
27
+ new({ pre: :style }) do |styles_send, _user_proc|
30
28
  styles_send.each do |particle_send, value|
31
29
  send(particle_send, value)
32
30
  end
33
31
  end
34
- generator.build_particle(:hide)
35
-
36
- generator.build_particle(:remove) do |particle_to_remove|
32
+ new({ particle: :hide })
33
+ new({ particle: :remove }) do |particle_to_remove|
37
34
  case particle_to_remove
38
35
  when :color
39
36
  send(particle_to_remove, :black)
@@ -41,6 +38,67 @@ generator.build_particle(:remove) do |particle_to_remove|
41
38
  # TODO : code to write
42
39
  puts 'code to write'
43
40
  else
44
- send(particle_to_remove, 0)
41
+ particle_to_remove_decision(particle_to_remove)
45
42
  end
46
43
  end
44
+ new({ particle: :classes }) do |value|
45
+ Universe.classes[value] ||= []
46
+ Universe.classes[value] |= [id.value]
47
+ end
48
+ new({ particle: :remove_classes }) do |value|
49
+ # Universe.classes.delete(value)
50
+ Universe.classes[value].delete(id.value)
51
+ end
52
+ new ({particle: :opacity})
53
+
54
+ # generator = Genesis.generator
55
+ #
56
+ # generator.build_particle(:red) do
57
+ # # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
58
+ # self
59
+ # end
60
+ # generator.build_particle(:green) do
61
+ # # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
62
+ # self
63
+ # end
64
+ # generator.build_particle(:blue) do
65
+ # # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
66
+ # self
67
+ # end
68
+ # generator.build_particle(:alpha) do
69
+ # # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
70
+ # self
71
+ # end
72
+ # generator.build_particle(:diffusion) do
73
+ # # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
74
+ # self
75
+ # end
76
+ # generator.build_particle(:visual)
77
+ # generator.build_particle(:overflow)
78
+ # generator.build_particle(:edit)
79
+ # generator.build_particle(:style)
80
+ # generator.build_option(:pre_render_style) do |styles_send, _user_proc|
81
+ # styles_send.each do |particle_send, value|
82
+ # send(particle_send, value)
83
+ # end
84
+ # end
85
+ # generator.build_particle(:hide)
86
+ # generator.build_particle(:remove) do |particle_to_remove|
87
+ # case particle_to_remove
88
+ # when :color
89
+ # send(particle_to_remove, :black)
90
+ # when :shadow
91
+ # # TODO : code to write
92
+ # puts 'code to write'
93
+ # else
94
+ # particle_to_remove_decision(particle_to_remove)
95
+ # end
96
+ # end
97
+ # generator.build_particle(:classes) do |value|
98
+ # Universe.classes[value] ||= []
99
+ # Universe.classes[value] |= [id.value]
100
+ # end
101
+ # generator.build_particle(:remove_classes) do |value|
102
+ # # Universe.classes.delete(value)
103
+ # Universe.classes[value].delete(id.value)
104
+ # end
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- generator = Genesis.generator
4
- # create particles
5
- generator.build_particle(:left) do |_params, user_proc|
3
+ new({ particle: :left }) do |_params, user_proc|
6
4
  instance_exec(&user_proc) if user_proc.is_a?(Proc)
7
5
  end
6
+ new({ particle: :right })
7
+ new({ particle: :top })
8
+ new({ particle: :bottom })
9
+ new({ particle: :rotate })
10
+ new({ particle: :direction })
11
+ new({ particle: :center })
12
+ new ({particle: :depth})
8
13
 
9
- generator.build_particle(:right)
10
- generator.build_particle(:top)
11
- generator.build_particle(:bottom)
12
- generator.build_particle(:rotate)
13
- generator.build_particle(:direction)
14
- generator.build_particle(:center)
@@ -2,4 +2,4 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
  # create particles
5
- generator.build_particle(:markers, { type: :hash })
5
+ new({ particle: :markers, type: :hash })
@@ -1,36 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- generator = Genesis.generator
4
3
 
5
- generator.build_particle(:renderers)
6
- generator.build_particle(:code)
7
- generator.build_particle(:run) do |params|
4
+ new({particle: :renderers })
5
+ new({particle: :code })
6
+ new({particle: :run }) do |params|
8
7
  code_found = @atome[:code]
9
8
  instance_exec(params, &code_found) if code_found.is_a?(Proc)
10
9
  end
11
- generator.build_particle(:broadcast)
12
- generator.build_particle(:additional)
13
- generator.build_particle(:data)
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
31
- # end
32
-
33
- generator.build_particle(:delete) do |params|
10
+ new({particle: :broadcast })
11
+ new({particle: :data })
12
+ new({particle: :additional })
13
+ new({particle: :delete }) do |params|
34
14
  if params == true
35
15
  # the machine delete the current atome
36
16
  Universe.delete(@atome[:id])
@@ -44,14 +24,13 @@ generator.build_particle(:delete) do |params|
44
24
  atome[param][value] = nil
45
25
  end
46
26
  else
47
- # # the machine try to reset the current particle(params), eg a.delete(:left) => left: 0
48
- send(params,0)
27
+ # the machine try to reset the current particle(params), eg a.delete(:left) => left: 0
28
+ send(params, 0)
49
29
  end
50
30
  end
51
-
52
- generator.build_particle(:clear)
53
- generator.build_particle(:path)
54
- generator.build_particle(:schedule) do |date, proc|
31
+ new({particle: :clear })
32
+ new({particle: :path })
33
+ new({particle: :schedule }) do |date, proc|
55
34
  date = date.to_s
56
35
  delimiters = [',', ' ', ':', '-']
57
36
  format_date = date.split(Regexp.union(delimiters))
@@ -59,15 +38,63 @@ generator.build_particle(:schedule) do |date, proc|
59
38
  send("#{renderer}_schedule", format_date, &proc)
60
39
  end
61
40
  end
62
- generator.build_particle(:read) do |file, proc|
41
+ new({particle: :read }) do |file, proc|
63
42
  Universe.renderer_list.each do |renderer|
64
43
  send("#{renderer}_reader", file, &proc)
65
44
  end
66
45
  end
46
+ new({particle: :cursor })
47
+ new({particle: :preset })
48
+ new({particle: :relations,type: :hash })
67
49
 
68
- generator.build_particle(:cursor)
69
-
70
- generator.build_particle(:preset)
71
-
72
- generator.build_particle(:relations, { type: :hash })
73
50
 
51
+ # generator = Genesis.generator
52
+ #
53
+ #
54
+ #
55
+ #
56
+ # generator.build_particle(:renderers)
57
+ # generator.build_particle(:code)
58
+ # generator.build_particle(:run) do |params|
59
+ # code_found = @atome[:code]
60
+ # instance_exec(params, &code_found) if code_found.is_a?(Proc)
61
+ # end
62
+ # generator.build_particle(:broadcast)
63
+ # generator.build_particle(:additional)
64
+ # generator.build_particle(:data)
65
+ # generator.build_particle(:delete) do |params|
66
+ # if params == true
67
+ # # the machine delete the current atome
68
+ # Universe.delete(@atome[:id])
69
+ # elsif params[:id]
70
+ # # the machine try to an atome by it's ID and delete it
71
+ # grab(params[:id]).delete(true)
72
+ # elsif params.instance_of? Hash
73
+ # # the machine try to find the sub particle id and remove it eg a.delete(monitor: :my_monitor) remove the monitor
74
+ # # with id my_monitor
75
+ # params.each do |param, value|
76
+ # atome[param][value] = nil
77
+ # end
78
+ # else
79
+ # # the machine try to reset the current particle(params), eg a.delete(:left) => left: 0
80
+ # send(params, 0)
81
+ # end
82
+ # end
83
+ # generator.build_particle(:clear)
84
+ # generator.build_particle(:path)
85
+ # generator.build_particle(:schedule) do |date, proc|
86
+ # date = date.to_s
87
+ # delimiters = [',', ' ', ':', '-']
88
+ # format_date = date.split(Regexp.union(delimiters))
89
+ # Universe.renderer_list.each do |renderer|
90
+ # send("#{renderer}_schedule", format_date, &proc)
91
+ # end
92
+ # end
93
+ # generator.build_particle(:read) do |file, proc|
94
+ # Universe.renderer_list.each do |renderer|
95
+ # send("#{renderer}_reader", file, &proc)
96
+ # end
97
+ # end
98
+ # generator.build_particle(:cursor)
99
+ # generator.build_particle(:preset)
100
+ # generator.build_particle(:relations, { type: :hash })
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  # Genesis method here
13
13
  class Atome
14
- def build_particle(particle_name,options={},&particle_proc)
14
+ def build_particle(particle_name, options = {}, &particle_proc)
15
15
  type = options[:type]
16
16
  type = :string if options[:type].nil?
17
17
  store = options[:store]
@@ -21,15 +21,17 @@ class Atome
21
21
 
22
22
  # we add the new method to the particle's collection of methods
23
23
  Universe.add_to_particle_list(particle_name, type)
24
- auto_render_generator(particle_name) if render # automatise the creation of an empty render method for current particle
25
- new_particle(particle_name,store,render , &particle_proc)
26
- additional_particle_methods(particle_name, store,render ,&particle_proc) # create alternative methods such as create 'method='
24
+ # the line below create an empty particle method for each renderer, eg: browser_left, headless_left, ...
25
+ auto_render_generator(particle_name) if render
26
+ new_particle(particle_name, store, render, &particle_proc)
27
+ # the line below create all alternatives methods such as create 'method='
28
+ additional_particle_methods(particle_name, store, render, &particle_proc)
27
29
  end
28
30
 
29
-
30
31
  def build_atome(atome_name, &atome_proc)
31
32
  # we add the new method to the atome's collection of methods
32
33
  Universe.add_to_atome_list(atome_name)
34
+ # the line below create an empty atome method for each renderer, eg: browser_left, headless_left, ...
33
35
  auto_render_generator(atome_name)
34
36
  new_atome(atome_name, &atome_proc)
35
37
  end
@@ -38,7 +38,7 @@ Atome.new(
38
38
  # color creation
39
39
  Atome.new(
40
40
  { color: { renderers: default_render, id: :view_color, type: :color,
41
- red: 0.15, green: 0.15, blue: 0.15, alpha: 1 } }
41
+ red: 0.15, green: 0.15, blue: 0.15, alpha: 1 } }
42
42
  )
43
43
 
44
44
  Atome.new(
@@ -66,7 +66,13 @@ Atome.new(
66
66
  left: 0, top: 0, red: 0.7, green: 0.7, blue: 0.7, alpha: 1, diffusion: :linear } }
67
67
  )
68
68
 
69
- # view creation
69
+ # system object creation
70
+ # the black_matter is used to store un materialized atomes
71
+ Atome.new(
72
+ { shape: { renderers: default_render, id: :black_matter, type: :shape, parents: [:user_view], children: [],
73
+ left: 0, right: 0, top: 0, bottom: 0, width: 0, height: 0, overflow: :hidden
74
+ } })
75
+ # view port
70
76
  Atome.new(
71
77
  { shape: { renderers: default_render, id: :view, type: :shape, parents: [:user_view], children: [],
72
78
  attached: [:view_color], left: 0, right: 0, top: 0, bottom: 0, width: :auto, height: :auto, overflow: :auto
@@ -4,27 +4,23 @@
4
4
  module Essentials
5
5
  @default_params = {
6
6
  render_engines: [:browser],
7
+ collector: { type: :element, renderers: [], children: [] },
7
8
  animation: { type: :animation, children: [] },
8
9
  element: { type: :element, renderers: [], children: [] },
9
10
  matrix: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
10
11
  attached: [:matrix_color], children: [],
11
- # color: { left: 0, top: 0, red: 0.1, green: 0.9, blue: 0.9, alpha: 1, diffusion: :linear },
12
12
  left: 100, top: 100, clones: [], preset: :matrix },
13
13
  box: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
14
14
  attached: [:box_color], children: [],
15
- # color: { left: 0, top: 0, red: 1, green: 0.3, blue: 0.3, alpha: 1, diffusion: :linear },
16
15
  left: 100, top: 100, clones: [], preset: :box },
17
16
  circle: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99, smooth: '100%',
18
- # color: { left: 0, top: 0, red: 0.3, green: 0.9, blue: 0.9, alpha: 1, diffusion: :linear },
19
17
  attached: [:circle_color], children: [],
20
18
  left: 100, top: 100, clones: [], preset: :circle },
21
19
  shape: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
22
- attached: [:view_color], children: [],
23
- # color: { left: 0, top: 0, red: 0.6, green: 0.9, blue: 0.9, alpha: 1, diffusion: :linear },
20
+ attached: [:shape_color], children: [],
24
21
  left: 100, top: 100, clones: [] },
25
22
  text: { renderers: [], id: '', type: :text, parents: [:view], visual: { size: 25 },
26
23
  attached: [:text_color], children: [],
27
- # color: { left: 0, top: 0, red: 0.3, green: 0.3, blue: 0.3, alpha: 1, diffusion: :linear },
28
24
  data: 'this is a text sample', width: 199, height: 33, clones: [] },
29
25
  drm: { type: :drm },
30
26
  shadow: {},
@@ -133,10 +133,25 @@ class Atome
133
133
  end
134
134
 
135
135
  end
136
+ def []=(params, value)
137
+ # TODO : it may miss some code, see above
138
+ self.value[params] = value
139
+ end
136
140
 
137
141
  def set(params)
138
142
  params.each do |particle, value|
139
143
  send(particle, value)
140
144
  end
141
145
  end
146
+
147
+ def particle_to_remove_decision(particle_to_remove)
148
+ if particle_to_remove.instance_of? Hash
149
+ particle_to_remove.each do |particle_found, value|
150
+ send("remove_#{particle_found}", value)
151
+ end
152
+ else
153
+ send(particle_to_remove, 0)
154
+ end
155
+ end
156
+
142
157
  end
@@ -3,14 +3,14 @@
3
3
  # universe method here
4
4
  class Universe
5
5
  @atomes = {}
6
+ @classes = {}
6
7
  @atome_list = []
7
8
  @particle_list = {}
8
9
  @renderer_list = %i[html browser headless server]
9
10
  @options = {}
10
11
  @sanitizers = {}
11
-
12
12
  class << self
13
- attr_reader :atomes, :renderer_list, :atome_list, :particle_list
13
+ attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes
14
14
 
15
15
  def add_to_particle_list(particle = nil, type)
16
16
  instance_variable_get('@particle_list')[particle]=type
@@ -17,7 +17,6 @@ class Atome
17
17
  temp_default.merge(params)
18
18
  end
19
19
 
20
-
21
20
  def box(params = {}, &bloc)
22
21
  default_renderer = Essentials.default_params[:render_engines]
23
22
  atome_type = :box
@@ -28,13 +27,6 @@ class Atome
28
27
 
29
28
  params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
30
29
 
31
- # params2 = { renderers: [:browser], id: generated_id, type: :shape, parents: [generated_parents], children: [],
32
- # width: 99, height: 99,
33
- # color: { renderers: [:browser], id: "#{params[:id]}_color", type: :color, attach: [params[:id]],
34
- # red: 0.15, green: 0.30, blue: 0.6, alpha: 1 },
35
- # left: 100, top: 100, clones: [], preset: :box
36
- # }
37
- # params[:children]=[]
38
30
  Atome.new({ atome_type => params }, &bloc)
39
31
  end
40
32
 
@@ -49,60 +41,67 @@ class Atome
49
41
  Atome.new({ atome_type => params }, &bloc)
50
42
  end
51
43
 
52
- def image(params = {}, &bloc)
53
- default_renderer = Essentials.default_params[:render_engines]
54
- generated_id = params[:id] || "image_#{Universe.atomes.length}"
55
- generated_render = params[:renderers] || default_renderer
56
- generated_parents = params[:parents] || id.value
57
- # TODO : the line below should get the value from default params Essentials
58
- temp_default = { renderers: generated_render, id: generated_id, type: :image, parents: [generated_parents],
59
- children: [], width: 99, height: 99, path: './medias/images/atome.svg' }
60
- params = temp_default.merge(params)
61
- Atome.new({ image: params }, &bloc)
62
- end
63
-
64
- def text(params = {}, &bloc)
65
- default_renderer = Essentials.default_params[:render_engines]
66
- atome_type = :text
67
- generated_render = params[:renderers] || default_renderer
68
- generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
69
- generated_parents = params[:parents] || [id.value]
70
- generated_children = params[:children] || []
71
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
72
- Atome.new({ atome_type => params }, &bloc)
73
- end
74
-
75
- def element(params = {}, &bloc)
76
- atome_type = :element
77
- generated_render = params[:renderers] || []
78
- generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
79
- generated_parents = params[:parents] || [id.value]
80
- generated_children = params[:children] || []
81
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
82
- Atome.new({ atome_type => params }, &bloc)
83
- end
44
+ # def image(params = {}, &bloc)
45
+ # default_renderer = Essentials.default_params[:render_engines]
46
+ # generated_id = params[:id] || "image_#{Universe.atomes.length}"
47
+ # generated_render = params[:renderers] || default_renderer
48
+ # generated_parents = params[:parents] || id.value
49
+ # # TODO : the line below should get the value from default params Essentials
50
+ # temp_default = { renderers: generated_render, id: generated_id, type: :image, parents: [generated_parents],
51
+ # children: [], width: 99, height: 99, path: './medias/images/atome.svg' }
52
+ # params = temp_default.merge(params)
53
+ # Atome.new({ image: params }, &bloc)
54
+ # end
55
+ #
56
+ # def text(params = {}, &bloc)
57
+ # default_renderer = Essentials.default_params[:render_engines]
58
+ # atome_type = :text
59
+ # generated_render = params[:renderers] || default_renderer
60
+ # generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
61
+ # generated_parents = params[:parents] || [id.value]
62
+ # generated_children = params[:children] || []
63
+ # params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
64
+ # Atome.new({ atome_type => params }, &bloc)
65
+ # end
84
66
 
85
- def web(params = {}, &bloc)
86
- default_renderer = Essentials.default_params[:render_engines]
67
+ # def element(params = 'kjh', &bloc)
68
+ # atome_type = :element
69
+ #
70
+ # generated_render = params[:renderers] || []
71
+ #
72
+ # generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
73
+ # generated_parents = params[:parents] || [id.value]
74
+ # generated_children = params[:children] || []
75
+ #
76
+ # generated_data = ""
77
+ # params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
78
+ # # FIXME: do not merge generated_data like this but change the atomecommon
79
+ # params.merge(generated_data)
80
+ #
81
+ # Atome.new({ atome_type => params }, &bloc)
82
+ # end
87
83
 
88
- generated_id = params[:id] || "web_#{Universe.atomes.length}"
89
- generated_render = params[:renderers] || default_renderer
90
- generated_parents = params[:parents] || id.value
91
- # TODO : the line below should get the value from default params Essentials
92
- temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
93
- children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
94
- params = temp_default.merge(params)
95
- Atome.new({ image: params }, &bloc)
96
- end
84
+ # def web(params = {}, &bloc)
85
+ # default_renderer = Essentials.default_params[:render_engines]
86
+ #
87
+ # generated_id = params[:id] || "web_#{Universe.atomes.length}"
88
+ # generated_render = params[:renderers] || default_renderer
89
+ # generated_parents = params[:parents] || id.value
90
+ # # TODO : the line below should get the value from default params Essentials
91
+ # temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
92
+ # children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
93
+ # params = temp_default.merge(params)
94
+ # Atome.new({ image: params }, &bloc)
95
+ # end
97
96
 
98
- def animation(params = {}, &bloc)
99
- default_renderer = Essentials.default_params[:render_engines]
100
- atome_type = :animation
101
- generated_render = params[:renderers] || default_renderer
102
- generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
103
- generated_parents = params[:parents] || []
104
- generated_children = params[:children] || []
105
- params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
106
- Atome.new({ atome_type => params }, &bloc)
107
- end
97
+ # def animation(params = {}, &bloc)
98
+ # default_renderer = Essentials.default_params[:render_engines]
99
+ # atome_type = :animation
100
+ # generated_render = params[:renderers] || default_renderer
101
+ # generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
102
+ # generated_parents = params[:parents] || []
103
+ # generated_children = params[:children] || []
104
+ # params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
105
+ # Atome.new({ atome_type => params }, &bloc)
106
+ # end
108
107
  end
@@ -4,8 +4,11 @@ generator = Genesis.generator
4
4
 
5
5
  generator.build_render(:browser_touch) do |value, proc|
6
6
  atome_id = @browser_object.attribute(:id)
7
- BrowserHelper.send("browser_touch_#{value}", atome_id, proc)
8
- # end
7
+ BrowserHelper.send("browser_touch_#{value}", atome_id,self, proc)
8
+ end
9
+
10
+ generator.build_render(:browser_over) do |value, proc|
11
+ BrowserHelper.send("browser_over_#{value}", @browser_object,self, proc)
9
12
  end
10
13
 
11
14
  generator.build_render(:browser_play) do |value, proc|
@@ -62,7 +65,7 @@ end
62
65
  generator.build_render(:browser_unbind) do |options, _proc|
63
66
  id_found = self.atome[:id]
64
67
  `
65
- const el = document.getElementById(#{id_found});
68
+ //const el = document.getElementById(#{id_found});
66
69
  interact('#'+#{id_found}).unset(#{options});
67
70
  `
68
71
  end
@@ -3,17 +3,25 @@
3
3
  generator = Genesis.generator
4
4
 
5
5
  generator.build_render(:browser_width) do |value|
6
- @browser_object.style[:width] = if value.instance_of? String
7
- value
8
- else
9
- "#{value}px"
10
- end
6
+
7
+ # aa=BrowserHelper.value_parse(value)
8
+ # # alert "value_parse : #{aa}"≈
9
+ # alert "#{value} : #{value.class} : value_parse : #{aa}"
10
+ # @browser_object.style[:width] = if value.instance_of? String
11
+ # value
12
+ # else
13
+ # "#{value}px"
14
+ # end
15
+
16
+
17
+ @browser_object.style[:width] = BrowserHelper.value_parse(value)
11
18
  end
12
19
 
13
20
  generator.build_render(:browser_height) do |value|
14
- @browser_object.style[:height] = if value.instance_of? String
15
- value
16
- else
17
- "#{value}px"
18
- end
21
+ # @browser_object.style[:height] = if value.instance_of? String
22
+ # value
23
+ # else
24
+ # "#{value}px"
25
+ # end
26
+ @browser_object.style[:height] = BrowserHelper.value_parse(value)
19
27
  end
@@ -14,4 +14,13 @@ module BrowserHelper
14
14
  def self.browser_attach_style(parents, _html_object, atome)
15
15
  browser_document[parents].add_class(atome[:id])
16
16
  end
17
+
18
+ def self.value_parse(value)
19
+ if value.instance_of?(String)
20
+ value
21
+ else
22
+ "#{value}px"
23
+ end
24
+
25
+ end
17
26
  end
@@ -16,18 +16,18 @@ module BrowserHelper
16
16
  end
17
17
 
18
18
  def self.browser_left_color(_value, _browser_object, _atome)
19
- puts 'code to write when implementing gradient'
19
+ # puts 'code to write when implementing gradient'
20
20
  end
21
21
 
22
22
  def self.browser_right_color(_value, _browser_object, _atome)
23
- puts 'code to write when implementing gradient'
23
+ # puts 'code to write when implementing gradient'
24
24
  end
25
25
 
26
26
  def self.browser_top_color(_value, _browser_object, _atome)
27
- puts 'code to write when implementing gradient'
27
+ # puts 'code to write when implementing gradient'
28
28
  end
29
29
 
30
30
  def self.browser_bottom_color(_value, _browser_object, _atome)
31
- puts 'code to write when implementing gradient'
31
+ # puts 'code to write when implementing gradient'
32
32
  end
33
33
  end